android.graphics.PorterDuffColorFilter Java Examples
The following examples show how to use
android.graphics.PorterDuffColorFilter.
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: KcaViewButtonService.java From kcanotify_h5-master with GNU General Public License v3.0 | 6 votes |
private void setFairyImage() { boolean glow_available = fairy_glow_on && getBooleanPreferences(getApplicationContext(), PREF_KCA_NOTI_QUEST_FAIRY_GLOW); Bitmap src = KcaUtils.getFairyImageFromStorage(getApplicationContext(), viewBitmapId, dbHelper); Bitmap alpha = src.extractAlpha(); Bitmap bmp = Bitmap.createBitmap(src.getWidth() + margin, src.getHeight() + margin, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bmp); if (glow_available) { Paint glow_paint = new Paint(); glow_paint.setColor(glowColor); glow_paint.setMaskFilter(new BlurMaskFilter(glowRadius, BlurMaskFilter.Blur.OUTER)); canvas.drawBitmap(alpha, halfMargin, halfMargin, glow_paint); } Paint color_paint = new Paint(); if (taiha_status) { color_paint.setColorFilter(new PorterDuffColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.colorHeavyDmgStateWarn), PorterDuff.Mode.MULTIPLY)); } else if (glow_available) { color_paint.setColorFilter(new PorterDuffColorFilter(glowColor2, PorterDuff.Mode.MULTIPLY)); } canvas.drawBitmap(src, halfMargin, halfMargin, color_paint); viewbutton.setImageBitmap(bmp); }
Example #2
Source File: ChatActivityEnterView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public RecordCircle(Context context) { super(context); paint.setColor(Theme.getColor(Theme.key_chat_messagePanelVoiceBackground)); paintRecord.setColor(Theme.getColor(Theme.key_chat_messagePanelVoiceShadow)); lockDrawable = getResources().getDrawable(R.drawable.lock_middle); lockDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_messagePanelVoiceLock), PorterDuff.Mode.MULTIPLY)); lockTopDrawable = getResources().getDrawable(R.drawable.lock_top); lockTopDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_messagePanelVoiceLock), PorterDuff.Mode.MULTIPLY)); lockArrowDrawable = getResources().getDrawable(R.drawable.lock_arrow); lockArrowDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_messagePanelVoiceLock), PorterDuff.Mode.MULTIPLY)); lockBackgroundDrawable = getResources().getDrawable(R.drawable.lock_round); lockBackgroundDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_messagePanelVoiceLockBackground), PorterDuff.Mode.MULTIPLY)); lockShadowDrawable = getResources().getDrawable(R.drawable.lock_round_shadow); lockShadowDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_messagePanelVoiceLockShadow), PorterDuff.Mode.MULTIPLY)); micDrawable = getResources().getDrawable(R.drawable.mic).mutate(); micDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_messagePanelVoicePressed), PorterDuff.Mode.MULTIPLY)); cameraDrawable = getResources().getDrawable(R.drawable.ic_msg_panel_video).mutate(); cameraDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_messagePanelVoicePressed), PorterDuff.Mode.MULTIPLY)); sendDrawable = getResources().getDrawable(R.drawable.ic_send).mutate(); sendDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_messagePanelVoicePressed), PorterDuff.Mode.MULTIPLY)); }
Example #3
Source File: ColorFilterTransformation.java From giffun with Apache License 2.0 | 6 votes |
@Override public Resource<Bitmap> transform(Resource<Bitmap> resource, int outWidth, int outHeight) { Bitmap source = resource.get(); int width = source.getWidth(); int height = source.getHeight(); Bitmap.Config config = source.getConfig() != null ? source.getConfig() : Bitmap.Config.ARGB_8888; Bitmap bitmap = mBitmapPool.get(width, height, config); if (bitmap == null) { bitmap = Bitmap.createBitmap(width, height, config); } Canvas canvas = new Canvas(bitmap); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setColorFilter(new PorterDuffColorFilter(mColor, PorterDuff.Mode.SRC_ATOP)); canvas.drawBitmap(source, 0, 0, paint); return BitmapResource.obtain(bitmap, mBitmapPool); }
Example #4
Source File: StickerCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void setSticker(TLRPC.Document document, int side) { if (document != null && document.thumb != null) { imageView.setImage(document.thumb.location, null, "webp", null); } sticker = document; if (side == -1) { setBackgroundResource(R.drawable.stickers_back_left); setPadding(AndroidUtilities.dp(7), 0, 0, 0); } else if (side == 0) { setBackgroundResource(R.drawable.stickers_back_center); setPadding(0, 0, 0, 0); } else if (side == 1) { setBackgroundResource(R.drawable.stickers_back_right); setPadding(0, 0, AndroidUtilities.dp(7), 0); } else if (side == 2) { setBackgroundResource(R.drawable.stickers_back_all); setPadding(AndroidUtilities.dp(3), 0, AndroidUtilities.dp(3), 0); } Drawable background = getBackground(); if (background != null) { background.setAlpha(230); background.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_stickersHintPanel), PorterDuff.Mode.MULTIPLY)); } }
Example #5
Source File: StickerCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void setSticker(TLRPC.Document document, int side) { if (document != null && document.thumb != null) { imageView.setImage(document.thumb.location, null, "webp", null); } sticker = document; if (side == -1) { setBackgroundResource(R.drawable.stickers_back_left); setPadding(AndroidUtilities.dp(7), 0, 0, 0); } else if (side == 0) { setBackgroundResource(R.drawable.stickers_back_center); setPadding(0, 0, 0, 0); } else if (side == 1) { setBackgroundResource(R.drawable.stickers_back_right); setPadding(0, 0, AndroidUtilities.dp(7), 0); } else if (side == 2) { setBackgroundResource(R.drawable.stickers_back_all); setPadding(AndroidUtilities.dp(3), 0, AndroidUtilities.dp(3), 0); } Drawable background = getBackground(); if (background != null) { background.setAlpha(230); background.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_stickersHintPanel), PorterDuff.Mode.MULTIPLY)); } }
Example #6
Source File: DrawableColorHelper.java From adamant-android with GNU General Public License v3.0 | 6 votes |
public static Drawable changeDrawable( Context context, int color, PorterDuff.Mode mode, Drawable drawable ) { if (drawable != null) { drawable = drawable.mutate(); drawable.setColorFilter( new PorterDuffColorFilter( ContextCompat.getColor(context, color), mode ) ); return drawable; } return null; }
Example #7
Source File: ManageChatTextCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public ManageChatTextCell(Context context) { super(context); textView = new SimpleTextView(context); textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); textView.setTextSize(16); textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); addView(textView); valueTextView = new SimpleTextView(context); valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteValueText)); valueTextView.setTextSize(16); valueTextView.setGravity(LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT); addView(valueTextView); imageView = new ImageView(context); imageView.setScaleType(ImageView.ScaleType.CENTER); imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayIcon), PorterDuff.Mode.MULTIPLY)); addView(imageView); }
Example #8
Source File: UserCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void setIsAdmin(int value) { if (adminImage == null) return; adminText.setVisibility(value != 0 ? VISIBLE : GONE); adminImage.setVisibility(value != 0 ? VISIBLE : GONE); nameTextView.setPadding(LocaleController.isRTL && value != 0 ? AndroidUtilities.dp(16) : 0, 0, !LocaleController.isRTL && value != 0 ? AndroidUtilities.dp(16) : 0, 0); if (value == 1) { setTag(Theme.key_profile_creatorIcon); adminImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_profile_creatorIcon), PorterDuff.Mode.MULTIPLY)); adminText.setText(LocaleController.getString("Creator", R.string.Creator)); } else if (value == 2) { setTag(Theme.key_profile_adminIcon); adminImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_profile_adminIcon), PorterDuff.Mode.MULTIPLY)); adminText.setText(LocaleController.getString("Admin", R.string.Admin)); } }
Example #9
Source File: ChatUnreadCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public ChatUnreadCell(Context context) { super(context); backgroundLayout = new FrameLayout(context); backgroundLayout.setBackgroundResource(R.drawable.newmsg_divider); backgroundLayout.getBackground().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_unreadMessagesStartBackground), PorterDuff.Mode.MULTIPLY)); addView(backgroundLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 27, Gravity.LEFT | Gravity.TOP, 0, 7, 0, 0)); imageView = new ImageView(context); imageView.setImageResource(R.drawable.ic_ab_new); imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_unreadMessagesStartArrowIcon), PorterDuff.Mode.MULTIPLY)); imageView.setPadding(0, AndroidUtilities.dp(2), 0, 0); backgroundLayout.addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 10, 0)); textView = new TextView(context); textView.setPadding(0, 0, 0, AndroidUtilities.dp(1)); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); textView.setTextColor(Theme.getColor(Theme.key_chat_unreadMessagesStartText)); textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER)); }
Example #10
Source File: StickerSetNameCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
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 #11
Source File: UserCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void setIsAdmin(int value) { if (adminImage == null) return; adminText.setVisibility(value != 0 ? VISIBLE : GONE); adminImage.setVisibility(value != 0 ? VISIBLE : GONE); nameTextView.setPadding(LocaleController.isRTL && value != 0 ? AndroidUtilities.dp(16) : 0, 0, !LocaleController.isRTL && value != 0 ? AndroidUtilities.dp(16) : 0, 0); if (value == 1) { setTag(Theme.key_profile_creatorIcon); adminImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_profile_creatorIcon), PorterDuff.Mode.MULTIPLY)); adminText.setText(LocaleController.getString("Creator", R.string.Creator)); } else if (value == 2) { setTag(Theme.key_profile_adminIcon); adminImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_profile_adminIcon), PorterDuff.Mode.MULTIPLY)); adminText.setText(LocaleController.getString("Admin", R.string.Admin)); } }
Example #12
Source File: ActionBarPopupWindow.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
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 #13
Source File: ThemeTypeCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
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 #14
Source File: ProxyListActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void setChecked(boolean checked) { if (checked) { if (checkDrawable == null) { checkDrawable = getResources().getDrawable(R.drawable.proxy_check).mutate(); } if (checkDrawable != null) { checkDrawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY)); } if (LocaleController.isRTL) { valueTextView.setCompoundDrawablesWithIntrinsicBounds(null, null, checkDrawable, null); } else { valueTextView.setCompoundDrawablesWithIntrinsicBounds(checkDrawable, null, null, null); } } else { valueTextView.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null); } }
Example #15
Source File: Switch.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void setChecked(boolean checked) { super.setChecked(checked); checked = isChecked(); if (attachedToWindow && wasLayout) { animateThumbToCheckedState(checked); } else { cancelPositionAnimator(); setThumbPosition(checked ? 1 : 0); } if (mTrackDrawable != null) { mTrackDrawable.setColorFilter(new PorterDuffColorFilter(checked ? Theme.getColor(Theme.key_switchTrackChecked) : Theme.getColor(Theme.key_switchTrack), PorterDuff.Mode.MULTIPLY)); } if (mThumbDrawable != null) { mThumbDrawable.setColorFilter(new PorterDuffColorFilter(checked ? Theme.getColor(Theme.key_switchThumbChecked) : Theme.getColor(Theme.key_switchThumb), PorterDuff.Mode.MULTIPLY)); } }
Example #16
Source File: ProxyListActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void setChecked(boolean checked) { if (checked) { if (checkDrawable == null) { checkDrawable = getResources().getDrawable(R.drawable.proxy_check).mutate(); } if (checkDrawable != null) { checkDrawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY)); } if (LocaleController.isRTL) { valueTextView.setCompoundDrawablesWithIntrinsicBounds(null, null, checkDrawable, null); } else { valueTextView.setCompoundDrawablesWithIntrinsicBounds(checkDrawable, null, null, null); } } else { valueTextView.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null); } }
Example #17
Source File: TextCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public TextCell(Context context) { super(context); textView = new SimpleTextView(context); textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); textView.setTextSize(16); textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); addView(textView); valueTextView = new SimpleTextView(context); valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteValueText)); valueTextView.setTextSize(16); valueTextView.setGravity(LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT); addView(valueTextView); imageView = new ImageView(context); imageView.setScaleType(ImageView.ScaleType.CENTER); imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayIcon), PorterDuff.Mode.MULTIPLY)); addView(imageView); valueImageView = new ImageView(context); valueImageView.setScaleType(ImageView.ScaleType.CENTER); addView(valueImageView); }
Example #18
Source File: ProxySettingsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public TypeCell(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, 18, 0, 18, 0)); }
Example #19
Source File: TextDetailCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
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 #20
Source File: VideoTimelinePlayView.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public VideoTimelinePlayView(Context context) { super(context); paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setColor(0xffffffff); paint2 = new Paint(); paint2.setColor(0x7f000000); drawableLeft = context.getResources().getDrawable(R.drawable.video_cropleft); drawableLeft.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY)); drawableRight = context.getResources().getDrawable(R.drawable.video_cropright); drawableRight.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY)); }
Example #21
Source File: DrawerAddCell.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override protected void onAttachedToWindow() { super.onAttachedToWindow(); textView.setTextColor(Theme.getColor(Theme.key_chats_menuItemText)); textView.setText(LocaleController.getString("AddAccount", R.string.AddAccount)); Drawable drawable = getResources().getDrawable(R.drawable.account_add); if (drawable != null) { drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_menuItemIcon), PorterDuff.Mode.MULTIPLY)); } textView.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); }
Example #22
Source File: LanguageCell.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public LanguageCell(Context context, boolean dialog) { super(context); setWillNotDraw(false); isDialog = dialog; textView = new TextView(context); textView.setTextColor(Theme.getColor(dialog ? 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.TOP); addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 23 + 48 : (dialog ? 23 : 16), (isDialog ? 4 : 6), LocaleController.isRTL ? (dialog ? 23 : 16) : 23 + 48, 0)); textView2 = new TextView(context); textView2.setTextColor(Theme.getColor(dialog ? Theme.key_dialogTextGray3 : Theme.key_windowBackgroundWhiteGrayText3)); textView2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13); textView2.setLines(1); textView2.setMaxLines(1); textView2.setSingleLine(true); textView2.setEllipsize(TextUtils.TruncateAt.END); textView2.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP); addView(textView2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 23 + 48 : (dialog ? 23 : 16), (isDialog ? 25 : 28), LocaleController.isRTL ? (dialog ? 23 : 16) : 23 + 48, 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 #23
Source File: ProxyListActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
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 : 17), 10, (LocaleController.isRTL ? 17 : 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 : 17), 35, (LocaleController.isRTL ? 17 : 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); 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 #24
Source File: BottomSheet.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public BottomSheetCell(Context context, int type) { super(context); setBackgroundDrawable(Theme.getSelectorDrawable(false)); setPadding(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), 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); if (type == 0) { 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)); } else if (type == 1) { textView.setGravity(Gravity.CENTER); textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); } }
Example #25
Source File: AlertDialog.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public AlertDialog(Context context, int progressStyle) { super(context, R.style.TransparentDialog); backgroundPaddings = new Rect(); shadowDrawable = context.getResources().getDrawable(R.drawable.popup_fixed_alert).mutate(); shadowDrawable.setColorFilter(new PorterDuffColorFilter(getThemeColor(Theme.key_dialogBackground), PorterDuff.Mode.MULTIPLY)); shadowDrawable.getPadding(backgroundPaddings); progressViewStyle = progressStyle; }
Example #26
Source File: ActionBarMenuItem.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void redrawPopup(int color) { if (popupLayout != null) { popupLayout.backgroundDrawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY)); popupLayout.invalidate(); } }
Example #27
Source File: FragmentContextView.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void updatePlaybackButton() { float currentPlaybackSpeed = MediaController.getInstance().getPlaybackSpeed(); if (currentPlaybackSpeed > 1) { playbackSpeedButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_inappPlayerPlayPause), PorterDuff.Mode.MULTIPLY)); } else { playbackSpeedButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_inappPlayerClose), PorterDuff.Mode.MULTIPLY)); } }
Example #28
Source File: ThemeCell.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public ThemeCell(Context context, boolean nightTheme) { super(context); setWillNotDraw(false); isNightTheme = nightTheme; paint = new Paint(Paint.ANTI_ALIAS_FLAG); textView = new TextView(context); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setLines(1); textView.setMaxLines(1); textView.setSingleLine(true); textView.setPadding(0, 0, 0, AndroidUtilities.dp(1)); 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 ? 53 + 48 : 60, 0, LocaleController.isRTL ? 60 : 53 + 48, 0)); checkImage = new ImageView(context); checkImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_featuredStickers_addedIcon), PorterDuff.Mode.MULTIPLY)); checkImage.setImageResource(R.drawable.sticker_added); if (!isNightTheme) { addView(checkImage, LayoutHelper.createFrame(19, 14, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 17 + 38, 0, 17 + 38, 0)); optionsButton = new ImageView(context); optionsButton.setFocusable(false); optionsButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_stickers_menuSelector))); optionsButton.setImageResource(R.drawable.ic_ab_other); optionsButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_stickers_menu), PorterDuff.Mode.MULTIPLY)); optionsButton.setScaleType(ImageView.ScaleType.CENTER); addView(optionsButton, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP)); } else { addView(checkImage, LayoutHelper.createFrame(19, 14, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 17, 0, 17, 0)); } }
Example #29
Source File: AboutLinkCell.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public AboutLinkCell(Context context) { super(context); 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, 5, LocaleController.isRTL ? 16 : 0, 0)); setWillNotDraw(false); }
Example #30
Source File: Switch.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void checkColorFilters() { if (mTrackDrawable != null) { mTrackDrawable.setColorFilter(new PorterDuffColorFilter(isChecked() ? Theme.getColor(Theme.key_switchTrackChecked) : Theme.getColor(Theme.key_switchTrack), PorterDuff.Mode.MULTIPLY)); } if (mThumbDrawable != null) { mThumbDrawable.setColorFilter(new PorterDuffColorFilter(isChecked() ? Theme.getColor(Theme.key_switchThumbChecked) : Theme.getColor(Theme.key_switchThumb), PorterDuff.Mode.MULTIPLY)); } }