Skip to content
This repository has been archived by the owner on Jan 28, 2024. It is now read-only.

Commit

Permalink
Refactor names
Browse files Browse the repository at this point in the history
Signed-off-by: gstraube <[email protected]>
  • Loading branch information
gstraube committed Jan 8, 2018
1 parent 7e25e4b commit fec1f0f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/com/github/cythara/CanvasPainter.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ private void drawText() {
private String getNote(NoteName name) {
SharedPreferences preferences = context.getSharedPreferences(PREFS_FILE, MODE_PRIVATE);

boolean useStandardNotation = preferences.getBoolean(USE_STANDARD_NOTATION, true);
boolean useScientificNotation = preferences.getBoolean(USE_SCIENTIFIC_NOTATION, true);

if (useStandardNotation) {
return name.getStandard();
if (useScientificNotation) {
return name.getScientific();
}

return name.getSol();
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/com/github/cythara/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class MainActivity extends AppCompatActivity implements ListenerFragment.

public static final int RECORD_AUDIO_PERMISSION = 0;
public static final String PREFS_FILE = "prefs_file";
public static final String USE_STANDARD_NOTATION = "useStandardNotation";
public static final String USE_SCIENTIFIC_NOTATION = "use_scientific_notation";
private static final String TAG_LISTENER_FRAGMENT = "listener_fragment";
static Tuning tuning = new GuitarTuning();

Expand Down Expand Up @@ -84,10 +84,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.set_notation: {
final SharedPreferences preferences = getSharedPreferences(PREFS_FILE,
MODE_PRIVATE);
final boolean useStandardNotation = preferences.getBoolean(USE_STANDARD_NOTATION,
final boolean useScientificNotation = preferences.getBoolean(USE_SCIENTIFIC_NOTATION,
true);

int checkedItem = useStandardNotation ? 0 : 1;
int checkedItem = useScientificNotation ? 0 : 1;

AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.choose_notation);
Expand All @@ -96,7 +96,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
public void onClick(DialogInterface dialog, int which) {
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean(USE_STANDARD_NOTATION, which == 0);
editor.putBoolean(USE_SCIENTIFIC_NOTATION, which == 0);
editor.apply();

dialog.dismiss();
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/github/cythara/NoteName.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ public enum NoteName {
A("A", "La"),
B("B", "Si");

private final String standard;
private final String scientific;
private final String sol;

NoteName(String standard, String sol) {
this.standard = standard;
NoteName(String scientific, String sol) {
this.scientific = scientific;
this.sol = sol;
}

public String getStandard() {
return standard;
public String getScientific() {
return scientific;
}

public String getSol() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<item>Chromatic</item>
</string-array>
<string-array name="notations">
<item name="standard">Standard</item>
<item name="scientific">Scientific pitch notation</item>
<item name="sol">Solfège</item>
</string-array>
</resources>

0 comments on commit fec1f0f

Please sign in to comment.