From c5fa809fee7816776b71725a5923946f74c8cb5c Mon Sep 17 00:00:00 2001 From: Patrik Date: Wed, 27 Jul 2022 22:52:31 +0200 Subject: Made showing suffixes optional --- app/src/main/java/github/daneren2005/dsub/util/Constants.java | 1 + app/src/main/java/github/daneren2005/dsub/util/Util.java | 5 +++++ app/src/main/java/github/daneren2005/dsub/view/SongView.java | 4 +++- app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/settings_appearance.xml | 7 +++++++ 5 files changed, 18 insertions(+), 1 deletion(-) (limited to 'app') 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 0ce58d73..91e3e37c 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/Constants.java +++ b/app/src/main/java/github/daneren2005/dsub/util/Constants.java @@ -93,6 +93,7 @@ public final class Constants { public static final String PREFERENCES_KEY_THEME = "theme"; public static final String PREFERENCES_KEY_FULL_SCREEN = "fullScreen"; public static final String PREFERENCES_KEY_DISPLAY_TRACK = "displayTrack"; + public static final String PREFERENCES_KEY_DISPLAY_FILE_SUFFIX = "displayFileSuffix"; public static final String PREFERENCES_KEY_MAX_BITRATE_WIFI = "maxBitrateWifi"; public static final String PREFERENCES_KEY_MAX_BITRATE_MOBILE = "maxBitrateMobile"; public static final String PREFERENCES_KEY_MAX_VIDEO_BITRATE_WIFI = "maxVideoBitrateWifi"; 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 1aa17c35..7989e8c9 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/Util.java +++ b/app/src/main/java/github/daneren2005/dsub/util/Util.java @@ -277,6 +277,11 @@ public final class Util { return prefs.getBoolean(Constants.PREFERENCES_KEY_DISPLAY_TRACK, true); } + public static boolean getDisplayFileSuffix(Context context) { + SharedPreferences prefs = getPreferences(context); + return prefs.getBoolean(Constants.PREFERENCES_KEY_DISPLAY_FILE_SUFFIX, true); + } + public static int getMaxBitrate(Context context) { ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = manager.getActiveNetworkInfo(); diff --git a/app/src/main/java/github/daneren2005/dsub/view/SongView.java b/app/src/main/java/github/daneren2005/dsub/view/SongView.java index 7a91ea6e..5ef06880 100644 --- a/app/src/main/java/github/daneren2005/dsub/view/SongView.java +++ b/app/src/main/java/github/daneren2005/dsub/view/SongView.java @@ -177,7 +177,9 @@ public class SongView extends UpdateView2 { titleTextView.setText(title); artistTextView.setText(artist); - suffixTextView.setText(song.getSuffix()); + if(Util.getDisplayFileSuffix(context)) { + suffixTextView.setText(song.getSuffix()); + } this.setBackgroundColor(0x00000000); ratingBar.setVisibility(View.GONE); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 87ebbe07..ea2b4f1a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -315,6 +315,8 @@ Hide as many UI elements as Android will allow Display Track # Display Track # in front of songs if one exists + Display file suffix + Display the suffix for your tracks Sort By Year Sort albums by year, or by alphabetical Open To Tab diff --git a/app/src/main/res/xml/settings_appearance.xml b/app/src/main/res/xml/settings_appearance.xml index 530d92a1..a0c2ac26 100644 --- a/app/src/main/res/xml/settings_appearance.xml +++ b/app/src/main/res/xml/settings_appearance.xml @@ -35,6 +35,13 @@ android:key="displayTrack" android:defaultValue="true"/> + + +