Fix to sdkLoc in build. Added light (without dark action bar) theme.
NOTE: I don't know how android will go with adding a new property to a string-array resource, but not having it translated everywhere. Will it struggle because the EN version has three values for "theme", but other translations only have two?
This commit is contained in:
parent
3050e3dbc5
commit
659b46fd4e
17
build.gradle
17
build.gradle
@ -10,7 +10,7 @@ buildscript {
|
|||||||
apply plugin: 'android'
|
apply plugin: 'android'
|
||||||
|
|
||||||
def toolVersion = "19.1"
|
def toolVersion = "19.1"
|
||||||
sdkLoc = android.plugin.sdkDirectory
|
sdkLoc = getSdkPath()
|
||||||
|
|
||||||
FileCollection getAndroidPrebuilt(String apiLevel) {
|
FileCollection getAndroidPrebuilt(String apiLevel) {
|
||||||
files("$sdkLoc/platforms/android-$apiLevel/android.jar")
|
files("$sdkLoc/platforms/android-$apiLevel/android.jar")
|
||||||
@ -142,3 +142,18 @@ subprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Currently a bit hacky, because android.plugin is protected.
|
||||||
|
* The end goal is to find something in the android BaseExtension class found here:
|
||||||
|
* https://android.googlesource.com/platform/tools/build/+/master/gradle/src/main/groovy/com/android/build/gradle/BaseExtension.groovy
|
||||||
|
* which ends up asking their Sdk class for it's location. That class knows about
|
||||||
|
* both ANDROID_HOME env variables, and also local.properties sdk.loc properties.
|
||||||
|
*
|
||||||
|
* If in the future, the android.adbExe is found to be inappropriate, deprecated,
|
||||||
|
* or a better way of finding the sdk path exists, we can change the implementation
|
||||||
|
* of this method to reflect that.
|
||||||
|
*/
|
||||||
|
def getSdkPath() {
|
||||||
|
new File( "$android.adbExe/../../" ).canonicalPath
|
||||||
|
}
|
||||||
|
@ -11,5 +11,6 @@
|
|||||||
<string-array name="themeNames">
|
<string-array name="themeNames">
|
||||||
<item>Dark</item>
|
<item>Dark</item>
|
||||||
<item>Light</item>
|
<item>Light</item>
|
||||||
|
<item>Light (with dark action bar)</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
<string-array name="themeValues">
|
<string-array name="themeValues">
|
||||||
<item>dark</item>
|
<item>dark</item>
|
||||||
<item>light</item>
|
<item>light</item>
|
||||||
|
<item>lightWithDarkActionBar</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -4,7 +4,11 @@
|
|||||||
<!-- backward-compatibility theme options go here -->
|
<!-- backward-compatibility theme options go here -->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppBaseThemeLight" parent="Theme.AppCompat.Light.DarkActionBar">
|
<style name="AppBaseThemeLight" parent="Theme.AppCompat.Light">
|
||||||
|
<!-- backward-compatibility theme options go here -->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="AppBaseThemeLightWithDarkActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
<!-- backward-compatibility theme options go here -->
|
<!-- backward-compatibility theme options go here -->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@ -25,4 +29,8 @@
|
|||||||
<!-- customizations that are not API-level specific go here. -->
|
<!-- customizations that are not API-level specific go here. -->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="AppThemeLightWithDarkActionBar" parent="AppBaseThemeLightWithDarkActionBar">
|
||||||
|
<!-- customizations that are not API-level specific go here. -->
|
||||||
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -76,7 +76,7 @@ public class FDroidApp extends Application {
|
|||||||
BluetoothAdapter bluetoothAdapter = null;
|
BluetoothAdapter bluetoothAdapter = null;
|
||||||
|
|
||||||
private static enum Theme {
|
private static enum Theme {
|
||||||
dark, light
|
dark, light, lightWithDarkActionBar
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Theme curTheme = Theme.dark;
|
private static Theme curTheme = Theme.dark;
|
||||||
@ -95,6 +95,9 @@ public class FDroidApp extends Application {
|
|||||||
case light:
|
case light:
|
||||||
activity.setTheme(R.style.AppThemeLight);
|
activity.setTheme(R.style.AppThemeLight);
|
||||||
break;
|
break;
|
||||||
|
case lightWithDarkActionBar:
|
||||||
|
activity.setTheme(R.style.AppThemeLightWithDarkActionBar);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user