Java Code Examples for org.telegram.messenger.SharedConfig#passcodeType()
The following examples show how to use
org.telegram.messenger.SharedConfig#passcodeType() .
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: PasscodeView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void onResume() { checkRetryTextView(); if (retryTextView.getVisibility() != VISIBLE) { if (SharedConfig.passcodeType == 1) { if (passwordEditText != null) { passwordEditText.requestFocus(); AndroidUtilities.showKeyboard(passwordEditText); } AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { if (retryTextView.getVisibility() != VISIBLE && passwordEditText != null) { passwordEditText.requestFocus(); AndroidUtilities.showKeyboard(passwordEditText); } } }, 200); } checkFingerprint(); } }
Example 2
Source File: PasscodeView.java From Telegram with GNU General Public License v2.0 | 6 votes |
public void onResume() { checkRetryTextView(); if (retryTextView.getVisibility() != VISIBLE) { if (SharedConfig.passcodeType == 1) { if (passwordEditText != null) { passwordEditText.requestFocus(); AndroidUtilities.showKeyboard(passwordEditText); } AndroidUtilities.runOnUIThread(() -> { if (retryTextView.getVisibility() != VISIBLE && passwordEditText != null) { passwordEditText.requestFocus(); AndroidUtilities.showKeyboard(passwordEditText); } }, 200); } checkFingerprint(); } }
Example 3
Source File: PasscodeView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { View rootView = getRootView(); int usableViewHeight = rootView.getHeight() - AndroidUtilities.statusBarHeight - AndroidUtilities.getViewInset(rootView); getWindowVisibleDisplayFrame(rect); keyboardHeight = usableViewHeight - (rect.bottom - rect.top); if (SharedConfig.passcodeType == 1 && (AndroidUtilities.isTablet() || getContext().getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE)) { int t = 0; if (passwordFrameLayout.getTag() != null) { t = (Integer) passwordFrameLayout.getTag(); } LayoutParams layoutParams = (LayoutParams) passwordFrameLayout.getLayoutParams(); layoutParams.topMargin = t + layoutParams.height - keyboardHeight / 2 - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); passwordFrameLayout.setLayoutParams(layoutParams); } super.onLayout(changed, left, top, right, bottom); }
Example 4
Source File: PasscodeView.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { View rootView = getRootView(); int usableViewHeight = rootView.getHeight() - AndroidUtilities.statusBarHeight - AndroidUtilities.getViewInset(rootView); getWindowVisibleDisplayFrame(rect); keyboardHeight = usableViewHeight - (rect.bottom - rect.top); if (SharedConfig.passcodeType == 1 && (AndroidUtilities.isTablet() || getContext().getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE)) { int t = 0; if (passwordFrameLayout.getTag() != null) { t = (Integer) passwordFrameLayout.getTag(); } LayoutParams layoutParams = (LayoutParams) passwordFrameLayout.getLayoutParams(); layoutParams.topMargin = t + layoutParams.height - keyboardHeight / 2 - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); passwordFrameLayout.setLayoutParams(layoutParams); } super.onLayout(changed, left, top, right, bottom); }
Example 5
Source File: PasscodeView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void onResume() { checkRetryTextView(); if (retryTextView.getVisibility() != VISIBLE) { if (SharedConfig.passcodeType == 1) { if (passwordEditText != null) { passwordEditText.requestFocus(); AndroidUtilities.showKeyboard(passwordEditText); } AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { if (retryTextView.getVisibility() != VISIBLE && passwordEditText != null) { passwordEditText.requestFocus(); AndroidUtilities.showKeyboard(passwordEditText); } } }, 200); } checkFingerprint(); } }
Example 6
Source File: PasscodeView.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { View rootView = getRootView(); int usableViewHeight = rootView.getHeight() - AndroidUtilities.statusBarHeight - AndroidUtilities.getViewInset(rootView); getWindowVisibleDisplayFrame(rect); keyboardHeight = usableViewHeight - (rect.bottom - rect.top); if (SharedConfig.passcodeType == 1 && (AndroidUtilities.isTablet() || getContext().getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE)) { int t = 0; if (passwordFrameLayout.getTag() != null) { t = (Integer) passwordFrameLayout.getTag(); } LayoutParams layoutParams = (LayoutParams) passwordFrameLayout.getLayoutParams(); layoutParams.topMargin = t + layoutParams.height - keyboardHeight / 2 - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); passwordFrameLayout.setLayoutParams(layoutParams); } super.onLayout(changed, left, top, right, bottom); }
Example 7
Source File: PasscodeView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { View rootView = getRootView(); int usableViewHeight = rootView.getHeight() - AndroidUtilities.statusBarHeight - AndroidUtilities.getViewInset(rootView); getWindowVisibleDisplayFrame(rect); keyboardHeight = usableViewHeight - (rect.bottom - rect.top); if (SharedConfig.passcodeType == 1 && (AndroidUtilities.isTablet() || getContext().getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE)) { int t = 0; if (passwordFrameLayout.getTag() != null) { t = (Integer) passwordFrameLayout.getTag(); } LayoutParams layoutParams = (LayoutParams) passwordFrameLayout.getLayoutParams(); layoutParams.topMargin = t + layoutParams.height - keyboardHeight / 2 - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); passwordFrameLayout.setLayoutParams(layoutParams); } super.onLayout(changed, left, top, right, bottom); }
Example 8
Source File: PasscodeView.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public void onResume() { checkRetryTextView(); if (retryTextView.getVisibility() != VISIBLE) { if (SharedConfig.passcodeType == 1) { if (passwordEditText != null) { passwordEditText.requestFocus(); AndroidUtilities.showKeyboard(passwordEditText); } AndroidUtilities.runOnUIThread(() -> { if (retryTextView.getVisibility() != VISIBLE && passwordEditText != null) { passwordEditText.requestFocus(); AndroidUtilities.showKeyboard(passwordEditText); } }, 200); } checkFingerprint(); } }
Example 9
Source File: PasscodeActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void updateDropDownTextView() { if (dropDown != null) { if (currentPasswordType == 0) { dropDown.setText(LocaleController.getString("PasscodePIN", R.string.PasscodePIN)); } else if (currentPasswordType == 1) { dropDown.setText(LocaleController.getString("PasscodePassword", R.string.PasscodePassword)); } } if (type == 1 && currentPasswordType == 0 || type == 2 && SharedConfig.passcodeType == 0) { InputFilter[] filterArray = new InputFilter[1]; filterArray[0] = new InputFilter.LengthFilter(4); passwordEditText.setFilters(filterArray); passwordEditText.setInputType(InputType.TYPE_CLASS_PHONE); passwordEditText.setKeyListener(DigitsKeyListener.getInstance("1234567890")); } else if (type == 1 && currentPasswordType == 1 || type == 2 && SharedConfig.passcodeType == 1) { passwordEditText.setFilters(new InputFilter[0]); passwordEditText.setKeyListener(null); passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); } passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance()); }
Example 10
Source File: PasscodeView.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void checkRetryTextView() { long currentTime = SystemClock.elapsedRealtime(); if (currentTime > SharedConfig.lastUptimeMillis) { SharedConfig.passcodeRetryInMs -= (currentTime - SharedConfig.lastUptimeMillis); if (SharedConfig.passcodeRetryInMs < 0) { SharedConfig.passcodeRetryInMs = 0; } } SharedConfig.lastUptimeMillis = currentTime; SharedConfig.saveConfig(); if (SharedConfig.passcodeRetryInMs > 0) { int value = Math.max(1, (int) Math.ceil(SharedConfig.passcodeRetryInMs / 1000.0)); if (value != lastValue) { retryTextView.setText(LocaleController.formatString("TooManyTries", R.string.TooManyTries, LocaleController.formatPluralString("Seconds", value))); lastValue = value; } if (retryTextView.getVisibility() != VISIBLE) { retryTextView.setVisibility(VISIBLE); passwordFrameLayout.setVisibility(INVISIBLE); if (numbersFrameLayout.getVisibility() == VISIBLE) { numbersFrameLayout.setVisibility(INVISIBLE); } AndroidUtilities.hideKeyboard(passwordEditText); AndroidUtilities.cancelRunOnUIThread(checkRunnable); AndroidUtilities.runOnUIThread(checkRunnable, 100); } } else { AndroidUtilities.cancelRunOnUIThread(checkRunnable); if (passwordFrameLayout.getVisibility() != VISIBLE) { retryTextView.setVisibility(INVISIBLE); passwordFrameLayout.setVisibility(VISIBLE); if (SharedConfig.passcodeType == 0) { numbersFrameLayout.setVisibility(VISIBLE); } else if (SharedConfig.passcodeType == 1) { AndroidUtilities.showKeyboard(passwordEditText); } } } }
Example 11
Source File: PasscodeActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void updateDropDownTextView() { if (dropDown != null) { if (currentPasswordType == 0) { dropDown.setText(LocaleController.getString("PasscodePIN", R.string.PasscodePIN)); } else if (currentPasswordType == 1) { dropDown.setText(LocaleController.getString("PasscodePassword", R.string.PasscodePassword)); } } if (type == 1 && currentPasswordType == 0 || type == 2 && SharedConfig.passcodeType == 0) { InputFilter[] filterArray = new InputFilter[1]; filterArray[0] = new InputFilter.LengthFilter(4); passwordEditText.setFilters(filterArray); passwordEditText.setInputType(InputType.TYPE_CLASS_PHONE); passwordEditText.setKeyListener(DigitsKeyListener.getInstance("1234567890")); } else if (type == 1 && currentPasswordType == 1 || type == 2 && SharedConfig.passcodeType == 1) { passwordEditText.setFilters(new InputFilter[0]); passwordEditText.setKeyListener(null); passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); } passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance()); }
Example 12
Source File: PasscodeView.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void checkRetryTextView() { long currentTime = SystemClock.elapsedRealtime(); if (currentTime > SharedConfig.lastUptimeMillis) { SharedConfig.passcodeRetryInMs -= (currentTime - SharedConfig.lastUptimeMillis); if (SharedConfig.passcodeRetryInMs < 0) { SharedConfig.passcodeRetryInMs = 0; } } SharedConfig.lastUptimeMillis = currentTime; SharedConfig.saveConfig(); if (SharedConfig.passcodeRetryInMs > 0) { int value = Math.max(1, (int) Math.ceil(SharedConfig.passcodeRetryInMs / 1000.0)); if (value != lastValue) { retryTextView.setText(LocaleController.formatString("TooManyTries", R.string.TooManyTries, LocaleController.formatPluralString("Seconds", value))); lastValue = value; } if (retryTextView.getVisibility() != VISIBLE) { retryTextView.setVisibility(VISIBLE); passwordFrameLayout.setVisibility(INVISIBLE); if (numbersFrameLayout.getVisibility() == VISIBLE) { numbersFrameLayout.setVisibility(INVISIBLE); } AndroidUtilities.hideKeyboard(passwordEditText); AndroidUtilities.cancelRunOnUIThread(checkRunnable); AndroidUtilities.runOnUIThread(checkRunnable, 100); } } else { AndroidUtilities.cancelRunOnUIThread(checkRunnable); if (passwordFrameLayout.getVisibility() != VISIBLE) { retryTextView.setVisibility(INVISIBLE); passwordFrameLayout.setVisibility(VISIBLE); if (SharedConfig.passcodeType == 0) { numbersFrameLayout.setVisibility(VISIBLE); } else if (SharedConfig.passcodeType == 1) { AndroidUtilities.showKeyboard(passwordEditText); } } } }
Example 13
Source File: PasscodeView.java From Telegram with GNU General Public License v2.0 | 5 votes |
private void checkRetryTextView() { long currentTime = SystemClock.elapsedRealtime(); if (currentTime > SharedConfig.lastUptimeMillis) { SharedConfig.passcodeRetryInMs -= (currentTime - SharedConfig.lastUptimeMillis); if (SharedConfig.passcodeRetryInMs < 0) { SharedConfig.passcodeRetryInMs = 0; } } SharedConfig.lastUptimeMillis = currentTime; SharedConfig.saveConfig(); if (SharedConfig.passcodeRetryInMs > 0) { int value = Math.max(1, (int) Math.ceil(SharedConfig.passcodeRetryInMs / 1000.0)); if (value != lastValue) { retryTextView.setText(LocaleController.formatString("TooManyTries", R.string.TooManyTries, LocaleController.formatPluralString("Seconds", value))); lastValue = value; } if (retryTextView.getVisibility() != VISIBLE) { retryTextView.setVisibility(VISIBLE); passwordFrameLayout.setVisibility(INVISIBLE); if (numbersFrameLayout.getVisibility() == VISIBLE) { numbersFrameLayout.setVisibility(INVISIBLE); } AndroidUtilities.hideKeyboard(passwordEditText); AndroidUtilities.cancelRunOnUIThread(checkRunnable); AndroidUtilities.runOnUIThread(checkRunnable, 100); } } else { AndroidUtilities.cancelRunOnUIThread(checkRunnable); if (passwordFrameLayout.getVisibility() != VISIBLE) { retryTextView.setVisibility(INVISIBLE); passwordFrameLayout.setVisibility(VISIBLE); if (SharedConfig.passcodeType == 0) { numbersFrameLayout.setVisibility(VISIBLE); } else if (SharedConfig.passcodeType == 1) { AndroidUtilities.showKeyboard(passwordEditText); } } } }
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(); } }
Example 15
Source File: PasscodeView.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public void onShow() { checkRetryTextView(); Activity parentActivity = (Activity) getContext(); if (SharedConfig.passcodeType == 1) { if (retryTextView.getVisibility() != VISIBLE && passwordEditText != null) { passwordEditText.requestFocus(); AndroidUtilities.showKeyboard(passwordEditText); } } else { if (parentActivity != null) { View currentFocus = parentActivity.getCurrentFocus(); if (currentFocus != null) { currentFocus.clearFocus(); AndroidUtilities.hideKeyboard(((Activity) getContext()).getCurrentFocus()); } } } if (retryTextView.getVisibility() != VISIBLE) { checkFingerprint(); } if (getVisibility() == View.VISIBLE) { return; } setAlpha(1.0f); setTranslationY(0); if (Theme.isCustomTheme()) { backgroundDrawable = Theme.getCachedWallpaper(); backgroundFrameLayout.setBackgroundColor(0xbf000000); } else { String selectedBackgroundSlug = Theme.getSelectedBackgroundSlug(); if (Theme.DEFAULT_BACKGROUND_SLUG.equals(selectedBackgroundSlug)) { backgroundFrameLayout.setBackgroundColor(0xff517c9e); } else { backgroundDrawable = Theme.getCachedWallpaper(); if (backgroundDrawable != null) { backgroundFrameLayout.setBackgroundColor(0xbf000000); } else { backgroundFrameLayout.setBackgroundColor(0xff517c9e); } } } passcodeTextView.setText(LocaleController.getString("EnterYourPasscode", R.string.EnterYourPasscode)); if (SharedConfig.passcodeType == 0) { if (retryTextView.getVisibility() != VISIBLE) { numbersFrameLayout.setVisibility(VISIBLE); } passwordEditText.setVisibility(GONE); passwordEditText2.setVisibility(VISIBLE); checkImage.setVisibility(GONE); } else if (SharedConfig.passcodeType == 1) { passwordEditText.setFilters(new InputFilter[0]); passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); numbersFrameLayout.setVisibility(GONE); passwordEditText.setFocusable(true); passwordEditText.setFocusableInTouchMode(true); passwordEditText.setVisibility(VISIBLE); passwordEditText2.setVisibility(GONE); checkImage.setVisibility(VISIBLE); } setVisibility(VISIBLE); passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance()); passwordEditText.setText(""); passwordEditText2.eraseAllCharacters(false); setOnTouchListener((v, event) -> true); }
Example 16
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 17
Source File: PasscodeView.java From Telegram with GNU General Public License v2.0 | 4 votes |
public void onShow() { checkRetryTextView(); Activity parentActivity = (Activity) getContext(); if (SharedConfig.passcodeType == 1) { if (retryTextView.getVisibility() != VISIBLE && passwordEditText != null) { passwordEditText.requestFocus(); AndroidUtilities.showKeyboard(passwordEditText); } } else { if (parentActivity != null) { View currentFocus = parentActivity.getCurrentFocus(); if (currentFocus != null) { currentFocus.clearFocus(); AndroidUtilities.hideKeyboard(((Activity) getContext()).getCurrentFocus()); } } } if (retryTextView.getVisibility() != VISIBLE) { checkFingerprint(); } if (getVisibility() == View.VISIBLE) { return; } setAlpha(1.0f); setTranslationY(0); if (Theme.isCustomTheme()) { backgroundDrawable = Theme.getCachedWallpaper(); backgroundFrameLayout.setBackgroundColor(0xbf000000); } else { String selectedBackgroundSlug = Theme.getSelectedBackgroundSlug(); if (Theme.DEFAULT_BACKGROUND_SLUG.equals(selectedBackgroundSlug)) { backgroundFrameLayout.setBackgroundColor(0xff517c9e); } else { backgroundDrawable = Theme.getCachedWallpaper(); if (backgroundDrawable != null) { backgroundFrameLayout.setBackgroundColor(0xbf000000); } else { backgroundFrameLayout.setBackgroundColor(0xff517c9e); } } } passcodeTextView.setText(LocaleController.getString("EnterYourPasscode", R.string.EnterYourPasscode)); if (SharedConfig.passcodeType == 0) { if (retryTextView.getVisibility() != VISIBLE) { numbersFrameLayout.setVisibility(VISIBLE); } passwordEditText.setVisibility(GONE); passwordEditText2.setVisibility(VISIBLE); checkImage.setVisibility(GONE); } else if (SharedConfig.passcodeType == 1) { passwordEditText.setFilters(new InputFilter[0]); passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); numbersFrameLayout.setVisibility(GONE); passwordEditText.setFocusable(true); passwordEditText.setFocusableInTouchMode(true); passwordEditText.setVisibility(VISIBLE); passwordEditText2.setVisibility(GONE); checkImage.setVisibility(VISIBLE); } setVisibility(VISIBLE); passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance()); passwordEditText.setText(""); passwordEditText2.eraseAllCharacters(false); setOnTouchListener((v, event) -> true); }
Example 18
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 19
Source File: PasscodeView.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public void onShow() { checkRetryTextView(); Activity parentActivity = (Activity) getContext(); if (SharedConfig.passcodeType == 1) { if (retryTextView.getVisibility() != VISIBLE && passwordEditText != null) { passwordEditText.requestFocus(); AndroidUtilities.showKeyboard(passwordEditText); } } else { if (parentActivity != null) { View currentFocus = parentActivity.getCurrentFocus(); if (currentFocus != null) { currentFocus.clearFocus(); AndroidUtilities.hideKeyboard(((Activity) getContext()).getCurrentFocus()); } } } if (retryTextView.getVisibility() != VISIBLE) { checkFingerprint(); } if (getVisibility() == View.VISIBLE) { return; } setAlpha(1.0f); setTranslationY(0); if (Theme.isCustomTheme()) { backgroundDrawable = Theme.getCachedWallpaper(); backgroundFrameLayout.setBackgroundColor(0xbf000000); } else { SharedPreferences preferences = MessagesController.getGlobalMainSettings(); int selectedBackground = preferences.getInt("selectedBackground", 1000001); if (selectedBackground == 1000001) { backgroundFrameLayout.setBackgroundColor(0xff517c9e); } else { backgroundDrawable = Theme.getCachedWallpaper(); if (backgroundDrawable != null) { backgroundFrameLayout.setBackgroundColor(0xbf000000); } else { backgroundFrameLayout.setBackgroundColor(0xff517c9e); } } } passcodeTextView.setText(LocaleController.getString("EnterYourPasscode", R.string.EnterYourPasscode)); if (SharedConfig.passcodeType == 0) { if (retryTextView.getVisibility() != VISIBLE) { numbersFrameLayout.setVisibility(VISIBLE); } passwordEditText.setVisibility(GONE); passwordEditText2.setVisibility(VISIBLE); checkImage.setVisibility(GONE); } else if (SharedConfig.passcodeType == 1) { passwordEditText.setFilters(new InputFilter[0]); passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); numbersFrameLayout.setVisibility(GONE); passwordEditText.setFocusable(true); passwordEditText.setFocusableInTouchMode(true); passwordEditText.setVisibility(VISIBLE); passwordEditText2.setVisibility(GONE); checkImage.setVisibility(VISIBLE); } setVisibility(VISIBLE); passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance()); passwordEditText.setText(""); passwordEditText2.eraseAllCharacters(false); setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); }
Example 20
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(); } }