[Android] Extract string for new equalizer preset

Geoffrey Métais git at videolan.org
Thu Sep 28 10:53:35 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Sep 28 10:49:38 2017 +0200| [005d71b5d1b09e428b6fde0c9d84a6ee6e78e689] | committer: Geoffrey Métais

Extract string for new equalizer preset

> https://code.videolan.org/videolan/vlc-android/commit/005d71b5d1b09e428b6fde0c9d84a6ee6e78e689
---

 vlc-android/res/values/strings.xml                                | 1 +
 vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index c2fe0c957..da54ec469 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -563,4 +563,5 @@
     <string name="custom_set_already_exist">Equalizer-set with this name already exists</string>
     <string name="custom_set_restored">Custom equalizer-set restored.</string>
     <string name="unsaved_set_deleted_message">Unsaved equalizer-set deleted.</string>
+    <string name="equalizer_new_preset_name">New</string>
 </resources>
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java
index 925ad6505..dbe27b277 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java
@@ -78,6 +78,7 @@ public class EqualizerFragment extends AppCompatDialogFragment implements Playba
     private boolean updateAlreadyHandled = false;
     private EqualizerBinding binding;
     final private EqualizerState mState = new EqualizerState();
+    private final String newPresetName = VLCApplication.getAppResources().getString(R.string.equalizer_new_preset_name);
 
     private final static int TYPE_PRESET = 0;
     private final static int TYPE_CUSTOM = 1;
@@ -129,7 +130,7 @@ public class EqualizerFragment extends AppCompatDialogFragment implements Playba
                 customCount++;
             }
         }
-        allSets.add("new");
+        allSets.add(newPresetName);
 
         mEqualizer = VLCOptions.getEqualizerSetFromSettings(context);
 
@@ -376,8 +377,8 @@ public class EqualizerFragment extends AppCompatDialogFragment implements Playba
                 positiveButton.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View view) {
-                        String newName = input.getText().toString();
-                        if (newName.contains("_") || TextUtils.equals(newName,"new")) {
+                        final String newName = input.getText().toString();
+                        if (newName.contains("_") || TextUtils.equals(newName, newPresetName)) {
                             Toast.makeText(VLCApplication.getAppContext(), VLCApplication.getAppContext().getResources().getString(R.string.custom_set_wrong_input), Toast.LENGTH_SHORT).show();
                         } else if (allSets.contains(newName) && !TextUtils.equals(newName,oldName)) {
                             Toast.makeText(VLCApplication.getAppContext(), VLCApplication.getAppContext().getResources().getString(R.string.custom_set_already_exist), Toast.LENGTH_SHORT).show();



More information about the Android mailing list