Search in sources :

Example 1 with TextInfoPrivacyCell

use of org.telegram.ui.Cells.TextInfoPrivacyCell in project Telegram-FOSS by Telegram-FOSS-Team.

the class DialogsAdapter method onCreateViewHolder.

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
    View view;
    switch(viewType) {
        case 0:
            DialogCell dialogCell = new DialogCell(parentFragment, mContext, true, false, currentAccount, null);
            dialogCell.setArchivedPullAnimation(pullForegroundDrawable);
            dialogCell.setPreloader(preloader);
            view = dialogCell;
            break;
        case 1:
            FlickerLoadingView flickerLoadingView = new FlickerLoadingView(mContext);
            flickerLoadingView.setIsSingleCell(true);
            flickerLoadingView.setViewType(FlickerLoadingView.DIALOG_CELL_TYPE);
            view = flickerLoadingView;
            break;
        case 2:
            {
                HeaderCell headerCell = new HeaderCell(mContext);
                headerCell.setText(LocaleController.getString("RecentlyViewed", R.string.RecentlyViewed));
                TextView textView = new TextView(mContext);
                textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
                textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
                textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader));
                textView.setText(LocaleController.getString("RecentlyViewedHide", R.string.RecentlyViewedHide));
                textView.setGravity((LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL);
                headerCell.addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, 17, 15, 17, 0));
                textView.setOnClickListener(view1 -> {
                    MessagesController.getInstance(currentAccount).hintDialogs.clear();
                    SharedPreferences preferences = MessagesController.getGlobalMainSettings();
                    preferences.edit().remove("installReferer").commit();
                    notifyDataSetChanged();
                });
                view = headerCell;
                break;
            }
        case 3:
            FrameLayout frameLayout = new FrameLayout(mContext) {

                @Override
                protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
                    super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(12), MeasureSpec.EXACTLY));
                }
            };
            frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
            View v = new View(mContext);
            v.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
            frameLayout.addView(v, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
            view = frameLayout;
            break;
        case 4:
            view = new DialogMeUrlCell(mContext);
            break;
        case 5:
            view = new DialogsEmptyCell(mContext);
            break;
        case 6:
            view = new UserCell(mContext, 8, 0, false);
            break;
        case 7:
            view = new HeaderCell(mContext);
            break;
        case 8:
            {
                view = new ShadowSectionCell(mContext);
                Drawable drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow);
                CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), drawable);
                combinedDrawable.setFullsize(true);
                view.setBackgroundDrawable(combinedDrawable);
                break;
            }
        case 9:
            archiveHintCell = new ArchiveHintCell(mContext);
            view = archiveHintCell;
            break;
        case 10:
            {
                view = new LastEmptyView(mContext);
                break;
            }
        case 11:
            {
                view = new TextInfoPrivacyCell(mContext) {

                    private int movement;

                    private float moveProgress;

                    private long lastUpdateTime;

                    private int originalX;

                    private int originalY;

                    @Override
                    protected void afterTextDraw() {
                        if (arrowDrawable != null) {
                            Rect bounds = arrowDrawable.getBounds();
                            arrowDrawable.setBounds(originalX, originalY, originalX + bounds.width(), originalY + bounds.height());
                        }
                    }

                    @Override
                    protected void onTextDraw() {
                        if (arrowDrawable != null) {
                            Rect bounds = arrowDrawable.getBounds();
                            int dx = (int) (moveProgress * AndroidUtilities.dp(3));
                            originalX = bounds.left;
                            originalY = bounds.top;
                            arrowDrawable.setBounds(originalX + dx, originalY + AndroidUtilities.dp(1), originalX + dx + bounds.width(), originalY + AndroidUtilities.dp(1) + bounds.height());
                            long newUpdateTime = SystemClock.elapsedRealtime();
                            long dt = newUpdateTime - lastUpdateTime;
                            if (dt > 17) {
                                dt = 17;
                            }
                            lastUpdateTime = newUpdateTime;
                            if (movement == 0) {
                                moveProgress += dt / 664.0f;
                                if (moveProgress >= 1.0f) {
                                    movement = 1;
                                    moveProgress = 1.0f;
                                }
                            } else {
                                moveProgress -= dt / 664.0f;
                                if (moveProgress <= 0.0f) {
                                    movement = 0;
                                    moveProgress = 0.0f;
                                }
                            }
                            getTextView().invalidate();
                        }
                    }
                };
                Drawable drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow);
                CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), drawable);
                combinedDrawable.setFullsize(true);
                view.setBackgroundDrawable(combinedDrawable);
                break;
            }
        case 12:
        default:
            {
                view = new TextCell(mContext);
            }
    }
    view.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, viewType == 5 ? RecyclerView.LayoutParams.MATCH_PARENT : RecyclerView.LayoutParams.WRAP_CONTENT));
    return new RecyclerListView.Holder(view);
}
Also used : ArchiveHintCell(org.telegram.ui.Cells.ArchiveHintCell) Rect(android.graphics.Rect) FrameLayout(android.widget.FrameLayout) AndroidUtilities(org.telegram.messenger.AndroidUtilities) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) ShadowSectionCell(org.telegram.ui.Cells.ShadowSectionCell) TextCell(org.telegram.ui.Cells.TextCell) PullForegroundDrawable(org.telegram.ui.Components.PullForegroundDrawable) DialogsActivity(org.telegram.ui.DialogsActivity) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) CombinedDrawable(org.telegram.ui.Components.CombinedDrawable) PorterDuff(android.graphics.PorterDuff) ConnectionsManager(org.telegram.tgnet.ConnectionsManager) ViewGroup(android.view.ViewGroup) UserConfig(org.telegram.messenger.UserConfig) TextView(android.widget.TextView) PorterDuffColorFilter(android.graphics.PorterDuffColorFilter) Context(android.content.Context) Theme(org.telegram.ui.ActionBar.Theme) ViewPager(androidx.viewpager.widget.ViewPager) SystemClock(android.os.SystemClock) LocaleController(org.telegram.messenger.LocaleController) HeaderCell(org.telegram.ui.Cells.HeaderCell) TextInfoPrivacyCell(org.telegram.ui.Cells.TextInfoPrivacyCell) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) TLRPC(org.telegram.tgnet.TLRPC) ActionBar(org.telegram.ui.ActionBar.ActionBar) DialogMeUrlCell(org.telegram.ui.Cells.DialogMeUrlCell) TLObject(org.telegram.tgnet.TLObject) SharedConfig(org.telegram.messenger.SharedConfig) DialogsEmptyCell(org.telegram.ui.Cells.DialogsEmptyCell) BuildVars(org.telegram.messenger.BuildVars) Build(android.os.Build) DialogCell(org.telegram.ui.Cells.DialogCell) DialogObject(org.telegram.messenger.DialogObject) UserCell(org.telegram.ui.Cells.UserCell) R(org.telegram.messenger.R) LayoutHelper(org.telegram.ui.Components.LayoutHelper) FileLog(org.telegram.messenger.FileLog) FlickerLoadingView(org.telegram.ui.Components.FlickerLoadingView) MessagesController(org.telegram.messenger.MessagesController) Gravity(android.view.Gravity) SharedPreferences(android.content.SharedPreferences) TypedValue(android.util.TypedValue) ContactsController(org.telegram.messenger.ContactsController) Collections(java.util.Collections) RecyclerListView(org.telegram.ui.Components.RecyclerListView) HeaderCell(org.telegram.ui.Cells.HeaderCell) TextCell(org.telegram.ui.Cells.TextCell) DialogCell(org.telegram.ui.Cells.DialogCell) DialogsEmptyCell(org.telegram.ui.Cells.DialogsEmptyCell) TextView(android.widget.TextView) FlickerLoadingView(org.telegram.ui.Components.FlickerLoadingView) UserCell(org.telegram.ui.Cells.UserCell) Rect(android.graphics.Rect) ShadowSectionCell(org.telegram.ui.Cells.ShadowSectionCell) SharedPreferences(android.content.SharedPreferences) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) PullForegroundDrawable(org.telegram.ui.Components.PullForegroundDrawable) CombinedDrawable(org.telegram.ui.Components.CombinedDrawable) TextInfoPrivacyCell(org.telegram.ui.Cells.TextInfoPrivacyCell) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) FlickerLoadingView(org.telegram.ui.Components.FlickerLoadingView) RecyclerListView(org.telegram.ui.Components.RecyclerListView) DialogMeUrlCell(org.telegram.ui.Cells.DialogMeUrlCell) ColorDrawable(android.graphics.drawable.ColorDrawable) FrameLayout(android.widget.FrameLayout) CombinedDrawable(org.telegram.ui.Components.CombinedDrawable) ArchiveHintCell(org.telegram.ui.Cells.ArchiveHintCell) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Example 2 with TextInfoPrivacyCell

