Back to project page gnucash-android.
The source code is released under:
Apache License
If you think the Android project gnucash-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.gnucash.android.ui.passcode; /*from ww w .ja va2s. com*/ import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; import com.actionbarsherlock.app.SherlockFragmentActivity; import org.gnucash.android.app.GnuCashApplication; import org.gnucash.android.ui.UxArgument; /** * This activity used as the parent class for enabling passcode lock * * @author Oleksandr Tyshkovets <olexandr.tyshkovets@gmail.com> * @see org.gnucash.android.ui.account.AccountsActivity * @see org.gnucash.android.ui.transaction.TransactionsActivity */ public class PassLockActivity extends SherlockFragmentActivity { private static final String TAG = "PassLockActivity"; @Override protected void onResume() { super.onResume(); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); if (sharedPreferences.getBoolean(UxArgument.ENABLED_PASSCODE, false) && !isSessionActive()) { startActivity(new Intent(this, PasscodeLockScreenActivity.class) .setAction(getIntent().getAction()) .putExtra(UxArgument.PASSCODE_CLASS_CALLER, this.getClass().getName()) .putExtra(UxArgument.SELECTED_ACCOUNT_UID, getIntent().getStringExtra(UxArgument.SELECTED_ACCOUNT_UID)) ); } } @Override protected void onPause() { super.onPause(); GnuCashApplication.PASSCODE_SESSION_INIT_TIME = System.currentTimeMillis(); } /** * @return {@code true} if passcode session is active, and {@code false} otherwise */ private boolean isSessionActive() { return System.currentTimeMillis() - GnuCashApplication.PASSCODE_SESSION_INIT_TIME < GnuCashApplication.SESSION_TIMEOUT; } }