plectrum

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 52081c99ea798b40380417cd6b87d830a022df1e
parent 73c2fe2c7ad66b7dc578bdb797f91f2f77963b7c
Author: gstraube <gstraube@mailbox.org>
Date:   Mon,  8 Jan 2018 16:43:20 +0100

Remove automatic selection of notation (issue #9)

Signed-off-by: gstraube <gstraube@mailbox.org>

Diffstat:
Dapp/src/main/java/com/github/cythara/Language.java | 34----------------------------------
Mapp/src/main/java/com/github/cythara/MainActivity.java | 47-----------------------------------------------
2 files changed, 0 insertions(+), 81 deletions(-)

diff --git a/app/src/main/java/com/github/cythara/Language.java b/app/src/main/java/com/github/cythara/Language.java @@ -1,34 +0,0 @@ -package com.github.cythara; - -public enum Language { - - FRENCH("fr"), - ITALIAN("it"), - SPANISH("es"), - ROMANIAN("ro"), - PORTUGUESE("pt"), - BOSNIAN("bs"), - CROATIAN("hr"), - SERBO_CROATIAN("sh"), - SERBIAN("sr"), - RUSSIAN("ru"), - UKRAINIAN("uk"), - BULGARIAN("bg"), - GREEK("el"), - ALBANIAN("sq"), - MACEDONIAN("mk"), - MONGOLIAN("mn"), - PERSIAN("fa"), - TURKISH("tr"), - HEBREW("he"); - - private String code; - - Language(String code) { - this.code = code; - } - - public String getCode() { - return code; - } -} diff --git a/app/src/main/java/com/github/cythara/MainActivity.java b/app/src/main/java/com/github/cythara/MainActivity.java @@ -23,8 +23,6 @@ import android.widget.ArrayAdapter; import com.github.cythara.tuning.GuitarTuning; import com.jaredrummler.materialspinner.MaterialSpinner; -import java.util.Locale; - import static android.widget.ArrayAdapter.createFromResource; import static com.github.cythara.TuningMapper.getTuningFromPosition; @@ -35,7 +33,6 @@ public class MainActivity extends AppCompatActivity implements ListenerFragment. public static final String PREFS_FILE = "prefs_file"; public static final String USE_STANDARD_NOTATION = "useStandardNotation"; private static final String TAG_LISTENER_FRAGMENT = "listener_fragment"; - private static final String NOTATION_MANUALLY_CHOSEN = "notationManuallyChosen"; static Tuning tuning = new GuitarTuning(); @Override @@ -50,8 +47,6 @@ public class MainActivity extends AppCompatActivity implements ListenerFragment. startRecording(); } - setNotation(); - super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); @@ -70,46 +65,6 @@ public class MainActivity extends AppCompatActivity implements ListenerFragment. setSupportActionBar(myToolbar); } - private void setNotation() { - SharedPreferences preferences = getSharedPreferences(PREFS_FILE, MODE_PRIVATE); - - boolean notationManuallyChosen = preferences.getBoolean(NOTATION_MANUALLY_CHOSEN, false); - - if (!notationManuallyChosen && !useStandardNotation()) { - SharedPreferences.Editor editor = preferences.edit(); - editor.putBoolean(USE_STANDARD_NOTATION, false); - - editor.apply(); - } - } - - private boolean useStandardNotation() { - Locale locale = Locale.getDefault(); - - Locale[] locales = {Locale.FRENCH, Locale.CANADA_FRENCH, Locale.FRANCE, - Locale.ITALIAN, Locale.ITALY}; - - if (locale != null) { - for (Locale predefinedLocale : locales) { - if (locale == predefinedLocale) { - return false; - } - } - } - - if (locale != null && locale.getLanguage() != null) { - String deviceLanguage = locale.getLanguage(); - - for (Language language : Language.values()) { - if (language.getCode().equals(deviceLanguage)) { - return false; - } - } - } - - return true; - } - @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.toolbar_menu, menu); @@ -142,10 +97,8 @@ public class MainActivity extends AppCompatActivity implements ListenerFragment. public void onClick(DialogInterface dialog, int which) { SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean(USE_STANDARD_NOTATION, which == 0); - editor.putBoolean(NOTATION_MANUALLY_CHOSEN, true); editor.apply(); - dialog.dismiss(); } });