From 97507a25a1c8f144cab06f228f8ae7329fc589dd Mon Sep 17 00:00:00 2001 From: Andrew Rabert Date: Sat, 21 Dec 2019 14:45:58 -0500 Subject: [PATCH] Remove color action bar --- .../audinaut/activity/SubsonicActivity.java | 6 ++--- .../audinaut/adapter/SectionAdapter.java | 16 ------------ .../net/nullsum/audinaut/util/Constants.java | 1 - .../net/nullsum/audinaut/util/ThemeUtil.java | 25 ++++++------------- app/src/main/res/values/strings.xml | 2 -- app/src/main/res/xml/settings_appearance.xml | 6 ----- 6 files changed, 9 insertions(+), 47 deletions(-) diff --git a/app/src/main/java/net/nullsum/audinaut/activity/SubsonicActivity.java b/app/src/main/java/net/nullsum/audinaut/activity/SubsonicActivity.java index 8ad40da..46495ab 100644 --- a/app/src/main/java/net/nullsum/audinaut/activity/SubsonicActivity.java +++ b/app/src/main/java/net/nullsum/audinaut/activity/SubsonicActivity.java @@ -82,7 +82,6 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte private static final int PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 1; private static String theme; private static boolean fullScreen; - private static boolean actionbarColored; private static ImageLoader IMAGE_LOADER; static { @@ -176,7 +175,7 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte private void createCustomActionBarView() { actionBarSpinner = (Spinner) getLayoutInflater().inflate(R.layout.actionbar_spinner, null); - if ((this instanceof SubsonicFragmentActivity || this instanceof SettingsActivity) && (Util.getPreferences(this).getBoolean(Constants.PREFERENCES_KEY_COLOR_ACTION_BAR, true) || ThemeUtil.getThemeRes(this) != R.style.Theme_Audinaut_Light_No_Color)) { + if ((this instanceof SubsonicFragmentActivity || this instanceof SettingsActivity) && ThemeUtil.getThemeRes(this) != R.style.Theme_Audinaut_Light_No_Color) { actionBarSpinner.setBackground(DrawableTint.getTintedDrawableFromColor(this)); } spinnerAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item); @@ -194,7 +193,7 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte // Make sure to update theme SharedPreferences prefs = Util.getPreferences(this); - if (theme != null && !theme.equals(ThemeUtil.getTheme(this)) || fullScreen != prefs.getBoolean(Constants.PREFERENCES_KEY_FULL_SCREEN, false) || actionbarColored != prefs.getBoolean(Constants.PREFERENCES_KEY_COLOR_ACTION_BAR, true)) { + if (theme != null && !theme.equals(ThemeUtil.getTheme(this)) || fullScreen != prefs.getBoolean(Constants.PREFERENCES_KEY_FULL_SCREEN, false)) { restart(); overridePendingTransition(R.anim.fade_in, R.anim.fade_out); DrawableTint.wipeTintCache(); @@ -742,7 +741,6 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte } ThemeUtil.applyTheme(this, theme); - actionbarColored = Util.getPreferences(this).getBoolean(Constants.PREFERENCES_KEY_COLOR_ACTION_BAR, true); } private void applyFullscreen() { diff --git a/app/src/main/java/net/nullsum/audinaut/adapter/SectionAdapter.java b/app/src/main/java/net/nullsum/audinaut/adapter/SectionAdapter.java index 7485084..33997f4 100644 --- a/app/src/main/java/net/nullsum/audinaut/adapter/SectionAdapter.java +++ b/app/src/main/java/net/nullsum/audinaut/adapter/SectionAdapter.java @@ -391,17 +391,6 @@ public abstract class SectionAdapter extends RecyclerView.Adapter= 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); - int colorPrimaryDark = typedValue.data; - - Window window = ((SubsonicFragmentActivity) context).getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - window.setStatusBarColor(colorPrimaryDark); - } return true; } @@ -428,11 +417,6 @@ public abstract class SectionAdapter extends RecyclerView.Adapter= Build.VERSION_CODES.LOLLIPOP && Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_COLOR_ACTION_BAR, true)) { - Window window = ((SubsonicFragmentActivity) context).getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - } } }); } diff --git a/app/src/main/java/net/nullsum/audinaut/util/Constants.java b/app/src/main/java/net/nullsum/audinaut/util/Constants.java index e1b6509..5675fe6 100644 --- a/app/src/main/java/net/nullsum/audinaut/util/Constants.java +++ b/app/src/main/java/net/nullsum/audinaut/util/Constants.java @@ -121,7 +121,6 @@ public final class Constants { public static final String PREFERENCES_KEY_ALBUMS_PER_FOLDER = "albumsPerFolder"; 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 PREFERENCES_KEY_SHUFFLE_BY_ALBUM = "shuffleByAlbum"; public static final String PREFERENCES_KEY_BATCH_MODE = "batchMode"; diff --git a/app/src/main/java/net/nullsum/audinaut/util/ThemeUtil.java b/app/src/main/java/net/nullsum/audinaut/util/ThemeUtil.java index 7d97fd4..8b80d27 100644 --- a/app/src/main/java/net/nullsum/audinaut/util/ThemeUtil.java +++ b/app/src/main/java/net/nullsum/audinaut/util/ThemeUtil.java @@ -59,24 +59,13 @@ public final class ThemeUtil { private static int getThemeRes(Context context, String theme) { if (context instanceof SubsonicFragmentActivity || context instanceof SettingsActivity) { - if (Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_COLOR_ACTION_BAR, true)) { - switch (theme) { - case THEME_DARK: - return R.style.Theme_Audinaut_Dark_No_Actionbar; - case THEME_BLACK: - return R.style.Theme_Audinaut_Black_No_Actionbar; - default: - return R.style.Theme_Audinaut_Light_No_Actionbar; - } - } else { - switch (theme) { - case THEME_DARK: - return R.style.Theme_Audinaut_Dark_No_Color; - case THEME_BLACK: - return R.style.Theme_Audinaut_Black_No_Color; - default: - return R.style.Theme_Audinaut_Light_No_Color; - } + switch (theme) { + case THEME_DARK: + return R.style.Theme_Audinaut_Dark_No_Color; + case THEME_BLACK: + return R.style.Theme_Audinaut_Black_No_Color; + default: + return R.style.Theme_Audinaut_Light_No_Color; } } else { switch (theme) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2d59d35..13745ab 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -243,8 +243,6 @@ Songs without Replay Gain Start on headphones 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 Audinaut is not running. - Color Action Bar - Color the action bar and status bar or leave them alone Shuffle By Album Shuffle order of albums Shuffle all songs together diff --git a/app/src/main/res/xml/settings_appearance.xml b/app/src/main/res/xml/settings_appearance.xml index a15deb5..011cb75 100644 --- a/app/src/main/res/xml/settings_appearance.xml +++ b/app/src/main/res/xml/settings_appearance.xml @@ -16,12 +16,6 @@ android:key="fullScreen" android:summary="@string/settings.theme_fullscreen_summary" android:title="@string/settings.theme_fullscreen" /> - -