mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2024-11-21 23:03: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>
|
</intent-filter>
|
||||||
<meta-data android:name="android.view.im" android:resource="@xml/method"/>
|
<meta-data android:name="android.view.im" android:resource="@xml/method"/>
|
||||||
</service>
|
</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>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</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>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<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_marginHorizontal">16dp</item>
|
||||||
<item name="android:layout_gravity">center</item>
|
<item name="android:layout_gravity">center</item>
|
||||||
</style>
|
</style>
|
||||||
|
<style name="appTheme" parent="@android:style/Theme.DeviceDefault.DayNight"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -25,6 +25,7 @@ public class LauncherActivity extends Activity
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState)
|
public void onCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.launcher_activity);
|
setContentView(R.layout.launcher_activity);
|
||||||
_intro_video = (VideoView)findViewById(R.id.launcher_intro_video);
|
_intro_video = (VideoView)findViewById(R.id.launcher_intro_video);
|
||||||
|
@ -12,7 +12,6 @@ public class SettingsActivity extends PreferenceActivity
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState)
|
public void onCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
detectSystemTheme();
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
// The preferences can't be read when in direct-boot mode. Avoid crashing
|
// The preferences can't be read when in direct-boot mode. Avoid crashing
|
||||||
// and don't allow changing the settings.
|
// and don't allow changing the settings.
|
||||||
@ -26,18 +25,6 @@ public class SettingsActivity extends PreferenceActivity
|
|||||||
addPreferencesFromResource(R.xml.settings);
|
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()
|
void fallbackEncrypted()
|
||||||
{
|
{
|
||||||
// Can't communicate with the user here.
|
// Can't communicate with the user here.
|
||||||
|
Loading…
Reference in New Issue
Block a user