use of org.telegram.ui.Cells.TextInfoPrivacyCell in project Telegram-FOSS by Telegram-FOSS-Team.

the class ThemeSetUrlActivity method createView.

@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    if (creatingNewTheme) {
        actionBar.setTitle(LocaleController.getString("NewThemeTitle", R.string.NewThemeTitle));
    } else {
        actionBar.setTitle(LocaleController.getString("EditThemeTitle", R.string.EditThemeTitle));
    }
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {

        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            } else if (id == done_button) {
                saveTheme();
            }
        }
    });
    ActionBarMenu menu = actionBar.createMenu();
    doneButton = menu.addItem(done_button, LocaleController.getString("Done", R.string.Done).toUpperCase());
    fragmentView = new LinearLayout(context);
    fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
    LinearLayout linearLayout = (LinearLayout) fragmentView;
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    fragmentView.setOnTouchListener((v, event) -> true);
    linearLayoutTypeContainer = new LinearLayout(context);
    linearLayoutTypeContainer.setOrientation(LinearLayout.VERTICAL);
    linearLayoutTypeContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
    linearLayout.addView(linearLayoutTypeContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    headerCell = new HeaderCell(context, 23);
    headerCell.setText(LocaleController.getString("Info", R.string.Info));
    linearLayoutTypeContainer.addView(headerCell);
    nameField = new EditTextBoldCursor(context);
    nameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    nameField.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
    nameField.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    nameField.setMaxLines(1);
    nameField.setLines(1);
    nameField.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
    nameField.setBackgroundDrawable(null);
    nameField.setPadding(0, 0, 0, 0);
    nameField.setSingleLine(true);
    InputFilter[] inputFilters = new InputFilter[1];
    inputFilters[0] = new InputFilter.LengthFilter(128);
    nameField.setFilters(inputFilters);
    nameField.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
    nameField.setImeOptions(EditorInfo.IME_ACTION_DONE);
    nameField.setHint(LocaleController.getString("ThemeNamePlaceholder", R.string.ThemeNamePlaceholder));
    nameField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    nameField.setCursorSize(AndroidUtilities.dp(20));
    nameField.setCursorWidth(1.5f);
    linearLayoutTypeContainer.addView(nameField, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50, 23, 0, 23, 0));
    nameField.setOnEditorActionListener((textView, i, keyEvent) -> {
        if (i == EditorInfo.IME_ACTION_DONE) {
            AndroidUtilities.hideKeyboard(nameField);
            return true;
        }
        return false;
    });
    divider = new View(context) {

        @Override
        protected void onDraw(Canvas canvas) {
            canvas.drawLine(LocaleController.isRTL ? 0 : AndroidUtilities.dp(20), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(20) : 0), getMeasuredHeight() - 1, Theme.dividerPaint);
        }
    };
    linearLayoutTypeContainer.addView(divider, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 1));
    LinearLayout linkContainer = new LinearLayout(context);
    linkContainer.setOrientation(LinearLayout.HORIZONTAL);
    linearLayoutTypeContainer.addView(linkContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50, 23, 0, 23, 0));
    editText = new EditTextBoldCursor(context);
    editText.setText(getMessagesController().linkPrefix + "/addtheme/");
    editText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    editText.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
    editText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    editText.setMaxLines(1);
    editText.setLines(1);
    editText.setEnabled(false);
    editText.setBackgroundDrawable(null);
    editText.setPadding(0, 0, 0, 0);
    editText.setSingleLine(true);
    editText.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
    editText.setImeOptions(EditorInfo.IME_ACTION_DONE);
    linkContainer.addView(editText, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 50));
    linkField = new EditTextBoldCursor(context);
    linkField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    linkField.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
    linkField.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    linkField.setMaxLines(1);
    linkField.setLines(1);
    linkField.setBackgroundDrawable(null);
    linkField.setPadding(0, 0, 0, 0);
    linkField.setSingleLine(true);
    linkField.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
    linkField.setImeOptions(EditorInfo.IME_ACTION_DONE);
    linkField.setHint(LocaleController.getString("SetUrlPlaceholder", R.string.SetUrlPlaceholder));
    linkField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    linkField.setCursorSize(AndroidUtilities.dp(20));
    linkField.setCursorWidth(1.5f);
    linkContainer.addView(linkField, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50));
    linkField.setOnEditorActionListener((textView, i, keyEvent) -> {
        if (i == EditorInfo.IME_ACTION_DONE && doneButton != null) {
            doneButton.performClick();
            return true;
        }
        return false;
    });
    linkField.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            if (ignoreCheck) {
                return;
            }
            checkUrl(linkField.getText().toString(), false);
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (creatingNewTheme) {
                return;
            }
            if (linkField.length() > 0) {
                String url = "https://" + getMessagesController().linkPrefix + "/addtheme/" + linkField.getText();
                String text = LocaleController.formatString("ThemeHelpLink", R.string.ThemeHelpLink, url);
                int index = text.indexOf(url);
                SpannableStringBuilder textSpan = new SpannableStringBuilder(text);
                if (index >= 0) {
                    textSpan.setSpan(new LinkSpan(url), index, index + url.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                }
                helpInfoCell.setText(TextUtils.concat(infoText, "\n\n", textSpan));
            } else {
                helpInfoCell.setText(infoText);
            }
        }
    });
    if (creatingNewTheme) {
        linkField.setOnFocusChangeListener((v, hasFocus) -> {
            if (hasFocus) {
                helpInfoCell.setText(AndroidUtilities.replaceTags(LocaleController.getString("ThemeCreateHelp2", R.string.ThemeCreateHelp2)));
            } else {
                helpInfoCell.setText(AndroidUtilities.replaceTags(LocaleController.getString("ThemeCreateHelp", R.string.ThemeCreateHelp)));
            }
        });
    }
    checkInfoCell = new TextInfoPrivacyCell(context);
    checkInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
    checkInfoCell.setVisibility(View.GONE);
    checkInfoCell.setBottomPadding(0);
    linearLayout.addView(checkInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    helpInfoCell = new TextInfoPrivacyCell(context);
    helpInfoCell.getTextView().setMovementMethod(new LinkMovementMethodMy());
    helpInfoCell.getTextView().setHighlightColor(Theme.getColor(Theme.key_windowBackgroundWhiteLinkSelection));
    if (creatingNewTheme) {
        helpInfoCell.setText(AndroidUtilities.replaceTags(LocaleController.getString("ThemeCreateHelp", R.string.ThemeCreateHelp)));
    } else {
        helpInfoCell.setText(infoText = AndroidUtilities.replaceTags(LocaleController.getString("ThemeSetUrlHelp", R.string.ThemeSetUrlHelp)));
    }
    linearLayout.addView(helpInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    if (creatingNewTheme) {
        helpInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
        messagesCell = new ThemePreviewMessagesCell(context, parentLayout, 1);
        linearLayout.addView(messagesCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
        createCell = new TextSettingsCell(context);
        createCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
        createCell.setText(LocaleController.getString("UseDifferentTheme", R.string.UseDifferentTheme), false);
        linearLayout.addView(createCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
        createCell.setOnClickListener(v -> {
            if (getParentActivity() == null) {
                return;
            }
            BottomSheet.Builder builder = new BottomSheet.Builder(getParentActivity(), false);
            builder.setApplyBottomPadding(false);
            LinearLayout container = new LinearLayout(context);
            container.setOrientation(LinearLayout.VERTICAL);
            TextView titleView = new TextView(context);
            titleView.setText(LocaleController.getString("ChooseTheme", R.string.ChooseTheme));
            titleView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
            titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
            titleView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            container.addView(titleView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 22, 12, 22, 4));
            titleView.setOnTouchListener((v2, event) -> true);
            builder.setCustomView(container);
            ArrayList<Theme.ThemeInfo> themes = new ArrayList<>();
            for (int a = 0, N = Theme.themes.size(); a < N; a++) {
                Theme.ThemeInfo themeInfo = Theme.themes.get(a);
                if (themeInfo.info != null && themeInfo.info.document == null) {
                    continue;
                }
                themes.add(themeInfo);
            }
            ThemesHorizontalListCell cell = new ThemesHorizontalListCell(context, ThemeActivity.THEME_TYPE_OTHER, themes, new ArrayList<>()) {

                @Override
                protected void updateRows() {
                    builder.getDismissRunnable().run();
                }
            };
            container.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 148, 0, 7, 0, 1));
            cell.scrollToCurrentTheme(fragmentView.getMeasuredWidth(), false);
            showDialog(builder.create());
        });
        createInfoCell = new TextInfoPrivacyCell(context);
        createInfoCell.setText(AndroidUtilities.replaceTags(LocaleController.getString("UseDifferentThemeInfo", R.string.UseDifferentThemeInfo)));
        createInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
        linearLayout.addView(createInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    } else {
        helpInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
    }
    if (info != null) {
        ignoreCheck = true;
        nameField.setText(info.title);
        nameField.setSelection(nameField.length());
        linkField.setText(info.slug);
        linkField.setSelection(linkField.length());
        ignoreCheck = false;
    }
    return fragmentView;
}
Also used : HeaderCell(org.telegram.ui.Cells.HeaderCell) SpannableStringBuilder(android.text.SpannableStringBuilder) ArrayList(java.util.ArrayList) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) TextView(android.widget.TextView) EditTextBoldCursor(org.telegram.ui.Components.EditTextBoldCursor) ActionBar(org.telegram.ui.ActionBar.ActionBar) InputFilter(android.text.InputFilter) ThemePreviewMessagesCell(org.telegram.ui.Cells.ThemePreviewMessagesCell) Canvas(android.graphics.Canvas) TextInfoPrivacyCell(org.telegram.ui.Cells.TextInfoPrivacyCell) ThemesHorizontalListCell(org.telegram.ui.Cells.ThemesHorizontalListCell) ActionBarMenu(org.telegram.ui.ActionBar.ActionBarMenu) View(android.view.View) TextView(android.widget.TextView) TextPaint(android.text.TextPaint) TextSettingsCell(org.telegram.ui.Cells.TextSettingsCell) Theme(org.telegram.ui.ActionBar.Theme) BottomSheet(org.telegram.ui.ActionBar.BottomSheet) LinearLayout(android.widget.LinearLayout) SpannableStringBuilder(android.text.SpannableStringBuilder)

