Refactored location of passcode check: a callback to rule them all
[pub/Android/ownCloud.git] / src / com / owncloud / android / authentication / PinCheck.java
index 0f3f4c5..2f48eb0 100644 (file)
@@ -9,8 +9,8 @@ import com.owncloud.android.MainApp;
 public class PinCheck extends Activity {
 
     private static Long timestamp = 0l;
-    private static Long lastStart = 0l;
-    private static int PINCODE_TIMEOUT = 10000;
+    private static Long lastStart = 0l; // this must be here because it's called twice - in onCreate and onResume
+    private static int PINCODE_TIMEOUT = 1000;
     
     public static void setUnlockTimestamp() {
         timestamp = System.currentTimeMillis();
@@ -18,7 +18,8 @@ public class PinCheck extends Activity {
 
     public static boolean checkIfPinEntry(){
         if ((System.currentTimeMillis() - timestamp) > PINCODE_TIMEOUT &&
-            (System.currentTimeMillis() - lastStart) > PINCODE_TIMEOUT){
+            (System.currentTimeMillis() - lastStart) > PINCODE_TIMEOUT
+            ){
             SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(MainApp.getAppContext());
             if (appPrefs.getBoolean("set_pincode", false)) {
                 lastStart = System.currentTimeMillis();