Java Code Examples for org.telegram.ui.Components.BackupImageView#setAspectFit()

The following examples show how to use org.telegram.ui.Components.BackupImageView#setAspectFit() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StickerCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public StickerCell(Context context) {
    super(context);

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    addView(imageView, LayoutHelper.createFrame(66, 66, Gravity.CENTER_HORIZONTAL, 0, 5, 0, 0));
}
 
Example 2
Source File: FeaturedStickerSetCell.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public FeaturedStickerSetCell(Context context) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 22 : 71, 10, LocaleController.isRTL ? 71 : 22, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setEllipsize(TextUtils.TruncateAt.END);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 100 : 71, 35, LocaleController.isRTL ? 71 : 100, 0));

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    imageView.setLayerNum(1);
    addView(imageView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 8, LocaleController.isRTL ? 12 : 0, 0));

    addButton = new ProgressButton(context);
    addButton.setText(LocaleController.getString("Add", R.string.Add));
    addButton.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText));
    addButton.setProgressColor(Theme.getColor(Theme.key_featuredStickers_buttonProgress));
    addButton.setBackgroundRoundRect(Theme.getColor(Theme.key_featuredStickers_addButton), Theme.getColor(Theme.key_featuredStickers_addButtonPressed));
    addView(addButton, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.END, 0, 18, 14, 0));

    checkImage = new ImageView(context);
    checkImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_featuredStickers_addedIcon), PorterDuff.Mode.MULTIPLY));
    checkImage.setImageResource(R.drawable.sticker_added);
    addView(checkImage, LayoutHelper.createFrame(19, 14));
}
 
Example 3
Source File: ArchivedStickerSetCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public ArchivedStickerSetCell(Context context, boolean needCheckBox) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, 71, 10, needCheckBox ? 71 : 21, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, 71, 35, needCheckBox ? 71 : 21, 0));

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    addView(imageView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 8, LocaleController.isRTL ? 12 : 0, 0));

    if (needCheckBox) {
        checkBox = new Switch(context);
        checkBox.setDuplicateParentStateEnabled(false);
        checkBox.setFocusable(false);
        checkBox.setFocusableInTouchMode(false);
        addView(checkBox, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 14, 0, 14, 0));
    }
}
 
Example 4
Source File: StickerEmojiCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public StickerEmojiCell(Context context) {
    super(context);

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    addView(imageView, LayoutHelper.createFrame(66, 66, Gravity.CENTER));

    emojiTextView = new TextView(context);
    emojiTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    addView(emojiTextView, LayoutHelper.createFrame(28, 28, Gravity.BOTTOM | Gravity.RIGHT));
}
 
Example 5
Source File: StickerCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public StickerCell(Context context) {
    super(context);

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    addView(imageView, LayoutHelper.createFrame(66, 66, Gravity.CENTER_HORIZONTAL, 0, 5, 0, 0));
}
 
Example 6
Source File: StickerCell.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public StickerCell(Context context) {
    super(context);

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    imageView.setLayerNum(1);
    addView(imageView, LayoutHelper.createFrame(66, 66, Gravity.CENTER_HORIZONTAL, 0, 5, 0, 0));
    setFocusable(true);
}
 
Example 7
Source File: ArchivedStickerSetCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public ArchivedStickerSetCell(Context context, boolean needCheckBox) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, 71, 10, needCheckBox ? 71 : 21, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, 71, 35, needCheckBox ? 71 : 21, 0));

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    addView(imageView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 8, LocaleController.isRTL ? 12 : 0, 0));

    if (needCheckBox) {
        checkBox = new Switch(context);
        checkBox.setDuplicateParentStateEnabled(false);
        checkBox.setFocusable(false);
        checkBox.setFocusableInTouchMode(false);
        addView(checkBox, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 14, 0, 14, 0));
    }
}
 
Example 8
Source File: StickerEmojiCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public StickerEmojiCell(Context context) {
    super(context);

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    addView(imageView, LayoutHelper.createFrame(66, 66, Gravity.CENTER));

    emojiTextView = new TextView(context);
    emojiTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    addView(emojiTextView, LayoutHelper.createFrame(28, 28, Gravity.BOTTOM | Gravity.RIGHT));
}
 
