org.telegram.ui.Components.LayoutHelper Java Examples

The following examples show how to use org.telegram.ui.Components.LayoutHelper. 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: ActionBarPopupWindow.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public ActionBarPopupWindowLayout(Context context) {
    super(context);

    backgroundDrawable = getResources().getDrawable(R.drawable.popup_fixed_alert2).mutate();
    setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));

    setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8));
    setWillNotDraw(false);

    try {
        scrollView = new ScrollView(context);
        scrollView.setVerticalScrollBarEnabled(false);
        addView(scrollView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    } catch (Throwable e) {
        FileLog.e(e);
    }

    linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    if (scrollView != null) {
        scrollView.addView(linearLayout, new ScrollView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    } else {
        addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    }
}
 
Example #2
Source File: TextDetailCell.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public TextDetailCell(Context context) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    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 ? 16 : 71, 10, LocaleController.isRTL ? 71 : 16, 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 ? 16 : 71, 35, LocaleController.isRTL ? 71 : 16, 0));

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayIcon), PorterDuff.Mode.MULTIPLY));
    addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 16, 11, LocaleController.isRTL ? 16 : 0, 0));
}
 
Example #3
Source File: AlertDialog.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public AlertDialogCell(Context context) {
    super(context);

    setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_dialogButtonSelector), 2));
    setPadding(AndroidUtilities.dp(23), 0, AndroidUtilities.dp(23), 0);

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogIcon), PorterDuff.Mode.MULTIPLY));
    addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 40, Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT)));

    textView = new TextView(context);
    textView.setLines(1);
    textView.setSingleLine(true);
    textView.setGravity(Gravity.CENTER_HORIZONTAL);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL));
}
 
Example #4
Source File: LegendSignatureView.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
Holder() {
    root = new LinearLayout(getContext());
    root.setPadding(AndroidUtilities.dp(4), AndroidUtilities.dp(2), AndroidUtilities.dp(4), AndroidUtilities.dp(2));

    if (showPercentage) {
        root.addView(percentage = new TextView(getContext()));
        percentage.getLayoutParams().width = AndroidUtilities.dp(36);
        percentage.setVisibility(GONE);
        percentage.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        percentage.setTextSize(13);
    }

    root.addView(signature = new TextView(getContext()));
    signature.getLayoutParams().width = showPercentage ? AndroidUtilities.dp(80) : AndroidUtilities.dp(96);
    root.addView(value = new TextView(getContext()), LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));

    signature.setGravity(Gravity.START);
    value.setGravity(Gravity.END);

    value.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    value.setTextSize(13);
    value.setMinEms(4);
    value.setMaxEms(4);
    signature.setTextSize(13);
}
 
Example #5
Source File: AlertDialog.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public AlertDialogCell(Context context) {
    super(context);

    setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_dialogButtonSelector), 2));
    setPadding(AndroidUtilities.dp(23), 0, AndroidUtilities.dp(23), 0);

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogIcon), PorterDuff.Mode.MULTIPLY));
    addView(imageView, LayoutHelper.createFrame(24, 24, Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT)));

    textView = new TextView(context);
    textView.setLines(1);
    textView.setSingleLine(true);
    textView.setGravity(Gravity.CENTER_HORIZONTAL);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL));
}
 
Example #6
Source File: ThemeTypeCell.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public ThemeTypeCell(Context context) {
    super(context);

    setWillNotDraw(false);

    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) | Gravity.CENTER_VERTICAL);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 23 + 48 : 17, 0, LocaleController.isRTL ? 17 : 23, 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, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 23, 0, 23, 0));
}
 
