update some strings in the settings

This commit is contained in:
dkanada 2020-04-29 17:05:10 +09:00
commit 248dabfa92
6 changed files with 38 additions and 106 deletions

View file

@ -22,7 +22,7 @@ import com.kabouzeid.gramophone.util.PreferenceUtil;
public final class AppShortcutIconGenerator {
public static Icon generateThemedIcon(Context context, int iconId) {
if (PreferenceUtil.getInstance(context).getColoredAppShortcuts()) {
if (PreferenceUtil.getInstance(context).getColoredShortcuts()) {
return generateUserThemedIcon(context, iconId).toIcon();
} else {
return generateDefaultThemedIcon(context, iconId).toIcon();

View file

@ -122,7 +122,6 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
addPreferencesFromResource(R.xml.pref_now_playing_screen);
addPreferencesFromResource(R.xml.pref_lockscreen);
addPreferencesFromResource(R.xml.pref_audio);
addPreferencesFromResource(R.xml.pref_playlists);
}
@Nullable
@ -236,10 +235,10 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) {
colorAppShortcuts.setVisible(false);
} else {
colorAppShortcuts.setChecked(PreferenceUtil.getInstance(getActivity()).getColoredAppShortcuts());
colorAppShortcuts.setChecked(PreferenceUtil.getInstance(getActivity()).getColoredShortcuts());
colorAppShortcuts.setOnPreferenceChangeListener((preference, newValue) -> {
// Save preference
PreferenceUtil.getInstance(getActivity()).setColoredAppShortcuts((Boolean) newValue);
PreferenceUtil.getInstance(getActivity()).setColoredShortcuts((Boolean) newValue);
// Update app shortcuts
new DynamicShortcutManager(getActivity()).updateDynamicShortcuts();

View file

@ -51,14 +51,12 @@ public final class PreferenceUtil {
public static final String CLASSIC_NOTIFICATION = "classic_notification";
public static final String GENERAL_THEME = "general_theme";
public static final String COLORED_APP_SHORTCUTS = "colored_app_shortcuts";
public static final String COLORED_SHORTCUTS = "colored_shortcuts";
public static final String AUDIO_DUCKING = "audio_ducking";
public static final String GAPLESS_PLAYBACK = "gapless_playback";
public static final String REMEMBER_SHUFFLE = "remember_shuffle";
public static final String LAST_ADDED_CUTOFF = "last_added_interval";
public static final String SHOW_ALBUM_COVER = "show_album_cover";
public static final String BLUR_ALBUM_COVER = "blur_album_cover";
@ -157,22 +155,26 @@ public final class PreferenceUtil {
editor.apply();
}
public final boolean getColoredAppShortcuts() {
return mPreferences.getBoolean(COLORED_APP_SHORTCUTS, true);
public final boolean getColoredShortcuts() {
return mPreferences.getBoolean(COLORED_SHORTCUTS, true);
}
public void setColoredAppShortcuts(final boolean value) {
public void setColoredShortcuts(final boolean value) {
final SharedPreferences.Editor editor = mPreferences.edit();
editor.putBoolean(COLORED_APP_SHORTCUTS, value);
editor.putBoolean(COLORED_SHORTCUTS, value);
editor.apply();
}
public final boolean getAudioDucking() {
return mPreferences.getBoolean(AUDIO_DUCKING, true);
}
public final boolean getGaplessPlayback() {
return mPreferences.getBoolean(GAPLESS_PLAYBACK, true);
}
public final boolean getAudioDucking() {
return mPreferences.getBoolean(AUDIO_DUCKING, true);
public final boolean getRememberShuffle() {
return mPreferences.getBoolean(REMEMBER_SHUFFLE, true);
}
public final boolean getShowAlbumCover() {
@ -229,34 +231,6 @@ public final class PreferenceUtil {
return mPreferences.getString(GENRE_SORT_ORDER, SortOrder.GenreSortOrder.GENRE_A_Z);
}
public long getLastAddedCutoff() {
final CalendarUtil calendarUtil = new CalendarUtil();
long interval;
switch (mPreferences.getString(LAST_ADDED_CUTOFF, "")) {
case "today":
interval = calendarUtil.getElapsedToday();
break;
case "this_week":
interval = calendarUtil.getElapsedWeek();
break;
case "past_seven_days":
interval = calendarUtil.getElapsedDays(7);
break;
case "past_three_months":
interval = calendarUtil.getElapsedMonths(3);
break;
case "this_year":
interval = calendarUtil.getElapsedYear();
break;
case "this_month":
default:
interval = calendarUtil.getElapsedMonth();
break;
}
return (System.currentTimeMillis() - interval) / 1000;
}
public int getLastSleepTimerValue() {
return mPreferences.getInt(LAST_SLEEP_TIMER_VALUE, 30);
}
@ -387,20 +361,6 @@ public final class PreferenceUtil {
editor.apply();
}
public final boolean getRememberShuffle() {
return mPreferences.getBoolean(REMEMBER_SHUFFLE, true);
}
public void setLibraryCategories(List<CategoryInfo> categories) {
Gson gson = new Gson();
Type collectionType = new TypeToken<List<CategoryInfo>>() {
}.getType();
final SharedPreferences.Editor editor = mPreferences.edit();
editor.putString(LIBRARY_CATEGORIES, gson.toJson(categories, collectionType));
editor.apply();
}
public List<CategoryInfo> getLibraryCategories() {
String data = mPreferences.getString(LIBRARY_CATEGORIES, null);
if (data != null) {
@ -418,6 +378,15 @@ public final class PreferenceUtil {
return getDefaultLibraryCategories();
}
public void setLibraryCategories(List<CategoryInfo> categories) {
Gson gson = new Gson();
Type collectionType = new TypeToken<List<CategoryInfo>>() {}.getType();
final SharedPreferences.Editor editor = mPreferences.edit();
editor.putString(LIBRARY_CATEGORIES, gson.toJson(categories, collectionType));
editor.apply();
}
public List<CategoryInfo> getDefaultLibraryCategories() {
List<CategoryInfo> defaultCategories = new ArrayList<>(5);
defaultCategories.add(new CategoryInfo(CategoryInfo.Category.SONGS, true));

View file

@ -12,22 +12,4 @@
<item>black</item>
</string-array>
<string-array name="pref_playlists_last_added_interval_titles">
<item>@string/today</item>
<item>@string/this_week</item>
<item>@string/past_seven_days</item>
<item>@string/this_month</item>
<item>@string/past_three_months</item>
<item>@string/this_year</item>
</string-array>
<string-array name="pref_playlists_last_added_interval_values">
<item>today</item>
<item>this_week</item>
<item>past_seven_days</item>
<item>this_month</item>
<item>past_three_months</item>
<item>this_year</item>
</string-array>
</resources>

View file

@ -87,7 +87,7 @@
<string name="this_year">This year</string>
<string name="equalizer">Equalizer</string>
<string name="pref_header_colors">Colors</string>
<string name="pref_header_now_playing_screen">Now playing</string>
<string name="pref_header_now_playing_screen">Now Playing</string>
<string name="pref_title_general_theme">General theme</string>
<string name="pref_header_audio">Audio</string>
<string name="pref_header_library">Library</string>
@ -125,16 +125,16 @@
<string name="empty">Empty</string>
<string name="playlist_name_empty">Playlist name</string>
<string name="song">Song</string>
<string name="pref_summary_album_art_on_lockscreen">Uses the current songs album cover as lockscreen wallpaper.</string>
<string name="pref_summary_blurred_album_art">Blurs the album cover on the lockscreen. Can cause problems with third party apps and widgets.</string>
<string name="pref_summary_album_art_on_lockscreen">Uses the current song\'s album cover as the lockscreen wallpaper.</string>
<string name="pref_summary_blurred_album_art">Blurs the album cover on the lockscreen. This can cause problems with third party apps and widgets.</string>
<string name="pref_summary_classic_notification">Use the classic notification design.</string>
<string name="pref_summary_colored_notification">"Colors the notification in the album cover\u2019s vibrant color."</string>
<string name="pref_summary_gapless_playback">"Can cause playback issues on some devices."</string>
<string name="pref_summary_colored_notification">"Colors the notification with a vibrant color taken from the album cover."</string>
<string name="pref_summary_audio_ducking">Decrease the volume for notifications and other system sounds.</string>
<string name="pref_summary_gapless_playback">"This can cause playback issues on some devices."</string>
<string name="pref_summary_remember_shuffle">Shuffle mode will stay on when selecting a new list of songs for the queue.</string>
<string name="pref_summary_colored_navigation_bar">Colors the navigation bar in the primary color.</string>
<string name="pref_summary_colored_app_shortcuts">Colors the app shortcuts in the primary color.</string>
<string name="pref_summary_audio_ducking">Notifications, navigation etc.</string>
<string name="pref_summary_remember_last_tab">Go to the last opened tab on launch</string>
<string name="pref_summary_remember_shuffle">Shuffle mode will stay on when selecting a new list of songs</string>
<string name="pref_summary_remember_last_tab">Go to the last opened tab on launch.</string>
<string name="favorites">Favorites</string>
<string name="last_added">Last added</string>
<string name="history">Recently played</string>
@ -166,17 +166,17 @@
<string name="follow_on_twitter">Follow on Twitter</string>
<string name="visit_website">Visit website</string>
<string name="report_bugs">Report bugs</string>
<string name="report_bugs_summary">Report bugs or request new features.</string>
<string name="report_bugs_summary">Open a new issue for bugs or features.</string>
<string name="translate">Translate</string>
<string name="translate_summary">Help translating Phonograph to your native language.</string>
<string name="translate_summary">Help translate strings to your native language.</string>
<string name="rate_on_google_play">Rate</string>
<string name="rate_on_google_play_summary">Leave a positive rating on Google Play if you like Phonograph.</string>
<string name="donate">Donate</string>
<string name="donate_summary">If you think I deserve to get paid for my work, you can leave me a few dollars here.</string>
<string name="aidan_follestad_summary">For the theme engine and some other great stuff.</string>
<string name="aidan_follestad_summary">Improved theme engine and made some other excellent additions.</string>
<string name="michael_cook_summary">For the pretty material app icon.</string>
<string name="maarten_corpel_summary">For making the Play Store illustration and the empty album cover.</string>
<string name="aleksandar_tesic_summary">For helping me with the design.</string>
<string name="maarten_corpel_summary">Designed a placeholder image for albums with no cover art.</string>
<string name="aleksandar_tesic_summary">Made great improvements to the general design.</string>
<string name="website">Website</string>
<string name="loading_products">Loading products…</string>
<string name="up_next">Up next</string>
@ -201,8 +201,8 @@
<string name="playlist_is_empty">Playlist is empty</string>
<string name="playing_notification_description">The playing notification provides actions for play/pause etc.</string>
<string name="playing_notification_name">Playing notification</string>
<string name="eugene_cheung_summary">For his contributions to the source code.</string>
<string name="adrian_summary">For creating the album page design.</string>
<string name="eugene_cheung_summary">Several amazing contributions to the source code.</string>
<string name="adrian_summary">Designed the new album page which was then ported to other activities.</string>
<string name="add_action">Add</string>
<string name="library_categories">Library categories</string>
<string name="pref_summary_library_categories">Configure visibility and order of library categories.</string>

View file

@ -1,18 +0,0 @@
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<com.kabouzeid.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory android:title="@string/pref_header_playlists">
<com.kabouzeid.appthemehelper.common.prefs.supportv7.ATEListPreference
app:iconSpaceReserved="false"
android:defaultValue="this_month"
android:entries="@array/pref_playlists_last_added_interval_titles"
android:entryValues="@array/pref_playlists_last_added_interval_values"
android:key="last_added_interval"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:title="@string/pref_title_last_added_interval" />
</com.kabouzeid.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
</androidx.preference.PreferenceScreen>