mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2024-11-21 14:53:11 +01:00
Light and dark themes for the launcher and settings
This commit is contained in:
parent
b3dcd61c28
commit
a55506e607
@ -7,12 +7,12 @@
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.view.im" android:resource="@xml/method"/>
|
||||
</service>
|
||||
<activity android:name="juloo.keyboard2.SettingsActivity" android:icon="@mipmap/ic_launcher" android:label="@string/settings_activity_label" android:theme="@style/android:Theme.DeviceDefault" android:exported="true" android:directBootAware="true">
|
||||
<activity android:name="juloo.keyboard2.SettingsActivity" android:icon="@mipmap/ic_launcher" android:label="@string/settings_activity_label" android:theme="@style/appTheme" android:exported="true" android:directBootAware="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="juloo.keyboard2.LauncherActivity" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/android:Theme.DeviceDefault" android:exported="true" android:directBootAware="true">
|
||||
<activity android:name="juloo.keyboard2.LauncherActivity" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/appTheme" android:exported="true" android:directBootAware="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
|
4
res/values-night-v21/styles.xml
Normal file
4
res/values-night-v21/styles.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="appTheme" parent="@android:style/Theme.Material"/>
|
||||
</resources>
|
4
res/values-v21/styles.xml
Normal file
4
res/values-v21/styles.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="appTheme" parent="@android:style/Theme.Material.Light"/>
|
||||
</resources>
|
@ -22,4 +22,5 @@
|
||||
<item name="android:layout_marginHorizontal">16dp</item>
|
||||
<item name="android:layout_gravity">center</item>
|
||||
</style>
|
||||
<style name="appTheme" parent="@android:style/Theme.DeviceDefault.DayNight"/>
|
||||
</resources>
|
||||
|
@ -25,6 +25,7 @@ public class LauncherActivity extends Activity
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.launcher_activity);
|
||||
_intro_video = (VideoView)findViewById(R.id.launcher_intro_video);
|
||||
|
@ -12,7 +12,6 @@ public class SettingsActivity extends PreferenceActivity
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
detectSystemTheme();
|
||||
super.onCreate(savedInstanceState);
|
||||
// The preferences can't be read when in direct-boot mode. Avoid crashing
|
||||
// and don't allow changing the settings.
|
||||
@ -26,18 +25,6 @@ public class SettingsActivity extends PreferenceActivity
|
||||
addPreferencesFromResource(R.xml.settings);
|
||||
}
|
||||
|
||||
/** The default theme is [Theme.DeviceDefault], which is dark. Detect if the
|
||||
system is using light theme. */
|
||||
void detectSystemTheme()
|
||||
{
|
||||
if (Build.VERSION.SDK_INT >= 14)
|
||||
{
|
||||
int ui_mode = getResources().getConfiguration().uiMode;
|
||||
if ((ui_mode & Configuration.UI_MODE_NIGHT_NO) != 0)
|
||||
setTheme(android.R.style.Theme_DeviceDefault_Light);
|
||||
}
|
||||
}
|
||||
|
||||
void fallbackEncrypted()
|
||||
{
|
||||
// Can't communicate with the user here.
|
||||
|
Loading…
Reference in New Issue
Block a user