Example #7
Source File: StickerSetNameCell.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public StickerSetNameCell(Context context) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_chat_emojiPanelStickerSetName));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setSingleLine(true);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 17, 4, 57, 0));

    urlTextView = new TextView(context);
    urlTextView.setTextColor(Theme.getColor(Theme.key_chat_emojiPanelStickerSetName));
    urlTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    urlTextView.setEllipsize(TextUtils.TruncateAt.END);
    urlTextView.setSingleLine(true);
    urlTextView.setVisibility(INVISIBLE);
    addView(urlTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.RIGHT, 17, 6, 17, 0));

    buttonView = new ImageView(context);
    buttonView.setScaleType(ImageView.ScaleType.CENTER);
    buttonView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_emojiPanelStickerSetNameIcon), PorterDuff.Mode.MULTIPLY));
    addView(buttonView, LayoutHelper.createFrame(24, 24, Gravity.TOP | Gravity.RIGHT, 0, 0, 16, 0));
}
 
Example #8
Source File: TextCheckBoxCell.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public TextCheckBoxCell(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.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 64 : 17, 0, LocaleController.isRTL ? 17 : 64, 0));

    checkBox = new CheckBoxSquare(context, false);
    checkBox.setDuplicateParentStateEnabled(false);
    checkBox.setFocusable(false);
    checkBox.setFocusableInTouchMode(false);
    checkBox.setClickable(false);
    addView(checkBox, LayoutHelper.createFrame(18, 18, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 19, 0, 19, 0));
}
 
Example #9
Source File: PhotoAttachPermissionCell.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public PhotoAttachPermissionCell(Context context) {
    super(context);

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_attachPermissionImage), PorterDuff.Mode.MULTIPLY));
    addView(imageView, LayoutHelper.createFrame(44, 44, Gravity.CENTER, 5, 0, 0, 27));

    imageView2 = new ImageView(context);
    imageView2.setScaleType(ImageView.ScaleType.CENTER);
    imageView2.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_attachPermissionMark), PorterDuff.Mode.MULTIPLY));
    addView(imageView2, LayoutHelper.createFrame(44, 44, Gravity.CENTER, 5, 0, 0, 27));

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_chat_attachPermissionText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    textView.setGravity(Gravity.CENTER);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 5, 13, 5, 0));

    itemSize = AndroidUtilities.dp(80);
}
 
Example #10
Source File: GroupCreateUserCell.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public GroupCreateUserCell(Context context, boolean needCheck) {
    super(context);
    avatarDrawable = new AvatarDrawable();

    avatarImageView = new BackupImageView(context);
    avatarImageView.setRoundRadius(AndroidUtilities.dp(24));
    addView(avatarImageView, LayoutHelper.createFrame(50, 50, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 11, 11, LocaleController.isRTL ? 11 : 0, 0));

    nameTextView = new SimpleTextView(context);
    nameTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    nameTextView.setTextSize(17);
    nameTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
    addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 28 : 72, 14, LocaleController.isRTL ? 72 : 28, 0));

    statusTextView = new SimpleTextView(context);
    statusTextView.setTextSize(16);
    statusTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
    addView(statusTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 28 : 72, 39, LocaleController.isRTL ? 72 : 28, 0));

    if (needCheck) {
        checkBox = new GroupCreateCheckBox(context);
        checkBox.setVisibility(VISIBLE);
        addView(checkBox, LayoutHelper.createFrame(24, 24, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 41, 41, LocaleController.isRTL ? 41 : 0, 0));
    }
}
 
Example #11
Source File: ActionBarPopupWindow.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public ActionBarPopupWindowLayout(Context context) {
    super(context);

    backgroundDrawable = getResources().getDrawable(R.drawable.popup_fixed).mutate();
    backgroundDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground), PorterDuff.Mode.MULTIPLY));

    setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8));
    setWillNotDraw(false);

    try {
        scrollView = new ScrollView(context);
        scrollView.setVerticalScrollBarEnabled(false);
        addView(scrollView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    } catch (Throwable e) {
        FileLog.e(e);
    }


    linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    if (scrollView != null) {
        scrollView.addView(linearLayout, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    } else {
        addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    }
}
 
Example #12
Source File: HeaderCell.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public HeaderCell(Context context, String textColorKey, int padding, int topMargin, boolean text2) {
    super(context);

    textView = new TextView(getContext());
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
    textView.setMinHeight(AndroidUtilities.dp(height - topMargin));
    textView.setTextColor(Theme.getColor(textColorKey));
    textView.setTag(textColorKey);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, padding, topMargin, padding, 0));

    if (text2) {
        textView2 = new SimpleTextView(getContext());
        textView2.setTextSize(13);
        textView2.setGravity((LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP);
        addView(textView2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, padding, 21, padding, 0));
    }
}
 
