MultipleChoicePreference to set colored navigation bar for each activity individually.

This commit is contained in:
Karim Abou Zeid 2015-04-18 17:03:11 +02:00
commit 2d08e5c5d1
12 changed files with 161 additions and 132 deletions

View file

@ -8,8 +8,13 @@ public class UIPreferenceChangedEvent {
public static final int ALBUM_OVERVIEW_PALETTE_CHANGED = 1; public static final int ALBUM_OVERVIEW_PALETTE_CHANGED = 1;
public static final int COLORED_NAVIGATION_BAR_ARTIST_CHANGED = 2; public static final int COLORED_NAVIGATION_BAR_ARTIST_CHANGED = 2;
public static final int COLORED_NAVIGATION_BAR_ALBUM_CHANGED = 3; public static final int COLORED_NAVIGATION_BAR_ALBUM_CHANGED = 3;
public static final int PLAYBACK_CONTROLLER_CARD_CHANGED = 4; public static final int COLORED_NAVIGATION_BAR_PLAYLIST_CHANGED = 4;
public static final int TOOLBAR_TRANSPARENT_CHANGED = 5; public static final int COLORED_NAVIGATION_BAR_TAG_EDITOR_CHANGED = 5;
public static final int COLORED_NAVIGATION_BAR_CURRENT_PLAYING_CHANGED = 6;
public static final int COLORED_NAVIGATION_BAR_CHANGED = 10;
public static final int COLORED_NAVIGATION_BAR_OTHER_SCREENS_CHANGED = 7;
public static final int PLAYBACK_CONTROLLER_CARD_CHANGED = 8;
public static final int TOOLBAR_TRANSPARENT_CHANGED = 9;
private final int action; private final int action;
private final Object value; private final Object value;

View file

@ -58,6 +58,7 @@ import com.koushikdutta.ion.Ion;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
public class MainActivity extends AbsFabActivity public class MainActivity extends AbsFabActivity
@ -99,7 +100,7 @@ public class MainActivity extends AbsFabActivity
@Override @Override
protected boolean shouldColorNavBar() { protected boolean shouldColorNavBar() {
return false; return PreferenceUtils.getInstance(this).coloredNavigationBarOtherScreensEnabled();
} }
private void setUpViewPager() { private void setUpViewPager() {
@ -355,6 +356,16 @@ public class MainActivity extends AbsFabActivity
case UIPreferenceChangedEvent.TOOLBAR_TRANSPARENT_CHANGED: case UIPreferenceChangedEvent.TOOLBAR_TRANSPARENT_CHANGED:
setToolBarTransparent((boolean) event.getValue()); setToolBarTransparent((boolean) event.getValue());
break; break;
case UIPreferenceChangedEvent.COLORED_NAVIGATION_BAR_OTHER_SCREENS_CHANGED:
setShouldColorNavBar((boolean) event.getValue());
break;
case UIPreferenceChangedEvent.COLORED_NAVIGATION_BAR_CHANGED:
try {
setShouldColorNavBar(((Set) event.getValue()).contains(PreferenceUtils.COLORED_NAVIGATION_BAR_OTHER_SCREENS));
} catch (NullPointerException ignored) {
setShouldColorNavBar(false);
}
break;
} }
} }

View file

