Java Code Examples for org.telegram.ui.ActionBar.Theme#isCustomTheme()

The following examples show how to use org.telegram.ui.ActionBar.Theme#isCustomTheme() . 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: DrawerProfileCell.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onDraw(Canvas canvas) {
    Drawable backgroundDrawable = Theme.getCachedWallpaper();
    int color;
    if (Theme.hasThemeKey(Theme.key_chats_menuTopShadow)) {
        color = Theme.getColor(Theme.key_chats_menuTopShadow);
    } else {
        color = Theme.getServiceMessageColor() | 0xff000000;
    }
    if (currentColor == null || currentColor != color) {
        currentColor = color;
        shadowView.getDrawable().setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
    }
    nameTextView.setTextColor(Theme.getColor(Theme.key_chats_menuName));
    if (Theme.isCustomTheme() && backgroundDrawable != null) {
        phoneTextView.setTextColor(Theme.getColor(Theme.key_chats_menuPhone));
        shadowView.setVisibility(VISIBLE);
        if (backgroundDrawable instanceof ColorDrawable) {
            backgroundDrawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
            backgroundDrawable.draw(canvas);
        } else if (backgroundDrawable instanceof BitmapDrawable) {
            Bitmap bitmap = ((BitmapDrawable) backgroundDrawable).getBitmap();
            float scaleX = (float) getMeasuredWidth() / (float) bitmap.getWidth();
            float scaleY = (float) getMeasuredHeight() / (float) bitmap.getHeight();
            float scale = scaleX < scaleY ? scaleY : scaleX;
            int width = (int) (getMeasuredWidth() / scale);
            int height = (int) (getMeasuredHeight() / scale);
            int x = (bitmap.getWidth() - width) / 2;
            int y = (bitmap.getHeight() - height) / 2;
            srcRect.set(x, y, x + width, y + height);
            destRect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
            try {
                canvas.drawBitmap(bitmap, srcRect, destRect, paint);
            } catch (Throwable e) {
                FileLog.e(e);
            }
        }
    } else {
        shadowView.setVisibility(INVISIBLE);
        phoneTextView.setTextColor(Theme.getColor(Theme.key_chats_menuPhoneCats));
        super.onDraw(canvas);
    }
}
 
Example 2
Source File: PasscodeView.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
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 3
Source File: DrawerProfileCell.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onDraw(Canvas canvas) {
    Drawable backgroundDrawable = Theme.getCachedWallpaper();
    int color;
    if (Theme.hasThemeKey(Theme.key_chats_menuTopShadow)) {
        color = Theme.getColor(Theme.key_chats_menuTopShadow);
    } else {
        color = Theme.getServiceMessageColor() | 0xff000000;
    }
    if (currentColor == null || currentColor != color) {
        currentColor = color;
        shadowView.getDrawable().setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
    }
    nameTextView.setTextColor(Theme.getColor(Theme.key_chats_menuName));
    if (Theme.isCustomTheme() && backgroundDrawable != null) {
        phoneTextView.setTextColor(Theme.getColor(Theme.key_chats_menuPhone));
        shadowView.setVisibility(VISIBLE);
        if (backgroundDrawable instanceof ColorDrawable) {
            backgroundDrawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
            backgroundDrawable.draw(canvas);
        } else if (backgroundDrawable instanceof BitmapDrawable) {
            Bitmap bitmap = ((BitmapDrawable) backgroundDrawable).getBitmap();
            float scaleX = (float) getMeasuredWidth() / (float) bitmap.getWidth();
            float scaleY = (float) getMeasuredHeight() / (float) bitmap.getHeight();
            float scale = scaleX < scaleY ? scaleY : scaleX;
            int width = (int) (getMeasuredWidth() / scale);
            int height = (int) (getMeasuredHeight() / scale);
            int x = (bitmap.getWidth() - width) / 2;
            int y = (bitmap.getHeight() - height) / 2;
            srcRect.set(x, y, x + width, y + height);
            destRect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
            try {
                canvas.drawBitmap(bitmap, srcRect, destRect, paint);
            } catch (Throwable e) {
                FileLog.e(e);
            }
        }
    } else {
        shadowView.setVisibility(INVISIBLE);
        phoneTextView.setTextColor(Theme.getColor(Theme.key_chats_menuPhoneCats));
        super.onDraw(canvas);
    }
}
 
