mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-01-31 22:44:51 +01:00
implement enabling Autosave from the dialog
This commit is contained in:
parent
397fe8d47c
commit
903425e40a
@ -14,7 +14,6 @@ import android.view.MenuItem;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.simplemobiletools.notes.Config;
|
||||
import com.simplemobiletools.notes.Constants;
|
||||
import com.simplemobiletools.notes.MyWidgetProvider;
|
||||
import com.simplemobiletools.notes.R;
|
||||
@ -47,7 +46,7 @@ public class MainActivity extends SimpleActivity {
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
if (Config.newInstance(getApplicationContext()).getIsAutosaveEnabled()) {
|
||||
if (mConfig.getIsAutosaveEnabled()) {
|
||||
saveText(false);
|
||||
}
|
||||
}
|
||||
@ -65,13 +64,13 @@ public class MainActivity extends SimpleActivity {
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
Config.newInstance(getApplicationContext()).setIsFirstRun(false);
|
||||
mConfig.setIsFirstRun(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu, menu);
|
||||
if (Config.newInstance(getApplicationContext()).getIsAutosaveEnabled())
|
||||
if (mConfig.getIsAutosaveEnabled())
|
||||
menu.findItem(R.id.save).setVisible(false);
|
||||
|
||||
return true;
|
||||
@ -106,7 +105,8 @@ public class MainActivity extends SimpleActivity {
|
||||
alertDialog.setPositiveButton(R.string.enable_autosave, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
mConfig.setIsAutosaveEnabled(true);
|
||||
supportInvalidateOptionsMenu();
|
||||
}
|
||||
});
|
||||
alertDialog.create().show();
|
||||
|
@ -11,6 +11,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:gravity="top"
|
||||
android:padding="@dimen/activity_margin"/>
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:textSize="@dimen/normal_text_size"/>
|
||||
|
||||
</ScrollView>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<string name="enable_autosave">Enable autosave</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="unsaved_changes">Unsaved changes</string>
|
||||
<string name="autosave_prompt_msg">Changes made to the note have not be saved. Do you want to enable autosave?</string>
|
||||
<string name="autosave_prompt_msg">Changes made to the note have not been saved. Do you want to enable autosave?</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="settings">Impostazioni</string>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<string name="enable_autosave">Enable autosave</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="unsaved_changes">Unsaved changes</string>
|
||||
<string name="autosave_prompt_msg">Changes made to the note have not be saved. Do you want to enable autosave?</string>
|
||||
<string name="autosave_prompt_msg">Changes made to the note have not been saved. Do you want to enable autosave?</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="settings">設定</string>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<string name="enable_autosave">Enable autosave</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="unsaved_changes">Unsaved changes</string>
|
||||
<string name="autosave_prompt_msg">Changes made to the note have not be saved. Do you want to enable autosave?</string>
|
||||
<string name="autosave_prompt_msg">Changes made to the note have not been saved. Do you want to enable autosave?</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="settings">Inställningar</string>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<string name="enable_autosave">Enable autosave</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="unsaved_changes">Unsaved changes</string>
|
||||
<string name="autosave_prompt_msg">Changes made to the note have not be saved. Do you want to enable autosave?</string>
|
||||
<string name="autosave_prompt_msg">Changes made to the note have not been saved. Do you want to enable autosave?</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="settings">Settings</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user