Java Code Examples for org.telegram.messenger.SharedConfig#appLocked()
The following examples show how to use
org.telegram.messenger.SharedConfig#appLocked() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DialogsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private void updatePasscodeButton() { if (passcodeItem == null) { return; } if (SharedConfig.passcodeHash.length() != 0 && !searching) { passcodeItem.setVisibility(View.VISIBLE); if (SharedConfig.appLocked) { passcodeItem.setIcon(R.drawable.lock_close); } else { passcodeItem.setIcon(R.drawable.lock_open); } } else { passcodeItem.setVisibility(View.GONE); } }
Example 2
Source File: DialogsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private void updatePasscodeButton() { if (passcodeItem == null) { return; } if (SharedConfig.passcodeHash.length() != 0 && !searching) { passcodeItem.setVisibility(View.VISIBLE); if (SharedConfig.appLocked) { passcodeItem.setIcon(R.drawable.lock_close); } else { passcodeItem.setIcon(R.drawable.lock_open); } } else { passcodeItem.setVisibility(View.GONE); } }
Example 3
Source File: ExternalActionActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void showPasscodeActivity() { if (passcodeView == null) { return; } SharedConfig.appLocked = true; if (SecretMediaViewer.hasInstance() && SecretMediaViewer.getInstance().isVisible()) { SecretMediaViewer.getInstance().closePhoto(false, false); } else if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) { PhotoViewer.getInstance().closePhoto(false, true); } else if (ArticleViewer.hasInstance() && ArticleViewer.getInstance().isVisible()) { ArticleViewer.getInstance().close(false, true); } passcodeView.onShow(); SharedConfig.isWaitingForPasscodeEnter = true; drawerLayoutContainer.setAllowOpenDrawer(false, false); passcodeView.setDelegate(() -> { SharedConfig.isWaitingForPasscodeEnter = false; if (passcodeSaveIntent != null) { handleIntent(passcodeSaveIntent, passcodeSaveIntentIsNew, passcodeSaveIntentIsRestore, true, passcodeSaveIntentAccount, passcodeSaveIntentState); passcodeSaveIntent = null; } drawerLayoutContainer.setAllowOpenDrawer(true, false); actionBarLayout.showLastFragment(); if (AndroidUtilities.isTablet()) { layersActionBarLayout.showLastFragment(); } }); }
Example 4
Source File: ExternalActionActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void onPasscodePause() { if (lockRunnable != null) { AndroidUtilities.cancelRunOnUIThread(lockRunnable); lockRunnable = null; } if (SharedConfig.passcodeHash.length() != 0) { SharedConfig.lastPauseTime = ConnectionsManager.getInstance(UserConfig.selectedAccount).getCurrentTime(); lockRunnable = new Runnable() { @Override public void run() { if (lockRunnable == this) { if (AndroidUtilities.needShowPasscode(true)) { if (BuildVars.LOGS_ENABLED) { FileLog.d("lock app"); } showPasscodeActivity(); } else { if (BuildVars.LOGS_ENABLED) { FileLog.d("didn't pass lock check"); } } lockRunnable = null; } } }; if (SharedConfig.appLocked) { AndroidUtilities.runOnUIThread(lockRunnable, 1000); } else if (SharedConfig.autoLockIn != 0) { AndroidUtilities.runOnUIThread(lockRunnable, (long) SharedConfig.autoLockIn * 1000 + 1000); } } else { SharedConfig.lastPauseTime = 0; } SharedConfig.saveConfig(); }
Example 5
Source File: ExternalActionActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void showPasscodeActivity() { if (passcodeView == null) { return; } SharedConfig.appLocked = true; if (SecretMediaViewer.hasInstance() && SecretMediaViewer.getInstance().isVisible()) { SecretMediaViewer.getInstance().closePhoto(false, false); } else if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) { PhotoViewer.getInstance().closePhoto(false, true); } else if (ArticleViewer.hasInstance() && ArticleViewer.getInstance().isVisible()) { ArticleViewer.getInstance().close(false, true); } passcodeView.onShow(); SharedConfig.isWaitingForPasscodeEnter = true; drawerLayoutContainer.setAllowOpenDrawer(false, false); passcodeView.setDelegate(() -> { SharedConfig.isWaitingForPasscodeEnter = false; if (passcodeSaveIntent != null) { handleIntent(passcodeSaveIntent, passcodeSaveIntentIsNew, passcodeSaveIntentIsRestore, true, passcodeSaveIntentAccount, passcodeSaveIntentState); passcodeSaveIntent = null; } drawerLayoutContainer.setAllowOpenDrawer(true, false); actionBarLayout.showLastFragment(); if (AndroidUtilities.isTablet()) { layersActionBarLayout.showLastFragment(); } }); }
Example 6
Source File: ExternalActionActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void onPasscodePause() { if (lockRunnable != null) { AndroidUtilities.cancelRunOnUIThread(lockRunnable); lockRunnable = null; } if (SharedConfig.passcodeHash.length() != 0) { SharedConfig.lastPauseTime = ConnectionsManager.getInstance(UserConfig.selectedAccount).getCurrentTime(); lockRunnable = new Runnable() { @Override public void run() { if (lockRunnable == this) { if (AndroidUtilities.needShowPasscode(true)) { if (BuildVars.LOGS_ENABLED) { FileLog.d("lock app"); } showPasscodeActivity(); } else { if (BuildVars.LOGS_ENABLED) { FileLog.d("didn't pass lock check"); } } lockRunnable = null; } } }; if (SharedConfig.appLocked) { AndroidUtilities.runOnUIThread(lockRunnable, 1000); } else if (SharedConfig.autoLockIn != 0) { AndroidUtilities.runOnUIThread(lockRunnable, (long) SharedConfig.autoLockIn * 1000 + 1000); } } else { SharedConfig.lastPauseTime = 0; } SharedConfig.saveConfig(); }
Example 7
Source File: ExternalActionActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private void showPasscodeActivity() { if (passcodeView == null) { return; } SharedConfig.appLocked = true; if (SecretMediaViewer.hasInstance() && SecretMediaViewer.getInstance().isVisible()) { SecretMediaViewer.getInstance().closePhoto(false, false); } else if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) { PhotoViewer.getInstance().closePhoto(false, true); } else if (ArticleViewer.hasInstance() && ArticleViewer.getInstance().isVisible()) { ArticleViewer.getInstance().close(false, true); } passcodeView.onShow(); SharedConfig.isWaitingForPasscodeEnter = true; drawerLayoutContainer.setAllowOpenDrawer(false, false); passcodeView.setDelegate(() -> { SharedConfig.isWaitingForPasscodeEnter = false; if (passcodeSaveIntent != null) { handleIntent(passcodeSaveIntent, passcodeSaveIntentIsNew, passcodeSaveIntentIsRestore, true, passcodeSaveIntentAccount, passcodeSaveIntentState); passcodeSaveIntent = null; } drawerLayoutContainer.setAllowOpenDrawer(true, false); actionBarLayout.showLastFragment(); if (AndroidUtilities.isTablet()) { layersActionBarLayout.showLastFragment(); } }); }
Example 8
Source File: ExternalActionActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private void onPasscodePause() { if (lockRunnable != null) { AndroidUtilities.cancelRunOnUIThread(lockRunnable); lockRunnable = null; } if (SharedConfig.passcodeHash.length() != 0) { SharedConfig.lastPauseTime = (int) (SystemClock.elapsedRealtime() / 1000); lockRunnable = new Runnable() { @Override public void run() { if (lockRunnable == this) { if (AndroidUtilities.needShowPasscode(true)) { if (BuildVars.LOGS_ENABLED) { FileLog.d("lock app"); } showPasscodeActivity(); } else { if (BuildVars.LOGS_ENABLED) { FileLog.d("didn't pass lock check"); } } lockRunnable = null; } } }; if (SharedConfig.appLocked) { AndroidUtilities.runOnUIThread(lockRunnable, 1000); } else if (SharedConfig.autoLockIn != 0) { AndroidUtilities.runOnUIThread(lockRunnable, (long) SharedConfig.autoLockIn * 1000 + 1000); } } else { SharedConfig.lastPauseTime = 0; } SharedConfig.saveConfig(); }
Example 9
Source File: ExternalActionActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
private void showPasscodeActivity() { if (passcodeView == null) { return; } SharedConfig.appLocked = true; if (SecretMediaViewer.hasInstance() && SecretMediaViewer.getInstance().isVisible()) { SecretMediaViewer.getInstance().closePhoto(false, false); } else if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) { PhotoViewer.getInstance().closePhoto(false, true); } else if (ArticleViewer.hasInstance() && ArticleViewer.getInstance().isVisible()) { ArticleViewer.getInstance().close(false, true); } passcodeView.onShow(); SharedConfig.isWaitingForPasscodeEnter = true; drawerLayoutContainer.setAllowOpenDrawer(false, false); passcodeView.setDelegate(() -> { SharedConfig.isWaitingForPasscodeEnter = false; if (passcodeSaveIntent != null) { handleIntent(passcodeSaveIntent, passcodeSaveIntentIsNew, passcodeSaveIntentIsRestore, true, passcodeSaveIntentAccount, passcodeSaveIntentState); passcodeSaveIntent = null; } drawerLayoutContainer.setAllowOpenDrawer(true, false); actionBarLayout.showLastFragment(); if (AndroidUtilities.isTablet()) { layersActionBarLayout.showLastFragment(); } }); }
Example 10
Source File: ExternalActionActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
private void onPasscodePause() { if (lockRunnable != null) { AndroidUtilities.cancelRunOnUIThread(lockRunnable); lockRunnable = null; } if (SharedConfig.passcodeHash.length() != 0) { SharedConfig.lastPauseTime = (int) (SystemClock.elapsedRealtime() / 1000); lockRunnable = new Runnable() { @Override public void run() { if (lockRunnable == this) { if (AndroidUtilities.needShowPasscode(true)) { if (BuildVars.LOGS_ENABLED) { FileLog.d("lock app"); } showPasscodeActivity(); } else { if (BuildVars.LOGS_ENABLED) { FileLog.d("didn't pass lock check"); } } lockRunnable = null; } } }; if (SharedConfig.appLocked) { AndroidUtilities.runOnUIThread(lockRunnable, 1000); } else if (SharedConfig.autoLockIn != 0) { AndroidUtilities.runOnUIThread(lockRunnable, (long) SharedConfig.autoLockIn * 1000 + 1000); } } else { SharedConfig.lastPauseTime = 0; } SharedConfig.saveConfig(); }
Example 11
Source File: PasscodeView.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
private void processDone(boolean fingerprint) { if (!fingerprint) { if (SharedConfig.passcodeRetryInMs > 0) { return; } String password = ""; if (SharedConfig.passcodeType == 0) { password = passwordEditText2.getString(); } else if (SharedConfig.passcodeType == 1) { password = passwordEditText.getText().toString(); } if (password.length() == 0) { onPasscodeError(); return; } if (!SharedConfig.checkPasscode(password)) { SharedConfig.increaseBadPasscodeTries(); if (SharedConfig.passcodeRetryInMs > 0) { checkRetryTextView(); } passwordEditText.setText(""); passwordEditText2.eraseAllCharacters(true); onPasscodeError(); return; } } SharedConfig.badPasscodeTries = 0; passwordEditText.clearFocus(); AndroidUtilities.hideKeyboard(passwordEditText); AnimatorSet AnimatorSet = new AnimatorSet(); AnimatorSet.setDuration(200); AnimatorSet.playTogether( ObjectAnimator.ofFloat(this, "translationY", AndroidUtilities.dp(20)), ObjectAnimator.ofFloat(this, "alpha", AndroidUtilities.dp(0.0f))); AnimatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { setVisibility(View.GONE); } }); AnimatorSet.start(); SharedConfig.appLocked = false; SharedConfig.saveConfig(); NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didSetPasscode); setOnTouchListener(null); if (delegate != null) { delegate.didAcceptedPassword(); } }
Example 12
Source File: PasscodeView.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
private void processDone(boolean fingerprint) { if (!fingerprint) { if (SharedConfig.passcodeRetryInMs > 0) { return; } String password = ""; if (SharedConfig.passcodeType == 0) { password = passwordEditText2.getString(); } else if (SharedConfig.passcodeType == 1) { password = passwordEditText.getText().toString(); } if (password.length() == 0) { onPasscodeError(); return; } if (!SharedConfig.checkPasscode(password)) { SharedConfig.increaseBadPasscodeTries(); if (SharedConfig.passcodeRetryInMs > 0) { checkRetryTextView(); } passwordEditText.setText(""); passwordEditText2.eraseAllCharacters(true); onPasscodeError(); return; } } SharedConfig.badPasscodeTries = 0; passwordEditText.clearFocus(); AndroidUtilities.hideKeyboard(passwordEditText); AnimatorSet AnimatorSet = new AnimatorSet(); AnimatorSet.setDuration(200); AnimatorSet.playTogether( ObjectAnimator.ofFloat(this, "translationY", AndroidUtilities.dp(20)), ObjectAnimator.ofFloat(this, "alpha", AndroidUtilities.dp(0.0f))); AnimatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { setVisibility(View.GONE); } }); AnimatorSet.start(); SharedConfig.appLocked = false; SharedConfig.saveConfig(); NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didSetPasscode); setOnTouchListener(null); if (delegate != null) { delegate.didAcceptedPassword(); } }
Example 13
Source File: PasscodeView.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
private void processDone(boolean fingerprint) { if (!fingerprint) { if (SharedConfig.passcodeRetryInMs > 0) { return; } String password = ""; if (SharedConfig.passcodeType == 0) { password = passwordEditText2.getString(); } else if (SharedConfig.passcodeType == 1) { password = passwordEditText.getText().toString(); } if (password.length() == 0) { onPasscodeError(); return; } if (!SharedConfig.checkPasscode(password)) { SharedConfig.increaseBadPasscodeTries(); if (SharedConfig.passcodeRetryInMs > 0) { checkRetryTextView(); } passwordEditText.setText(""); passwordEditText2.eraseAllCharacters(true); onPasscodeError(); return; } } SharedConfig.badPasscodeTries = 0; passwordEditText.clearFocus(); AndroidUtilities.hideKeyboard(passwordEditText); AnimatorSet AnimatorSet = new AnimatorSet(); AnimatorSet.setDuration(200); AnimatorSet.playTogether( ObjectAnimator.ofFloat(this, View.TRANSLATION_Y, AndroidUtilities.dp(20)), ObjectAnimator.ofFloat(this, View.ALPHA, AndroidUtilities.dp(0.0f))); AnimatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { setVisibility(View.GONE); } }); AnimatorSet.start(); SharedConfig.appLocked = false; SharedConfig.saveConfig(); NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didSetPasscode); setOnTouchListener(null); if (delegate != null) { delegate.didAcceptedPassword(); } }
Example 14
Source File: PasscodeView.java From Telegram with GNU General Public License v2.0 | 4 votes |
private void processDone(boolean fingerprint) { if (!fingerprint) { if (SharedConfig.passcodeRetryInMs > 0) { return; } String password = ""; if (SharedConfig.passcodeType == 0) { password = passwordEditText2.getString(); } else if (SharedConfig.passcodeType == 1) { password = passwordEditText.getText().toString(); } if (password.length() == 0) { onPasscodeError(); return; } if (!SharedConfig.checkPasscode(password)) { SharedConfig.increaseBadPasscodeTries(); if (SharedConfig.passcodeRetryInMs > 0) { checkRetryTextView(); } passwordEditText.setText(""); passwordEditText2.eraseAllCharacters(true); onPasscodeError(); return; } } SharedConfig.badPasscodeTries = 0; passwordEditText.clearFocus(); AndroidUtilities.hideKeyboard(passwordEditText); AnimatorSet AnimatorSet = new AnimatorSet(); AnimatorSet.setDuration(200); AnimatorSet.playTogether( ObjectAnimator.ofFloat(this, View.TRANSLATION_Y, AndroidUtilities.dp(20)), ObjectAnimator.ofFloat(this, View.ALPHA, AndroidUtilities.dp(0.0f))); AnimatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { setVisibility(View.GONE); } }); AnimatorSet.start(); SharedConfig.appLocked = false; SharedConfig.saveConfig(); NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didSetPasscode); setOnTouchListener(null); if (delegate != null) { delegate.didAcceptedPassword(); } }