mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-06-05 17:00:23 +02: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.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
import com.simplemobiletools.notes.Config;
|
|
||||||
import com.simplemobiletools.notes.Constants;
|
import com.simplemobiletools.notes.Constants;
|
||||||
import com.simplemobiletools.notes.MyWidgetProvider;
|
import com.simplemobiletools.notes.MyWidgetProvider;
|
||||||
import com.simplemobiletools.notes.R;
|
import com.simplemobiletools.notes.R;
|
||||||
@ -47,7 +46,7 @@ public class MainActivity extends SimpleActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
if (Config.newInstance(getApplicationContext()).getIsAutosaveEnabled()) {
|
if (mConfig.getIsAutosaveEnabled()) {
|
||||||
saveText(false);
|
saveText(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,13 +64,13 @@ public class MainActivity extends SimpleActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
Config.newInstance(getApplicationContext()).setIsFirstRun(false);
|
mConfig.setIsFirstRun(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.menu, menu);
|
getMenuInflater().inflate(R.menu.menu, menu);
|
||||||
if (Config.newInstance(getApplicationContext()).getIsAutosaveEnabled())
|
if (mConfig.getIsAutosaveEnabled())
|
||||||
menu.findItem(R.id.save).setVisible(false);
|
menu.findItem(R.id.save).setVisible(false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -106,7 +105,8 @@ public class MainActivity extends SimpleActivity {
|
|||||||
alertDialog.setPositiveButton(R.string.enable_autosave, new DialogInterface.OnClickListener() {
|
alertDialog.setPositiveButton(R.string.enable_autosave, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
mConfig.setIsAutosaveEnabled(true);
|
||||||
|
supportInvalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
alertDialog.create().show();
|
alertDialog.create().show();
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:gravity="top"
|
android:gravity="top"
|
||||||
android:padding="@dimen/activity_margin"/>
|
android:padding="@dimen/activity_margin"
|
||||||
|
android:textSize="@dimen/normal_text_size"/>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<string name="enable_autosave">Enable autosave</string>
|
<string name="enable_autosave">Enable autosave</string>
|
||||||
<string name="cancel">Cancel</string>
|
<string name="cancel">Cancel</string>
|
||||||
<string name="unsaved_changes">Unsaved changes</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 -->
|
<!-- Settings -->
|
||||||
<string name="settings">Impostazioni</string>
|
<string name="settings">Impostazioni</string>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<string name="enable_autosave">Enable autosave</string>
|
<string name="enable_autosave">Enable autosave</string>
|
||||||
<string name="cancel">Cancel</string>
|
<string name="cancel">Cancel</string>
|
||||||
<string name="unsaved_changes">Unsaved changes</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 -->
|
<!-- Settings -->
|
||||||
<string name="settings">設定</string>
|
<string name="settings">設定</string>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<string name="enable_autosave">Enable autosave</string>
|
<string name="enable_autosave">Enable autosave</string>
|
||||||
<string name="cancel">Cancel</string>
|
<string name="cancel">Cancel</string>
|
||||||
<string name="unsaved_changes">Unsaved changes</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 -->
|
<!-- Settings -->
|
||||||
<string name="settings">Inställningar</string>
|
<string name="settings">Inställningar</string>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<string name="enable_autosave">Enable autosave</string>
|
<string name="enable_autosave">Enable autosave</string>
|
||||||
<string name="cancel">Cancel</string>
|
<string name="cancel">Cancel</string>
|
||||||
<string name="unsaved_changes">Unsaved changes</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 -->
|
<!-- Settings -->
|
||||||
<string name="settings">Settings</string>
|
<string name="settings">Settings</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user