Example 4
Source File: PasscodeView.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
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 5
Source File: DrawerProfileCell.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onDraw(Canvas canvas) {
    Drawable backgroundDrawable = Theme.getCachedWallpaper();
    String backgroundKey = applyBackground(false);
    boolean useImageBackground = !backgroundKey.equals(Theme.key_chats_menuTopBackground) && Theme.isCustomTheme() && !Theme.isPatternWallpaper() && backgroundDrawable != null && !(backgroundDrawable instanceof ColorDrawable) && !(backgroundDrawable instanceof GradientDrawable);
    boolean drawCatsShadow = false;
    int color;
    int darkBackColor = 0;
    if (!useImageBackground && Theme.hasThemeKey(Theme.key_chats_menuTopShadowCats)) {
        color = Theme.getColor(Theme.key_chats_menuTopShadowCats);
        drawCatsShadow = true;
    } else {
        if (Theme.hasThemeKey(Theme.key_chats_menuTopShadow)) {
            color = Theme.getColor(Theme.key_chats_menuTopShadow);
        } else {
            color = Theme.getServiceMessageColor() | 0xff000000;
        }
    }
    if (currentColor == null || currentColor != color) {
        currentColor = color;
        shadowView.getDrawable().setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
    }
    color = Theme.getColor(Theme.key_chats_menuName);
    if (currentMoonColor == null || currentColor != color) {
        currentMoonColor = color;
        darkThemeView.getDrawable().setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
    }
    nameTextView.setTextColor(Theme.getColor(Theme.key_chats_menuName));
    if (useImageBackground) {
        phoneTextView.setTextColor(Theme.getColor(Theme.key_chats_menuPhone));
        if (shadowView.getVisibility() != VISIBLE) {
            shadowView.setVisibility(VISIBLE);
        }
        if (backgroundDrawable instanceof ColorDrawable || backgroundDrawable instanceof GradientDrawable) {
            backgroundDrawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
            backgroundDrawable.draw(canvas);
            darkBackColor = Theme.getColor(Theme.key_listSelector);
        } else if (backgroundDrawable instanceof BitmapDrawable) {
            Bitmap bitmap = ((BitmapDrawable) backgroundDrawable).getBitmap();
            float scaleX = (float) getMeasuredWidth() / (float) bitmap.getWidth();
            float scaleY = (float) getMeasuredHeight() / (float) bitmap.getHeight();
            float scale = scaleX < scaleY ? scaleY : scaleX;
            int width = (int) (getMeasuredWidth() / scale);
            int height = (int) (getMeasuredHeight() / scale);
            int x = (bitmap.getWidth() - width) / 2;
            int y = (bitmap.getHeight() - height) / 2;
            srcRect.set(x, y, x + width, y + height);
            destRect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
            try {
                canvas.drawBitmap(bitmap, srcRect, destRect, paint);
            } catch (Throwable e) {
                FileLog.e(e);
            }
            darkBackColor = (Theme.getServiceMessageColor() & 0x00ffffff) | 0x50000000;
        }
    } else {
        int visibility = drawCatsShadow? VISIBLE : INVISIBLE;
        if (shadowView.getVisibility() != visibility) {
            shadowView.setVisibility(visibility);
        }
        phoneTextView.setTextColor(Theme.getColor(Theme.key_chats_menuPhoneCats));
        super.onDraw(canvas);
        darkBackColor = Theme.getColor(Theme.key_listSelector);
    }

    if (darkBackColor != 0) {
        if (darkBackColor != darkThemeBackgroundColor) {
            backPaint.setColor(darkThemeBackgroundColor = darkBackColor);
            if (Build.VERSION.SDK_INT >= 21) {
                Theme.setSelectorDrawableColor(darkThemeView.getBackground(), darkThemeBackgroundColor = darkBackColor, true);
            }
        }
        if (useImageBackground && backgroundDrawable instanceof BitmapDrawable) {
            canvas.drawCircle(darkThemeView.getX() + darkThemeView.getMeasuredWidth() / 2, darkThemeView.getY() + darkThemeView.getMeasuredHeight() / 2, AndroidUtilities.dp(17), backPaint);
        }
    }

    if (snowflakesEffect != null) {
        snowflakesEffect.onDraw(this, canvas);
    }
}
 
