Java Code Examples for org.telegram.ui.Components.LayoutHelper#createFrame()
The following examples show how to use
org.telegram.ui.Components.LayoutHelper#createFrame() .
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: StickerSetNameCell.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public StickerSetNameCell(Context context, boolean emoji, boolean supportRtl) { super(context); isEmoji = emoji; FrameLayout.LayoutParams lp; textView = new TextView(context); textView.setTextColor(Theme.getColor(Theme.key_chat_emojiPanelStickerSetName)); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); textView.setEllipsize(TextUtils.TruncateAt.END); textView.setSingleLine(true); if (supportRtl) { lp = LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.START, emoji ? 15 : 17, 4, 57, 0); } else { lp = LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, emoji ? 15 : 17, 4, 57, 0); } addView(textView, lp); 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); if (supportRtl) { lp = LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.END, 17, 6, 17, 0); } else { lp = LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.RIGHT, 17, 6, 17, 0); } addView(urlTextView, lp); buttonView = new ImageView(context); buttonView.setScaleType(ImageView.ScaleType.CENTER); buttonView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_emojiPanelStickerSetNameIcon), PorterDuff.Mode.MULTIPLY)); if (supportRtl) { lp = LayoutHelper.createFrameRelatively(24, 24, Gravity.TOP | Gravity.END, 0, 0, 16, 0); } else { lp = LayoutHelper.createFrame(24, 24, Gravity.TOP | Gravity.RIGHT, 0, 0, 16, 0); } addView(buttonView, lp); }
Example 2
Source File: FeaturedStickerSetInfoCell.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public FeaturedStickerSetInfoCell(Context context, int left, boolean supportRtl, boolean canAddRemove) { super(context); this.canAddRemove = canAddRemove; FrameLayout.LayoutParams lp; nameTextView = new TextView(context); nameTextView.setTextColor(Theme.getColor(Theme.key_chat_emojiPanelTrendingTitle)); nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 17); nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); nameTextView.setEllipsize(TextUtils.TruncateAt.END); nameTextView.setSingleLine(true); if (supportRtl) { lp = LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.START, left, 8, 40, 0); } else { lp = LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, left, 8, 40, 0); } addView(nameTextView, lp); infoTextView = new TextView(context); infoTextView.setTextColor(Theme.getColor(Theme.key_chat_emojiPanelTrendingDescription)); infoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13); infoTextView.setEllipsize(TextUtils.TruncateAt.END); infoTextView.setSingleLine(true); if (supportRtl) { lp = LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.START, left, 30, 100, 0); } else { lp = LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, left, 30, 100, 0); } addView(infoTextView, lp); if (canAddRemove) { addButton = new ProgressButton(context); addButton.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText)); addButton.setText(LocaleController.getString("Add", R.string.Add)); if (supportRtl) { lp = LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.END, 0, 16, 14, 0); } else { lp = LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.RIGHT, 0, 16, 14, 0); } addView(addButton, lp); 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)); if (supportRtl) { lp = LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.END, 0, 16, 14, 0); } else { lp = LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.RIGHT, 0, 16, 14, 0); } addView(delButton, lp); } setWillNotDraw(false); updateColors(); }
Example 3
Source File: StickerSetNameCell.java From Telegram with GNU General Public License v2.0 | 4 votes |
public StickerSetNameCell(Context context, boolean emoji, boolean supportRtl) { super(context); isEmoji = emoji; FrameLayout.LayoutParams lp; textView = new TextView(context); textView.setTextColor(Theme.getColor(Theme.key_chat_emojiPanelStickerSetName)); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); textView.setEllipsize(TextUtils.TruncateAt.END); textView.setSingleLine(true); if (supportRtl) { lp = LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.START, emoji ? 15 : 17, 4, 57, 0); } else { lp = LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, emoji ? 15 : 17, 4, 57, 0); } addView(textView, lp); 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); if (supportRtl) { lp = LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.END, 17, 6, 17, 0); } else { lp = LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.RIGHT, 17, 6, 17, 0); } addView(urlTextView, lp); buttonView = new ImageView(context); buttonView.setScaleType(ImageView.ScaleType.CENTER); buttonView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_emojiPanelStickerSetNameIcon), PorterDuff.Mode.MULTIPLY)); if (supportRtl) { lp = LayoutHelper.createFrameRelatively(24, 24, Gravity.TOP | Gravity.END, 0, 0, 16, 0); } else { lp = LayoutHelper.createFrame(24, 24, Gravity.TOP | Gravity.RIGHT, 0, 0, 16, 0); } addView(buttonView, lp); }
Example 4
Source File: FeaturedStickerSetInfoCell.java From Telegram with GNU General Public License v2.0 | 4 votes |
public FeaturedStickerSetInfoCell(Context context, int left, boolean supportRtl, boolean canAddRemove) { super(context); this.canAddRemove = canAddRemove; FrameLayout.LayoutParams lp; nameTextView = new TextView(context); nameTextView.setTextColor(Theme.getColor(Theme.key_chat_emojiPanelTrendingTitle)); nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 17); nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); nameTextView.setEllipsize(TextUtils.TruncateAt.END); nameTextView.setSingleLine(true); if (supportRtl) { lp = LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.START, left, 8, 40, 0); } else { lp = LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, left, 8, 40, 0); } addView(nameTextView, lp); infoTextView = new TextView(context); infoTextView.setTextColor(Theme.getColor(Theme.key_chat_emojiPanelTrendingDescription)); infoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13); infoTextView.setEllipsize(TextUtils.TruncateAt.END); infoTextView.setSingleLine(true); if (supportRtl) { lp = LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.START, left, 30, 100, 0); } else { lp = LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, left, 30, 100, 0); } addView(infoTextView, lp); if (canAddRemove) { addButton = new ProgressButton(context); addButton.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText)); addButton.setText(LocaleController.getString("Add", R.string.Add)); if (supportRtl) { lp = LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.END, 0, 16, 14, 0); } else { lp = LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.RIGHT, 0, 16, 14, 0); } addView(addButton, lp); 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)); if (supportRtl) { lp = LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.END, 0, 16, 14, 0); } else { lp = LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.RIGHT, 0, 16, 14, 0); } addView(delButton, lp); } setWillNotDraw(false); updateColors(); }