Skip to content

Commit

Permalink
Not show options menu when no selected record
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimowner committed Aug 17, 2019
1 parent 8178981 commit f52cb28
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,16 @@ public void hideImportProgress() {
btnImport.setVisibility(View.VISIBLE);
}

@Override
public void showOptionsMenu() {
btnShare.setVisibility(View.VISIBLE);
}

@Override
public void hideOptionsMenu() {
btnShare.setVisibility(View.INVISIBLE);
}

@Override
public void showRecordProcessing() {
pnlRecordProcessing.setVisibility(View.VISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ interface View extends Contract.View {
void showImportStart();
void hideImportProgress();

void showOptionsMenu();
void hideOptionsMenu();

void showRecordProcessing();
void hideRecordProcessing();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ public void bindView(final MainContract.View v) {
view.hideImportProgress();
}

if (!prefs.hasAskToRenameAfterStopRecordingSetting()) {
prefs.setAskToRenameAfterStopRecording(true);
}

if (appRecorder.isRecording()) {
view.showRecordingStart();
view.keepScreenOn(prefs.isKeepScreenOn());
Expand Down Expand Up @@ -441,6 +445,7 @@ public void run() {
view.showWaveForm(record.getAmps(), songDuration);
view.showName(FileUtil.removeFileExtension(record.getName()));
view.showDuration(TimeUtils.formatTimeIntervalHourMinSec2(songDuration / 1000));
view.showOptionsMenu();
view.hideProgress();
}
}
Expand Down Expand Up @@ -482,6 +487,7 @@ public void run() {
view.showName("");
view.showDuration(TimeUtils.formatTimeIntervalHourMinSec2(0));
view.hideProgress();
view.hideOptionsMenu();
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public interface Prefs {
void setStoreDirPublic(boolean b);

boolean isAskToRenameAfterStopRecording();
boolean hasAskToRenameAfterStopRecordingSetting();
void setAskToRenameAfterStopRecording(boolean b);

long getActiveRecord();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public void firstRunExecuted() {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(PREF_KEY_IS_FIRST_RUN, false);
editor.putBoolean(PREF_KEY_IS_STORE_DIR_PUBLIC, true);
editor.putBoolean(PREF_KEY_IS_ASK_TO_RENAME_AFTER_STOP_RECORDING, true);
editor.apply();
// setStoreDirPublic(true);
}
Expand All @@ -94,6 +93,11 @@ public boolean isAskToRenameAfterStopRecording() {
return sharedPreferences.contains(PREF_KEY_IS_ASK_TO_RENAME_AFTER_STOP_RECORDING) && sharedPreferences.getBoolean(PREF_KEY_IS_ASK_TO_RENAME_AFTER_STOP_RECORDING, true);
}

@Override
public boolean hasAskToRenameAfterStopRecordingSetting() {
return sharedPreferences.contains(PREF_KEY_IS_ASK_TO_RENAME_AFTER_STOP_RECORDING);
}

@Override
public void setAskToRenameAfterStopRecording(boolean b) {
SharedPreferences.Editor editor = sharedPreferences.edit();
Expand Down

0 comments on commit f52cb28

Please sign in to comment.