Example #13
Source File: ThemeActivity.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public TextSizeCell(Context context) {
    super(context);

    setWillNotDraw(false);

    textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
    textPaint.setTextSize(AndroidUtilities.dp(16));

    sizeBar = new SeekBarView(context);
    sizeBar.setReportChanges(true);
    sizeBar.setDelegate(new SeekBarView.SeekBarViewDelegate() {
        @Override
        public void onSeekBarDrag(boolean stop, float progress) {
            setFontSize(Math.round(startFontSize + (endFontSize - startFontSize) * progress));
        }

        @Override
        public void onSeekBarPressed(boolean pressed) {

        }
    });
    addView(sizeBar, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.LEFT | Gravity.TOP, 5, 5, 39, 0));

    messagesCell = new ThemePreviewMessagesCell(context, parentLayout, 0);
    addView(messagesCell, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 0, 53, 0, 0));
}
 
Example #14
Source File: ActionBarMenuItem.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public ActionBarMenuItem(Context context, ActionBarMenu menu, int backgroundColor, int iconColor)
{
    super(context);
    if (backgroundColor != 0)
    {
        setBackgroundDrawable(Theme.createSelectorDrawable(backgroundColor));
    }
    parentMenu = menu;

    iconView = new ImageView(context);
    iconView.setScaleType(ImageView.ScaleType.CENTER);
    addView(iconView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    if (iconColor != 0)
    {
        iconView.setColorFilter(new PorterDuffColorFilter(iconColor, PorterDuff.Mode.MULTIPLY));
    }
}
 
Example #15
Source File: PhotoAttachPermissionCell.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public void setType(int type) {
    if (type == 0) {
        imageView.setImageResource(R.drawable.permissions_camera1);
        imageView2.setImageResource(R.drawable.permissions_camera2);
        textView.setText(LocaleController.getString("CameraPermissionText", R.string.CameraPermissionText));

        imageView.setLayoutParams(LayoutHelper.createFrame(44, 44, Gravity.CENTER, 5, 0, 0, 27));
        imageView2.setLayoutParams(LayoutHelper.createFrame(44, 44, Gravity.CENTER, 5, 0, 0, 27));
    } else {
        imageView.setImageResource(R.drawable.permissions_gallery1);
        imageView2.setImageResource(R.drawable.permissions_gallery2);
        textView.setText(LocaleController.getString("GalleryPermissionText", R.string.GalleryPermissionText));

        imageView.setLayoutParams(LayoutHelper.createFrame(44, 44, Gravity.CENTER, 0, 0, 2, 27));
        imageView2.setLayoutParams(LayoutHelper.createFrame(44, 44, Gravity.CENTER, 0, 0, 2, 27));
    }
}
 
Example #16
Source File: TextDetailCell.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public TextDetailCell(Context context) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, 23, 8, 23, 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, 23, 33, 23, 0));
}
 
Example #17
Source File: ThemeTypeCell.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public ThemeTypeCell(Context context) {
    super(context);

    setWillNotDraw(false);

    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) | Gravity.CENTER_VERTICAL);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 23 + 48 : 21, 0, LocaleController.isRTL ? 21 : 23, 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, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 23, 0, 23, 0));
}
 
Example #18
Source File: TextPriceCell.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public TextPriceCell(Context context) {
    super(context);

    dotstring = LocaleController.isRTL ? " ." : ". ";
    setWillNotDraw(false);

    textView = new TextView(context);
    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) | Gravity.CENTER_VERTICAL);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 0, 17, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    valueTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setEllipsize(TextUtils.TruncateAt.END);
    valueTextView.setGravity((LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, 17, 0, 17, 0));
}
 