Example 9
Source File: StickerCell.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public StickerCell(Context context) {
    super(context);

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    imageView.setLayerNum(1);
    addView(imageView, LayoutHelper.createFrame(66, 66, Gravity.CENTER_HORIZONTAL, 0, 5, 0, 0));
    setFocusable(true);
}
 
Example 10
Source File: StickerEmojiCell.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public StickerEmojiCell(Context context) {
    super(context);

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    imageView.setLayerNum(1);
    addView(imageView, LayoutHelper.createFrame(66, 66, Gravity.CENTER));

    emojiTextView = new TextView(context);
    emojiTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    addView(emojiTextView, LayoutHelper.createFrame(28, 28, Gravity.BOTTOM | Gravity.RIGHT));
    setFocusable(true);
}
 
Example 11
Source File: StickerEmojiCell.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public StickerEmojiCell(Context context) {
    super(context);

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    imageView.setLayerNum(1);
    addView(imageView, LayoutHelper.createFrame(66, 66, Gravity.CENTER));

    emojiTextView = new TextView(context);
    emojiTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    addView(emojiTextView, LayoutHelper.createFrame(28, 28, Gravity.BOTTOM | Gravity.RIGHT));
    setFocusable(true);
}
 
Example 12
Source File: ArchivedStickerSetCell.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public ArchivedStickerSetCell(Context context, boolean checkable) {
    super(context);

    if (this.checkable = checkable) {
        currentButton = addButton = new ProgressButton(context);
        addButton.setText(LocaleController.getString("Add", R.string.Add));
        addButton.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText));
        addButton.setProgressColor(Theme.getColor(Theme.key_featuredStickers_buttonProgress));
        addButton.setBackgroundRoundRect(Theme.getColor(Theme.key_featuredStickers_addButton), Theme.getColor(Theme.key_featuredStickers_addButtonPressed));
        addView(addButton, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.END, 0, 18, 14, 0));

        final int minWidth = AndroidUtilities.dp(60);
        deleteButton = new ProgressButton(context);
        deleteButton.setAllCaps(false);
        deleteButton.setMinWidth(minWidth);
        deleteButton.setMinimumWidth(minWidth);
        deleteButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
        deleteButton.setTextColor(Theme.getColor(Theme.key_featuredStickers_removeButtonText));
        deleteButton.setText(LocaleController.getString("StickersRemove", R.string.StickersRemove));
        deleteButton.setBackground(Theme.getRoundRectSelectorDrawable(Theme.getColor(Theme.key_featuredStickers_removeButtonText)));
        deleteButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        ViewHelper.setPadding(deleteButton, 8, 0, 8, 0);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            deleteButton.setOutlineProvider(null);
        }
        addView(deleteButton, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.END, 0, 18, 14, 0));

        final OnClickListener toggleListener = v -> toggle();
        addButton.setOnClickListener(toggleListener);
        deleteButton.setOnClickListener(toggleListener);

        syncButtons(false);
    } else {
        addButton = null;
        deleteButton = null;
    }

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(LayoutHelper.getAbsoluteGravityStart());
    addView(textView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, 71, 10, 21, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setGravity(LayoutHelper.getAbsoluteGravityStart());
    addView(valueTextView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, 71, 35, 21, 0));

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    imageView.setLayerNum(1);
    addView(imageView, LayoutHelper.createFrameRelatively(48, 48, Gravity.START | Gravity.TOP, 12, 8, 0, 0));
}
 
