Reputation: 2180
I have an application which is both for mobile/tablet and tv. As of I am using leanback for the tv, this project consist of 3 modules. First one (library) contains all the classes which are common for both tv and mobile/tablet module, then I have tv and mobile/tablet module which in build generates two separate apks. One is for mobile/tablet and one is for tv.
I am building a module which would contain both modules so I can generate a single apk. I was able to merge gradle build into one. But, I am using different themes for both apks. That is defined in the <application>
in the manifest. Is there a way to determine or branch the build so that the app knows which theme to use without writing algorithm of display metrics ec. ?
Both themes are AppTheme
:
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<style name="AppTheme" parent="@style/Theme.Leanback">
Would it be possible to provide values-tv for an example? So i don't have to do a complete refactor or where ever is this theme used to do if/else statement?
Any one have experience with merging two modules without making one of them a library?
This thread looks interesting, but this theme thing...
Upvotes: 1
Views: 741
Reputation: 3861
Your idea is right. Just use the resource specifier and add your second theme to the folder e.g. values-television. Your theme should extend a base theme so you do not struggle with naming issues. More information about resource configs can be found here: https://developer.android.com/guide/topics/resources/providing-resources.html
Upvotes: 1