diff options
Diffstat (limited to 'app/src/main/java')
4 files changed, 28 insertions, 9 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)) { |