Skip to content

Commit 903425e

Browse files
committed
implement enabling Autosave from the dialog
1 parent 397fe8d commit 903425e

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

app/src/main/java/com/simplemobiletools/notes/activities/MainActivity.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import android.view.inputmethod.InputMethodManager;
1515
import android.widget.EditText;
1616

17-
import com.simplemobiletools.notes.Config;
1817
import com.simplemobiletools.notes.Constants;
1918
import com.simplemobiletools.notes.MyWidgetProvider;
2019
import com.simplemobiletools.notes.R;
@@ -47,7 +46,7 @@ protected void onResume() {
4746
@Override
4847
protected void onPause() {
4948
super.onPause();
50-
if (Config.newInstance(getApplicationContext()).getIsAutosaveEnabled()) {
49+
if (mConfig.getIsAutosaveEnabled()) {
5150
saveText(false);
5251
}
5352
}
@@ -65,13 +64,13 @@ public void onBackPressed() {
6564
@Override
6665
protected void onDestroy() {
6766
super.onDestroy();
68-
Config.newInstance(getApplicationContext()).setIsFirstRun(false);
67+
mConfig.setIsFirstRun(false);
6968
}
7069

7170
@Override
7271
public boolean onCreateOptionsMenu(Menu menu) {
7372
getMenuInflater().inflate(R.menu.menu, menu);
74-
if (Config.newInstance(getApplicationContext()).getIsAutosaveEnabled())
73+
if (mConfig.getIsAutosaveEnabled())
7574
menu.findItem(R.id.save).setVisible(false);
7675

7776
return true;
@@ -106,7 +105,8 @@ private void displayAutosavePrompt() {
106105
alertDialog.setPositiveButton(R.string.enable_autosave, new DialogInterface.OnClickListener() {
107106
@Override
108107
public void onClick(DialogInterface dialog, int which) {
109-
108+
mConfig.setIsAutosaveEnabled(true);
109+
supportInvalidateOptionsMenu();
110110
}
111111
});
112112
alertDialog.create().show();

app/src/main/res/layout/activity_main.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
android:layout_height="wrap_content"
1212
android:background="@null"
1313
android:gravity="top"
14-
android:padding="@dimen/activity_margin"/>
14+
android:padding="@dimen/activity_margin"
15+
android:textSize="@dimen/normal_text_size"/>
1516

1617
</ScrollView>

app/src/main/res/values-it/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<string name="enable_autosave">Enable autosave</string>
1111
<string name="cancel">Cancel</string>
1212
<string name="unsaved_changes">Unsaved changes</string>
13-
<string name="autosave_prompt_msg">Changes made to the note have not be saved. Do you want to enable autosave?</string>
13+
<string name="autosave_prompt_msg">Changes made to the note have not been saved. Do you want to enable autosave?</string>
1414

1515
<!-- Settings -->
1616
<string name="settings">Impostazioni</string>

app/src/main/res/values-ja/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<string name="enable_autosave">Enable autosave</string>
1111
<string name="cancel">Cancel</string>
1212
<string name="unsaved_changes">Unsaved changes</string>
13-
<string name="autosave_prompt_msg">Changes made to the note have not be saved. Do you want to enable autosave?</string>
13+
<string name="autosave_prompt_msg">Changes made to the note have not been saved. Do you want to enable autosave?</string>
1414

1515
<!-- Settings -->
1616
<string name="settings">設定</string>

app/src/main/res/values-sv/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<string name="enable_autosave">Enable autosave</string>
1111
<string name="cancel">Cancel</string>
1212
<string name="unsaved_changes">Unsaved changes</string>
13-
<string name="autosave_prompt_msg">Changes made to the note have not be saved. Do you want to enable autosave?</string>
13+
<string name="autosave_prompt_msg">Changes made to the note have not been saved. Do you want to enable autosave?</string>
1414

1515
<!-- Settings -->
1616
<string name="settings">Inställningar</string>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<string name="enable_autosave">Enable autosave</string>
1111
<string name="cancel">Cancel</string>
1212
<string name="unsaved_changes">Unsaved changes</string>
13-
<string name="autosave_prompt_msg">Changes made to the note have not be saved. Do you want to enable autosave?</string>
13+
<string name="autosave_prompt_msg">Changes made to the note have not been saved. Do you want to enable autosave?</string>
1414

1515
<!-- Settings -->
1616
<string name="settings">Settings</string>

0 commit comments

Comments
 (0)