Over17 / UnityShowAndroidStatusBar

Show Android status bar for applications built with Unity 5.3 and later
MIT License
149 stars 35 forks source link

Using a new Android theme which inherits from "UnityTransparentStatusBarTheme" #21

Closed foxyseta closed 4 years ago

foxyseta commented 4 years ago

The plugin itself works fine, but I'd like to tweak the standard theme a little bit as well. Here's what I did to the original Assets/Plugins/Android/AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.company.productname">
  <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" />
  <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:theme="@style/NewTheme">
    <activity android:label="@string/app_name" android:name="com.unity3d.nostatusbar.UnityPlayerActivityStatusBar">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>
  </application>
  <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="23" />
</manifest>

And here's the XML file in which I defined a new style (Assets/Plugins/Android/res/values/styles.xml):

<resources>
  <style name="NewTheme" parent="@style/UnityTransparentStatusBarTheme">
    <item name="android:colorPrimary">#0A90BA</item>
    <item name="android:statusBarColor">#0A90BA</item>
    <item name="android:navigationBarColor">#06607D</item>
  </style>
</resources>

Thanks in advance!

Over17 commented 4 years ago

What you are doing looks correct; what is the actual question? :)

foxyseta commented 4 years ago

The thing is, I was able to make it work only when I unzipped your .aar and edited the code from there: simply saving these files as normal assets was of no use. In order to work with Unity assets, am I supposed to prepare both a values folder, a values-v14 folder and so on?

Over17 commented 4 years ago

It is totally fine to unzip the aar and edit manifest/resource files there, and zip it again. I would even say it's the easiest; having values folder in your project may need some extra effort.