@ -81,7 +81,7 @@ public class PlaylistDetailActivity extends AbsFabActivity {
@Override @Override
protected boolean shouldColorNavBar() { protected boolean shouldColorNavBar() {
return true; return PreferenceUtils.getInstance(this).coloredNavigationBarPlaylistEnabled();
} }
private void getIntentExtras() { private void getIntentExtras() {

View file

@ -21,6 +21,9 @@ import com.kabouzeid.gramophone.prefs.ColorChooserPreference;
import com.kabouzeid.gramophone.ui.activities.base.AbsBaseActivity; import com.kabouzeid.gramophone.ui.activities.base.AbsBaseActivity;
import com.kabouzeid.gramophone.util.NavigationUtil; import com.kabouzeid.gramophone.util.NavigationUtil;
import com.kabouzeid.gramophone.util.PreferenceUtils; import com.kabouzeid.gramophone.util.PreferenceUtils;
import com.kabouzeid.gramophone.util.Util;
import java.util.Set;
public class SettingsActivity extends AbsBaseActivity implements ColorChooserDialog.ColorCallback { public class SettingsActivity extends AbsBaseActivity implements ColorChooserDialog.ColorCallback {
public static final String TAG = SettingsActivity.class.getSimpleName(); public static final String TAG = SettingsActivity.class.getSimpleName();
@ -29,7 +32,7 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setStatusBarTranslucent(false); setStatusBarTranslucent(!Util.hasLollipopSDK());
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_preferences); setContentView(R.layout.activity_preferences);
mToolbar = (Toolbar) findViewById(R.id.toolbar); mToolbar = (Toolbar) findViewById(R.id.toolbar);
@ -48,7 +51,7 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
@Override @Override
protected boolean shouldColorNavBar() { protected boolean shouldColorNavBar() {
return true; return PreferenceUtils.getInstance(this).coloredNavigationBarOtherScreensEnabled();
} }
@Override @Override
@ -134,22 +137,6 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
} }
}); });
findPreference("colored_navigation_bar_artist").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object o) {
App.bus.post(new UIPreferenceChangedEvent(UIPreferenceChangedEvent.COLORED_NAVIGATION_BAR_ARTIST_CHANGED, o));
return true;
}
});
findPreference("colored_navigation_bar_album").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object o) {
App.bus.post(new UIPreferenceChangedEvent(UIPreferenceChangedEvent.COLORED_NAVIGATION_BAR_ALBUM_CHANGED, o));
return true;
}
});
findPreference("playback_controller_card").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { findPreference("playback_controller_card").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override @Override
public boolean onPreferenceChange(Preference preference, Object o) { public boolean onPreferenceChange(Preference preference, Object o) {
@ -158,6 +145,14 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
} }
}); });
findPreference("colored_navigation_bar").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object o) {
App.bus.post(new UIPreferenceChangedEvent(UIPreferenceChangedEvent.COLORED_NAVIGATION_BAR_CHANGED, o));
return true;
}
});
equalizer = findPreference("equalizer"); equalizer = findPreference("equalizer");
resolveEqualizer(); resolveEqualizer();
equalizer.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { equalizer.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@ -201,6 +196,23 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
} }
} }
@Override
protected void onUIPreferenceChangedEvent(UIPreferenceChangedEvent event) {
super.onUIPreferenceChangedEvent(event);
switch (event.getAction()) {
case UIPreferenceChangedEvent.COLORED_NAVIGATION_BAR_OTHER_SCREENS_CHANGED:
setShouldColorNavBar((boolean) event.getValue());
break;
case UIPreferenceChangedEvent.COLORED_NAVIGATION_BAR_CHANGED:
try {
setShouldColorNavBar(((Set) event.getValue()).contains(PreferenceUtils.COLORED_NAVIGATION_BAR_OTHER_SCREENS));
} catch (NullPointerException ignored) {
setShouldColorNavBar(false);
}
break;
}
}
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) { if (item.getItemId() == android.R.id.home) {

View file

@ -3,6 +3,7 @@ package com.kabouzeid.gramophone.ui.activities.base;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
@ -20,13 +21,13 @@ import com.readystatesoftware.systembartint.SystemBarTintManager;
/** /**
* READ! * READ!
* * <p/>
* Instructions: * Instructions:
* * <p/>
* KitKat or Lollipop solid statusBar with the right color (primaryDark): * KitKat or Lollipop solid statusBar with the right color (primaryDark):
* - shouldColorStatusBar return true OR return false and call setStatusBarColor() in the activity with a custom color * - shouldColorStatusBar return true OR return false and call setStatusBarColor() in the activity with a custom color
* - setStatusBarTranslucent(!Util.hasLollipopSDK()) * - setStatusBarTranslucent(!Util.hasLollipopSDK())
* * <p/>
* KitKat or Lollipop translucent statusBar (not the color is too dark on Lollipop and KitKat only does fading but MUCH better performance the setStatusBarColor in onScrollCallback) * KitKat or Lollipop translucent statusBar (not the color is too dark on Lollipop and KitKat only does fading but MUCH better performance the setStatusBarColor in onScrollCallback)
* - shouldColorStatusBar return false DO NOT return true and do not call setStatusBarColor() in this case at all here * - shouldColorStatusBar return false DO NOT return true and do not call setStatusBarColor() in this case at all here
* - setStatusBarTranslucent(true) * - setStatusBarTranslucent(true)
@ -49,13 +50,8 @@ public abstract class ThemeBaseActivity extends ActionBarActivity implements Kab
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setupTheme() { private void setupTheme() {
// Apply colors to system UI if necessary // Apply colors to system UI if necessary
final int primaryDark = PreferenceUtils.getInstance(this).getThemeColorPrimaryDarker(); setShouldColorNavBar(shouldColorNavBar());
if (Util.hasLollipopSDK()) { setShouldColorStatusBar(shouldColorStatusBar());
if (shouldColorNavBar())
getWindow().setNavigationBarColor(primaryDark);
}
if (shouldColorStatusBar()) setStatusBarColor(primaryDark, false);
// Persist current values so the Activity knows if they change // Persist current values so the Activity knows if they change
// mLastDarkTheme = PreferenceUtils.getInstance(this).getGeneralTheme() == 1; // mLastDarkTheme = PreferenceUtils.getInstance(this).getGeneralTheme() == 1;
@ -110,4 +106,31 @@ public abstract class ThemeBaseActivity extends ActionBarActivity implements Kab
tintManager.setStatusBarTintColor(color); tintManager.setStatusBarTintColor(color);
} }
} }
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected final void setShouldColorNavBar(boolean shouldColorNavBar) {
if (Util.hasLollipopSDK()) {
if (shouldColorNavBar) {
final int primaryDark = PreferenceUtils.getInstance(this).getThemeColorPrimaryDarker();
getWindow().setNavigationBarColor(primaryDark);
} else {
getWindow().setNavigationBarColor(Color.BLACK);
}
}
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected final void setShouldColorStatusBar(boolean shouldColorStatusBar) {
if (shouldColorStatusBar) {
final int primaryDark = PreferenceUtils.getInstance(this).getThemeColorPrimaryDarker();
setStatusBarColor(primaryDark, false);
} else {
if (Util.hasLollipopSDK()) {
getWindow().setStatusBarColor(Util.resolveColor(this, android.R.attr.statusBarColor));
} else {
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(false);
}
}
}
} }

View file

@ -199,12 +199,13 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
protected abstract void save(); protected abstract void save();
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void restoreStandardColors() { private void restoreStandardColors() {
final int vibrantColor = PreferenceUtils.getInstance(this).getThemeColorPrimary(); final int vibrantColor = PreferenceUtils.getInstance(this).getThemeColorPrimary();
paletteColorPrimary = vibrantColor; paletteColorPrimary = vibrantColor;
observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false); observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false);
setStatusBarColor(ColorChooserDialog.shiftColorDown(vibrantColor), false); setStatusBarColor(ColorChooserDialog.shiftColorDown(vibrantColor), false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarTagEditorEnabled())
getWindow().setNavigationBarColor(vibrantColor); getWindow().setNavigationBarColor(vibrantColor);
} }
@ -256,7 +257,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
int primaryDark = ColorChooserDialog.shiftColorDown(paletteColorPrimary); int primaryDark = ColorChooserDialog.shiftColorDown(paletteColorPrimary);
setStatusBarColor(primaryDark, false); setStatusBarColor(primaryDark, false);
if (Util.hasLollipopSDK()) if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarTagEditorEnabled())
getWindow().setNavigationBarColor(primaryDark); getWindow().setNavigationBarColor(primaryDark);
} }
@ -295,7 +296,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
paletteColorPrimary = vibrantColor; paletteColorPrimary = vibrantColor;
observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false); observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false);
setStatusBarColor(ColorChooserDialog.shiftColorDown(vibrantColor), false); setStatusBarColor(ColorChooserDialog.shiftColorDown(vibrantColor), false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(AbsTagEditorActivity.this).coloredNavigationBarTagEditorEnabled())
getWindow().setNavigationBarColor(vibrantColor); getWindow().setNavigationBarColor(vibrantColor);
} }
}); });

View file

@ -23,9 +23,13 @@ public final class PreferenceUtils {
public static final String ONLY_ON_WIFI = "auto_download_artist_images"; public static final String ONLY_ON_WIFI = "auto_download_artist_images";
// public static final String DOWNLOAD_MISSING_ARTIST_IMAGES = "auto_download_artist_images"; // public static final String DOWNLOAD_MISSING_ARTIST_IMAGES = "auto_download_artist_images";
public static final String COLORED_ALBUM_FOOTERS = "colored_album_footers"; public static final String COLORED_ALBUM_FOOTERS = "colored_album_footers";
public static final String COLORED_NAVIGATION_BAR = "colored_navigation_bar";
public static final String COLORED_NAVIGATION_BAR_ALBUM = "colored_navigation_bar_album"; public static final String COLORED_NAVIGATION_BAR_ALBUM = "colored_navigation_bar_album";
public static final String COLORED_NAVIGATION_BAR_ARTIST = "colored_navigation_bar_artist"; public static final String COLORED_NAVIGATION_BAR_ARTIST = "colored_navigation_bar_artist";
public static final String COLORED_NAVIGATION_BAR_CURRENT_PLAYING = "colored_navigation_bar_current_playing_enabled"; public static final String COLORED_NAVIGATION_BAR_CURRENT_PLAYING = "colored_navigation_bar_current_playing";
public static final String COLORED_NAVIGATION_BAR_PLAYIST = "colored_navigation_bar_playlist";
public static final String COLORED_NAVIGATION_BAR_TAG_EDITOR = "colored_navigation_bar_tag_editor";
public static final String COLORED_NAVIGATION_BAR_OTHER_SCREENS = "colored_navigation_bar_other_screens";
public static final String PLAYBACK_CONTROLLER_BOX = "playback_controller_card"; public static final String PLAYBACK_CONTROLLER_BOX = "playback_controller_card";
public static final String TRANSPARENT_TOOLBAR = "transparent_toolbar"; public static final String TRANSPARENT_TOOLBAR = "transparent_toolbar";
public static final String ALBUM_GRID_COLUMNS = "album_grid_columns"; public static final String ALBUM_GRID_COLUMNS = "album_grid_columns";
@ -81,30 +85,6 @@ public final class PreferenceUtils {
mPreferences.edit().putInt("accent_color", color).commit(); mPreferences.edit().putInt("accent_color", color).commit();
} }
// public void setGeneralTheme(int appTheme) {
// int value = -1;
// switch (appTheme) {
// case R.style.Theme_MaterialMusic_Light:
// value = 0;
// break;
// case R.style.Theme_MaterialMusic:
// value = 1;
// break;
// }
// if (value != 0 && value != 1) {
// return;
// }
// final SharedPreferences.Editor editor = mPreferences.edit();
// editor.putString(GENERAL_THEME, String.valueOf(value));
// editor.apply();
// }
//
// public void setDefaultStartPage(final int value) {
// final SharedPreferences.Editor editor = mPreferences.edit();
// editor.putString(DEFAULT_START_PAGE, String.valueOf(value));
// editor.apply();
// }
public final int getDefaultStartPage() { public final int getDefaultStartPage() {
return Integer.parseInt(mPreferences.getString(DEFAULT_START_PAGE, "-1")); return Integer.parseInt(mPreferences.getString(DEFAULT_START_PAGE, "-1"));
} }
@ -119,92 +99,70 @@ public final class PreferenceUtils {
return mPreferences.getInt(LAST_START_PAGE, DEFAULT_PAGE); return mPreferences.getInt(LAST_START_PAGE, DEFAULT_PAGE);
} }
public final boolean autoDownloadOnlyOnWifi() { // public final boolean autoDownloadOnlyOnWifi() {
return mPreferences.getBoolean(ONLY_ON_WIFI, false); // return mPreferences.getBoolean(ONLY_ON_WIFI, false);
}
// public void setAutoDownloadOnlyOnWifi(final boolean value) {
// final SharedPreferences.Editor editor = mPreferences.edit();
// editor.putBoolean(ONLY_ON_WIFI, value);
// editor.apply();
// } // }
public final boolean coloredAlbumFootersEnabled() { public final boolean coloredAlbumFootersEnabled() {
return mPreferences.getBoolean(COLORED_ALBUM_FOOTERS, true); return mPreferences.getBoolean(COLORED_ALBUM_FOOTERS, true);
} }
// public void setColoredAlbumFootersEnabled(final boolean value) {
// final SharedPreferences.Editor editor = mPreferences.edit();
// editor.putBoolean(COLORED_ALBUM_FOOTERS, value);
// editor.apply();
// }
public final boolean coloredNavigationBarAlbumEnabled() { public final boolean coloredNavigationBarAlbumEnabled() {
return mPreferences.getBoolean(COLORED_NAVIGATION_BAR_ALBUM, true); return coloredNavigationBarFor(COLORED_NAVIGATION_BAR_ALBUM);
} }
/*public void setColoredNavigationBarAlbumEnabled(final boolean value) {
final SharedPreferences.Editor editor = mPreferences.edit();
editor.putBoolean(COLORED_NAVIGATION_BAR_ALBUM, value);
editor.apply();
}*/
public final boolean coloredNavigationBarArtistEnabled() { public final boolean coloredNavigationBarArtistEnabled() {
return mPreferences.getBoolean(COLORED_NAVIGATION_BAR_ARTIST, true); return coloredNavigationBarFor(COLORED_NAVIGATION_BAR_ARTIST);
} }
// public void setColoredNavigationBarArtistEnabled(final boolean value) {
// final SharedPreferences.Editor editor = mPreferences.edit();
// editor.putBoolean(COLORED_NAVIGATION_BAR_ARTIST, value);
// editor.apply();
// }
public final boolean coloredNavigationBarCurrentPlayingEnabled() { public final boolean coloredNavigationBarCurrentPlayingEnabled() {
return mPreferences.getBoolean(COLORED_NAVIGATION_BAR_CURRENT_PLAYING, true); return coloredNavigationBarFor(COLORED_NAVIGATION_BAR_CURRENT_PLAYING);
} }
// public void setColoredNavigationBarCurrentPlayingEnabled(final boolean value) { public final boolean coloredNavigationBarPlaylistEnabled() {
// final SharedPreferences.Editor editor = mPreferences.edit(); return coloredNavigationBarFor(COLORED_NAVIGATION_BAR_PLAYIST);
// editor.putBoolean(COLORED_NAVIGATION_BAR_CURRENT_PLAYING, value); }
// editor.apply();
// } public final boolean coloredNavigationBarTagEditorEnabled() {
return coloredNavigationBarFor(COLORED_NAVIGATION_BAR_TAG_EDITOR);
}
public final boolean coloredNavigationBarOtherScreensEnabled() {
return coloredNavigationBarFor(COLORED_NAVIGATION_BAR_OTHER_SCREENS);
}
private final boolean coloredNavigationBarFor(String key) {
try {
return mPreferences.getStringSet(COLORED_NAVIGATION_BAR, null).contains(key);
} catch (NullPointerException e) {
return false;
}
}
@SuppressLint("CommitPrefEdits")
private void setColoredNavigationBarOtherScreens(boolean coloredNavbar) {
mPreferences.edit().putBoolean(COLORED_NAVIGATION_BAR_OTHER_SCREENS, coloredNavbar).commit();
}
public final boolean playbackControllerBoxEnabled() { public final boolean playbackControllerBoxEnabled() {
return mPreferences.getBoolean(PLAYBACK_CONTROLLER_BOX, false); return mPreferences.getBoolean(PLAYBACK_CONTROLLER_BOX, false);
} }
// public void setPlaybackControllerBoxEnabled(final boolean value) {
// final SharedPreferences.Editor editor = mPreferences.edit();
// editor.putBoolean(PLAYBACK_CONTROLLER_BOX, value);
// editor.apply();
// }
public final boolean transparentToolbar() { public final boolean transparentToolbar() {
return mPreferences.getBoolean(TRANSPARENT_TOOLBAR, false); return mPreferences.getBoolean(TRANSPARENT_TOOLBAR, false);
} }
// public void setTransparentToolbar(final boolean value) {
// final SharedPreferences.Editor editor = mPreferences.edit();
// editor.putBoolean(TRANSPARENT_TOOLBAR, value);
// editor.apply();
// }
// public final boolean downloadMissingArtistImages() { // public final boolean downloadMissingArtistImages() {
// return mPreferences.getBoolean(DOWNLOAD_MISSING_ARTIST_IMAGES, true); // return mPreferences.getBoolean(DOWNLOAD_MISSING_ARTIST_IMAGES, true);
// } // }
// //
// public void setDownloadMissingArtistImages(final boolean value) {
// private void setSortOrder(final String key, final String value) {
// final SharedPreferences.Editor editor = mPreferences.edit(); // final SharedPreferences.Editor editor = mPreferences.edit();
// editor.putBoolean(DOWNLOAD_MISSING_ARTIST_IMAGES, value); // editor.putString(key, value);
// editor.apply(); // editor.apply();
// } // }
private void setSortOrder(final String key, final String value) {
final SharedPreferences.Editor editor = mPreferences.edit();
editor.putString(key, value);
editor.apply();
}
// public void setArtistSortOrder(final String value) { // public void setArtistSortOrder(final String value) {
// setSortOrder(ARTIST_SORT_ORDER, value); // setSortOrder(ARTIST_SORT_ORDER, value);
// } // }

View file

@ -34,12 +34,12 @@ public class Util {
// return resId; // return resId;
// } // }
// public static int resolveColor(Context context, int color) { public static int resolveColor(Context context, int color) {
// TypedArray a = context.obtainStyledAttributes(new int[]{color}); TypedArray a = context.obtainStyledAttributes(new int[]{color});
// int resId = a.getColor(0, 0); int resId = a.getColor(0, 0);
// a.recycle(); a.recycle();
// return resId; return resId;
// } }
// public static boolean isWindowTranslucent(Context context) { // public static boolean isWindowTranslucent(Context context) {
// TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.windowTranslucentStatus}); // TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.windowTranslucentStatus});

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout
android:fitsSystemWindows="true"
android:orientation="vertical" android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -90,12 +90,18 @@
<string name="pref_title_general_theme">General theme</string> <string name="pref_title_general_theme">General theme</string>
<string name="pref_header_audio">Audio</string> <string name="pref_header_audio">Audio</string>
<string name="pref_header_general">General</string> <string name="pref_header_general">General</string>
<string name="pref_summary_navigation_bar">Set where the navigation bar should be colored</string>
<string name="pref_title_navigation_bar">Colored navigation bar</string>
<string name="pref_title_set_default_start_page">Set default start page</string> <string name="pref_title_set_default_start_page">Set default start page</string>
<string name="title_activity_settings">Settings</string> <string name="title_activity_settings">Settings</string>
<string name="pref_title_transparent_toolbar">Semi-Transparent toolbar</string> <string name="pref_title_transparent_toolbar">Semi-Transparent toolbar</string>
<string name="pref_title_show_playback_controller_card">Playback controller card</string> <string name="pref_title_show_playback_controller_card">Playback controller card</string>
<string name="pref_title_colored_navigation_bar_artists">Colored navigation bar artist view</string> <string name="pref_title_colored_navigation_bar_artists">Artist view</string>
<string name="pref_title_colored_navigation_bar_albums">Colored navigation bar album view</string> <string name="pref_title_colored_navigation_bar_albums">Album view</string>
<string name="pref_title_colored_navigation_bar_current_playing">Current playing view</string>
<string name="pref_title_colored_navigation_bar_playlists">Playlist view</string>
<string name="pref_title_colored_navigation_bar_tag_editor">Tag editor</string>
<string name="pref_title_colored_navigation_bar_other_screens">Everywhere else</string>
<string name="pref_title_colored_album_footers">Colored album footers</string> <string name="pref_title_colored_album_footers">Colored album footers</string>
<string name="no_equalizer">No equalizer found</string> <string name="no_equalizer">No equalizer found</string>
<string name="no_audio_id">No audio id, play something and try again.</string> <string name="no_audio_id">No audio id, play something and try again.</string>

View file

@ -25,4 +25,22 @@
<item>1</item> <item>1</item>
</string-array> </string-array>
<string-array name="pref_navigation_bar_color_titles">
<item>@string/pref_title_colored_navigation_bar_albums</item>
<item>@string/pref_title_colored_navigation_bar_artists</item>
<item>@string/pref_title_colored_navigation_bar_playlists</item>
<item>@string/pref_title_colored_navigation_bar_current_playing</item>
<item>@string/pref_title_colored_navigation_bar_tag_editor</item>
<item>@string/pref_title_colored_navigation_bar_other_screens</item>
</string-array>
<string-array name="pref_navigation_bar_color_values">
<item>colored_navigation_bar_album</item>
<item>colored_navigation_bar_artist</item>
<item>colored_navigation_bar_playlist</item>
<item>colored_navigation_bar_current_playing</item>
<item>colored_navigation_bar_tag_editor</item>
<item>colored_navigation_bar_other_screens</item>
</string-array>
</resources> </resources>

View file

@ -36,20 +36,6 @@
android:layout="@layout/preference_custom" android:layout="@layout/preference_custom"
android:widgetLayout="@layout/preference_dynamiccheckbox" /> android:widgetLayout="@layout/preference_dynamiccheckbox" />
<CheckBoxPreference
android:defaultValue="true"
android:key="colored_navigation_bar_artist"
android:title="@string/pref_title_colored_navigation_bar_artists"
android:layout="@layout/preference_custom"
android:widgetLayout="@layout/preference_dynamiccheckbox" />
<CheckBoxPreference
android:defaultValue="true"
android:key="colored_navigation_bar_album"
android:title="@string/pref_title_colored_navigation_bar_albums"
android:layout="@layout/preference_custom"
android:widgetLayout="@layout/preference_dynamiccheckbox" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
android:key="colored_album_footers" android:key="colored_album_footers"
@ -57,6 +43,14 @@
android:layout="@layout/preference_custom" android:layout="@layout/preference_custom"
android:widgetLayout="@layout/preference_dynamiccheckbox" /> android:widgetLayout="@layout/preference_dynamiccheckbox" />
<com.afollestad.materialdialogs.prefs.MaterialMultiSelectListPreference
android:key="colored_navigation_bar"
android:entries="@array/pref_navigation_bar_color_titles"
android:entryValues="@array/pref_navigation_bar_color_values"
android:title="@string/pref_title_navigation_bar"
android:summary="@string/pref_summary_navigation_bar"
android:layout="@layout/preference_custom" />
</com.kabouzeid.gramophone.prefs.DynamicPreferenceCategory> </com.kabouzeid.gramophone.prefs.DynamicPreferenceCategory>
</PreferenceScreen> </PreferenceScreen>