Search in sources :

Example 1 with InviteLinkBottomSheet

use of org.telegram.ui.Components.InviteLinkBottomSheet in project Telegram-FOSS by Telegram-FOSS-Team.

the class ChannelAdminLogActivity method showInviteLinkBottomSheet.

private void showInviteLinkBottomSheet(TLRPC.TL_messages_exportedChatInvite invite, HashMap<Long, TLRPC.User> usersMap) {
    TLRPC.ChatFull chatInfo = getMessagesController().getChatFull(currentChat.id);
    InviteLinkBottomSheet inviteLinkBottomSheet = new InviteLinkBottomSheet(contentView.getContext(), (TLRPC.TL_chatInviteExported) invite.invite, chatInfo, usersMap, ChannelAdminLogActivity.this, chatInfo.id, false, ChatObject.isChannel(currentChat));
    inviteLinkBottomSheet.setInviteDelegate(new InviteLinkBottomSheet.InviteDelegate() {

        @Override
        public void permanentLinkReplaced(TLRPC.TL_chatInviteExported oldLink, TLRPC.TL_chatInviteExported newLink) {
        }

        @Override
        public void linkRevoked(TLRPC.TL_chatInviteExported invite) {
            TLRPC.TL_channelAdminLogEvent event = new TLRPC.TL_channelAdminLogEvent();
            int size = messages.size();
            invite.revoked = true;
            TLRPC.TL_channelAdminLogEventActionExportedInviteRevoke revokeAction = new TLRPC.TL_channelAdminLogEventActionExportedInviteRevoke();
            revokeAction.invite = invite;
            event.action = revokeAction;
            event.date = (int) (System.currentTimeMillis() / 1000L);
            event.user_id = getAccountInstance().getUserConfig().clientUserId;
            MessageObject messageObject = new MessageObject(currentAccount, event, messages, messagesByDays, currentChat, mid, true);
            if (messageObject.contentType < 0) {
                return;
            }
            int addCount = messages.size() - size;
            if (addCount > 0) {
                chatListItemAnimator.setShouldAnimateEnterFromBottom(true);
                chatAdapter.notifyItemRangeInserted(chatAdapter.messagesEndRow, addCount);
                moveScrollToLastMessage();
            }
            invitesCache.remove(invite.link);
        }

        @Override
        public void onLinkDeleted(TLRPC.TL_chatInviteExported invite) {
            int size = messages.size();
            int messagesEndRow = chatAdapter.messagesEndRow;
            TLRPC.TL_channelAdminLogEvent event = new TLRPC.TL_channelAdminLogEvent();
            TLRPC.TL_channelAdminLogEventActionExportedInviteDelete deleteAction = new TLRPC.TL_channelAdminLogEventActionExportedInviteDelete();
            deleteAction.invite = invite;
            event.action = deleteAction;
            event.date = (int) (System.currentTimeMillis() / 1000L);
            event.user_id = getAccountInstance().getUserConfig().clientUserId;
            MessageObject messageObject = new MessageObject(currentAccount, event, messages, messagesByDays, currentChat, mid, true);
            if (messageObject.contentType < 0) {
                return;
            }
            int addCount = messages.size() - size;
            if (addCount > 0) {
                chatListItemAnimator.setShouldAnimateEnterFromBottom(true);
                chatAdapter.notifyItemRangeInserted(chatAdapter.messagesEndRow, addCount);
                moveScrollToLastMessage();
            }
            invitesCache.remove(invite.link);
        }

        @Override
        public void onLinkEdited(TLRPC.TL_chatInviteExported invite) {
            TLRPC.TL_channelAdminLogEvent event = new TLRPC.TL_channelAdminLogEvent();
            TLRPC.TL_channelAdminLogEventActionExportedInviteEdit editAction = new TLRPC.TL_channelAdminLogEventActionExportedInviteEdit();
            editAction.new_invite = invite;
            editAction.prev_invite = invite;
            event.action = editAction;
            event.date = (int) (System.currentTimeMillis() / 1000L);
            event.user_id = getAccountInstance().getUserConfig().clientUserId;
            MessageObject messageObject = new MessageObject(currentAccount, event, messages, messagesByDays, currentChat, mid, true);
            if (messageObject.contentType < 0) {
                return;
            }
            chatAdapter.notifyDataSetChanged();
            moveScrollToLastMessage();
        }
    });
    inviteLinkBottomSheet.show();
}
Also used : TLRPC(org.telegram.tgnet.TLRPC) InviteLinkBottomSheet(org.telegram.ui.Components.InviteLinkBottomSheet) MessageObject(org.telegram.messenger.MessageObject)