Example 3 with TextInfoPrivacyCell

use of org.telegram.ui.Cells.TextInfoPrivacyCell in project Telegram-FOSS by Telegram-FOSS-Team.

the class PassportActivity method createEmailInterface.

private void createEmailInterface(Context context) {
    actionBar.setTitle(LocaleController.getString("PassportEmail", R.string.PassportEmail));
    if (!TextUtils.isEmpty(currentEmail)) {
        TextSettingsCell settingsCell1 = new TextSettingsCell(context);
        settingsCell1.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
        settingsCell1.setBackgroundDrawable(Theme.getSelectorDrawable(true));
        settingsCell1.setText(LocaleController.formatString("PassportPhoneUseSame", R.string.PassportPhoneUseSame, currentEmail), false);
        linearLayout2.addView(settingsCell1, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
        settingsCell1.setOnClickListener(v -> {
            useCurrentValue = true;
            doneItem.callOnClick();
            useCurrentValue = false;
        });
        bottomCell = new TextInfoPrivacyCell(context);
        bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
        bottomCell.setText(LocaleController.getString("PassportPhoneUseSameEmailInfo", R.string.PassportPhoneUseSameEmailInfo));
        linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    }
    inputFields = new EditTextBoldCursor[1];
    for (int a = 0; a < 1; a++) {
        ViewGroup container = new FrameLayout(context);
        linearLayout2.addView(container, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50));
        container.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
        inputFields[a] = new EditTextBoldCursor(context);
        inputFields[a].setTag(a);
        inputFields[a].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
        inputFields[a].setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
        inputFields[a].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
        inputFields[a].setBackgroundDrawable(null);
        inputFields[a].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
        inputFields[a].setCursorSize(AndroidUtilities.dp(20));
        inputFields[a].setCursorWidth(1.5f);
        inputFields[a].setInputType(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
        inputFields[a].setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
        inputFields[a].setHint(LocaleController.getString("PaymentShippingEmailPlaceholder", R.string.PaymentShippingEmailPlaceholder));
        if (currentTypeValue != null && currentTypeValue.plain_data instanceof TLRPC.TL_securePlainEmail) {
            TLRPC.TL_securePlainEmail securePlainEmail = (TLRPC.TL_securePlainEmail) currentTypeValue.plain_data;
            if (!TextUtils.isEmpty(securePlainEmail.email)) {
                inputFields[a].setText(securePlainEmail.email);
            }
        }
        inputFields[a].setSelection(inputFields[a].length());
        inputFields[a].setPadding(0, 0, 0, AndroidUtilities.dp(6));
        inputFields[a].setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
        container.addView(inputFields[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 21, 12, 21, 6));
        inputFields[a].setOnEditorActionListener((textView, i, keyEvent) -> {
            if (i == EditorInfo.IME_ACTION_DONE || i == EditorInfo.IME_ACTION_NEXT) {
                doneItem.callOnClick();
                return true;
            }
            return false;
        });
    }
    bottomCell = new TextInfoPrivacyCell(context);
    bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
    bottomCell.setText(LocaleController.getString("PassportEmailUploadInfo", R.string.PassportEmailUploadInfo));
    linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
}
Also used : TextSettingsCell(org.telegram.ui.Cells.TextSettingsCell) ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) TextInfoPrivacyCell(org.telegram.ui.Cells.TextInfoPrivacyCell) EditTextBoldCursor(org.telegram.ui.Components.EditTextBoldCursor) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) TLRPC(org.telegram.tgnet.TLRPC)

Example 4 with TextInfoPrivacyCell

use of org.telegram.ui.Cells.TextInfoPrivacyCell in project Telegram-FOSS by Telegram-FOSS-Team.

the class ThemeActivity method updateSunTime.

