plectrum

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

commit 73c2fe2c7ad66b7dc578bdb797f91f2f77963b7c
parent 1b35f14a206f4e1843e152a16bfb62be3397d988
Author: gstraube <gstraube@mailbox.org>
Date:   Sun,  7 Jan 2018 19:12:53 +0100

Keep user selection of notation (issue #9)

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

Diffstat:
Mapp/src/main/java/com/github/cythara/MainActivity.java | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/app/src/main/java/com/github/cythara/MainActivity.java b/app/src/main/java/com/github/cythara/MainActivity.java @@ -33,8 +33,9 @@ public class MainActivity extends AppCompatActivity implements ListenerFragment. public static final int RECORD_AUDIO_PERMISSION = 0; public static final String PREFS_FILE = "prefs_file"; - private static final String TAG_LISTENER_FRAGMENT = "listener_fragment"; 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 @@ -70,8 +71,11 @@ public class MainActivity extends AppCompatActivity implements ListenerFragment. } private void setNotation() { - if (!useStandardNotation()) { - SharedPreferences preferences = getSharedPreferences(PREFS_FILE, MODE_PRIVATE); + 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); @@ -138,8 +142,10 @@ 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(); } });