aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java5
-rw-r--r--app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Constants.java1
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Util.java29
-rw-r--r--app/src/main/res/layout/abstract_fragment_activity.xml8
-rw-r--r--app/src/main/res/layout/drawer_header.xml4
-rw-r--r--app/src/main/res/layout/settings_activity.xml6
-rw-r--r--app/src/main/res/values-v21/themes.xml17
-rw-r--r--app/src/main/res/values/attrs.xml4
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--app/src/main/res/values/themes.xml54
-rw-r--r--app/src/main/res/xml/settings.xml6
12 files changed, 120 insertions, 18 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
index bc114272..ab68a59a 100644
--- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -85,6 +85,7 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
private static ImageLoader IMAGE_LOADER;
protected static String theme;
protected static boolean fullScreen;
+ protected static boolean actionbarColored;
private static final int MENU_GROUP_SERVER = 10;
private static final int MENU_ITEM_SERVER_BASE = 100;
@@ -204,7 +205,8 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
Util.registerMediaButtonEventReceiver(this);
// Make sure to update theme
- if (theme != null && !theme.equals(Util.getTheme(this)) || fullScreen != Util.getPreferences(this).getBoolean(Constants.PREFERENCES_KEY_FULL_SCREEN, false)) {
+ SharedPreferences prefs = Util.getPreferences(this);
+ if (theme != null && !theme.equals(Util.getTheme(this)) || fullScreen != prefs.getBoolean(Constants.PREFERENCES_KEY_FULL_SCREEN, false) || actionbarColored != prefs.getBoolean(Constants.PREFERENCES_KEY_COLOR_ACTION_BAR, true)) {
restart();
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
DrawableTint.wipeTintCache();
@@ -873,6 +875,7 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
}
Util.applyTheme(this, theme);
+ actionbarColored = Util.getPreferences(this).getBoolean(Constants.PREFERENCES_KEY_COLOR_ACTION_BAR, true);
}
private void applyFullscreen() {
fullScreen = Util.getPreferences(this).getBoolean(Constants.PREFERENCES_KEY_FULL_SCREEN, false);
diff --git a/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java b/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java
index 53cc5e99..d8107158 100644
--- a/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java
+++ b/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java
@@ -413,7 +413,7 @@ public abstract class SectionAdapter<T> extends RecyclerView.Adapter<UpdateViewH
setChecked(updateView, true);
mode.setTitle(context.getResources().getString(R.string.select_album_n_selected, selected.size()));
- if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_COLOR_ACTION_BAR, true)) {
TypedValue typedValue = new TypedValue();
Resources.Theme theme = context.getTheme();
theme.resolveAttribute(R.attr.colorPrimaryDark, typedValue, true);
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Constants.java b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
index 3c685fe9..e9e668f7 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Constants.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
@@ -159,6 +159,7 @@ public final class Constants {
public static final String PREFERENCES_KEY_RENAME_DUPLICATES = "renameDuplicates";
public static final String PREFERENCES_KEY_FIRST_LEVEL_ARTIST = "firstLevelArtist";
public static final String PREFERENCES_KEY_START_ON_HEADPHONES = "startOnHeadphones";
+ public static final String PREFERENCES_KEY_COLOR_ACTION_BAR = "colorActionBar";
public static final String OFFLINE_SCROBBLE_COUNT = "scrobbleCount";
public static final String OFFLINE_SCROBBLE_ID = "scrobbleID";
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Util.java b/app/src/main/java/github/daneren2005/dsub/util/Util.java
index ec73afa7..24895226 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Util.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Util.java
@@ -19,6 +19,7 @@ package github.daneren2005.dsub.util;
import android.annotation.TargetApi;
import android.app.Activity;
+import android.graphics.Color;
import android.support.annotation.StringRes;
import android.support.v7.app.AlertDialog;
import android.content.ComponentName;
@@ -46,6 +47,8 @@ import android.text.util.Linkify;
import android.util.Log;
import android.util.SparseArray;
import android.view.Gravity;
+import android.view.Window;
+import android.view.WindowManager;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
@@ -271,14 +274,26 @@ public final class Util {
}
public static int getThemeRes(Context context, String theme) {
if(context instanceof SubsonicFragmentActivity || context instanceof SettingsActivity) {
- if ("dark".equals(theme)) {
- return R.style.Theme_DSub_Dark_No_Actionbar;
- } else if ("black".equals(theme)) {
- return R.style.Theme_DSub_Black_No_Actionbar;
- } else if ("holo".equals(theme)) {
- return R.style.Theme_DSub_Holo_No_Actionbar;
+ if(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_COLOR_ACTION_BAR, true)) {
+ if ("dark".equals(theme)) {
+ return R.style.Theme_DSub_Dark_No_Actionbar;
+ } else if ("black".equals(theme)) {
+ return R.style.Theme_DSub_Black_No_Actionbar;
+ } else if ("holo".equals(theme)) {
+ return R.style.Theme_DSub_Holo_No_Actionbar;
+ } else {
+ return R.style.Theme_DSub_Light_No_Actionbar;
+ }
} else {
- return R.style.Theme_DSub_Light_No_Actionbar;
+ if ("dark".equals(theme)) {
+ return R.style.Theme_DSub_Dark_No_Color;
+ } else if ("black".equals(theme)) {
+ return R.style.Theme_DSub_Black_No_Color;
+ } else if ("holo".equals(theme)) {
+ return R.style.Theme_DSub_Holo_No_Color;
+ } else {
+ return R.style.Theme_DSub_Light_No_Color;
+ }
}
} else {
if ("dark".equals(theme)) {
diff --git a/app/src/main/res/layout/abstract_fragment_activity.xml b/app/src/main/res/layout/abstract_fragment_activity.xml
index 04e6ec81..d41b0115 100644
--- a/app/src/main/res/layout/abstract_fragment_activity.xml
+++ b/app/src/main/res/layout/abstract_fragment_activity.xml
@@ -18,9 +18,9 @@
android:id="@+id/main_toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
- android:background="?attr/colorPrimary"
+ android:background="?attr/actionbarBackgroundColor"
android:elevation="4dp"
- android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
+ android:theme="?attr/actionbarThemeStyle"
app:popupTheme="?attr/actionbarPopupStyle"/>
<include layout="@layout/abstract_fragment_container"/>
@@ -36,7 +36,7 @@
android:id="@+id/slide_up_swipe_target"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="?attr/colorPrimary">
+ android:background="?attr/actionbarBackgroundColor">
<android.support.v7.widget.Toolbar
android:id="@+id/now_playing_toolbar"
@@ -44,7 +44,7 @@
android:layout_width="match_parent"
android:elevation="4dp"
android:visibility="gone"
- app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
+ app:theme="?attr/actionbarThemeStyle"
app:popupTheme="?attr/actionbarPopupStyle"/>
<LinearLayout
diff --git a/app/src/main/res/layout/drawer_header.xml b/app/src/main/res/layout/drawer_header.xml
index 91fad9fe..86222f43 100644
--- a/app/src/main/res/layout/drawer_header.xml
+++ b/app/src/main/res/layout/drawer_header.xml
@@ -25,14 +25,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
- style="?attr/actionbarTitleStyle"/>
+ style="?attr/drawerTitleStyle"/>
<TextView
android:id="@+id/header_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
- style="?attr/actionbarSubtitleStyle"/>
+ style="?attr/drawerSubtitleStyle"/>
</LinearLayout>
<View
diff --git a/app/src/main/res/layout/settings_activity.xml b/app/src/main/res/layout/settings_activity.xml
index c77528b2..3baa30d4 100644
--- a/app/src/main/res/layout/settings_activity.xml
+++ b/app/src/main/res/layout/settings_activity.xml
@@ -8,10 +8,10 @@
android:id="@+id/main_toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
- android:background="?attr/colorPrimary"
+ android:background="?attr/actionbarBackgroundColor"
android:elevation="4dp"
- app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
- app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
+ app:theme="?attr/actionbarThemeStyle"
+ app:popupTheme="?attr/actionbarPopupStyle"/>
<FrameLayout
android:id="@+id/fragment_container"
diff --git a/app/src/main/res/values-v21/themes.xml b/app/src/main/res/values-v21/themes.xml
index acd117b5..5c54b75a 100644
--- a/app/src/main/res/values-v21/themes.xml
+++ b/app/src/main/res/values-v21/themes.xml
@@ -7,4 +7,21 @@
<style name="Theme.DSub.Dark" parent="Theme.DSub.Dark.Base">
<item name="android:windowTranslucentStatus">true</item>
</style>
+
+ <style name="Theme.DSub.Light.No_Color" parent="Theme.DSub.Light.No_Color.Base">
+ <item name="android:windowTranslucentStatus">false</item>
+ <item name="android:statusBarColor">@android:color/black</item>
+ </style>
+ <style name="Theme.DSub.Black.No_Color" parent="Theme.DSub.Black.No_Color.Base">
+ <item name="android:windowTranslucentStatus">false</item>
+ <item name="android:statusBarColor">@android:color/black</item>
+ </style>
+ <style name="Theme.DSub.Dark.No_Color" parent="Theme.DSub.Dark.No_Color.Base">
+ <item name="android:windowTranslucentStatus">false</item>
+ <item name="android:statusBarColor">@android:color/black</item>
+ </style>
+ <style name="Theme.DSub.Holo.No_Color" parent="Theme.DSub.Holo.No_Color.Base">
+ <item name="android:windowTranslucentStatus">false</item>
+ <item name="android:statusBarColor">@android:color/black</item>
+ </style>
</resources> \ No newline at end of file
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
index 8f1e27a8..e14370e2 100644
--- a/app/src/main/res/values/attrs.xml
+++ b/app/src/main/res/values/attrs.xml
@@ -47,9 +47,13 @@
<attr name="drawerAdmin" format="reference"/>
<attr name="drawerDownloading" format="reference"/>
<attr name="drawerSettings" format="reference"/>
+ <attr name="actionbarThemeStyle" format="reference"/>
<attr name="actionbarTitleStyle" format="reference"/>
<attr name="actionbarSubtitleStyle" format="reference"/>
<attr name="actionbarPopupStyle" format="reference"/>
+ <attr name="actionbarBackgroundColor" format="reference"/>
+ <attr name="drawerTitleStyle" format="reference"/>
+ <attr name="drawerSubtitleStyle" format="reference"/>
<declare-styleable name="SeekBarPreference">
<attr name="min" format="integer"/>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index fc61a0f0..453cfdb1 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -457,6 +457,8 @@
<string name="settings.rename_duplicates_summary">Rename duplicate tracks to the original filename so you can tell them apart.</string>
<string name="settings.start_on_headphones">Start on headphones</string>
<string name="settings.start_on_headphones_summary">Start when headphones are plugged in. This requires the use of a service which starts on boot up to check for the headphone plug event even when DSub is not running.</string>
+ <string name="settings.color_action_bar">Color Action Bar</string>
+ <string name="settings.color_action_bar.summary">Color the action bar and status bar or leave them alone</string>
<string name="shuffle.title">Shuffle By</string>
<string name="shuffle.startYear">Start Year:</string>
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 6eac0202..dd156170 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -51,10 +51,14 @@
<item name="colorPrimary">@color/lightPrimary</item>
<item name="colorPrimaryDark">@color/lightPrimaryDark</item>
<item name="colorAccent">@color/lightAccent</item>
+ <item name="actionbarBackgroundColor">@color/lightPrimary</item>
<item name="actionbarTitleStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse</item>
<item name="actionbarSubtitleStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle.Inverse</item>
<item name="actionbarPopupStyle">@style/ThemeOverlay.AppCompat.Light</item>
+ <item name="actionbarThemeStyle">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
<item name="android:spinnerItemStyle">@style/DarkSpinnerItem</item>
+ <item name="drawerTitleStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse</item>
+ <item name="drawerSubtitleStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle.Inverse</item>
<item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">?attr/colorPrimary</item>
</style>
@@ -109,9 +113,13 @@
<item name="colorPrimary">@color/lightPrimary</item>
<item name="colorPrimaryDark">@color/lightPrimaryDark</item>
<item name="colorAccent">@color/lightAccent</item>
+ <item name="actionbarBackgroundColor">@color/lightPrimary</item>
<item name="actionbarTitleStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Title</item>
<item name="actionbarSubtitleStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle</item>
<item name="actionbarPopupStyle">@style/ThemeOverlay.AppCompat.Dark</item>
+ <item name="actionbarThemeStyle">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
+ <item name="drawerTitleStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Title</item>
+ <item name="drawerSubtitleStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle</item>
<item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">?attr/colorPrimary</item>
</style>
@@ -127,6 +135,7 @@
<item name="colorPrimary">@color/holoPrimary</item>
<item name="colorPrimaryDark">@color/holoPrimaryDark</item>
<item name="colorAccent">@color/holoAccent</item>
+ <item name="actionbarBackgroundColor">@color/holoPrimary</item>
</style>
<style name="Theme.DSub.Light.No_Actionbar" parent="Theme.DSub.Light">
@@ -146,10 +155,55 @@
<item name="windowNoTitle">true</item>
</style>
+ <style name="Theme.DSub.Light.No_Color.Base" parent="Theme.DSub.Light.No_Actionbar">
+ <item name="actionbarThemeStyle">@style/ThemeOverlay.AppCompat.ActionBar</item>
+ <item name="actionbarBackgroundColor">@android:color/transparent</item>
+ <item name="actionbarTitleStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Title</item>
+ <item name="actionbarSubtitleStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle</item>
+ <item name="android:spinnerItemStyle">@style/LightSpinnerItem</item>
+ <item name="drawerTitleStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse</item>
+ <item name="drawerSubtitleStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle.Inverse</item>
+ <item name="actionbar_backward">@drawable/media_backward_light</item>
+ <item name="actionbar_forward">@drawable/media_forward_light</item>
+ <item name="actionbar_pause">@drawable/media_pause_light</item>
+ <item name="actionbar_start">@drawable/media_start_light</item>
+ <item name="actionbar_stop">@drawable/media_stop_light</item>
+ <item name="add">@drawable/ic_action_add_light</item>
+ <item name="shuffle">@drawable/ic_menu_shuffle_light</item>
+ <item name="refresh">@drawable/ic_menu_refresh_light</item>
+ <item name="search">@drawable/ic_menu_search_light</item>
+ <item name="remove">@drawable/ic_menu_remove_light</item>
+ <item name="save">@drawable/ic_menu_save_light</item>
+ <item name="add_person">@drawable/ic_menu_add_person_light</item>
+ <item name="password">@drawable/ic_menu_password_light</item>
+ <item name="radio">@drawable/ic_menu_radio_light</item>
+ </style>
+ <style name="Theme.DSub.Black.No_Color.Base" parent="Theme.DSub.Black.No_Actionbar">
+ <item name="actionbarBackgroundColor">@android:color/transparent</item>
+ </style>
+ <style name="Theme.DSub.Dark.No_Color.Base" parent="Theme.DSub.Dark.No_Actionbar">
+ <item name="actionbarBackgroundColor">@android:color/transparent</item>
+ </style>
+ <style name="Theme.DSub.Holo.No_Color.Base" parent="Theme.DSub.Holo.No_Actionbar">
+ <item name="actionbarBackgroundColor">@android:color/transparent</item>
+ </style>
+
+ <style name="Theme.DSub.Light.No_Color" parent="Theme.DSub.Light.No_Color.Base">
+ </style>
+ <style name="Theme.DSub.Black.No_Color" parent="Theme.DSub.Black.No_Color.Base">
+ </style>
+ <style name="Theme.DSub.Dark.No_Color" parent="Theme.DSub.Dark.No_Color.Base">
+ </style>
+ <style name="Theme.DSub.Holo.No_Color" parent="Theme.DSub.Holo.No_Color.Base">
+ </style>
+
<style name="DSub.DrawerArrow" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
</style>
+ <style name="LightSpinnerItem" parent="Widget.AppCompat.TextView.SpinnerItem">
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
+ </style>
<style name="DarkSpinnerItem" parent="Widget.AppCompat.TextView.SpinnerItem">
<item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
</style>
diff --git a/app/src/main/res/xml/settings.xml b/app/src/main/res/xml/settings.xml
index 078ccbeb..b30d59fd 100644
--- a/app/src/main/res/xml/settings.xml
+++ b/app/src/main/res/xml/settings.xml
@@ -39,6 +39,12 @@
android:defaultValue="false"/>
<CheckBoxPreference
+ android:title="@string/settings.color_action_bar"
+ android:summary="@string/settings.color_action_bar.summary"
+ android:key="colorActionBar"
+ android:defaultValue="true"/>
+
+ <CheckBoxPreference
android:title="@string/settings.track_title"
android:summary="@string/settings.track_summary"
android:key="displayTrack"