Search in sources :

Example 16 with TextSettingsCell

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

the class ProfileNotificationsActivity method checkRowsEnabled.

private void checkRowsEnabled() {
    int count = listView.getChildCount();
    ArrayList<Animator> animators = new ArrayList<>();
    for (int a = 0; a < count; a++) {
        View child = listView.getChildAt(a);
        RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.getChildViewHolder(child);
        int type = holder.getItemViewType();
        int position = holder.getAdapterPosition();
        if (position != customRow && position != enableRow && type != 0) {
            switch(type) {
                case 1:
                    {
                        TextSettingsCell textCell = (TextSettingsCell) holder.itemView;
                        textCell.setEnabled(customEnabled && notificationsEnabled, animators);
                        break;
                    }
                case 2:
                    {
                        TextInfoPrivacyCell textCell = (TextInfoPrivacyCell) holder.itemView;
                        textCell.setEnabled(customEnabled && notificationsEnabled, animators);
                        break;
                    }
                case 3:
                    {
                        TextColorCell textCell = (TextColorCell) holder.itemView;
                        textCell.setEnabled(customEnabled && notificationsEnabled, animators);
                        break;
                    }
                case 4:
                    {
                        RadioCell radioCell = (RadioCell) holder.itemView;
                        radioCell.setEnabled(customEnabled && notificationsEnabled, animators);
                        break;
                    }
                case 8:
                    {
                        if (position == previewRow) {
                            TextCheckCell checkCell = (TextCheckCell) holder.itemView;
                            checkCell.setEnabled(customEnabled && notificationsEnabled, animators);
                        }
                        break;
                    }
            }
        }
    }
    if (!animators.isEmpty()) {
        if (animatorSet != null) {
            animatorSet.cancel();
        }
        animatorSet = new AnimatorSet();
        animatorSet.playTogether(animators);
        animatorSet.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animator) {
                if (animator.equals(animatorSet)) {
                    animatorSet = null;
                }
            }
        });
        animatorSet.setDuration(150);
        animatorSet.start();
    }
}
Also used : TextCheckCell(org.telegram.ui.Cells.TextCheckCell) ArrayList(java.util.ArrayList) RadioCell(org.telegram.ui.Cells.RadioCell) TextInfoPrivacyCell(org.telegram.ui.Cells.TextInfoPrivacyCell) AnimatorSet(android.animation.AnimatorSet) RecyclerListView(org.telegram.ui.Components.RecyclerListView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) RecyclerListView(org.telegram.ui.Components.RecyclerListView) TextSettingsCell(org.telegram.ui.Cells.TextSettingsCell) Animator(android.animation.Animator) TextColorCell(org.telegram.ui.Cells.TextColorCell) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Aggregations

TextSettingsCell (org.telegram.ui.Cells.TextSettingsCell)16 View (android.view.View)14 TextView (android.widget.TextView)12 TextInfoPrivacyCell (org.telegram.ui.Cells.TextInfoPrivacyCell)12 FrameLayout (android.widget.FrameLayout)11 HeaderCell (org.telegram.ui.Cells.HeaderCell)11 LinearLayout (android.widget.LinearLayout)10 ArrayList (java.util.ArrayList)10 Canvas (android.graphics.Canvas)9 Editable (android.text.Editable)9 TextWatcher (android.text.TextWatcher)9 ViewGroup (android.view.ViewGroup)9 ActionBar (org.telegram.ui.ActionBar.ActionBar)9 EditTextBoldCursor (org.telegram.ui.Components.EditTextBoldCursor)9 SuppressLint (android.annotation.SuppressLint)8 Paint (android.graphics.Paint)8 InputFilter (android.text.InputFilter)8 SpannableStringBuilder (android.text.SpannableStringBuilder)8 TextPaint (android.text.TextPaint)8 ScrollView (android.widget.ScrollView)8