private void updateSunTime(Location lastKnownLocation, boolean forceUpdate) {
    LocationManager locationManager = (LocationManager) ApplicationLoader.applicationContext.getSystemService(Context.LOCATION_SERVICE);
    if (Build.VERSION.SDK_INT >= 23) {
        Activity activity = getParentActivity();
        if (activity != null) {
            if (activity.checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                activity.requestPermissions(new String[] { Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION }, 2);
                return;
            }
        }
    }
    if (getParentActivity() != null) {
        if (!getParentActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS)) {
            return;
        }
        try {
            LocationManager lm = (LocationManager) ApplicationLoader.applicationContext.getSystemService(Context.LOCATION_SERVICE);
            if (!lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setTitle(LocaleController.getString("GpsDisabledAlertTitle", R.string.GpsDisabledAlertTitle));
                builder.setMessage(LocaleController.getString("GpsDisabledAlertText", R.string.GpsDisabledAlertText));
                builder.setPositiveButton(LocaleController.getString("ConnectingToProxyEnable", R.string.ConnectingToProxyEnable), (dialog, id) -> {
                    if (getParentActivity() == null) {
                        return;
                    }
                    try {
                        getParentActivity().startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
                    } catch (Exception ignore) {
                    }
                });
                builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                showDialog(builder.create());
                return;
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
    }
    try {
        lastKnownLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
        if (lastKnownLocation == null) {
            lastKnownLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
        }
        if (lastKnownLocation == null) {
            lastKnownLocation = locationManager.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER);
        }
    } catch (Exception e) {
        FileLog.e(e);
    }
    if (lastKnownLocation == null || forceUpdate) {
        startLocationUpdate();
        if (lastKnownLocation == null) {
            return;
        }
    }
    Theme.autoNightLocationLatitude = lastKnownLocation.getLatitude();
    Theme.autoNightLocationLongitude = lastKnownLocation.getLongitude();
    int[] time = SunDate.calculateSunriseSunset(Theme.autoNightLocationLatitude, Theme.autoNightLocationLongitude);
    Theme.autoNightSunriseTime = time[0];
    Theme.autoNightSunsetTime = time[1];
    Theme.autoNightCityName = null;
    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(System.currentTimeMillis());
    Theme.autoNightLastSunCheckDay = calendar.get(Calendar.DAY_OF_MONTH);
    Utilities.globalQueue.postRunnable(() -> {
        String name;
        try {
            Geocoder gcd = new Geocoder(ApplicationLoader.applicationContext, Locale.getDefault());
            List<Address> addresses = gcd.getFromLocation(Theme.autoNightLocationLatitude, Theme.autoNightLocationLongitude, 1);
            if (addresses.size() > 0) {
                name = addresses.get(0).getLocality();
            } else {
                name = null;
            }
        } catch (Exception ignore) {
            name = null;
        }
        final String nameFinal = name;
        AndroidUtilities.runOnUIThread(() -> {
            Theme.autoNightCityName = nameFinal;
            if (Theme.autoNightCityName == null) {
                Theme.autoNightCityName = String.format("(%.06f, %.06f)", Theme.autoNightLocationLatitude, Theme.autoNightLocationLongitude);
            }
            Theme.saveAutoNightThemeConfig();
            if (listView != null) {
                RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findViewHolderForAdapterPosition(scheduleUpdateLocationRow);
                if (holder != null && holder.itemView instanceof TextSettingsCell) {
                    ((TextSettingsCell) holder.itemView).setTextAndValue(LocaleController.getString("AutoNightUpdateLocation", R.string.AutoNightUpdateLocation), Theme.autoNightCityName, false);
                }
            }
        });
    });
    RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findViewHolderForAdapterPosition(scheduleLocationInfoRow);
    if (holder != null && holder.itemView instanceof TextInfoPrivacyCell) {
        ((TextInfoPrivacyCell) holder.itemView).setText(getLocationSunString());
    }
    if (Theme.autoNightScheduleByLocation && Theme.selectedAutoNightType == Theme.AUTO_NIGHT_TYPE_SCHEDULED) {
        Theme.checkAutoNightThemeConditions();
    }
}
Also used : LocationManager(android.location.LocationManager) AlertDialog(org.telegram.ui.ActionBar.AlertDialog) Address(android.location.Address) Calendar(java.util.Calendar) Activity(android.app.Activity) Intent(android.content.Intent) TextInfoPrivacyCell(org.telegram.ui.Cells.TextInfoPrivacyCell) RecyclerListView(org.telegram.ui.Components.RecyclerListView) Geocoder(android.location.Geocoder) TextSettingsCell(org.telegram.ui.Cells.TextSettingsCell)

Example 5 with TextInfoPrivacyCell

use of org.telegram.ui.Cells.TextInfoPrivacyCell in project Telegram-FOSS by Telegram-FOSS-Team.

the class PassportActivity method createIdentityInterface.