Example 2 with InviteLinkBottomSheet

use of org.telegram.ui.Components.InviteLinkBottomSheet in project Telegram-FOSS by Telegram-FOSS-Team.

the class ManageLinksActivity method createView.

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

        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });
    fragmentView = new FrameLayout(context) {

        @Override
        protected void onAttachedToWindow() {
            super.onAttachedToWindow();
            AndroidUtilities.runOnUIThread(updateTimerRunnable, 500);
        }

        @Override
        protected void onDetachedFromWindow() {
            super.onDetachedFromWindow();
            AndroidUtilities.cancelRunOnUIThread(updateTimerRunnable);
        }
    };
    fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
    fragmentView.setTag(Theme.key_windowBackgroundGray);
    FrameLayout frameLayout = (FrameLayout) fragmentView;
    listView = new RecyclerListView(context);
    LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) {

        @Override
        public boolean supportsPredictiveItemAnimations() {
            return false;
        }
    };
    listView.setLayoutManager(layoutManager);
    listView.setAdapter(listViewAdapter = new ListAdapter(context));
    listView.setOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            if (hasMore && !linksLoading) {
                int lastPosition = layoutManager.findLastVisibleItemPosition();
                if (rowCount - lastPosition < 10) {
                    loadLinks(true);
                }
            }
        }
    });
    recyclerItemsEnterAnimator = new RecyclerItemsEnterAnimator(listView, false);
    DefaultItemAnimator defaultItemAnimator = new DefaultItemAnimator();
    defaultItemAnimator.setDelayAnimations(false);
    defaultItemAnimator.setSupportsChangeAnimations(false);
    listView.setItemAnimator(defaultItemAnimator);
    listView.setVerticalScrollbarPosition(LocaleController.isRTL ? RecyclerListView.SCROLLBAR_POSITION_LEFT : RecyclerListView.SCROLLBAR_POSITION_RIGHT);
    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView.setOnItemClickListener((view, position) -> {
        if (position == creatorRow) {
            TLRPC.User user = users.get(invite.admin_id);
            if (user != null) {
                Bundle bundle = new Bundle();
                bundle.putLong("user_id", user.id);
                MessagesController.getInstance(UserConfig.selectedAccount).putUser(user, false);
                ProfileActivity profileActivity = new ProfileActivity(bundle);
                presentFragment(profileActivity);
            }
        } else if (position == createNewLinkRow) {
            LinkEditActivity linkEditActivity = new LinkEditActivity(LinkEditActivity.CREATE_TYPE, currentChatId);
            linkEditActivity.setCallback(linkEditActivityCallback);
            presentFragment(linkEditActivity);
        } else if (position >= linksStartRow && position < linksEndRow) {
            TLRPC.TL_chatInviteExported invite = invites.get(position - linksStartRow);
            inviteLinkBottomSheet = new InviteLinkBottomSheet(context, invite, info, users, this, currentChatId, false, isChannel);
            inviteLinkBottomSheet.setCanEdit(canEdit);
            inviteLinkBottomSheet.show();
        } else if (position >= revokedLinksStartRow && position < revokedLinksEndRow) {
            TLRPC.TL_chatInviteExported invite = revokedInvites.get(position - revokedLinksStartRow);
            inviteLinkBottomSheet = new InviteLinkBottomSheet(context, invite, info, users, this, currentChatId, false, isChannel);
            inviteLinkBottomSheet.show();
        } else if (position == revokeAllRow) {
            if (deletingRevokedLinks) {
                return;
            }
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            builder.setTitle(LocaleController.getString("DeleteAllRevokedLinks", R.string.DeleteAllRevokedLinks));
            builder.setMessage(LocaleController.getString("DeleteAllRevokedLinkHelp", R.string.DeleteAllRevokedLinkHelp));
            builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), (dialogInterface2, i2) -> {
                TLRPC.TL_messages_deleteRevokedExportedChatInvites req = new TLRPC.TL_messages_deleteRevokedExportedChatInvites();
                req.peer = getMessagesController().getInputPeer(-currentChatId);
                if (adminId == getUserConfig().getClientUserId()) {
                    req.admin_id = getMessagesController().getInputUser(getUserConfig().getCurrentUser());
                } else {
                    req.admin_id = getMessagesController().getInputUser(adminId);
                }
                deletingRevokedLinks = true;
                getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
                    deletingRevokedLinks = false;
                    if (error == null) {
                        DiffCallback callback = saveListState();
                        revokedInvites.clear();
                        updateRecyclerViewAnimated(callback);
                    }
                }));
            });
            builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
            showDialog(builder.create());
        } else if (position >= adminsStartRow && position < adminsEndRow) {
            int p = position - adminsStartRow;
            TLRPC.TL_chatAdminWithInvites admin = admins.get(p);
            if (users.containsKey(admin.admin_id)) {
                getMessagesController().putUser(users.get(admin.admin_id), false);
            }
            ManageLinksActivity fragment = new ManageLinksActivity(currentChatId, admin.admin_id, admin.invites_count);
            fragment.setInfo(info, null);
            presentFragment(fragment);
        }
    });
    listView.setOnItemLongClickListener((view, position) -> {
        if ((position >= linksStartRow && position < linksEndRow) || (position >= revokedLinksStartRow && position < revokedLinksEndRow)) {
            LinkCell cell = (LinkCell) view;
            cell.optionsView.callOnClick();
            view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
            return true;
        }
        return false;
    });
    linkIcon = ContextCompat.getDrawable(context, R.drawable.msg_link_1);
    linkIconRevoked = ContextCompat.getDrawable(context, R.drawable.msg_link_2);
    linkIcon.setColorFilter(new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY));
    updateRows(true);
    timeDif = getConnectionsManager().getCurrentTime() - (System.currentTimeMillis() / 1000L);
    return fragmentView;
}
Also used : AlertDialog(org.telegram.ui.ActionBar.AlertDialog) SpannableStringBuilder(android.text.SpannableStringBuilder) PorterDuffColorFilter(android.graphics.PorterDuffColorFilter) RecyclerListView(org.telegram.ui.Components.RecyclerListView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator) TLRPC(org.telegram.tgnet.TLRPC) InviteLinkBottomSheet(org.telegram.ui.Components.InviteLinkBottomSheet) ActionBar(org.telegram.ui.ActionBar.ActionBar) Bundle(android.os.Bundle) Paint(android.graphics.Paint) FrameLayout(android.widget.FrameLayout) RecyclerItemsEnterAnimator(org.telegram.ui.Components.RecyclerItemsEnterAnimator) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Example 3 with InviteLinkBottomSheet