Example #19
Source File: FeaturedStickerSetCell.java    From Telegram-FOSS 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 #20
Source File: QuickRepliesSettingsActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public View createView(Context context) {
	actionBar.setBackButtonImage(R.drawable.ic_ab_back);
	actionBar.setTitle(LocaleController.getString("VoipQuickReplies", R.string.VoipQuickReplies));
	if (AndroidUtilities.isTablet()) {
		actionBar.setOccupyStatusBar(false);
	}
	actionBar.setAllowOverlayTitle(true);
	actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
		@Override
		public void onItemClick(int id) {
			if (id == -1) {
				finishFragment();
			}
		}
	});

	listAdapter = new ListAdapter(context);

	fragmentView = new FrameLayout(context);
	fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
	FrameLayout frameLayout = (FrameLayout) fragmentView;

	listView = new RecyclerListView(context);
	listView.setVerticalScrollBarEnabled(false);
	listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
	frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
	listView.setAdapter(listAdapter);

	return fragmentView;
}
 
Example #21
Source File: DrawerAddCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public DrawerAddCell(Context context) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_chats_menuItemText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
    textView.setCompoundDrawablePadding(AndroidUtilities.dp(34));
    addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.LEFT | Gravity.TOP, 23, 0, 16, 0));
}
 
Example #22
Source File: LocationCell.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public LocationCell(Context context, boolean wrap) {
    super(context);

    wrapContent = wrap;

    imageView = new BackupImageView(context);
    imageView.setBackground(circleDrawable = Theme.createCircleDrawable(AndroidUtilities.dp(42), 0xffffffff));
    imageView.setSize(AndroidUtilities.dp(30), AndroidUtilities.dp(30));
    addView(imageView, LayoutHelper.createFrame(42, 42, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 15, 11, LocaleController.isRTL ? 15 : 0, 0));

    nameTextView = new TextView(context);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    nameTextView.setMaxLines(1);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    nameTextView.setSingleLine(true);
    nameTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    nameTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), (LocaleController.isRTL ? 16 : 73), 10, (LocaleController.isRTL ? 73 : 16), 0));

    addressTextView = new TextView(context);
    addressTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    addressTextView.setMaxLines(1);
    addressTextView.setEllipsize(TextUtils.TruncateAt.END);
    addressTextView.setSingleLine(true);
    addressTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText3));
    addressTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(addressTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), (LocaleController.isRTL ? 16 : 73), 35, (LocaleController.isRTL ? 73 : 16), 0));
}
 
Example #23
Source File: TextInfoPrivacyCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public TextInfoPrivacyCell(Context context)
{
    super(context);

    textView = new TextView(context);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    textView.setPadding(0, AndroidUtilities.dp(10), 0, AndroidUtilities.dp(17));
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 0, 17, 0));
}
 
Example #24
Source File: SharedMediaSectionCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public SharedMediaSectionCell(Context context) {
    super(context);

    textView = new TextView(getContext());
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 13, 0, 13, 0));
}
 
Example #25
Source File: SharedPhotoVideoCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public PhotoVideoView(Context context) {
    super(context);

    container = new FrameLayout(context);
    addView(container, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    imageView = new BackupImageView(context);
    imageView.getImageReceiver().setNeedsQualityThumb(true);
    imageView.getImageReceiver().setShouldGenerateQualityThumb(true);
    container.addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    videoInfoContainer = new FrameLayout(context);
    videoInfoContainer.setBackgroundResource(R.drawable.phototime);
    videoInfoContainer.setPadding(AndroidUtilities.dp(3), 0, AndroidUtilities.dp(3), 0);
    container.addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 16, Gravity.BOTTOM | Gravity.LEFT));

    ImageView imageView1 = new ImageView(context);
    imageView1.setImageResource(R.drawable.ic_video);
    videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL));

    videoTextView = new TextView(context);
    videoTextView.setTextColor(0xffffffff);
    videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 18, -0.7f, 0, 0));

    selector = new View(context);
    selector.setBackgroundDrawable(Theme.getSelectorDrawable(false));
    addView(selector, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    checkBox = new CheckBox(context, R.drawable.round_check2);
    checkBox.setVisibility(INVISIBLE);
    checkBox.setColor(Theme.getColor(Theme.key_checkbox), Theme.getColor(Theme.key_checkboxCheck));
    addView(checkBox, LayoutHelper.createFrame(22, 22, Gravity.RIGHT | Gravity.TOP, 0, 2, 2, 0));
}
 
