Hi all,
So, I'm working on a program where the user can change the layout on the fly based on their own specifications, similar to the way Minecraft uses zipped Resource Packs. I was working out how to change the colors of the navigation bar to match the colors of the resources selected, but I have a couple of questions.
1. Changing it via the Manifest Editor:
This method seems perfect for changing the colors of the app's navigation bar once when the program launches, but I'm not sure how to change the colors afterwards if the user changes the resource pack.
2. The navigation bar's color can be changed directly within the program, but the obvious delay in application a) looks rough and b) I can't figure out how to change the text color of the navigation bar's commands (i.e., one can RunMethod setNavigationBarColor, but what is the method to "setNavigationBarTextColor"?):
So, with these issues, and these requirements, would it be better to use an immersive method and simply hide the navigation bar and create a custom bar as part of the resource pack that will duplicate the commands of the navigation bar? I believe I can use Typeface.FONTAWESOME to recreate the symbols in any text color I need, and as part of the resource pack, it would load at the same time as the activity. If I proceed in this manner, what are the three commands that will force a keypress for the back button, minimize, and bring up all running apps?
Thanks all!
So, I'm working on a program where the user can change the layout on the fly based on their own specifications, similar to the way Minecraft uses zipped Resource Packs. I was working out how to change the colors of the navigation bar to match the colors of the resources selected, but I have a couple of questions.
1. Changing it via the Manifest Editor:
This method seems perfect for changing the colors of the app's navigation bar once when the program launches, but I'm not sure how to change the colors afterwards if the user changes the resource pack.
Add this to Manifest Editor::
SetApplicationAttribute(android:theme, "@style/LightTheme")
CreateResource(values, colors.xml,
<resources>
<color name="actionbar">#ff039be5</color>
<color name="statusbar">#ff006db3</color>
<color name="textColorPrimary">#ffffffff</color>
<color name="navigationBar">#ff006db3</color>
</resources>
)
CreateResource(values-v20, theme.xml,
<resources>
<style name="LightTheme" parent="@android:style/Theme.Material.Light">
<item name="android:colorPrimary">@color/actionbar</item>
<item name="android:colorPrimaryDark">@color/statusbar</item>
<item name="android:textColorPrimary">@color/textColorPrimary</item>
<item name="android:navigationBarColor">@color/navigationBar</item>
</style>
</resources>
)
CreateResource(values-v14, theme.xml,
<resources>
<style name="LightTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/CustomActionBarStyle</item>
</style>
<style name="CustomActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/actionbar</item>
</style>
</resources>
)
2. The navigation bar's color can be changed directly within the program, but the obvious delay in application a) looks rough and b) I can't figure out how to change the text color of the navigation bar's commands (i.e., one can RunMethod setNavigationBarColor, but what is the method to "setNavigationBarTextColor"?):
B4X:
Dim p As Phone
If p.SdkVersion>21 Then
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethodJO("getWindow", Null).RunMethod("setNavigationBarColor", Array(Colors.Red))
End If
So, with these issues, and these requirements, would it be better to use an immersive method and simply hide the navigation bar and create a custom bar as part of the resource pack that will duplicate the commands of the navigation bar? I believe I can use Typeface.FONTAWESOME to recreate the symbols in any text color I need, and as part of the resource pack, it would load at the same time as the activity. If I proceed in this manner, what are the three commands that will force a keypress for the back button, minimize, and bring up all running apps?
Thanks all!