Example 6
Source File: PasscodeView.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
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 7
Source File: DrawerProfileCell.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onDraw(Canvas canvas) {
    Drawable backgroundDrawable = Theme.getCachedWallpaper();
    String backgroundKey = applyBackground(false);
    boolean useImageBackground = !backgroundKey.equals(Theme.key_chats_menuTopBackground) && Theme.isCustomTheme() && !Theme.isPatternWallpaper() && backgroundDrawable != null && !(backgroundDrawable instanceof ColorDrawable) && !(backgroundDrawable instanceof GradientDrawable);
    boolean drawCatsShadow = false;
    int color;
    int darkBackColor = 0;
    if (!useImageBackground && Theme.hasThemeKey(Theme.key_chats_menuTopShadowCats)) {
        color = Theme.getColor(Theme.key_chats_menuTopShadowCats);
        drawCatsShadow = true;
    } else {
        if (Theme.hasThemeKey(Theme.key_chats_menuTopShadow)) {
            color = Theme.getColor(Theme.key_chats_menuTopShadow);
        } else {
            color = Theme.getServiceMessageColor() | 0xff000000;
        }
    }
    if (currentColor == null || currentColor != color) {
        currentColor = color;
        shadowView.getDrawable().setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
    }
    color = Theme.getColor(Theme.key_chats_menuName);
    if (currentMoonColor == null || currentColor != color) {
        currentMoonColor = color;
        darkThemeView.getDrawable().setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
    }
    nameTextView.setTextColor(Theme.getColor(Theme.key_chats_menuName));
    if (useImageBackground) {
        phoneTextView.setTextColor(Theme.getColor(Theme.key_chats_menuPhone));
        if (shadowView.getVisibility() != VISIBLE) {
            shadowView.setVisibility(VISIBLE);
        }
        if (backgroundDrawable instanceof ColorDrawable || backgroundDrawable instanceof GradientDrawable) {
            backgroundDrawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
            backgroundDrawable.draw(canvas);
            darkBackColor = Theme.getColor(Theme.key_listSelector);
        } else if (backgroundDrawable instanceof BitmapDrawable) {
            Bitmap bitmap = ((BitmapDrawable) backgroundDrawable).getBitmap();
            float scaleX = (float) getMeasuredWidth() / (float) bitmap.getWidth();
            float scaleY = (float) getMeasuredHeight() / (float) bitmap.getHeight();
            float scale = scaleX < scaleY ? scaleY : scaleX;
            int width = (int) (getMeasuredWidth() / scale);
            int height = (int) (getMeasuredHeight() / scale);
            int x = (bitmap.getWidth() - width) / 2;
            int y = (bitmap.getHeight() - height) / 2;
            srcRect.set(x, y, x + width, y + height);
            destRect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
            try {
                canvas.drawBitmap(bitmap, srcRect, destRect, paint);
            } catch (Throwable e) {
                FileLog.e(e);
            }
            darkBackColor = (Theme.getServiceMessageColor() & 0x00ffffff) | 0x50000000;
        }
    } else {
        int visibility = drawCatsShadow? VISIBLE : INVISIBLE;
        if (shadowView.getVisibility() != visibility) {
            shadowView.setVisibility(visibility);
        }
        phoneTextView.setTextColor(Theme.getColor(Theme.key_chats_menuPhoneCats));
        super.onDraw(canvas);
        darkBackColor = Theme.getColor(Theme.key_listSelector);
    }

    if (darkBackColor != 0) {
        if (darkBackColor != darkThemeBackgroundColor) {
            backPaint.setColor(darkThemeBackgroundColor = darkBackColor);
            if (Build.VERSION.SDK_INT >= 21) {
                Theme.setSelectorDrawableColor(darkThemeView.getBackground(), darkThemeBackgroundColor = darkBackColor, true);
            }
        }
        if (useImageBackground && backgroundDrawable instanceof BitmapDrawable) {
            canvas.drawCircle(darkThemeView.getX() + darkThemeView.getMeasuredWidth() / 2, darkThemeView.getY() + darkThemeView.getMeasuredHeight() / 2, AndroidUtilities.dp(17), backPaint);
        }
    }

    if (snowflakesEffect != null) {
        snowflakesEffect.onDraw(this, canvas);
    }
}
 
Example 8
Source File: PasscodeView.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
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);
}