Example #26
Source File: CheckBoxCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public CheckBoxCell(Context context, int type) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(type == 1 ? Theme.key_dialogTextBlack : 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) | Gravity.CENTER_VERTICAL);
    if (type == 2) {
        addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, (LocaleController.isRTL ? 0 : 29), 0, (LocaleController.isRTL ? 29 : 0), 0));
    } else {
        addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, (LocaleController.isRTL ? 17 : 46), 0, (LocaleController.isRTL ? 46 : 17), 0));
    }

    valueTextView = new TextView(context);
    valueTextView.setTextColor(Theme.getColor(type == 1 ? Theme.key_dialogTextBlue : Theme.key_windowBackgroundWhiteValueText));
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setEllipsize(TextUtils.TruncateAt.END);
    valueTextView.setGravity((LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, 17, 0, 17, 0));

    checkBox = new CheckBoxSquare(context, type == 1);
    if (type == 2) {
        addView(checkBox, LayoutHelper.createFrame(18, 18, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 0, 15, 0, 0));
    } else {
        addView(checkBox, LayoutHelper.createFrame(18, 18, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, (LocaleController.isRTL ? 0 : 17), 15, (LocaleController.isRTL ? 17 : 0), 0));
    }
}
 
Example #27
Source File: ProxyListActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public TextDetailProxyCell(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) | Gravity.CENTER_VERTICAL);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, (LocaleController.isRTL ? 56 : 21), 10, (LocaleController.isRTL ? 21 : 56), 0));

    valueTextView = new TextView(context);
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setCompoundDrawablePadding(AndroidUtilities.dp(6));
    valueTextView.setEllipsize(TextUtils.TruncateAt.END);
    valueTextView.setPadding(0, 0, 0, 0);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, (LocaleController.isRTL ? 56 : 21), 35, (LocaleController.isRTL ? 21 : 56), 0));

    checkImageView = new ImageView(context);
    checkImageView.setImageResource(R.drawable.profile_info);
    checkImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText3), PorterDuff.Mode.MULTIPLY));
    checkImageView.setScaleType(ImageView.ScaleType.CENTER);
    checkImageView.setContentDescription(LocaleController.getString("Edit", R.string.Edit));
    addView(checkImageView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, 8, 8, 8, 0));
    checkImageView.setOnClickListener(v -> presentFragment(new ProxySettingsActivity(currentInfo)));

    setWillNotDraw(false);
}
 
Example #28
Source File: SharedMediaSectionCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public SharedMediaSectionCell(Context context) {
    super(context);

    textView = new TextView(getContext());
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 13, 0, 13, 0));
}
 
Example #29
Source File: TextInfoPrivacyCell.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public TextInfoPrivacyCell(Context context, int padding) {
    super(context);

    textView = new TextView(context);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    textView.setPadding(0, AndroidUtilities.dp(10), 0, AndroidUtilities.dp(17));
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4));
    textView.setLinkTextColor(Theme.getColor(linkTextColorKey));
    addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, padding, 0, padding, 0));
}
 
Example #30
Source File: GraySectionCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public GraySectionCell(Context context) {
    super(context);

    setBackgroundColor(Theme.getColor(Theme.key_graySection));

    textView = new TextView(getContext());
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setTextColor(Theme.getColor(Theme.key_graySectionText));
    textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 16, 0, 16, 0));
}