Added black (AMOLED) theme
This commit is contained in:
parent
44f162c160
commit
0dc5c1e17d
8 changed files with 36 additions and 7 deletions
|
|
@ -26,7 +26,7 @@ public abstract class AbsThemeActivity extends AppCompatActivity implements KabV
|
|||
private int colorPrimary;
|
||||
private int colorPrimaryDarker;
|
||||
private int colorAccent;
|
||||
private boolean darkTheme;
|
||||
private int theme;
|
||||
private boolean coloredNavigationBar;
|
||||
|
||||
@Nullable
|
||||
|
|
@ -34,7 +34,8 @@ public abstract class AbsThemeActivity extends AppCompatActivity implements KabV
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(PreferenceUtil.getInstance(this).getGeneralTheme());
|
||||
theme = PreferenceUtil.getInstance(this).getGeneralTheme();
|
||||
setTheme(theme);
|
||||
super.onCreate(savedInstanceState);
|
||||
setupTheme();
|
||||
}
|
||||
|
|
@ -52,16 +53,17 @@ public abstract class AbsThemeActivity extends AppCompatActivity implements KabV
|
|||
}
|
||||
|
||||
private void setupTheme() {
|
||||
boolean dark = theme != R.style.Theme_MaterialMusic_Light;
|
||||
|
||||
colorPrimary = PreferenceUtil.getInstance(this).getThemeColorPrimary(this);
|
||||
colorPrimaryDarker = ColorUtil.shiftColorDown(colorPrimary);
|
||||
colorAccent = PreferenceUtil.getInstance(this).getThemeColorAccent(this);
|
||||
darkTheme = PreferenceUtil.getInstance(this).getGeneralTheme() == R.style.Theme_MaterialMusic;
|
||||
coloredNavigationBar = PreferenceUtil.getInstance(this).shouldUseColoredNavigationBar();
|
||||
|
||||
final ColorStateList accentColorStateList;
|
||||
if (colorAccent == Color.WHITE && !darkTheme) {
|
||||
if (colorAccent == Color.WHITE && !dark) {
|
||||
accentColorStateList = ColorStateList.valueOf(Color.BLACK);
|
||||
} else if (colorAccent == Color.BLACK && darkTheme) {
|
||||
} else if (colorAccent == Color.BLACK && dark) {
|
||||
accentColorStateList = ColorStateList.valueOf(Color.WHITE);
|
||||
} else {
|
||||
accentColorStateList = ColorStateList.valueOf(colorAccent);
|
||||
|
|
@ -71,7 +73,8 @@ public abstract class AbsThemeActivity extends AppCompatActivity implements KabV
|
|||
ThemeSingleton.get().negativeColor = accentColorStateList;
|
||||
ThemeSingleton.get().neutralColor = accentColorStateList;
|
||||
ThemeSingleton.get().widgetColor = accentColorStateList.getDefaultColor();
|
||||
ThemeSingleton.get().darkTheme = darkTheme;
|
||||
ThemeSingleton.get().darkTheme = dark;
|
||||
|
||||
|
||||
if (!overridesTaskColor()) {
|
||||
notifyTaskColorChange(getThemeColorPrimary());
|
||||
|
|
@ -88,7 +91,7 @@ public abstract class AbsThemeActivity extends AppCompatActivity implements KabV
|
|||
return coloredNavigationBar != PreferenceUtil.getInstance(this).shouldUseColoredNavigationBar() ||
|
||||
colorPrimary != PreferenceUtil.getInstance(this).getThemeColorPrimary(this) ||
|
||||
colorAccent != PreferenceUtil.getInstance(this).getThemeColorAccent(this) ||
|
||||
darkTheme != (PreferenceUtil.getInstance(this).getGeneralTheme() == R.style.Theme_MaterialMusic);
|
||||
theme != PreferenceUtil.getInstance(this).getGeneralTheme();
|
||||
}
|
||||
|
||||
protected void notifyTaskColorChange(@ColorInt int color) {
|
||||
|
|
|
|||
|
|
@ -104,6 +104,8 @@ public final class PreferenceUtil {
|
|||
return R.style.Theme_MaterialMusic_Light;
|
||||
case 1:
|
||||
return R.style.Theme_MaterialMusic;
|
||||
case 2:
|
||||
return R.style.Theme_MaterialMusic_Black;
|
||||
}
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
|
|
|
|||
5
app/src/main/res/drawable-nodpi/black.xml
Normal file
5
app/src/main/res/drawable-nodpi/black.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@android:color/black" />
|
||||
</shape>
|
||||
|
|
@ -14,6 +14,13 @@
|
|||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.MaterialMusic.Black" parent="Theme.MaterialMusic.Base.Black">
|
||||
<item name="round_selector">@drawable/round_ripple_selector</item>
|
||||
<item name="rect_selector">@drawable/rect_ripple_selector</item>
|
||||
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.MaterialMusic.Notification" parent="@android:style/TextAppearance.Material.Notification" />
|
||||
|
||||
<style name="Theme.MaterialMusic.Notification.Title" parent="@android:style/TextAppearance.Material.Notification.Title" />
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@
|
|||
<string name="last_opened">Last opened</string>
|
||||
<string name="light_theme_name">Light</string>
|
||||
<string name="dark_theme_name">Dark</string>
|
||||
<string name="black_theme_name">Black (AMOLED)</string>
|
||||
<string name="equalizer">Equalizer</string>
|
||||
<string name="pref_header_colors">Colors</string>
|
||||
<string name="pref_header_now_playing_screen">Now playing</string>
|
||||
|
|
|
|||
|
|
@ -18,11 +18,13 @@
|
|||
<string-array name="pref_general_theme_list_titles">
|
||||
<item>@string/light_theme_name</item>
|
||||
<item>@string/dark_theme_name</item>
|
||||
<item>@string/black_theme_name</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_general_theme_list_values">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
<style name="Theme.MaterialMusic.Light" parent="Theme.MaterialMusic.Base.Light" />
|
||||
|
||||
<style name="Theme.MaterialMusic.Black" parent="Theme.MaterialMusic.Base.Black" />
|
||||
|
||||
<style name="Theme.MaterialMusic.Notification" parent="@android:style/TextAppearance.StatusBar.EventContent" />
|
||||
|
||||
<style name="Theme.MaterialMusic.Notification.Title" parent="@android:style/TextAppearance.StatusBar.EventContent.Title" />
|
||||
|
|
|
|||
|
|
@ -57,6 +57,13 @@
|
|||
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.MaterialMusic.Base.Black" parent="@style/Theme.MaterialMusic.Base">
|
||||
<item name="android:windowBackground">@drawable/black</item>
|
||||
<item name="divider_color">#18FFFFFF</item>
|
||||
<item name="cardBackgroundColor">@color/grey_900</item>
|
||||
<item name="md_background_color">@color/grey_900</item>
|
||||
</style>
|
||||
|
||||
<style name="PlayPauseFabParent">
|
||||
<item name="borderWidth">0dp</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue