Search in sources :

Example 76 with AlertDialog

use of org.telegram.ui.ActionBar.AlertDialog in project Telegram-FOSS by Telegram-FOSS-Team.

the class SessionsActivity method createView.

@Override
public View createView(Context context) {
    globalFlickerLoadingView = new FlickerLoadingView(context);
    globalFlickerLoadingView.setIsSingleCell(true);
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    if (currentType == 0) {
        actionBar.setTitle(LocaleController.getString("Devices", R.string.Devices));
    } else {
        actionBar.setTitle(LocaleController.getString("WebSessionsTitle", R.string.WebSessionsTitle));
    }
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {

        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });
    listAdapter = new ListAdapter(context);
    fragmentView = new FrameLayout(context);
    FrameLayout frameLayout = (FrameLayout) fragmentView;
    frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
    emptyLayout = new LinearLayout(context);
    emptyLayout.setOrientation(LinearLayout.VERTICAL);
    emptyLayout.setGravity(Gravity.CENTER);
    emptyLayout.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
    emptyLayout.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, AndroidUtilities.displaySize.y - ActionBar.getCurrentActionBarHeight()));
    imageView = new ImageView(context);
    if (currentType == 0) {
        imageView.setImageResource(R.drawable.devices);
    } else {
        imageView.setImageResource(R.drawable.no_apps);
    }
    imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_sessions_devicesImage), PorterDuff.Mode.MULTIPLY));
    emptyLayout.addView(imageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    textView1 = new TextView(context);
    textView1.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
    textView1.setGravity(Gravity.CENTER);
    textView1.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 17);
    textView1.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    if (currentType == 0) {
        textView1.setText(LocaleController.getString("NoOtherSessions", R.string.NoOtherSessions));
    } else {
        textView1.setText(LocaleController.getString("NoOtherWebSessions", R.string.NoOtherWebSessions));
    }
    emptyLayout.addView(textView1, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 0, 16, 0, 0));
    textView2 = new TextView(context);
    textView2.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
    textView2.setGravity(Gravity.CENTER);
    textView2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 17);
    textView2.setPadding(AndroidUtilities.dp(20), 0, AndroidUtilities.dp(20), 0);
    if (currentType == 0) {
        textView2.setText(LocaleController.getString("NoOtherSessionsInfo", R.string.NoOtherSessionsInfo));
    } else {
        textView2.setText(LocaleController.getString("NoOtherWebSessionsInfo", R.string.NoOtherWebSessionsInfo));
    }
    emptyLayout.addView(textView2, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 0, 14, 0, 0));
    emptyView = new EmptyTextProgressView(context);
    emptyView.showProgress();
    frameLayout.addView(emptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER));
    listView = new RecyclerListView(context);
    listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    listView.setVerticalScrollBarEnabled(false);
    listView.setEmptyView(emptyView);
    listView.setAnimateEmptyView(true, 0);
    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener((view, position) -> {
        if (position == ttlRow) {
            if (getParentActivity() == null) {
                return;
            }
            int selected;
            if (ttlDays <= 7) {
                selected = 0;
            } else if (ttlDays <= 93) {
                selected = 1;
            } else if (ttlDays <= 183) {
                selected = 2;
            } else {
                selected = 3;
            }
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            builder.setTitle(LocaleController.getString("SessionsSelfDestruct", R.string.SessionsSelfDestruct));
            String[] items = new String[] { LocaleController.formatPluralString("Weeks", 1), LocaleController.formatPluralString("Months", 3), LocaleController.formatPluralString("Months", 6), LocaleController.formatPluralString("Years", 1) };
            final LinearLayout linearLayout = new LinearLayout(getParentActivity());
            linearLayout.setOrientation(LinearLayout.VERTICAL);
            builder.setView(linearLayout);
            for (int a = 0; a < items.length; a++) {
                RadioColorCell cell = new RadioColorCell(getParentActivity());
                cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0);
                cell.setTag(a);
                cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked));
                cell.setTextAndValue(items[a], selected == a);
                linearLayout.addView(cell);
                cell.setOnClickListener(v -> {
                    builder.getDismissRunnable().run();
                    Integer which = (Integer) v.getTag();
                    int value = 0;
                    if (which == 0) {
                        value = 7;
                    } else if (which == 1) {
                        value = 90;
                    } else if (which == 2) {
                        value = 183;
                    } else if (which == 3) {
                        value = 365;
                    }
                    final TLRPC.TL_account_setAuthorizationTTL req = new TLRPC.TL_account_setAuthorizationTTL();
                    req.authorization_ttl_days = value;
                    ttlDays = value;
                    if (listAdapter != null) {
                        listAdapter.notifyDataSetChanged();
                    }
                    getConnectionsManager().sendRequest(req, (response, error) -> {
                    });
                });
            }
            builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
            showDialog(builder.create());
        } else if (position == terminateAllSessionsRow) {
            if (getParentActivity() == null) {
                return;
            }
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            String buttonText;
            if (currentType == 0) {
                builder.setMessage(LocaleController.getString("AreYouSureSessions", R.string.AreYouSureSessions));
                builder.setTitle(LocaleController.getString("AreYouSureSessionsTitle", R.string.AreYouSureSessionsTitle));
                buttonText = LocaleController.getString("Terminate", R.string.Terminate);
            } else {
                builder.setMessage(LocaleController.getString("AreYouSureWebSessions", R.string.AreYouSureWebSessions));
                builder.setTitle(LocaleController.getString("TerminateWebSessionsTitle", R.string.TerminateWebSessionsTitle));
                buttonText = LocaleController.getString("Disconnect", R.string.Disconnect);
            }
            builder.setPositiveButton(buttonText, (dialogInterface, i) -> {
                if (currentType == 0) {
                    TLRPC.TL_auth_resetAuthorizations req = new TLRPC.TL_auth_resetAuthorizations();
                    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
                        AndroidUtilities.runOnUIThread(() -> {
                            if (getParentActivity() == null) {
                                return;
                            }
                            if (error == null && response instanceof TLRPC.TL_boolTrue) {
                                Toast toast = Toast.makeText(getParentActivity(), LocaleController.getString("TerminateAllSessions", R.string.TerminateAllSessions), Toast.LENGTH_SHORT);
                                toast.show();
                                finishFragment();
                            }
                        });
                        for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
                            UserConfig userConfig = UserConfig.getInstance(a);
                            if (!userConfig.isClientActivated()) {
                                continue;
                            }
                            userConfig.registeredForPush = false;
                            userConfig.saveConfig(false);
                            MessagesController.getInstance(a).registerForPush(SharedConfig.pushString);
                            ConnectionsManager.getInstance(a).setUserId(userConfig.getClientUserId());
                        }
                    });
                } else {
                    TLRPC.TL_account_resetWebAuthorizations req = new TLRPC.TL_account_resetWebAuthorizations();
                    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
                        if (getParentActivity() == null) {
                            return;
                        }
                        if (error == null && response instanceof TLRPC.TL_boolTrue) {
                            Toast toast = Toast.makeText(getParentActivity(), LocaleController.getString("TerminateAllWebSessions", R.string.TerminateAllWebSessions), Toast.LENGTH_SHORT);
                            toast.show();
                        } else {
                            Toast toast = Toast.makeText(getParentActivity(), LocaleController.getString("UnknownError", R.string.UnknownError), Toast.LENGTH_SHORT);
                            toast.show();
                        }
                        finishFragment();
                    }));
                }
            });
            builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
            AlertDialog alertDialog = builder.create();
            showDialog(alertDialog);
            TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
            if (button != null) {
                button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
            }
        } else if (position >= otherSessionsStartRow && position < otherSessionsEndRow || position >= passwordSessionsStartRow && position < passwordSessionsEndRow || position == currentSessionRow) {
            if (getParentActivity() == null) {
                return;
            }
            if (currentType == 0) {
                final TLRPC.TL_authorization authorization;
                boolean isCurrentSession = false;
                if (position == currentSessionRow) {
                    authorization = currentSession;
                    isCurrentSession = true;
                } else if (position >= otherSessionsStartRow && position < otherSessionsEndRow) {
                    authorization = (TLRPC.TL_authorization) sessions.get(position - otherSessionsStartRow);
                } else {
                    authorization = (TLRPC.TL_authorization) passwordSessions.get(position - passwordSessionsStartRow);
                }
                showSessionBottomSheet(authorization, isCurrentSession);
                return;
            }
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            final boolean[] param = new boolean[1];
            String buttonText;
            if (currentType == 0) {
                builder.setMessage(LocaleController.getString("TerminateSessionText", R.string.TerminateSessionText));
                builder.setTitle(LocaleController.getString("AreYouSureSessionTitle", R.string.AreYouSureSessionTitle));
                buttonText = LocaleController.getString("Terminate", R.string.Terminate);
            } else {
                final TLRPC.TL_webAuthorization authorization = (TLRPC.TL_webAuthorization) sessions.get(position - otherSessionsStartRow);
                builder.setMessage(LocaleController.formatString("TerminateWebSessionText", R.string.TerminateWebSessionText, authorization.domain));
                builder.setTitle(LocaleController.getString("TerminateWebSessionTitle", R.string.TerminateWebSessionTitle));
                buttonText = LocaleController.getString("Disconnect", R.string.Disconnect);
                FrameLayout frameLayout1 = new FrameLayout(getParentActivity());
                TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(authorization.bot_id);
                String name;
                if (user != null) {
                    name = UserObject.getFirstName(user);
                } else {
                    name = "";
                }
                CheckBoxCell cell = new CheckBoxCell(getParentActivity(), 1);
                cell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
                cell.setText(LocaleController.formatString("TerminateWebSessionStop", R.string.TerminateWebSessionStop, name), "", false, false);
                cell.setPadding(LocaleController.isRTL ? AndroidUtilities.dp(16) : AndroidUtilities.dp(8), 0, LocaleController.isRTL ? AndroidUtilities.dp(8) : AndroidUtilities.dp(16), 0);
                frameLayout1.addView(cell, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.TOP | Gravity.LEFT, 0, 0, 0, 0));
                cell.setOnClickListener(v -> {
                    if (!v.isEnabled()) {
                        return;
                    }
                    CheckBoxCell cell1 = (CheckBoxCell) v;
                    param[0] = !param[0];
                    cell1.setChecked(param[0], true);
                });
                builder.setCustomViewOffset(16);
                builder.setView(frameLayout1);
            }
            builder.setPositiveButton(buttonText, (dialogInterface, option) -> {
                if (getParentActivity() == null) {
                    return;
                }
                final AlertDialog progressDialog = new AlertDialog(getParentActivity(), 3);
                progressDialog.setCanCacnel(false);
                progressDialog.show();
                if (currentType == 0) {
                    final TLRPC.TL_authorization authorization;
                    if (position >= otherSessionsStartRow && position < otherSessionsEndRow) {
                        authorization = (TLRPC.TL_authorization) sessions.get(position - otherSessionsStartRow);
                    } else {
                        authorization = (TLRPC.TL_authorization) passwordSessions.get(position - passwordSessionsStartRow);
                    }
                    TLRPC.TL_account_resetAuthorization req = new TLRPC.TL_account_resetAuthorization();
                    req.hash = authorization.hash;
                    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
                        try {
                            progressDialog.dismiss();
                        } catch (Exception e) {
                            FileLog.e(e);
                        }
                        if (error == null) {
                            sessions.remove(authorization);
                            passwordSessions.remove(authorization);
                            updateRows();
                            if (listAdapter != null) {
                                listAdapter.notifyDataSetChanged();
                            }
                        }
                    }));
                } else {
                    final TLRPC.TL_webAuthorization authorization = (TLRPC.TL_webAuthorization) sessions.get(position - otherSessionsStartRow);
                    TLRPC.TL_account_resetWebAuthorization req = new TLRPC.TL_account_resetWebAuthorization();
                    req.hash = authorization.hash;
                    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
                        try {
                            progressDialog.dismiss();
                        } catch (Exception e) {
                            FileLog.e(e);
                        }
                        if (error == null) {
                            sessions.remove(authorization);
                            updateRows();
                            if (listAdapter != null) {
                                listAdapter.notifyDataSetChanged();
                            }
                        }
                    }));
                    if (param[0]) {
                        MessagesController.getInstance(currentAccount).blockPeer(authorization.bot_id);
                    }
                }
            });
            builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
            AlertDialog alertDialog = builder.create();
            showDialog(alertDialog);
            TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
            if (button != null) {
                button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
            }
        }
    });
    if (currentType == 0) {
        undoView = new UndoView(context) {

            @Override
            public void hide(boolean apply, int animated) {
                if (!apply) {
                    TLRPC.TL_authorization authorization = (TLRPC.TL_authorization) getCurrentInfoObject();
                    TLRPC.TL_account_resetAuthorization req = new TLRPC.TL_account_resetAuthorization();
                    req.hash = authorization.hash;
                    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
                        if (error == null) {
                            sessions.remove(authorization);
                            passwordSessions.remove(authorization);
                            updateRows();
                            if (listAdapter != null) {
                                listAdapter.notifyDataSetChanged();
                            }
                            loadSessions(true);
                        }
                    }));
                }
                super.hide(apply, animated);
            }
        };
        frameLayout.addView(undoView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8));
    }
    itemsEnterAnimator = new RecyclerItemsEnterAnimator(listView, true) {

        @Override
        public View getProgressView() {
            View progressView = null;
            for (int i = 0; i < listView.getChildCount(); i++) {
                View child = listView.getChildAt(i);
                if (listView.getChildAdapterPosition(child) >= 0 && child instanceof SessionCell && ((SessionCell) child).isStub()) {
                    progressView = child;
                }
            }
            return progressView;
        }
    };
    itemsEnterAnimator.animateAlphaProgressView = false;
    updateRows();
    return fragmentView;
}
Also used : AlertDialog(org.telegram.ui.ActionBar.AlertDialog) ThemeDescription(org.telegram.ui.ActionBar.ThemeDescription) LinearLayout(android.widget.LinearLayout) SvgHelper(org.telegram.messenger.SvgHelper) PackageManager(android.content.pm.PackageManager) NonNull(androidx.annotation.NonNull) Uri(android.net.Uri) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) AndroidUtilities(org.telegram.messenger.AndroidUtilities) CheckBoxCell(org.telegram.ui.Cells.CheckBoxCell) Manifest(android.Manifest) ApplicationLoader(org.telegram.messenger.ApplicationLoader) SessionCell(org.telegram.ui.Cells.SessionCell) TextCell(org.telegram.ui.Cells.TextCell) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) ContextCompat(androidx.core.content.ContextCompat) DocumentObject(org.telegram.messenger.DocumentObject) SlideChooseView(org.telegram.ui.Components.SlideChooseView) EmptyTextProgressView(org.telegram.ui.Components.EmptyTextProgressView) RLottieImageView(org.telegram.ui.Components.RLottieImageView) ImageLocation(org.telegram.messenger.ImageLocation) UndoView(org.telegram.ui.Components.UndoView) BaseFragment(org.telegram.ui.ActionBar.BaseFragment) PorterDuff(android.graphics.PorterDuff) ConnectionsManager(org.telegram.tgnet.ConnectionsManager) ViewGroup(android.view.ViewGroup) NotificationCenter(org.telegram.messenger.NotificationCenter) RecyclerItemsEnterAnimator(org.telegram.ui.Components.RecyclerItemsEnterAnimator) UserConfig(org.telegram.messenger.UserConfig) TextView(android.widget.TextView) PorterDuffColorFilter(android.graphics.PorterDuffColorFilter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) Context(android.content.Context) Spanned(android.text.Spanned) ImageSpan(android.text.style.ImageSpan) ColoredImageSpan(org.telegram.ui.Components.ColoredImageSpan) Theme(org.telegram.ui.ActionBar.Theme) Intent(android.content.Intent) LocaleController(org.telegram.messenger.LocaleController) HeaderCell(org.telegram.ui.Cells.HeaderCell) URLSpanNoUnderline(org.telegram.ui.Components.URLSpanNoUnderline) AlertsCreator(org.telegram.ui.Components.AlertsCreator) TextInfoPrivacyCell(org.telegram.ui.Cells.TextInfoPrivacyCell) ArrayList(java.util.ArrayList) SpannableStringBuilder(android.text.SpannableStringBuilder) TLRPC(org.telegram.tgnet.TLRPC) Toast(android.widget.Toast) ActionBar(org.telegram.ui.ActionBar.ActionBar) TLObject(org.telegram.tgnet.TLObject) SharedConfig(org.telegram.messenger.SharedConfig) MediaDataController(org.telegram.messenger.MediaDataController) Build(android.os.Build) DialogInterface(android.content.DialogInterface) TextSettingsCell(org.telegram.ui.Cells.TextSettingsCell) R(org.telegram.messenger.R) ReplaceableIconDrawable(org.telegram.ui.Components.ReplaceableIconDrawable) BackupImageView(org.telegram.ui.Components.BackupImageView) AbsListView(android.widget.AbsListView) 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) UserObject(org.telegram.messenger.UserObject) SharedPreferences(android.content.SharedPreferences) TypedValue(android.util.TypedValue) Base64(android.util.Base64) RadioColorCell(org.telegram.ui.Cells.RadioColorCell) AlertDialog(org.telegram.ui.ActionBar.AlertDialog) RecyclerListView(org.telegram.ui.Components.RecyclerListView) SpannableStringBuilder(android.text.SpannableStringBuilder) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) TLRPC(org.telegram.tgnet.TLRPC) TextView(android.widget.TextView) ImageView(android.widget.ImageView) RLottieImageView(org.telegram.ui.Components.RLottieImageView) BackupImageView(org.telegram.ui.Components.BackupImageView) ActionBar(org.telegram.ui.ActionBar.ActionBar) AbsListView(android.widget.AbsListView) UserConfig(org.telegram.messenger.UserConfig) CheckBoxCell(org.telegram.ui.Cells.CheckBoxCell) RecyclerItemsEnterAnimator(org.telegram.ui.Components.RecyclerItemsEnterAnimator) PorterDuffColorFilter(android.graphics.PorterDuffColorFilter) RecyclerListView(org.telegram.ui.Components.RecyclerListView) UndoView(org.telegram.ui.Components.UndoView) Toast(android.widget.Toast) FlickerLoadingView(org.telegram.ui.Components.FlickerLoadingView) EmptyTextProgressView(org.telegram.ui.Components.EmptyTextProgressView) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) SlideChooseView(org.telegram.ui.Components.SlideChooseView) EmptyTextProgressView(org.telegram.ui.Components.EmptyTextProgressView) RLottieImageView(org.telegram.ui.Components.RLottieImageView) UndoView(org.telegram.ui.Components.UndoView) TextView(android.widget.TextView) BackupImageView(org.telegram.ui.Components.BackupImageView) AbsListView(android.widget.AbsListView) FlickerLoadingView(org.telegram.ui.Components.FlickerLoadingView) RecyclerListView(org.telegram.ui.Components.RecyclerListView) SessionCell(org.telegram.ui.Cells.SessionCell) FrameLayout(android.widget.FrameLayout) RadioColorCell(org.telegram.ui.Cells.RadioColorCell) LinearLayout(android.widget.LinearLayout)

Example 77 with AlertDialog

use of org.telegram.ui.ActionBar.AlertDialog in project Telegram-FOSS by Telegram-FOSS-Team.

the class SessionsActivity method proccessQrCode.

private void proccessQrCode(String code) {
    AlertDialog progressDialog = new AlertDialog(getParentActivity(), 3);
    progressDialog.setCanCacnel(false);
    progressDialog.show();
    byte[] token = Base64.decode(code.substring("tg://login?token=".length()), Base64.URL_SAFE);
    TLRPC.TL_auth_acceptLoginToken req = new TLRPC.TL_auth_acceptLoginToken();
    req.token = token;
    getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
        try {
            progressDialog.dismiss();
        } catch (Exception ignore) {
        }
        if (response instanceof TLRPC.TL_authorization) {
            TLRPC.TL_authorization authorization = (TLRPC.TL_authorization) response;
            sessions.add(0, authorization);
            updateRows();
            listAdapter.notifyDataSetChanged();
            undoView.showWithAction(0, UndoView.ACTION_QR_SESSION_ACCEPTED, response);
        } else {
            AndroidUtilities.runOnUIThread(() -> {
                final String text;
                if (error.text.equals("AUTH_TOKEN_EXCEPTION")) {
                    text = LocaleController.getString("AccountAlreadyLoggedIn", R.string.AccountAlreadyLoggedIn);
                } else {
                    text = LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + error.text;
                }
                AlertsCreator.showSimpleAlert(SessionsActivity.this, LocaleController.getString("AuthAnotherClient", R.string.AuthAnotherClient), text);
            });
        }
    }));
}
Also used : AlertDialog(org.telegram.ui.ActionBar.AlertDialog) TLRPC(org.telegram.tgnet.TLRPC)

Example 78 with AlertDialog

use of org.telegram.ui.ActionBar.AlertDialog in project Telegram-FOSS by Telegram-FOSS-Team.

the class TwoStepVerificationActivity method createView.

@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(false);
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {

        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                if (otherwiseReloginDays >= 0) {
                    showSetForcePasswordAlert();
                } else {
                    finishFragment();
                }
            } else if (id == done_button) {
                processDone();
            }
        }
    });
    fragmentView = new FrameLayout(context);
    FrameLayout frameLayout = (FrameLayout) fragmentView;
    frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
    ActionBarMenu menu = actionBar.createMenu();
    doneItem = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
    scrollView = new ScrollView(context);
    scrollView.setFillViewport(true);
    frameLayout.addView(scrollView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    LinearLayout linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    scrollView.addView(linearLayout, LayoutHelper.createScroll(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP));
    titleTextView = new TextView(context);
    titleTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
    titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    titleTextView.setGravity(Gravity.CENTER_HORIZONTAL);
    titleTextView.setPadding(AndroidUtilities.dp(40), 0, AndroidUtilities.dp(40), 0);
    linearLayout.addView(titleTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 0, 38, 0, 0));
    passwordEditText = new EditTextBoldCursor(context);
    passwordEditText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
    passwordEditText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    passwordEditText.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
    passwordEditText.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
    passwordEditText.setMaxLines(1);
    passwordEditText.setLines(1);
    passwordEditText.setGravity(Gravity.CENTER_HORIZONTAL);
    passwordEditText.setSingleLine(true);
    passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
    passwordEditText.setTypeface(Typeface.DEFAULT);
    passwordEditText.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    passwordEditText.setCursorWidth(1.5f);
    linearLayout.addView(passwordEditText, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 36, Gravity.TOP | Gravity.LEFT, 40, 32, 40, 0));
    passwordEditText.setOnEditorActionListener((textView, i, keyEvent) -> {
        if (i == EditorInfo.IME_ACTION_NEXT || i == EditorInfo.IME_ACTION_DONE) {
            processDone();
            return true;
        }
        return false;
    });
    passwordEditText.setCustomSelectionActionModeCallback(new ActionMode.Callback() {

        public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
            return false;
        }

        public void onDestroyActionMode(ActionMode mode) {
        }

        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
            return false;
        }

        public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
            return false;
        }
    });
    bottomTextView = new TextView(context);
    bottomTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
    bottomTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    bottomTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
    bottomTextView.setText(LocaleController.getString("YourEmailInfo", R.string.YourEmailInfo));
    linearLayout.addView(bottomTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 40, 30, 40, 0));
    LinearLayout linearLayout2 = new LinearLayout(context);
    linearLayout2.setOrientation(LinearLayout.VERTICAL);
    linearLayout2.setGravity(Gravity.BOTTOM | Gravity.CENTER_VERTICAL);
    linearLayout2.setClipChildren(false);
    linearLayout.addView(linearLayout2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    bottomButton = new SimpleTextView(context);
    bottomButton.setTextSize(14);
    bottomButton.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.BOTTOM);
    bottomButton.setPadding(0, AndroidUtilities.dp(10), 0, 0);
    linearLayout2.addView(bottomButton, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 40, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.BOTTOM, 40, 0, 40, 14));
    bottomButton.setOnClickListener(v -> onPasswordForgot());
    cancelResetButton = new TextView(context);
    cancelResetButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    cancelResetButton.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.BOTTOM);
    cancelResetButton.setPadding(0, AndroidUtilities.dp(10), 0, 0);
    cancelResetButton.setText(LocaleController.getString("CancelReset", R.string.CancelReset));
    cancelResetButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
    linearLayout2.addView(cancelResetButton, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.BOTTOM, 40, 0, 40, 26));
    cancelResetButton.setOnClickListener(v -> cancelPasswordReset());
    emptyView = new EmptyTextProgressView(context);
    emptyView.showProgress();
    frameLayout.addView(emptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView = new RecyclerListView(context);
    listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    listView.setEmptyView(emptyView);
    listView.setVerticalScrollBarEnabled(false);
    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView.setAdapter(listAdapter = new ListAdapter(context));
    listView.setOnItemClickListener((view, position) -> {
        if (position == setPasswordRow || position == changePasswordRow) {
            TwoStepVerificationSetupActivity fragment = new TwoStepVerificationSetupActivity(currentAccount, TwoStepVerificationSetupActivity.TYPE_ENTER_FIRST, currentPassword);
            fragment.addFragmentToClose(this);
            fragment.setCurrentPasswordParams(currentPasswordHash, currentSecretId, currentSecret, false);
            presentFragment(fragment);
        } else if (position == setRecoveryEmailRow || position == changeRecoveryEmailRow) {
            TwoStepVerificationSetupActivity fragment = new TwoStepVerificationSetupActivity(currentAccount, TwoStepVerificationSetupActivity.TYPE_ENTER_EMAIL, currentPassword);
            fragment.addFragmentToClose(this);
            fragment.setCurrentPasswordParams(currentPasswordHash, currentSecretId, currentSecret, true);
            presentFragment(fragment);
        } else if (position == turnPasswordOffRow) {
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            String text = LocaleController.getString("TurnPasswordOffQuestion", R.string.TurnPasswordOffQuestion);
            if (currentPassword.has_secure_values) {
                text += "\n\n" + LocaleController.getString("TurnPasswordOffPassport", R.string.TurnPasswordOffPassport);
            }
            String title = LocaleController.getString("TurnPasswordOffQuestionTitle", R.string.TurnPasswordOffQuestionTitle);
            String buttonText = LocaleController.getString("Disable", R.string.Disable);
            builder.setMessage(text);
            builder.setTitle(title);
            builder.setPositiveButton(buttonText, (dialogInterface, i) -> clearPassword());
            builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
            AlertDialog alertDialog = builder.create();
            showDialog(alertDialog);
            TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
            if (button != null) {
                button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
            }
        }
    });
    updateRows();
    actionBar.setTitle(LocaleController.getString("TwoStepVerificationTitle", R.string.TwoStepVerificationTitle));
    if (delegate != null) {
        titleTextView.setText(LocaleController.getString("PleaseEnterCurrentPasswordTransfer", R.string.PleaseEnterCurrentPasswordTransfer));
    } else {
        titleTextView.setText(LocaleController.getString("PleaseEnterCurrentPassword", R.string.PleaseEnterCurrentPassword));
    }
    if (passwordEntered) {
        fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
        fragmentView.setTag(Theme.key_windowBackgroundGray);
    } else {
        fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
        fragmentView.setTag(Theme.key_windowBackgroundWhite);
    }
    return fragmentView;
}
Also used : AlertDialog(org.telegram.ui.ActionBar.AlertDialog) ActionBarMenuItem(org.telegram.ui.ActionBar.ActionBarMenuItem) MenuItem(android.view.MenuItem) EmptyTextProgressView(org.telegram.ui.Components.EmptyTextProgressView) RecyclerListView(org.telegram.ui.Components.RecyclerListView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) ActionBarMenu(org.telegram.ui.ActionBar.ActionBarMenu) ScrollView(android.widget.ScrollView) ActionMode(android.view.ActionMode) FrameLayout(android.widget.FrameLayout) SimpleTextView(org.telegram.ui.ActionBar.SimpleTextView) TextView(android.widget.TextView) SimpleTextView(org.telegram.ui.ActionBar.SimpleTextView) Menu(android.view.Menu) ActionBarMenu(org.telegram.ui.ActionBar.ActionBarMenu) EditTextBoldCursor(org.telegram.ui.Components.EditTextBoldCursor) ActionBar(org.telegram.ui.ActionBar.ActionBar) LinearLayout(android.widget.LinearLayout)

Example 79 with AlertDialog

use of org.telegram.ui.ActionBar.AlertDialog in project Telegram-FOSS by Telegram-FOSS-Team.

the class TwoStepVerificationActivity method needShowProgress.

private void needShowProgress(boolean delay) {
    if (getParentActivity() == null || getParentActivity().isFinishing() || progressDialog != null) {
        return;
    }
    progressDialog = new AlertDialog(getParentActivity(), 3);
    progressDialog.setCanCacnel(false);
    if (delay) {
        progressDialog.showDelayed(300);
    } else {
        progressDialog.show();
    }
}
Also used : AlertDialog(org.telegram.ui.ActionBar.AlertDialog)

Example 80 with AlertDialog

use of org.telegram.ui.ActionBar.AlertDialog in project Telegram-FOSS by Telegram-FOSS-Team.

the class RestrictedLanguagesSelectActivity method createView.

@Override
public View createView(Context context) {
    searching = false;
    searchWas = false;
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("DoNotTranslate", R.string.DoNotTranslate));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {

        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });
    ActionBarMenu menu = actionBar.createMenu();
    ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {

        @Override
        public void onSearchExpand() {
            searching = true;
        }

        @Override
        public void onSearchCollapse() {
            search(null);
            searching = false;
            searchWas = false;
            if (listView != null) {
                emptyView.setVisibility(View.GONE);
                listView.setAdapter(listAdapter);
            }
        }

        @Override
        public void onTextChanged(EditText editText) {
            String text = editText.getText().toString();
            search(text);
            if (text.length() != 0) {
                searchWas = true;
                if (listView != null) {
                    listView.setAdapter(searchListViewAdapter);
                }
            } else {
                searching = false;
                searchWas = false;
                if (listView != null) {
                    emptyView.setVisibility(View.GONE);
                    listView.setAdapter(listAdapter);
                }
            }
        }
    });
    item.setSearchFieldHint(LocaleController.getString("Search", R.string.Search));
    listAdapter = new ListAdapter(context, false);
    searchListViewAdapter = new ListAdapter(context, true);
    fragmentView = new FrameLayout(context);
    fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
    FrameLayout frameLayout = (FrameLayout) fragmentView;
    emptyView = new EmptyTextProgressView(context);
    emptyView.setText(LocaleController.getString("NoResult", R.string.NoResult));
    emptyView.showTextView();
    emptyView.setShowAtCenter(true);
    frameLayout.addView(emptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView = new RecyclerListView(context);
    listView.setEmptyView(emptyView);
    listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    listView.setVerticalScrollBarEnabled(false);
    listView.setAdapter(listAdapter);
    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView.setOnItemClickListener((view, position) -> {
        if (getParentActivity() == null || parentLayout == null || !(view instanceof TextCheckbox2Cell)) {
            return;
        }
        boolean search = listView.getAdapter() == searchListViewAdapter;
        if (!search)
            position--;
        LocaleController.LocaleInfo localeInfo;
        if (search) {
            localeInfo = searchResult.get(position);
        } else {
            localeInfo = sortedLanguages.get(position);
        }
        if (localeInfo != null) {
            LocaleController.LocaleInfo currentLocaleInfo = LocaleController.getInstance().getCurrentLocaleInfo();
            String langCode = localeInfo.pluralLangCode;
            if (langCode != null && langCode.equals(currentLocaleInfo.pluralLangCode)) {
                AndroidUtilities.shakeView(((TextCheckbox2Cell) view).checkbox, 2, 0);
                return;
            }
            boolean value = selectedLanguages.contains(langCode);
            HashSet<String> newSelectedLanguages = new HashSet<String>(selectedLanguages);
            if (value)
                newSelectedLanguages.removeIf(s -> s != null && s.equals(langCode));
            else
                newSelectedLanguages.add(langCode);
            if (newSelectedLanguages.size() == 1 && newSelectedLanguages.contains(currentLocaleInfo.pluralLangCode))
                preferences.edit().remove("translate_button_restricted_languages").apply();
            else
                preferences.edit().putStringSet("translate_button_restricted_languages", newSelectedLanguages).apply();
        }
    });
    listView.setOnItemLongClickListener((view, position) -> {
        if (getParentActivity() == null || parentLayout == null || !(view instanceof TextCheckbox2Cell)) {
            return false;
        }
        boolean search = listView.getAdapter() == searchListViewAdapter;
        if (!search)
            position--;
        LocaleController.LocaleInfo localeInfo;
        if (search) {
            localeInfo = searchResult.get(position);
        } else {
            localeInfo = sortedLanguages.get(position);
        }
        if (localeInfo == null || localeInfo.pathToFile == null || localeInfo.isRemote() && localeInfo.serverIndex != Integer.MAX_VALUE) {
            return false;
        }
        final LocaleController.LocaleInfo finalLocaleInfo = localeInfo;
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setTitle(LocaleController.getString("DeleteLocalizationTitle", R.string.DeleteLocalizationTitle));
        builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("DeleteLocalizationText", R.string.DeleteLocalizationText, localeInfo.name)));
        builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), (dialogInterface, i) -> {
            if (LocaleController.getInstance().deleteLanguage(finalLocaleInfo, currentAccount)) {
                fillLanguages();
                if (searchResult != null) {
                    searchResult.remove(finalLocaleInfo);
                }
                if (listAdapter != null) {
                    listAdapter.notifyDataSetChanged();
                }
                if (searchListViewAdapter != null) {
                    searchListViewAdapter.notifyDataSetChanged();
                }
            }
        });
        builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
        AlertDialog alertDialog = builder.create();
        showDialog(alertDialog);
        TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
        if (button != null) {
            button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
        }
        return true;
    });
    listView.setOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
                AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus());
            }
        }
    });
    return fragmentView;
}
Also used : ThemeDescription(org.telegram.ui.ActionBar.ThemeDescription) Context(android.content.Context) LinearLayout(android.widget.LinearLayout) ActionBarMenuItem(org.telegram.ui.ActionBar.ActionBarMenuItem) Arrays(java.util.Arrays) Theme(org.telegram.ui.ActionBar.Theme) FrameLayout(android.widget.FrameLayout) AndroidUtilities(org.telegram.messenger.AndroidUtilities) CubicBezierInterpolator(org.telegram.ui.Components.CubicBezierInterpolator) LocaleController(org.telegram.messenger.LocaleController) Timer(java.util.Timer) HeaderCell(org.telegram.ui.Cells.HeaderCell) TextCheckbox2Cell(org.telegram.ui.Cells.TextCheckbox2Cell) TextInfoPrivacyCell(org.telegram.ui.Cells.TextInfoPrivacyCell) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) CheckBoxCell(org.telegram.ui.Cells.CheckBoxCell) ShadowSectionCell(org.telegram.ui.Cells.ShadowSectionCell) ActionBar(org.telegram.ui.ActionBar.ActionBar) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TimerTask(java.util.TimerTask) DialogInterface(android.content.DialogInterface) TextRadioCell(org.telegram.ui.Cells.TextRadioCell) Utilities(org.telegram.messenger.Utilities) TextSettingsCell(org.telegram.ui.Cells.TextSettingsCell) EmptyTextProgressView(org.telegram.ui.Components.EmptyTextProgressView) ActionBarMenu(org.telegram.ui.ActionBar.ActionBarMenu) R(org.telegram.messenger.R) LanguageCell(org.telegram.ui.Cells.LanguageCell) Set(java.util.Set) BaseFragment(org.telegram.ui.ActionBar.BaseFragment) LayoutHelper(org.telegram.ui.Components.LayoutHelper) FileLog(org.telegram.messenger.FileLog) ViewGroup(android.view.ViewGroup) MessagesController(org.telegram.messenger.MessagesController) NotificationCenter(org.telegram.messenger.NotificationCenter) TextView(android.widget.TextView) SharedPreferences(android.content.SharedPreferences) TextCheckCell(org.telegram.ui.Cells.TextCheckCell) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) Comparator(java.util.Comparator) AlertDialog(org.telegram.ui.ActionBar.AlertDialog) Collections(java.util.Collections) EditText(android.widget.EditText) RecyclerListView(org.telegram.ui.Components.RecyclerListView) ValueAnimator(android.animation.ValueAnimator) AlertDialog(org.telegram.ui.ActionBar.AlertDialog) TextCheckbox2Cell(org.telegram.ui.Cells.TextCheckbox2Cell) RecyclerListView(org.telegram.ui.Components.RecyclerListView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) TextView(android.widget.TextView) ActionBar(org.telegram.ui.ActionBar.ActionBar) HashSet(java.util.HashSet) EditText(android.widget.EditText) ActionBarMenuItem(org.telegram.ui.ActionBar.ActionBarMenuItem) LocaleController(org.telegram.messenger.LocaleController) EmptyTextProgressView(org.telegram.ui.Components.EmptyTextProgressView) ActionBarMenu(org.telegram.ui.ActionBar.ActionBarMenu) FrameLayout(android.widget.FrameLayout) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Aggregations

AlertDialog (org.telegram.ui.ActionBar.AlertDialog)101 TLRPC (org.telegram.tgnet.TLRPC)71 TextView (android.widget.TextView)63 FrameLayout (android.widget.FrameLayout)47 ArrayList (java.util.ArrayList)47 Context (android.content.Context)45 View (android.view.View)44 AndroidUtilities (org.telegram.messenger.AndroidUtilities)41 LocaleController (org.telegram.messenger.LocaleController)41 Theme (org.telegram.ui.ActionBar.Theme)41 R (org.telegram.messenger.R)40 BaseFragment (org.telegram.ui.ActionBar.BaseFragment)40 LinearLayout (android.widget.LinearLayout)38 Paint (android.graphics.Paint)37 MessagesController (org.telegram.messenger.MessagesController)37 SuppressLint (android.annotation.SuppressLint)36 TextUtils (android.text.TextUtils)36 FileLog (org.telegram.messenger.FileLog)36 Build (android.os.Build)34 Gravity (android.view.Gravity)34