Example 13
Source File: StickerSetCell.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public StickerSetCell(Context context, int option) {
    super(context);
    this.option = option;

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(LayoutHelper.getAbsoluteGravityStart());
    addView(textView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, 71, 9, 46, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setGravity(LayoutHelper.getAbsoluteGravityStart());
    addView(valueTextView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, 71, 32, 46, 0));

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    imageView.setLayerNum(1);
    addView(imageView, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 13, 9, LocaleController.isRTL ? 13 : 0, 0));

    if (option == 2) {
        progressView = new RadialProgressView(getContext());
        progressView.setProgressColor(Theme.getColor(Theme.key_dialogProgressCircle));
        progressView.setSize(AndroidUtilities.dp(30));
        addView(progressView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 5, LocaleController.isRTL ? 12 : 0, 0));
    } else if (option != 0) {
        optionsButton = new ImageView(context);
        optionsButton.setFocusable(false);
        optionsButton.setScaleType(ImageView.ScaleType.CENTER);
        optionsButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_stickers_menuSelector)));
        if (option == 1) {
            optionsButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_stickers_menu), PorterDuff.Mode.MULTIPLY));
            optionsButton.setImageResource(R.drawable.msg_actions);
            addView(optionsButton, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL));

            reorderButton = new ImageView(context);
            reorderButton.setAlpha(0f);
            reorderButton.setVisibility(GONE);
            reorderButton.setScaleType(ImageView.ScaleType.CENTER);
            reorderButton.setImageResource(R.drawable.list_reorder);
            reorderButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_stickers_menu), PorterDuff.Mode.MULTIPLY));
            addView(reorderButton, LayoutHelper.createFrameRelatively(58, 58, Gravity.END));

            checkBox = new CheckBox2(context, 21);
            checkBox.setColor(null, Theme.key_windowBackgroundWhite, Theme.key_checkboxCheck);
            checkBox.setDrawUnchecked(false);
            checkBox.setDrawBackgroundAsArc(3);
            addView(checkBox, LayoutHelper.createFrameRelatively(24, 24, Gravity.START, 34, 30, 0, 0));
        } else if (option == 3) {
            optionsButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_featuredStickers_addedIcon), PorterDuff.Mode.MULTIPLY));
            optionsButton.setImageResource(R.drawable.sticker_added);
            addView(optionsButton, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, (LocaleController.isRTL ? 10 : 0), 9, (LocaleController.isRTL ? 0 : 10), 0));
        }
    }
}
 
Example 14
Source File: FeaturedStickerSetCell2.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public FeaturedStickerSetCell2(Context context) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 22 : 71, 10, LocaleController.isRTL ? 71 : 22, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setEllipsize(TextUtils.TruncateAt.END);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 100 : 71, 35, LocaleController.isRTL ? 71 : 100, 0));

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    imageView.setLayerNum(1);
    addView(imageView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 8, LocaleController.isRTL ? 12 : 0, 0));

    addButton = new ProgressButton(context);
    addButton.setText(LocaleController.getString("Add", R.string.Add));
    addButton.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText));
    addView(addButton, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.END, 0, 18, 14, 0));

    delButton = new TextView(context);
    delButton.setGravity(Gravity.CENTER);
    delButton.setTextColor(Theme.getColor(Theme.key_featuredStickers_removeButtonText));
    delButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    delButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    delButton.setText(LocaleController.getString("StickersRemove", R.string.StickersRemove));
    addView(delButton, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.END, 0, 16, 14, 0));

    updateColors();
}
 
Example 15
Source File: ArchivedStickerSetCell.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public ArchivedStickerSetCell(Context context, boolean checkable) {
    super(context);

    if (this.checkable = checkable) {
        currentButton = addButton = new ProgressButton(context);
        addButton.setText(LocaleController.getString("Add", R.string.Add));
        addButton.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText));
        addButton.setProgressColor(Theme.getColor(Theme.key_featuredStickers_buttonProgress));
        addButton.setBackgroundRoundRect(Theme.getColor(Theme.key_featuredStickers_addButton), Theme.getColor(Theme.key_featuredStickers_addButtonPressed));
        addView(addButton, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.END, 0, 18, 14, 0));

        final int minWidth = AndroidUtilities.dp(60);
        deleteButton = new ProgressButton(context);
        deleteButton.setAllCaps(false);
        deleteButton.setMinWidth(minWidth);
        deleteButton.setMinimumWidth(minWidth);
        deleteButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
        deleteButton.setTextColor(Theme.getColor(Theme.key_featuredStickers_removeButtonText));
        deleteButton.setText(LocaleController.getString("StickersRemove", R.string.StickersRemove));
        deleteButton.setBackground(Theme.getRoundRectSelectorDrawable(Theme.getColor(Theme.key_featuredStickers_removeButtonText)));
        deleteButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        ViewHelper.setPadding(deleteButton, 8, 0, 8, 0);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            deleteButton.setOutlineProvider(null);
        }
        addView(deleteButton, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.END, 0, 18, 14, 0));

        final OnClickListener toggleListener = v -> toggle();
        addButton.setOnClickListener(toggleListener);
        deleteButton.setOnClickListener(toggleListener);

        syncButtons(false);
    } else {
        addButton = null;
        deleteButton = null;
    }

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(LayoutHelper.getAbsoluteGravityStart());
    addView(textView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, 71, 10, 21, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setGravity(LayoutHelper.getAbsoluteGravityStart());
    addView(valueTextView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, 71, 35, 21, 0));

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    imageView.setLayerNum(1);
    addView(imageView, LayoutHelper.createFrameRelatively(48, 48, Gravity.START | Gravity.TOP, 12, 8, 0, 0));
}
 
Example 16
Source File: StickerSetCell.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public StickerSetCell(Context context, int option) {
    super(context);
    this.option = option;

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(LayoutHelper.getAbsoluteGravityStart());
    addView(textView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, 71, 9, 46, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setGravity(LayoutHelper.getAbsoluteGravityStart());
    addView(valueTextView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, 71, 32, 46, 0));

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    imageView.setLayerNum(1);
    addView(imageView, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 13, 9, LocaleController.isRTL ? 13 : 0, 0));

    if (option == 2) {
        progressView = new RadialProgressView(getContext());
        progressView.setProgressColor(Theme.getColor(Theme.key_dialogProgressCircle));
        progressView.setSize(AndroidUtilities.dp(30));
        addView(progressView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 5, LocaleController.isRTL ? 12 : 0, 0));
    } else if (option != 0) {
        optionsButton = new ImageView(context);
        optionsButton.setFocusable(false);
        optionsButton.setScaleType(ImageView.ScaleType.CENTER);
        optionsButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_stickers_menuSelector)));
        if (option == 1) {
            optionsButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_stickers_menu), PorterDuff.Mode.MULTIPLY));
            optionsButton.setImageResource(R.drawable.msg_actions);
            addView(optionsButton, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL));

            reorderButton = new ImageView(context);
            reorderButton.setAlpha(0f);
            reorderButton.setVisibility(GONE);
            reorderButton.setScaleType(ImageView.ScaleType.CENTER);
            reorderButton.setImageResource(R.drawable.list_reorder);
            reorderButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_stickers_menu), PorterDuff.Mode.MULTIPLY));
            addView(reorderButton, LayoutHelper.createFrameRelatively(58, 58, Gravity.END));

            checkBox = new CheckBox2(context, 21);
            checkBox.setColor(null, Theme.key_windowBackgroundWhite, Theme.key_checkboxCheck);
            checkBox.setDrawUnchecked(false);
            checkBox.setDrawBackgroundAsArc(3);
            addView(checkBox, LayoutHelper.createFrameRelatively(24, 24, Gravity.START, 34, 30, 0, 0));
        } else if (option == 3) {
            optionsButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_featuredStickers_addedIcon), PorterDuff.Mode.MULTIPLY));
            optionsButton.setImageResource(R.drawable.sticker_added);
            addView(optionsButton, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, (LocaleController.isRTL ? 10 : 0), 9, (LocaleController.isRTL ? 0 : 10), 0));
        }
    }
}
 
Example 17
Source File: FeaturedStickerSetCell.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public FeaturedStickerSetCell(Context context) {
    super(context);

    progressPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    progressPaint.setColor(Theme.getColor(Theme.key_featuredStickers_buttonProgress));
    progressPaint.setStrokeCap(Paint.Cap.ROUND);
    progressPaint.setStyle(Paint.Style.STROKE);
    progressPaint.setStrokeWidth(AndroidUtilities.dp(2));

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 100 : 71, 10, LocaleController.isRTL ? 71 : 100, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setEllipsize(TextUtils.TruncateAt.END);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 100 : 71, 35, LocaleController.isRTL ? 71 : 100, 0));

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    addView(imageView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 8, LocaleController.isRTL ? 12 : 0, 0));

    addButton = new TextView(context) {
        @Override
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            if (drawProgress || !drawProgress && progressAlpha != 0) {
                progressPaint.setAlpha(Math.min(255, (int) (progressAlpha * 255)));
                int x = getMeasuredWidth() - AndroidUtilities.dp(11);
                progressRect.set(x, AndroidUtilities.dp(3), x + AndroidUtilities.dp(8), AndroidUtilities.dp(8 + 3));
                canvas.drawArc(progressRect, angle, 220, false, progressPaint);
                invalidate((int) progressRect.left - AndroidUtilities.dp(2), (int) progressRect.top - AndroidUtilities.dp(2), (int) progressRect.right + AndroidUtilities.dp(2), (int) progressRect.bottom + AndroidUtilities.dp(2));
                long newTime = System.currentTimeMillis();
                if (Math.abs(lastUpdateTime - System.currentTimeMillis()) < 1000) {
                    long delta = (newTime - lastUpdateTime);
                    float dt = 360 * delta / 2000.0f;
                    angle += dt;
                    angle -= 360 * (angle / 360);
                    if (drawProgress) {
                        if (progressAlpha < 1.0f) {
                            progressAlpha += delta / 200.0f;
                            if (progressAlpha > 1.0f) {
                                progressAlpha = 1.0f;
                            }
                        }
                    } else {
                        if (progressAlpha > 0.0f) {
                            progressAlpha -= delta / 200.0f;
                            if (progressAlpha < 0.0f) {
                                progressAlpha = 0.0f;
                            }
                        }
                    }
                }
                lastUpdateTime = newTime;
                invalidate();
            }
        }
    };
    addButton.setGravity(Gravity.CENTER);
    addButton.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText));
    addButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    addButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    addButton.setBackgroundDrawable(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(4), Theme.getColor(Theme.key_featuredStickers_addButton), Theme.getColor(Theme.key_featuredStickers_addButtonPressed)));
    addButton.setText(LocaleController.getString("Add", R.string.Add).toUpperCase());
    addButton.setPadding(AndroidUtilities.dp(17), 0, AndroidUtilities.dp(17), 0);
    addView(addButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT), LocaleController.isRTL ? 14 : 0, 18, LocaleController.isRTL ? 0 : 14, 0));

    checkImage = new ImageView(context);
    checkImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_featuredStickers_addedIcon), PorterDuff.Mode.MULTIPLY));
    checkImage.setImageResource(R.drawable.sticker_added);
    addView(checkImage, LayoutHelper.createFrame(19, 14));
}
 
Example 18
Source File: StickerSetCell.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public StickerSetCell(Context context, int option) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 40 : 71, 10, LocaleController.isRTL ? 71 : 40, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 40 : 71, 35, LocaleController.isRTL ? 71 : 40, 0));

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    addView(imageView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 8, LocaleController.isRTL ? 12 : 0, 0));

    if (option == 2) {
        progressView = new RadialProgressView(getContext());
        progressView.setProgressColor(Theme.getColor(Theme.key_dialogProgressCircle));
        progressView.setSize(AndroidUtilities.dp(30));
        addView(progressView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 8, LocaleController.isRTL ? 12 : 0, 0));
    } else if (option != 0) {
        optionsButton = new ImageView(context);
        optionsButton.setFocusable(false);
        optionsButton.setScaleType(ImageView.ScaleType.CENTER);
        optionsButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_stickers_menuSelector)));
        if (option == 1) {
            optionsButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_stickers_menu), PorterDuff.Mode.MULTIPLY));
            optionsButton.setImageResource(R.drawable.msg_actions);
            addView(optionsButton, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP));
        } else if (option == 3) {
            optionsButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_featuredStickers_addedIcon), PorterDuff.Mode.MULTIPLY));
            optionsButton.setImageResource(R.drawable.sticker_added);
            addView(optionsButton, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, (LocaleController.isRTL ? 10 : 0), 12, (LocaleController.isRTL ? 0 : 10), 0));
        }
    }
}
 
Example 19
Source File: FeaturedStickerSetCell.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public FeaturedStickerSetCell(Context context) {
    super(context);

    progressPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    progressPaint.setColor(Theme.getColor(Theme.key_featuredStickers_buttonProgress));
    progressPaint.setStrokeCap(Paint.Cap.ROUND);
    progressPaint.setStyle(Paint.Style.STROKE);
    progressPaint.setStrokeWidth(AndroidUtilities.dp(2));

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 100 : 71, 10, LocaleController.isRTL ? 71 : 100, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setEllipsize(TextUtils.TruncateAt.END);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 100 : 71, 35, LocaleController.isRTL ? 71 : 100, 0));

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    addView(imageView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 8, LocaleController.isRTL ? 12 : 0, 0));

    addButton = new TextView(context) {
        @Override
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            if (drawProgress || !drawProgress && progressAlpha != 0) {
                progressPaint.setAlpha(Math.min(255, (int) (progressAlpha * 255)));
                int x = getMeasuredWidth() - AndroidUtilities.dp(11);
                progressRect.set(x, AndroidUtilities.dp(3), x + AndroidUtilities.dp(8), AndroidUtilities.dp(8 + 3));
                canvas.drawArc(progressRect, angle, 220, false, progressPaint);
                invalidate((int) progressRect.left - AndroidUtilities.dp(2), (int) progressRect.top - AndroidUtilities.dp(2), (int) progressRect.right + AndroidUtilities.dp(2), (int) progressRect.bottom + AndroidUtilities.dp(2));
                long newTime = System.currentTimeMillis();
                if (Math.abs(lastUpdateTime - System.currentTimeMillis()) < 1000) {
                    long delta = (newTime - lastUpdateTime);
                    float dt = 360 * delta / 2000.0f;
                    angle += dt;
                    angle -= 360 * (angle / 360);
                    if (drawProgress) {
                        if (progressAlpha < 1.0f) {
                            progressAlpha += delta / 200.0f;
                            if (progressAlpha > 1.0f) {
                                progressAlpha = 1.0f;
                            }
                        }
                    } else {
                        if (progressAlpha > 0.0f) {
                            progressAlpha -= delta / 200.0f;
                            if (progressAlpha < 0.0f) {
                                progressAlpha = 0.0f;
                            }
                        }
                    }
                }
                lastUpdateTime = newTime;
                invalidate();
            }
        }
    };
    addButton.setGravity(Gravity.CENTER);
    addButton.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText));
    addButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    addButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    addButton.setBackgroundDrawable(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(4), Theme.getColor(Theme.key_featuredStickers_addButton), Theme.getColor(Theme.key_featuredStickers_addButtonPressed)));
    addButton.setText(LocaleController.getString("Add", R.string.Add).toUpperCase());
    addButton.setPadding(AndroidUtilities.dp(17), 0, AndroidUtilities.dp(17), 0);
    addView(addButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT), LocaleController.isRTL ? 14 : 0, 18, LocaleController.isRTL ? 0 : 14, 0));

    checkImage = new ImageView(context);
    checkImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_featuredStickers_addedIcon), PorterDuff.Mode.MULTIPLY));
    checkImage.setImageResource(R.drawable.sticker_added);
    addView(checkImage, LayoutHelper.createFrame(19, 14));
}
 
Example 20
Source File: StickerSetCell.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public StickerSetCell(Context context, int option) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 40 : 71, 10, LocaleController.isRTL ? 71 : 40, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 40 : 71, 35, LocaleController.isRTL ? 71 : 40, 0));

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    addView(imageView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 8, LocaleController.isRTL ? 12 : 0, 0));

    if (option == 2) {
        progressView = new RadialProgressView(getContext());
        progressView.setProgressColor(Theme.getColor(Theme.key_dialogProgressCircle));
        progressView.setSize(AndroidUtilities.dp(30));
        addView(progressView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 8, LocaleController.isRTL ? 12 : 0, 0));
    } else if (option != 0) {
        optionsButton = new ImageView(context);
        optionsButton.setFocusable(false);
        optionsButton.setScaleType(ImageView.ScaleType.CENTER);
        optionsButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_stickers_menuSelector)));
        if (option == 1) {
            optionsButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_stickers_menu), PorterDuff.Mode.MULTIPLY));
            optionsButton.setImageResource(R.drawable.msg_actions);
            addView(optionsButton, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP));
        } else if (option == 3) {
            optionsButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_featuredStickers_addedIcon), PorterDuff.Mode.MULTIPLY));
            optionsButton.setImageResource(R.drawable.sticker_added);
            addView(optionsButton, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, (LocaleController.isRTL ? 10 : 0), 12, (LocaleController.isRTL ? 0 : 10), 0));
        }
    }
}