private void createIdentityInterface(final Context context) {
    languageMap = new HashMap<>();
    try {
        BufferedReader reader = new BufferedReader(new InputStreamReader(context.getResources().getAssets().open("countries.txt")));
        String line;
        while ((line = reader.readLine()) != null) {
            String[] args = line.split(";");
            languageMap.put(args[1], args[2]);
        }
        reader.close();
    } catch (Exception e) {
        FileLog.e(e);
    }
    topErrorCell = new TextInfoPrivacyCell(context);
    topErrorCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow));
    topErrorCell.setPadding(0, AndroidUtilities.dp(7), 0, 0);
    linearLayout2.addView(topErrorCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    checkTopErrorCell(true);
    if (currentDocumentsType != null) {
        headerCell = new HeaderCell(context);
        if (documentOnly) {
            headerCell.setText(LocaleController.getString("PassportDocuments", R.string.PassportDocuments));
        } else {
            headerCell.setText(LocaleController.getString("PassportRequiredDocuments", R.string.PassportRequiredDocuments));
        }
        headerCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
        linearLayout2.addView(headerCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
        frontLayout = new LinearLayout(context);
        frontLayout.setOrientation(LinearLayout.VERTICAL);
        linearLayout2.addView(frontLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
        uploadFrontCell = new TextDetailSettingsCell(context);
        uploadFrontCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
        linearLayout2.addView(uploadFrontCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
        uploadFrontCell.setOnClickListener(v -> {
            uploadingFileType = UPLOADING_TYPE_FRONT;
            openAttachMenu();
        });
        reverseLayout = new LinearLayout(context);
        reverseLayout.setOrientation(LinearLayout.VERTICAL);
        linearLayout2.addView(reverseLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
        boolean divider = currentDocumentsType.selfie_required;
        uploadReverseCell = new TextDetailSettingsCell(context);
        uploadReverseCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
        uploadReverseCell.setTextAndValue(LocaleController.getString("PassportReverseSide", R.string.PassportReverseSide), LocaleController.getString("PassportReverseSideInfo", R.string.PassportReverseSideInfo), divider);
        linearLayout2.addView(uploadReverseCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
        uploadReverseCell.setOnClickListener(v -> {
            uploadingFileType = UPLOADING_TYPE_REVERSE;
            openAttachMenu();
        });
        if (currentDocumentsType.selfie_required) {
            selfieLayout = new LinearLayout(context);
            selfieLayout.setOrientation(LinearLayout.VERTICAL);
            linearLayout2.addView(selfieLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
            uploadSelfieCell = new TextDetailSettingsCell(context);
            uploadSelfieCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
            uploadSelfieCell.setTextAndValue(LocaleController.getString("PassportSelfie", R.string.PassportSelfie), LocaleController.getString("PassportSelfieInfo", R.string.PassportSelfieInfo), currentType.translation_required);
            linearLayout2.addView(uploadSelfieCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
            uploadSelfieCell.setOnClickListener(v -> {
                uploadingFileType = UPLOADING_TYPE_SELFIE;
                openAttachMenu();
            });
        }
        bottomCell = new TextInfoPrivacyCell(context);
        bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
        bottomCell.setText(LocaleController.getString("PassportPersonalUploadInfo", R.string.PassportPersonalUploadInfo));
        linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
        if (currentDocumentsType.translation_required) {
            headerCell = new HeaderCell(context);
            headerCell.setText(LocaleController.getString("PassportTranslation", R.string.PassportTranslation));
            headerCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
            linearLayout2.addView(headerCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
            translationLayout = new LinearLayout(context);
            translationLayout.setOrientation(LinearLayout.VERTICAL);
            linearLayout2.addView(translationLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
            uploadTranslationCell = new TextSettingsCell(context);
            uploadTranslationCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
            linearLayout2.addView(uploadTranslationCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
            uploadTranslationCell.setOnClickListener(v -> {
                uploadingFileType = UPLOADING_TYPE_TRANSLATION;
                openAttachMenu();
            });
            bottomCellTranslation = new TextInfoPrivacyCell(context);
            bottomCellTranslation.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
            if (currentBotId != 0) {
                noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationUploadInfo", R.string.PassportAddTranslationUploadInfo);
            } else {
                if (currentDocumentsType.type instanceof TLRPC.TL_secureValueTypePassport) {
                    noAllTranslationErrorText = LocaleController.getString("PassportAddPassportInfo", R.string.PassportAddPassportInfo);
                } else if (currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeInternalPassport) {
                    noAllTranslationErrorText = LocaleController.getString("PassportAddInternalPassportInfo", R.string.PassportAddInternalPassportInfo);
                } else if (currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeIdentityCard) {
                    noAllTranslationErrorText = LocaleController.getString("PassportAddIdentityCardInfo", R.string.PassportAddIdentityCardInfo);
                } else if (currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense) {
                    noAllTranslationErrorText = LocaleController.getString("PassportAddDriverLicenceInfo", R.string.PassportAddDriverLicenceInfo);
                } else {
                    noAllTranslationErrorText = "";
                }
            }
            CharSequence text = noAllTranslationErrorText;
            if (documentsErrors != null) {
                String errorText;
                if ((errorText = documentsErrors.get("translation_all")) != null) {
                    SpannableStringBuilder stringBuilder = new SpannableStringBuilder(errorText);
                    stringBuilder.append("\n\n");
                    stringBuilder.append(noAllTranslationErrorText);
                    text = stringBuilder;
                    stringBuilder.setSpan(new ForegroundColorSpan(Theme.getColor(Theme.key_windowBackgroundWhiteRedText3)), 0, errorText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                    errorsValues.put("translation_all", "");
                }
            }
            bottomCellTranslation.setText(text);
            linearLayout2.addView(bottomCellTranslation, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
        }
    } else if (Build.VERSION.SDK_INT >= 18) {
        scanDocumentCell = new TextSettingsCell(context);
        scanDocumentCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
        scanDocumentCell.setText(LocaleController.getString("PassportScanPassport", R.string.PassportScanPassport), false);
        linearLayout2.addView(scanDocumentCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
        scanDocumentCell.setOnClickListener(v -> {
            if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
                getParentActivity().requestPermissions(new String[] { Manifest.permission.CAMERA }, 22);
                return;
            }
            CameraScanActivity fragment = new CameraScanActivity(org.telegram.ui.CameraScanActivity.TYPE_MRZ);
            fragment.setDelegate(new CameraScanActivity.CameraScanActivityDelegate() {

                @Override
                public void didFindMrzInfo(MrzRecognizer.Result result) {
                    if (!TextUtils.isEmpty(result.firstName)) {
                        inputFields[FIELD_NAME].setText(result.firstName);
                    }
                    if (!TextUtils.isEmpty(result.middleName)) {
                        inputFields[FIELD_MIDNAME].setText(result.middleName);
                    }
                    if (!TextUtils.isEmpty(result.lastName)) {
                        inputFields[FIELD_SURNAME].setText(result.lastName);
                    }
                    if (result.gender != MrzRecognizer.Result.GENDER_UNKNOWN) {
                        switch(result.gender) {
                            case MrzRecognizer.Result.GENDER_MALE:
                                currentGender = "male";
                                inputFields[FIELD_GENDER].setText(LocaleController.getString("PassportMale", R.string.PassportMale));
                                break;
                            case MrzRecognizer.Result.GENDER_FEMALE:
                                currentGender = "female";
                                inputFields[FIELD_GENDER].setText(LocaleController.getString("PassportFemale", R.string.PassportFemale));
                                break;
                        }
                    }
                    if (!TextUtils.isEmpty(result.nationality)) {
                        currentCitizeship = result.nationality;
                        String country = languageMap.get(currentCitizeship);
                        if (country != null) {
                            inputFields[FIELD_CITIZENSHIP].setText(country);
                        }
                    }
                    if (!TextUtils.isEmpty(result.issuingCountry)) {
                        currentResidence = result.issuingCountry;
                        String country = languageMap.get(currentResidence);
                        if (country != null) {
                            inputFields[FIELD_RESIDENCE].setText(country);
                        }
                    }
                    if (result.birthDay > 0 && result.birthMonth > 0 && result.birthYear > 0) {
                        inputFields[FIELD_BIRTHDAY].setText(String.format(Locale.US, "%02d.%02d.%d", result.birthDay, result.birthMonth, result.birthYear));
                    }
                }
            });
            presentFragment(fragment);
        });
        bottomCell = new TextInfoPrivacyCell(context);
        bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
        bottomCell.setText(LocaleController.getString("PassportScanPassportInfo", R.string.PassportScanPassportInfo));
        linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    }
    headerCell = new HeaderCell(context);
    if (documentOnly) {
        headerCell.setText(LocaleController.getString("PassportDocument", R.string.PassportDocument));
    } else {
        headerCell.setText(LocaleController.getString("PassportPersonal", R.string.PassportPersonal));
    }
    headerCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
    linearLayout2.addView(headerCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    int count = currentDocumentsType != null ? FIELD_IDENTITY_COUNT : FIELD_IDENTITY_NODOC_COUNT;
    inputFields = new EditTextBoldCursor[count];
    for (int a = 0; a < count; a++) {
        final EditTextBoldCursor field = new EditTextBoldCursor(context);
        inputFields[a] = field;
        ViewGroup container = new FrameLayout(context) {

            private StaticLayout errorLayout;

            private float offsetX;

            @Override
            protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
                int width = MeasureSpec.getSize(widthMeasureSpec) - AndroidUtilities.dp(34);
                errorLayout = field.getErrorLayout(width);
                if (errorLayout != null) {
                    int lineCount = errorLayout.getLineCount();
                    if (lineCount > 1) {
                        int height = AndroidUtilities.dp(64) + (errorLayout.getLineBottom(lineCount - 1) - errorLayout.getLineBottom(0));
                        heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
                    }
                    if (LocaleController.isRTL) {
                        float maxW = 0;
                        for (int a = 0; a < lineCount; a++) {
                            float l = errorLayout.getLineLeft(a);
                            if (l != 0) {
                                offsetX = 0;
                                break;
                            }
                            maxW = Math.max(maxW, errorLayout.getLineWidth(a));
                            if (a == lineCount - 1) {
                                offsetX = width - maxW;
                            }
                        }
                    }
                }
                super.onMeasure(widthMeasureSpec, heightMeasureSpec);
            }

            @Override
            protected void onDraw(Canvas canvas) {
                if (errorLayout != null) {
                    canvas.save();
                    canvas.translate(AndroidUtilities.dp(21) + offsetX, field.getLineY() + AndroidUtilities.dp(3));
                    errorLayout.draw(canvas);
                    canvas.restore();
                }
            }
        };
        container.setWillNotDraw(false);
        linearLayout2.addView(container, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 64));
        container.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
        if (a == count - 1) {
            extraBackgroundView = new View(context);
            extraBackgroundView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
            linearLayout2.addView(extraBackgroundView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 6));
        }
        if (documentOnly && currentDocumentsType != null && a < FIELD_CARDNUMBER) {
            container.setVisibility(View.GONE);
            if (extraBackgroundView != null) {
                extraBackgroundView.setVisibility(View.GONE);
            }
        }
        inputFields[a].setTag(a);
        inputFields[a].setSupportRtlHint(true);
        inputFields[a].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
        inputFields[a].setHintColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
        inputFields[a].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
        inputFields[a].setHeaderHintColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader));
        inputFields[a].setTransformHintToHeader(true);
        inputFields[a].setBackgroundDrawable(null);
        inputFields[a].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
        inputFields[a].setCursorSize(AndroidUtilities.dp(20));
        inputFields[a].setCursorWidth(1.5f);
        inputFields[a].setLineColors(Theme.getColor(Theme.key_windowBackgroundWhiteInputField), Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), Theme.getColor(Theme.key_windowBackgroundWhiteRedText3));
        if (a == FIELD_CITIZENSHIP || a == FIELD_RESIDENCE) {
            inputFields[a].setOnTouchListener((v, event) -> {
                if (getParentActivity() == null) {
                    return false;
                }
                if (event.getAction() == MotionEvent.ACTION_UP) {
                    CountrySelectActivity fragment = new CountrySelectActivity(false);
                    fragment.setCountrySelectActivityDelegate((country) -> {
                        int field12 = (Integer) v.getTag();
                        final EditTextBoldCursor editText = inputFields[field12];
                        if (field12 == FIELD_CITIZENSHIP) {
                            currentCitizeship = country.shortname;
                        } else {
                            currentResidence = country.shortname;
                        }
                        editText.setText(country.name);
                    });
                    presentFragment(fragment);
                }
                return true;
            });
            inputFields[a].setInputType(0);
        } else if (a == FIELD_BIRTHDAY || a == FIELD_EXPIRE) {
            inputFields[a].setOnTouchListener((v, event) -> {
                if (getParentActivity() == null) {
                    return false;
                }
                if (event.getAction() == MotionEvent.ACTION_UP) {
                    Calendar calendar = Calendar.getInstance();
                    int year = calendar.get(Calendar.YEAR);
                    int monthOfYear = calendar.get(Calendar.MONTH);
                    int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
                    try {
                        final EditTextBoldCursor field1 = (EditTextBoldCursor) v;
                        int num = (Integer) field1.getTag();
                        int minYear;
                        int maxYear;
                        int currentYearDiff;
                        String title;
                        if (num == FIELD_EXPIRE) {
                            title = LocaleController.getString("PassportSelectExpiredDate", R.string.PassportSelectExpiredDate);
                            minYear = 0;
                            maxYear = 20;
                            currentYearDiff = 0;
                        } else {
                            title = LocaleController.getString("PassportSelectBithdayDate", R.string.PassportSelectBithdayDate);
                            minYear = -120;
                            maxYear = 0;
                            currentYearDiff = -18;
                        }
                        int selectedDay = -1;
                        int selectedMonth = -1;
                        int selectedYear = -1;
                        String[] args = field1.getText().toString().split("\\.");
                        if (args.length == 3) {
                            selectedDay = Utilities.parseInt(args[0]);
                            selectedMonth = Utilities.parseInt(args[1]);
                            selectedYear = Utilities.parseInt(args[2]);
                        }
                        AlertDialog.Builder builder = AlertsCreator.createDatePickerDialog(context, minYear, maxYear, currentYearDiff, selectedDay, selectedMonth, selectedYear, title, num == FIELD_EXPIRE, (year1, month, dayOfMonth1) -> {
                            if (num == FIELD_EXPIRE) {
                                currentExpireDate[0] = year1;
                                currentExpireDate[1] = month + 1;
                                currentExpireDate[2] = dayOfMonth1;
                            }
                            field1.setText(String.format(Locale.US, "%02d.%02d.%d", dayOfMonth1, month + 1, year1));
                        });
                        if (num == FIELD_EXPIRE) {
                            builder.setNegativeButton(LocaleController.getString("PassportSelectNotExpire", R.string.PassportSelectNotExpire), (dialog, which) -> {
                                currentExpireDate[0] = currentExpireDate[1] = currentExpireDate[2] = 0;
                                field1.setText(LocaleController.getString("PassportNoExpireDate", R.string.PassportNoExpireDate));
                            });
                        }
                        showDialog(builder.create());
                    } catch (Exception e) {
                        FileLog.e(e);
                    }
                }
                return true;
            });
            inputFields[a].setInputType(0);
            inputFields[a].setFocusable(false);
        } else if (a == FIELD_GENDER) {
            inputFields[a].setOnTouchListener((v, event) -> {
                if (getParentActivity() == null) {
                    return false;
                }
                if (event.getAction() == MotionEvent.ACTION_UP) {
                    AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                    builder.setTitle(LocaleController.getString("PassportSelectGender", R.string.PassportSelectGender));
                    builder.setItems(new CharSequence[] { LocaleController.getString("PassportMale", R.string.PassportMale), LocaleController.getString("PassportFemale", R.string.PassportFemale) }, (dialogInterface, i) -> {
                        if (i == 0) {
                            currentGender = "male";
                            inputFields[FIELD_GENDER].setText(LocaleController.getString("PassportMale", R.string.PassportMale));
                        } else if (i == 1) {
                            currentGender = "female";
                            inputFields[FIELD_GENDER].setText(LocaleController.getString("PassportFemale", R.string.PassportFemale));
                        }
                    });
                    builder.setPositiveButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                    showDialog(builder.create());
                }
                return true;
            });
            inputFields[a].setInputType(0);
            inputFields[a].setFocusable(false);
        } else {
            inputFields[a].setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
            inputFields[a].setImeOptions(EditorInfo.IME_ACTION_NEXT | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
        }
        String value;
        final String key;
        HashMap<String, String> values;
        switch(a) {
            case FIELD_NAME:
                if (currentType.native_names) {
                    inputFields[a].setHintText(LocaleController.getString("PassportNameLatin", R.string.PassportNameLatin));
                } else {
                    inputFields[a].setHintText(LocaleController.getString("PassportName", R.string.PassportName));
                }
                key = "first_name";
                values = currentValues;
                break;
            case FIELD_MIDNAME:
                if (currentType.native_names) {
                    inputFields[a].setHintText(LocaleController.getString("PassportMidnameLatin", R.string.PassportMidnameLatin));
                } else {
                    inputFields[a].setHintText(LocaleController.getString("PassportMidname", R.string.PassportMidname));
                }
                key = "middle_name";
                values = currentValues;
                break;
            case FIELD_SURNAME:
                if (currentType.native_names) {
                    inputFields[a].setHintText(LocaleController.getString("PassportSurnameLatin", R.string.PassportSurnameLatin));
                } else {
                    inputFields[a].setHintText(LocaleController.getString("PassportSurname", R.string.PassportSurname));
                }
                key = "last_name";
                values = currentValues;
                break;
            case FIELD_BIRTHDAY:
                inputFields[a].setHintText(LocaleController.getString("PassportBirthdate", R.string.PassportBirthdate));
                key = "birth_date";
                values = currentValues;
                break;
            case FIELD_GENDER:
                inputFields[a].setHintText(LocaleController.getString("PassportGender", R.string.PassportGender));
                key = "gender";
                values = currentValues;
                break;
            case FIELD_CITIZENSHIP:
                inputFields[a].setHintText(LocaleController.getString("PassportCitizenship", R.string.PassportCitizenship));
                key = "country_code";
                values = currentValues;
                break;
            case FIELD_RESIDENCE:
                inputFields[a].setHintText(LocaleController.getString("PassportResidence", R.string.PassportResidence));
                key = "residence_country_code";
                values = currentValues;
                break;
            case FIELD_CARDNUMBER:
                inputFields[a].setHintText(LocaleController.getString("PassportDocumentNumber", R.string.PassportDocumentNumber));
                key = "document_no";
                values = currentDocumentValues;
                break;
            case FIELD_EXPIRE:
                inputFields[a].setHintText(LocaleController.getString("PassportExpired", R.string.PassportExpired));
                key = "expiry_date";
                values = currentDocumentValues;
                break;
            default:
                continue;
        }
        setFieldValues(values, inputFields[a], key);
        inputFields[a].setSelection(inputFields[a].length());
        if (a == FIELD_NAME || a == FIELD_SURNAME || a == FIELD_MIDNAME) {
            inputFields[a].addTextChangedListener(new TextWatcher() {

                private boolean ignore;

                @Override
                public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                }

                @Override
                public void onTextChanged(CharSequence s, int start, int before, int count) {
                }

                @Override
                public void afterTextChanged(Editable s) {
                    if (ignore) {
                        return;
                    }
                    int num = (Integer) field.getTag();
                    boolean error = false;
                    for (int a = 0; a < s.length(); a++) {
                        char ch = s.charAt(a);
                        if (!(ch >= '0' && ch <= '9' || ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z' || ch == ' ' || ch == '\'' || ch == ',' || ch == '.' || ch == '&' || ch == '-' || ch == '/')) {
                            error = true;
                            break;
                        }
                    }
                    if (error && !allowNonLatinName) {
                        field.setErrorText(LocaleController.getString("PassportUseLatinOnly", R.string.PassportUseLatinOnly));
                    } else {
                        nonLatinNames[num] = error;
                        checkFieldForError(field, key, s, false);
                    }
                }
            });
        } else {
            inputFields[a].addTextChangedListener(new TextWatcher() {

                @Override
                public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                }

                @Override
                public void onTextChanged(CharSequence s, int start, int before, int count) {
                }

                @Override
                public void afterTextChanged(Editable s) {
                    checkFieldForError(field, key, s, values == currentDocumentValues);
                    int field12 = (Integer) field.getTag();
                    final EditTextBoldCursor editText = inputFields[field12];
                    if (field12 == FIELD_RESIDENCE) {
                        checkNativeFields(true);
                    }
                }
            });
        }
        inputFields[a].setPadding(0, 0, 0, 0);
        inputFields[a].setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
        container.addView(inputFields[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.LEFT | Gravity.TOP, 21, 0, 21, 0));
        inputFields[a].setOnEditorActionListener((textView, i, keyEvent) -> {
            if (i == EditorInfo.IME_ACTION_NEXT) {
                int num = (Integer) textView.getTag();
                num++;
                if (num < inputFields.length) {
                    if (inputFields[num].isFocusable()) {
                        inputFields[num].requestFocus();
                    } else {
                        inputFields[num].dispatchTouchEvent(MotionEvent.obtain(0, 0, MotionEvent.ACTION_UP, 0, 0, 0));
                        textView.clearFocus();
                        AndroidUtilities.hideKeyboard(textView);
                    }
                }
                return true;
            }
            return false;
        });
    }
    sectionCell2 = new ShadowSectionCell(context);
    linearLayout2.addView(sectionCell2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    headerCell = new HeaderCell(context);
    headerCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
    linearLayout2.addView(headerCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    inputExtraFields = new EditTextBoldCursor[FIELD_NATIVE_COUNT];
    for (int a = 0; a < FIELD_NATIVE_COUNT; a++) {
        final EditTextBoldCursor field = new EditTextBoldCursor(context);
        inputExtraFields[a] = field;
        ViewGroup container = new FrameLayout(context) {

            private StaticLayout errorLayout;

            private float offsetX;

            @Override
            protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
                int width = MeasureSpec.getSize(widthMeasureSpec) - AndroidUtilities.dp(34);
                errorLayout = field.getErrorLayout(width);
                if (errorLayout != null) {
                    int lineCount = errorLayout.getLineCount();
                    if (lineCount > 1) {
                        int height = AndroidUtilities.dp(64) + (errorLayout.getLineBottom(lineCount - 1) - errorLayout.getLineBottom(0));
                        heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
                    }
                    if (LocaleController.isRTL) {
                        float maxW = 0;
                        for (int a = 0; a < lineCount; a++) {
                            float l = errorLayout.getLineLeft(a);
                            if (l != 0) {
                                offsetX = 0;
                                break;
                            }
                            maxW = Math.max(maxW, errorLayout.getLineWidth(a));
                            if (a == lineCount - 1) {
                                offsetX = width - maxW;
                            }
                        }
                    }
                }
                super.onMeasure(widthMeasureSpec, heightMeasureSpec);
            }

            @Override
            protected void onDraw(Canvas canvas) {
                if (errorLayout != null) {
                    canvas.save();
                    canvas.translate(AndroidUtilities.dp(21) + offsetX, field.getLineY() + AndroidUtilities.dp(3));
                    errorLayout.draw(canvas);
                    canvas.restore();
                }
            }
        };
        container.setWillNotDraw(false);
        linearLayout2.addView(container, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 64));
        container.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
        if (a == FIELD_NATIVE_COUNT - 1) {
            extraBackgroundView2 = new View(context);
            extraBackgroundView2.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
            linearLayout2.addView(extraBackgroundView2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 6));
        }
        inputExtraFields[a].setTag(a);
        inputExtraFields[a].setSupportRtlHint(true);
        inputExtraFields[a].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
        inputExtraFields[a].setHintColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
        inputExtraFields[a].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
        inputExtraFields[a].setHeaderHintColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader));
        inputExtraFields[a].setTransformHintToHeader(true);
        inputExtraFields[a].setBackgroundDrawable(null);
        inputExtraFields[a].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
        inputExtraFields[a].setCursorSize(AndroidUtilities.dp(20));
        inputExtraFields[a].setCursorWidth(1.5f);
        inputExtraFields[a].setLineColors(Theme.getColor(Theme.key_windowBackgroundWhiteInputField), Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), Theme.getColor(Theme.key_windowBackgroundWhiteRedText3));
        inputExtraFields[a].setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
        inputExtraFields[a].setImeOptions(EditorInfo.IME_ACTION_NEXT | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
        String value;
        final String key;
        HashMap<String, String> values;
        switch(a) {
            case FIELD_NATIVE_NAME:
                key = "first_name_native";
                values = currentValues;
                break;
            case FIELD_NATIVE_MIDNAME:
                key = "middle_name_native";
                values = currentValues;
                break;
            case FIELD_NATIVE_SURNAME:
                key = "last_name_native";
                values = currentValues;
                break;
            default:
                continue;
        }
        setFieldValues(values, inputExtraFields[a], key);
        inputExtraFields[a].setSelection(inputExtraFields[a].length());
        if (a == FIELD_NATIVE_NAME || a == FIELD_NATIVE_SURNAME || a == FIELD_NATIVE_MIDNAME) {
            inputExtraFields[a].addTextChangedListener(new TextWatcher() {

                private boolean ignore;

                @Override
                public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                }

                @Override
                public void onTextChanged(CharSequence s, int start, int before, int count) {
                }

                @Override
                public void afterTextChanged(Editable s) {
                    if (ignore) {
                        return;
                    }
                    checkFieldForError(field, key, s, false);
                }
            });
        }
        inputExtraFields[a].setPadding(0, 0, 0, 0);
        inputExtraFields[a].setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
        container.addView(inputExtraFields[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.LEFT | Gravity.TOP, 21, 0, 21, 0));
        inputExtraFields[a].setOnEditorActionListener((textView, i, keyEvent) -> {
            if (i == EditorInfo.IME_ACTION_NEXT) {
                int num = (Integer) textView.getTag();
                num++;
                if (num < inputExtraFields.length) {
                    if (inputExtraFields[num].isFocusable()) {
                        inputExtraFields[num].requestFocus();
                    } else {
                        inputExtraFields[num].dispatchTouchEvent(MotionEvent.obtain(0, 0, MotionEvent.ACTION_UP, 0, 0, 0));
                        textView.clearFocus();
                        AndroidUtilities.hideKeyboard(textView);
                    }
                }
                return true;
            }
            return false;
        });
    }
    nativeInfoCell = new TextInfoPrivacyCell(context);
    linearLayout2.addView(nativeInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    if ((currentBotId != 0 || currentDocumentsType == null) && currentTypeValue != null && !documentOnly || currentDocumentsTypeValue != null) {
        if (currentDocumentsTypeValue != null) {
            addDocumentViews(currentDocumentsTypeValue.files);
            if (currentDocumentsTypeValue.front_side instanceof TLRPC.TL_secureFile) {
                addDocumentViewInternal((TLRPC.TL_secureFile) currentDocumentsTypeValue.front_side, UPLOADING_TYPE_FRONT);
            }
            if (currentDocumentsTypeValue.reverse_side instanceof TLRPC.TL_secureFile) {
                addDocumentViewInternal((TLRPC.TL_secureFile) currentDocumentsTypeValue.reverse_side, UPLOADING_TYPE_REVERSE);
            }
            if (currentDocumentsTypeValue.selfie instanceof TLRPC.TL_secureFile) {
                addDocumentViewInternal((TLRPC.TL_secureFile) currentDocumentsTypeValue.selfie, UPLOADING_TYPE_SELFIE);
            }
            addTranslationDocumentViews(currentDocumentsTypeValue.translation);
        }
        TextSettingsCell settingsCell1 = new TextSettingsCell(context);
        settingsCell1.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText3));
        settingsCell1.setBackgroundDrawable(Theme.getSelectorDrawable(true));
        if (currentDocumentsType == null) {
            settingsCell1.setText(LocaleController.getString("PassportDeleteInfo", R.string.PassportDeleteInfo), false);
        } else {
            settingsCell1.setText(LocaleController.getString("PassportDeleteDocument", R.string.PassportDeleteDocument), false);
        }
        linearLayout2.addView(settingsCell1, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
        settingsCell1.setOnClickListener(v -> createDocumentDeleteAlert());
        nativeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
        sectionCell = new ShadowSectionCell(context);
        sectionCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
        linearLayout2.addView(sectionCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    } else {
        nativeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
    }
    updateInterfaceStringsForDocumentType();
    checkNativeFields(false);
}
Also used : RandomAccessFile(java.io.RandomAccessFile) Arrays(java.util.Arrays) Bundle(android.os.Bundle) Uri(android.net.Uri) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) EditTextBoldCursor(org.telegram.ui.Components.EditTextBoldCursor) Drawable(android.graphics.drawable.Drawable) AvatarDrawable(org.telegram.ui.Components.AvatarDrawable) Manifest(android.Manifest) RSAPublicKey(java.security.interfaces.RSAPublicKey) MediaStore(android.provider.MediaStore) Canvas(android.graphics.Canvas) TimerTask(java.util.TimerTask) ForegroundColorSpan(android.text.style.ForegroundColorSpan) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) X509EncodedKeySpec(java.security.spec.X509EncodedKeySpec) NotificationCenter(org.telegram.messenger.NotificationCenter) TextPaint(android.text.TextPaint) PorterDuffColorFilter(android.graphics.PorterDuffColorFilter) Paint(android.graphics.Paint) InputFilter(android.text.InputFilter) RadialProgress(org.telegram.ui.Components.RadialProgress) TextWatcher(android.text.TextWatcher) FileLoader(org.telegram.messenger.FileLoader) SlideView(org.telegram.ui.Components.SlideView) RequestDelegate(org.telegram.tgnet.RequestDelegate) Dialog(android.app.Dialog) URLSpanNoUnderline(org.telegram.ui.Components.URLSpanNoUnderline) AlertsCreator(org.telegram.ui.Components.AlertsCreator) Editable(android.text.Editable) TextInfoPrivacyCell(org.telegram.ui.Cells.TextInfoPrivacyCell) ArrayList(java.util.ArrayList) SpannableStringBuilder(android.text.SpannableStringBuilder) Calendar(java.util.Calendar) TextDetailSettingsCell(org.telegram.ui.Cells.TextDetailSettingsCell) TLRPC(org.telegram.tgnet.TLRPC) Toast(android.widget.Toast) PhoneFormat(org.telegram.PhoneFormat.PhoneFormat) Menu(android.view.Menu) BuildConfig(org.telegram.messenger.BuildConfig) TextSettingsCell(org.telegram.ui.Cells.TextSettingsCell) HintEditText(org.telegram.ui.Components.HintEditText) ActionBarMenu(org.telegram.ui.ActionBar.ActionBarMenu) R(org.telegram.messenger.R) TextUtils(android.text.TextUtils) InputStreamReader(java.io.InputStreamReader) File(java.io.File) Gravity(android.view.Gravity) UserObject(org.telegram.messenger.UserObject) SharedPreferences(android.content.SharedPreferences) TypedValue(android.util.TypedValue) ScrollView(android.widget.ScrollView) BufferedReader(java.io.BufferedReader) AlertDialog(org.telegram.ui.ActionBar.AlertDialog) ThemeDescription(org.telegram.ui.ActionBar.ThemeDescription) Rect(android.graphics.Rect) ActionMode(android.view.ActionMode) LinearLayout(android.widget.LinearLayout) ActionBarMenuItem(org.telegram.ui.ActionBar.ActionBarMenuItem) PackageManager(android.content.pm.PackageManager) Spannable(android.text.Spannable) AndroidUtilities(org.telegram.messenger.AndroidUtilities) ClickableSpan(android.text.style.ClickableSpan) Timer(java.util.Timer) Animator(android.animation.Animator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) CheckBoxCell(org.telegram.ui.Cells.CheckBoxCell) MrzRecognizer(org.telegram.messenger.MrzRecognizer) ShadowSectionCell(org.telegram.ui.Cells.ShadowSectionCell) JSONObject(org.json.JSONObject) ApplicationLoader(org.telegram.messenger.ApplicationLoader) Locale(java.util.Locale) MediaController(org.telegram.messenger.MediaController) View(android.view.View) ImageLoader(org.telegram.messenger.ImageLoader) ContextProgressView(org.telegram.ui.Components.ContextProgressView) Utilities(org.telegram.messenger.Utilities) EmptyTextProgressView(org.telegram.ui.Components.EmptyTextProgressView) ObjectAnimator(android.animation.ObjectAnimator) InputType(android.text.InputType) BaseFragment(org.telegram.ui.ActionBar.BaseFragment) PorterDuff(android.graphics.PorterDuff) SendMessagesHelper(org.telegram.messenger.SendMessagesHelper) ConnectionsManager(org.telegram.tgnet.ConnectionsManager) ViewGroup(android.view.ViewGroup) KeyFactory(java.security.KeyFactory) UserConfig(org.telegram.messenger.UserConfig) TextView(android.widget.TextView) FileProvider(androidx.core.content.FileProvider) EditorInfo(android.view.inputmethod.EditorInfo) Typeface(android.graphics.Typeface) Context(android.content.Context) StaticLayout(android.text.StaticLayout) Spanned(android.text.Spanned) KeyEvent(android.view.KeyEvent) Theme(org.telegram.ui.ActionBar.Theme) Intent(android.content.Intent) LocaleController(org.telegram.messenger.LocaleController) HashMap(java.util.HashMap) HeaderCell(org.telegram.ui.Cells.HeaderCell) PackageInfo(android.content.pm.PackageInfo) Cipher(javax.crypto.Cipher) MenuItem(android.view.MenuItem) SuppressLint(android.annotation.SuppressLint) PhoneNumberUtils(android.telephony.PhoneNumberUtils) MotionEvent(android.view.MotionEvent) SRPHelper(org.telegram.messenger.SRPHelper) SecureDocument(org.telegram.messenger.SecureDocument) TelephonyManager(android.telephony.TelephonyManager) ActionBar(org.telegram.ui.ActionBar.ActionBar) TLObject(org.telegram.tgnet.TLObject) AnimatorSet(android.animation.AnimatorSet) MessageObject(org.telegram.messenger.MessageObject) SharedConfig(org.telegram.messenger.SharedConfig) PasswordTransformationMethod(android.text.method.PasswordTransformationMethod) BuildVars(org.telegram.messenger.BuildVars) Build(android.os.Build) DownloadController(org.telegram.messenger.DownloadController) DialogInterface(android.content.DialogInterface) Browser(org.telegram.messenger.browser.Browser) Iterator(java.util.Iterator) BackupImageView(org.telegram.ui.Components.BackupImageView) LayoutHelper(org.telegram.ui.Components.LayoutHelper) FileLog(org.telegram.messenger.FileLog) SecureDocumentKey(org.telegram.messenger.SecureDocumentKey) ChatAttachAlert(org.telegram.ui.Components.ChatAttachAlert) Bitmap(android.graphics.Bitmap) Base64(android.util.Base64) Vibrator(android.os.Vibrator) Comparator(java.util.Comparator) Activity(android.app.Activity) Collections(java.util.Collections) JSONArray(org.json.JSONArray) AlertDialog(org.telegram.ui.ActionBar.AlertDialog) HeaderCell(org.telegram.ui.Cells.HeaderCell) SpannableStringBuilder(android.text.SpannableStringBuilder) TLRPC(org.telegram.tgnet.TLRPC) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) EditTextBoldCursor(org.telegram.ui.Components.EditTextBoldCursor) InputStreamReader(java.io.InputStreamReader) TextDetailSettingsCell(org.telegram.ui.Cells.TextDetailSettingsCell) ForegroundColorSpan(android.text.style.ForegroundColorSpan) ShadowSectionCell(org.telegram.ui.Cells.ShadowSectionCell) ViewGroup(android.view.ViewGroup) Canvas(android.graphics.Canvas) Calendar(java.util.Calendar) TextInfoPrivacyCell(org.telegram.ui.Cells.TextInfoPrivacyCell) StaticLayout(android.text.StaticLayout) ImageView(android.widget.ImageView) SlideView(org.telegram.ui.Components.SlideView) ScrollView(android.widget.ScrollView) View(android.view.View) ContextProgressView(org.telegram.ui.Components.ContextProgressView) EmptyTextProgressView(org.telegram.ui.Components.EmptyTextProgressView) TextView(android.widget.TextView) BackupImageView(org.telegram.ui.Components.BackupImageView) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) TextSettingsCell(org.telegram.ui.Cells.TextSettingsCell) FrameLayout(android.widget.FrameLayout) BufferedReader(java.io.BufferedReader) LinearLayout(android.widget.LinearLayout) SpannableStringBuilder(android.text.SpannableStringBuilder)

Aggregations

TextInfoPrivacyCell (org.telegram.ui.Cells.TextInfoPrivacyCell)21 View (android.view.View)16 HeaderCell (org.telegram.ui.Cells.HeaderCell)16 ViewGroup (android.view.ViewGroup)14 LinearLayout (android.widget.LinearLayout)14 FrameLayout (android.widget.FrameLayout)13 TextView (android.widget.TextView)13 ActionBar (org.telegram.ui.ActionBar.ActionBar)13 Editable (android.text.Editable)12 TextWatcher (android.text.TextWatcher)12 ArrayList (java.util.ArrayList)12 TLRPC (org.telegram.tgnet.TLRPC)12 TextSettingsCell (org.telegram.ui.Cells.TextSettingsCell)12 EditTextBoldCursor (org.telegram.ui.Components.EditTextBoldCursor)12 SuppressLint (android.annotation.SuppressLint)11 ScrollView (android.widget.ScrollView)11 AndroidUtilities (org.telegram.messenger.AndroidUtilities)10 Theme (org.telegram.ui.ActionBar.Theme)10 ShadowSectionCell (org.telegram.ui.Cells.ShadowSectionCell)10 Context (android.content.Context)9