use of org.telegram.ui.Components.InviteLinkBottomSheet in project Telegram-FOSS by Telegram-FOSS-Team.

the class ChatEditTypeActivity method createView.

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

        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            } else if (id == done_button) {
                processDone();
            }
        }
    });
    ActionBarMenu menu = actionBar.createMenu();
    doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
    fragmentView = new ScrollView(context) {

        @Override
        public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
            rectangle.bottom += AndroidUtilities.dp(60);
            return super.requestChildRectangleOnScreen(child, rectangle, immediate);
        }
    };
    fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
    ScrollView scrollView = (ScrollView) fragmentView;
    scrollView.setFillViewport(true);
    linearLayout = new LinearLayout(context);
    scrollView.addView(linearLayout, new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    if (isForcePublic) {
        actionBar.setTitle(LocaleController.getString("TypeLocationGroup", R.string.TypeLocationGroup));
    } else if (isChannel) {
        actionBar.setTitle(LocaleController.getString("ChannelSettingsTitle", R.string.ChannelSettingsTitle));
    } else {
        actionBar.setTitle(LocaleController.getString("GroupSettingsTitle", R.string.GroupSettingsTitle));
    }
    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));
    headerCell2 = new HeaderCell(context, 23);
    headerCell2.setHeight(46);
    if (isChannel) {
        headerCell2.setText(LocaleController.getString("ChannelTypeHeader", R.string.ChannelTypeHeader));
    } else {
        headerCell2.setText(LocaleController.getString("GroupTypeHeader", R.string.GroupTypeHeader));
    }
    linearLayoutTypeContainer.addView(headerCell2);
    radioButtonCell2 = new RadioButtonCell(context);
    radioButtonCell2.setBackgroundDrawable(Theme.getSelectorDrawable(false));
    if (isChannel) {
        radioButtonCell2.setTextAndValue(LocaleController.getString("ChannelPrivate", R.string.ChannelPrivate), LocaleController.getString("ChannelPrivateInfo", R.string.ChannelPrivateInfo), false, isPrivate);
    } else {
        radioButtonCell2.setTextAndValue(LocaleController.getString("MegaPrivate", R.string.MegaPrivate), LocaleController.getString("MegaPrivateInfo", R.string.MegaPrivateInfo), false, isPrivate);
    }
    linearLayoutTypeContainer.addView(radioButtonCell2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    radioButtonCell2.setOnClickListener(v -> {
        if (isPrivate) {
            return;
        }
        isPrivate = true;
        updatePrivatePublic();
    });
    radioButtonCell1 = new RadioButtonCell(context);
    radioButtonCell1.setBackgroundDrawable(Theme.getSelectorDrawable(false));
    if (isChannel) {
        radioButtonCell1.setTextAndValue(LocaleController.getString("ChannelPublic", R.string.ChannelPublic), LocaleController.getString("ChannelPublicInfo", R.string.ChannelPublicInfo), false, !isPrivate);
    } else {
        radioButtonCell1.setTextAndValue(LocaleController.getString("MegaPublic", R.string.MegaPublic), LocaleController.getString("MegaPublicInfo", R.string.MegaPublicInfo), false, !isPrivate);
    }
    linearLayoutTypeContainer.addView(radioButtonCell1, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    radioButtonCell1.setOnClickListener(v -> {
        if (!isPrivate) {
            return;
        }
        isPrivate = false;
        updatePrivatePublic();
    });
    sectionCell2 = new ShadowSectionCell(context);
    linearLayout.addView(sectionCell2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    if (isForcePublic) {
        radioButtonCell2.setVisibility(View.GONE);
        radioButtonCell1.setVisibility(View.GONE);
        sectionCell2.setVisibility(View.GONE);
        headerCell2.setVisibility(View.GONE);
    }
    linkContainer = new LinearLayout(context);
    linkContainer.setOrientation(LinearLayout.VERTICAL);
    linkContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
    linearLayout.addView(linkContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    headerCell = new HeaderCell(context, 23);
    linkContainer.addView(headerCell);
    publicContainer = new LinearLayout(context);
    publicContainer.setOrientation(LinearLayout.HORIZONTAL);
    linkContainer.addView(publicContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 36, 23, 7, 23, 0));
    editText = new EditTextBoldCursor(context);
    editText.setText(getMessagesController().linkPrefix + "/");
    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);
    publicContainer.addView(editText, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 36));
    usernameTextView = new EditTextBoldCursor(context);
    usernameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    usernameTextView.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
    usernameTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    usernameTextView.setMaxLines(1);
    usernameTextView.setLines(1);
    usernameTextView.setBackgroundDrawable(null);
    usernameTextView.setPadding(0, 0, 0, 0);
    usernameTextView.setSingleLine(true);
    usernameTextView.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
    usernameTextView.setImeOptions(EditorInfo.IME_ACTION_DONE);
    usernameTextView.setHint(LocaleController.getString("ChannelUsernamePlaceholder", R.string.ChannelUsernamePlaceholder));
    usernameTextView.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    usernameTextView.setCursorSize(AndroidUtilities.dp(20));
    usernameTextView.setCursorWidth(1.5f);
    publicContainer.addView(usernameTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 36));
    usernameTextView.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 (ignoreTextChanges) {
                return;
            }
            checkUserName(usernameTextView.getText().toString());
        }

        @Override
        public void afterTextChanged(Editable editable) {
            checkDoneButton();
        }
    });
    privateContainer = new LinearLayout(context);
    privateContainer.setOrientation(LinearLayout.VERTICAL);
    linkContainer.addView(privateContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    permanentLinkView = new LinkActionView(context, this, null, chatId, true, ChatObject.isChannel(currentChat));
    permanentLinkView.setDelegate(new LinkActionView.Delegate() {

        @Override
        public void revokeLink() {
            ChatEditTypeActivity.this.generateLink(true);
        }

        @Override
        public void showUsersForPermanentLink() {
            inviteLinkBottomSheet = new InviteLinkBottomSheet(context, invite, info, usersMap, ChatEditTypeActivity.this, chatId, true, ChatObject.isChannel(currentChat));
            inviteLinkBottomSheet.show();
        }
    });
    permanentLinkView.setUsers(0, null);
    privateContainer.addView(permanentLinkView);
    checkTextView = new TextInfoPrivacyCell(context);
    checkTextView.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
    checkTextView.setBottomPadding(6);
    linearLayout.addView(checkTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    typeInfoCell = new TextInfoPrivacyCell(context);
    linearLayout.addView(typeInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    loadingAdminedCell = new LoadingCell(context);
    linearLayout.addView(loadingAdminedCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    adminnedChannelsLayout = new LinearLayout(context);
    adminnedChannelsLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
    adminnedChannelsLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.addView(adminnedChannelsLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    adminedInfoCell = new ShadowSectionCell(context);
    linearLayout.addView(adminedInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    manageLinksTextView = new TextCell(context);
    manageLinksTextView.setBackgroundDrawable(Theme.getSelectorDrawable(true));
    manageLinksTextView.setTextAndIcon(LocaleController.getString("ManageInviteLinks", R.string.ManageInviteLinks), R.drawable.actions_link, false);
    manageLinksTextView.setOnClickListener(v -> {
        ManageLinksActivity fragment = new ManageLinksActivity(chatId, 0, 0);
        fragment.setInfo(info, invite);
        presentFragment(fragment);
    });
    linearLayout.addView(manageLinksTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    manageLinksInfoCell = new TextInfoPrivacyCell(context);
    linearLayout.addView(manageLinksInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    saveContainer = new LinearLayout(context);
    saveContainer.setOrientation(LinearLayout.VERTICAL);
    linearLayout.addView(saveContainer);
    saveHeaderCell = new HeaderCell(context, 23);
    saveHeaderCell.setHeight(46);
    saveHeaderCell.setText(LocaleController.getString("SavingContentTitle", R.string.SavingContentTitle));
    saveHeaderCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
    saveContainer.addView(saveHeaderCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    saveRestrictCell = new TextCheckCell(context);
    saveRestrictCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
    saveRestrictCell.setTextAndCheck(LocaleController.getString("RestrictSavingContent", R.string.RestrictSavingContent), isSaveRestricted, false);
    saveRestrictCell.setOnClickListener(v -> {
        isSaveRestricted = !isSaveRestricted;
        ((TextCheckCell) v).setChecked(isSaveRestricted);
    });
    saveContainer.addView(saveRestrictCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    saveRestrictInfoCell = new TextInfoPrivacyCell(context);
    if (isChannel && !ChatObject.isMegagroup(currentChat)) {
        saveRestrictInfoCell.setText(LocaleController.getString("RestrictSavingContentInfoChannel", R.string.RestrictSavingContentInfoChannel));
    } else {
        saveRestrictInfoCell.setText(LocaleController.getString("RestrictSavingContentInfoGroup", R.string.RestrictSavingContentInfoGroup));
    }
    saveContainer.addView(saveRestrictInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
    if (!isPrivate && currentChat.username != null) {
        ignoreTextChanges = true;
        usernameTextView.setText(currentChat.username);
        usernameTextView.setSelection(currentChat.username.length());
        ignoreTextChanges = false;
    }
    updatePrivatePublic();
    return fragmentView;
}
Also used : RadioButtonCell(org.telegram.ui.Cells.RadioButtonCell) LinkActionView(org.telegram.ui.Components.LinkActionView) TextCheckCell(org.telegram.ui.Cells.TextCheckCell) HeaderCell(org.telegram.ui.Cells.HeaderCell) TextCell(org.telegram.ui.Cells.TextCell) LoadingCell(org.telegram.ui.Cells.LoadingCell) InviteLinkBottomSheet(org.telegram.ui.Components.InviteLinkBottomSheet) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) EditTextBoldCursor(org.telegram.ui.Components.EditTextBoldCursor) ActionBar(org.telegram.ui.ActionBar.ActionBar) Rect(android.graphics.Rect) ShadowSectionCell(org.telegram.ui.Cells.ShadowSectionCell) TextInfoPrivacyCell(org.telegram.ui.Cells.TextInfoPrivacyCell) ActionBarMenu(org.telegram.ui.ActionBar.ActionBarMenu) LinkActionView(org.telegram.ui.Components.LinkActionView) View(android.view.View) ScrollView(android.widget.ScrollView) ScrollView(android.widget.ScrollView) LinearLayout(android.widget.LinearLayout)

Aggregations

InviteLinkBottomSheet (org.telegram.ui.Components.InviteLinkBottomSheet)3 TLRPC (org.telegram.tgnet.TLRPC)2 ActionBar (org.telegram.ui.ActionBar.ActionBar)2 Paint (android.graphics.Paint)1 PorterDuffColorFilter (android.graphics.PorterDuffColorFilter)1 Rect (android.graphics.Rect)1 Bundle (android.os.Bundle)1 Editable (android.text.Editable)1 SpannableStringBuilder (android.text.SpannableStringBuilder)1 TextWatcher (android.text.TextWatcher)1 View (android.view.View)1 FrameLayout (android.widget.FrameLayout)1 LinearLayout (android.widget.LinearLayout)1 ScrollView (android.widget.ScrollView)1 DefaultItemAnimator (androidx.recyclerview.widget.DefaultItemAnimator)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 MessageObject (org.telegram.messenger.MessageObject)1 ActionBarMenu (org.telegram.ui.ActionBar.ActionBarMenu)1 AlertDialog (org.telegram.ui.ActionBar.AlertDialog)1