Remove color action bar

This commit is contained in:
Andrew Rabert 2019-12-21 14:45:58 -05:00
parent e7628a97c7
commit 97507a25a1
6 changed files with 9 additions and 47 deletions

View File

@ -82,7 +82,6 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
private static final int PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 1; private static final int PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 1;
private static String theme; private static String theme;
private static boolean fullScreen; private static boolean fullScreen;
private static boolean actionbarColored;
private static ImageLoader IMAGE_LOADER; private static ImageLoader IMAGE_LOADER;
static { static {
@ -176,7 +175,7 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
private void createCustomActionBarView() { private void createCustomActionBarView() {
actionBarSpinner = (Spinner) getLayoutInflater().inflate(R.layout.actionbar_spinner, null); 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)); actionBarSpinner.setBackground(DrawableTint.getTintedDrawableFromColor(this));
} }
spinnerAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item); 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 // Make sure to update theme
SharedPreferences prefs = Util.getPreferences(this); 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(); restart();
overridePendingTransition(R.anim.fade_in, R.anim.fade_out); overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
DrawableTint.wipeTintCache(); DrawableTint.wipeTintCache();
@ -742,7 +741,6 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
} }
ThemeUtil.applyTheme(this, theme); ThemeUtil.applyTheme(this, theme);
actionbarColored = Util.getPreferences(this).getBoolean(Constants.PREFERENCES_KEY_COLOR_ACTION_BAR, true);
} }
private void applyFullscreen() { private void applyFullscreen() {

View File

@ -391,17 +391,6 @@ public abstract class SectionAdapter<T> extends RecyclerView.Adapter<UpdateViewH
MenuUtil.hideMenuItems(context, menu, updateView); MenuUtil.hideMenuItems(context, menu, updateView);
mode.setTitle(context.getResources().getString(R.string.select_album_n_selected, selected.size())); mode.setTitle(context.getResources().getString(R.string.select_album_n_selected, selected.size()));
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);
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; return true;
} }
@ -428,11 +417,6 @@ public abstract class SectionAdapter<T> extends RecyclerView.Adapter<UpdateViewH
updateView.setChecked(false); updateView.setChecked(false);
} }
selectedViews.clear(); selectedViews.clear();
if (Build.VERSION.SDK_INT >= 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);
}
} }
}); });
} }

View File

@ -121,7 +121,6 @@ public final class Constants {
public static final String PREFERENCES_KEY_ALBUMS_PER_FOLDER = "albumsPerFolder"; 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_FIRST_LEVEL_ARTIST = "firstLevelArtist";
public static final String PREFERENCES_KEY_START_ON_HEADPHONES = "startOnHeadphones"; 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_SHUFFLE_BY_ALBUM = "shuffleByAlbum";
public static final String PREFERENCES_KEY_BATCH_MODE = "batchMode"; public static final String PREFERENCES_KEY_BATCH_MODE = "batchMode";

View File

@ -59,24 +59,13 @@ public final class ThemeUtil {
private static int getThemeRes(Context context, String theme) { private static int getThemeRes(Context context, String theme) {
if (context instanceof SubsonicFragmentActivity || context instanceof SettingsActivity) { if (context instanceof SubsonicFragmentActivity || context instanceof SettingsActivity) {
if (Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_COLOR_ACTION_BAR, true)) { switch (theme) {
switch (theme) { case THEME_DARK:
case THEME_DARK: return R.style.Theme_Audinaut_Dark_No_Color;
return R.style.Theme_Audinaut_Dark_No_Actionbar; case THEME_BLACK:
case THEME_BLACK: return R.style.Theme_Audinaut_Black_No_Color;
return R.style.Theme_Audinaut_Black_No_Actionbar; default:
default: return R.style.Theme_Audinaut_Light_No_Color;
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;
}
} }
} else { } else {
switch (theme) { switch (theme) {

View File

@ -243,8 +243,6 @@
<string name="settings.replay_gain_untagged">Songs without Replay Gain</string> <string name="settings.replay_gain_untagged">Songs without Replay Gain</string>
<string name="settings.start_on_headphones">Start on headphones</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 Audinaut is not running.</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 Audinaut 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="settings.shuffle_by_album">Shuffle By Album</string> <string name="settings.shuffle_by_album">Shuffle By Album</string>
<string name="settings.shuffle_by_album.true">Shuffle order of albums</string> <string name="settings.shuffle_by_album.true">Shuffle order of albums</string>
<string name="settings.shuffle_by_album.false">Shuffle all songs together</string> <string name="settings.shuffle_by_album.false">Shuffle all songs together</string>

View File

@ -16,12 +16,6 @@
android:key="fullScreen" android:key="fullScreen"
android:summary="@string/settings.theme_fullscreen_summary" android:summary="@string/settings.theme_fullscreen_summary"
android:title="@string/settings.theme_fullscreen" /> android:title="@string/settings.theme_fullscreen" />
<CheckBoxPreference
android:defaultValue="true"
android:key="colorActionBar"
android:summary="@string/settings.color_action_bar.summary"
android:title="@string/settings.color_action_bar" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/settings.appearance_title"> <PreferenceCategory android:title="@string/settings.appearance_title">