1 package com
.owncloud
.android
.authentication
; 
   3 import android
.app
.Activity
; 
   4 import android
.content
.SharedPreferences
; 
   5 import android
.preference
.PreferenceManager
; 
   7 import com
.owncloud
.android
.MainApp
; 
   9 public class PinCheck 
extends Activity 
{ 
  11     private static Long timestamp 
= 0l; 
  12     private static Long lastStart 
= 0l; // this must be here because it's called twice - in onCreate and onResume 
  13     private static int PINCODE_TIMEOUT 
= 1000; 
  15     public static void setUnlockTimestamp() { 
  16         timestamp 
= System
.currentTimeMillis(); 
  19     public static boolean checkIfPinEntry(){ 
  20         if ((System
.currentTimeMillis() - timestamp
) > PINCODE_TIMEOUT 
&& 
  21             (System
.currentTimeMillis() - lastStart
) > PINCODE_TIMEOUT
 
  23             SharedPreferences appPrefs 
= PreferenceManager
.getDefaultSharedPreferences(MainApp
.getAppContext()); 
  24             if (appPrefs
.getBoolean("set_pincode", false
)) { 
  25                 lastStart 
= System
.currentTimeMillis();