mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix flickering and timeout toast in settings
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
*/
|
||||
package com.keepassdroid.activities;
|
||||
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -58,7 +57,6 @@ public abstract class LockingActivity extends StylishActivity {
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
TimeoutHelper.checkTime(this);
|
||||
TimeoutHelper.checkShutdown(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,6 +22,7 @@ package com.keepassdroid.timeout;
|
||||
import android.app.Activity;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.keepassdroid.password.PasswordActivity;
|
||||
import com.kunzisoft.keepass.R;
|
||||
@@ -31,6 +32,8 @@ import com.keepassdroid.timers.Timeout;
|
||||
|
||||
public class TimeoutHelper {
|
||||
|
||||
private static final String TAG = "TimeoutHelper";
|
||||
|
||||
private static final long DEFAULT_TIMEOUT = 5 * 60 * 1000; // 5 minutes
|
||||
|
||||
public static void recordTime(Activity act) {
|
||||
@@ -63,7 +66,6 @@ public class TimeoutHelper {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String sTimeout = prefs.getString(act.getString(R.string.app_timeout_key), act.getString(R.string.clipboard_timeout_default));
|
||||
long timeout;
|
||||
try {
|
||||
@@ -80,12 +82,15 @@ public class TimeoutHelper {
|
||||
long diff = cur_time - timeout_start;
|
||||
if (diff >= timeout) {
|
||||
// We have timed out
|
||||
if ( App.getDB().Loaded() ) {
|
||||
App.setShutdown(act.getString(R.string.app_timeout));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkShutdown(Activity act) {
|
||||
if ( App.isShutdown() && App.getDB().Loaded() ) {
|
||||
Log.e(TAG, "Shutdown " + act.getLocalClassName() + " after inactivity");
|
||||
act.setResult(PasswordActivity.RESULT_EXIT_LOCK);
|
||||
act.finish();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user