类android.graphics.PorterDuff源码实例Demo

下面列出了怎么用android.graphics.PorterDuff的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: TelePlus-Android   文件: ActionBarMenuItem.java
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));
    }
}
 
源代码2 项目: TelePlus-Android   文件: UserCell.java
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));
    }
}
 
源代码3 项目: mollyim-android   文件: ContactPreference.java
public void setState(boolean secure, boolean blocked) {
  this.secure = secure;

  if (secureCallButton != null)  secureCallButton.setVisibility(secure && !blocked ? View.VISIBLE : View.GONE);
  if (secureVideoButton != null) secureVideoButton.setVisibility(secure && !blocked ? View.VISIBLE : View.GONE);
  if (callButton != null)        callButton.setVisibility(secure || blocked ? View.GONE : View.VISIBLE);
  if (messageButton != null)     messageButton.setVisibility(blocked ? View.GONE : View.VISIBLE);

  int color;

  if (secure) {
    color = getContext().getResources().getColor(R.color.core_ultramarine);
  } else {
    color = getContext().getResources().getColor(R.color.grey_600);
  }

  if (messageButton != null)     messageButton.setColorFilter(color, PorterDuff.Mode.SRC_IN);
  if (secureCallButton != null)  secureCallButton.setColorFilter(color, PorterDuff.Mode.SRC_IN);
  if (secureVideoButton != null) secureVideoButton.setColorFilter(color, PorterDuff.Mode.SRC_IN);
  if (callButton != null)        callButton.setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
 
源代码4 项目: TelePlus-Android   文件: ManageChatTextCell.java
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);
}
 
源代码5 项目: mollyim-android   文件: TypingIndicatorView.java
private void initialize(@Nullable AttributeSet attrs) {
  inflate(getContext(), R.layout.typing_indicator_view, this);

  setWillNotDraw(false);

  dot1 = findViewById(R.id.typing_dot1);
  dot2 = findViewById(R.id.typing_dot2);
  dot3 = findViewById(R.id.typing_dot3);

  if (attrs != null) {
    TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.TypingIndicatorView, 0, 0);
    int        tint       = typedArray.getColor(R.styleable.TypingIndicatorView_typingIndicator_tint, Color.WHITE);
    typedArray.recycle();

    dot1.getBackground().setColorFilter(tint, PorterDuff.Mode.MULTIPLY);
    dot2.getBackground().setColorFilter(tint, PorterDuff.Mode.MULTIPLY);
    dot3.getBackground().setColorFilter(tint, PorterDuff.Mode.MULTIPLY);
  }
}
 
源代码6 项目: mollyim-android   文件: ShapeScrim.java
public ShapeScrim(Context context, AttributeSet attrs, int defStyleAttr) {
  super(context, attrs, defStyleAttr);

  if (attrs != null) {
    TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ShapeScrim, 0, 0);
    String     shapeName  = typedArray.getString(R.styleable.ShapeScrim_shape);

    if      ("square".equalsIgnoreCase(shapeName)) this.shape = ShapeType.SQUARE;
    else if ("circle".equalsIgnoreCase(shapeName)) this.shape = ShapeType.CIRCLE;
    else                                           this.shape = ShapeType.SQUARE;

    this.radius = typedArray.getFloat(R.styleable.ShapeScrim_radius, 0.4f);

    typedArray.recycle();
  } else {
    this.shape  = ShapeType.SQUARE;
    this.radius = 0.4f;
  }

  this.eraser = new Paint();
  this.eraser.setColor(0xFFFFFFFF);
  this.eraser.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
}
 
源代码7 项目: leafpicrevived   文件: AlertDialogsHelper.java
public static AlertDialog getProgressDialog(final ThemedActivity activity, String title, String message) {
    AlertDialog.Builder progressDialog = new AlertDialog.Builder(activity, activity.getDialogStyle());
    View dialogLayout = activity.getLayoutInflater().inflate(com.alienpants.leafpicrevived.R.layout.dialog_progress, null);
    TextView dialogTitle = dialogLayout.findViewById(R.id.progress_dialog_title);
    TextView dialogMessage = dialogLayout.findViewById(R.id.progress_dialog_text);

    dialogTitle.setBackgroundColor(activity.getPrimaryColor());
    ((CardView) dialogLayout.findViewById(com.alienpants.leafpicrevived.R.id.progress_dialog_card)).setCardBackgroundColor(activity.getCardBackgroundColor());
    ((ProgressBar) dialogLayout.findViewById(com.alienpants.leafpicrevived.R.id.progress_dialog_loading)).getIndeterminateDrawable().setColorFilter(activity.getPrimaryColor(), android.graphics
            .PorterDuff.Mode.SRC_ATOP);

    dialogTitle.setText(title);
    dialogMessage.setText(message);
    dialogMessage.setTextColor(activity.getTextColor());

    progressDialog.setCancelable(false);
    progressDialog.setView(dialogLayout);
    return progressDialog.create();
}
 
源代码8 项目: arcusandroid   文件: AccountBillingInfoFragment.java
private void setUpYearSpinner() {
    boolean isSettingsVariant = variant == ScreenVariant.SETTINGS;

    adapter = new SpinnerAdapter(
            //context
            getActivity(),
            //spinner closed state (view)
            R.layout.spinner_item_state_closed,
            //model
            getResources().getStringArray(R.array
                    .account_registration_exp_year_list),
            //color scheme
            isSettingsVariant

    );
    adapter.setDisabledItems(0);

    expYear.setAdapter(adapter);
    if (isSettingsVariant) {
        expYear.getBackground().setColorFilter(getResources().getColor(R.color.overlay_white_with_50), PorterDuff.Mode.SRC_ATOP);
    }
}
 
源代码9 项目: TelePlus-Android   文件: ProxySettingsActivity.java
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));
}
 
源代码10 项目: TelePlus-Android   文件: ActionBarPopupWindow.java
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));
    }
}
 
源代码11 项目: Lassi-Android   文件: CropImage.java
/**
 * Create a new bitmap that has all pixels beyond the oval shape transparent. Old bitmap is
 * recycled.
 */
public static Bitmap toOvalBitmap(@NonNull Bitmap bitmap) {
    int width = bitmap.getWidth();
    int height = bitmap.getHeight();
    Bitmap output = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);

    Canvas canvas = new Canvas(output);

    int color = 0xff424242;
    Paint paint = new Paint();

    paint.setAntiAlias(true);
    canvas.drawARGB(0, 0, 0, 0);
    paint.setColor(color);

    RectF rect = new RectF(0, 0, width, height);
    canvas.drawOval(rect, paint);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
    canvas.drawBitmap(bitmap, 0, 0, paint);

    bitmap.recycle();

    return output;
}
 
源代码12 项目: graphics-samples   文件: DrawableTintingFragment.java
/**
 * Update the tint of the image with the color set in the seekbars and selected blend mode.
 * The seekbars are set to a maximum of 255, with one for each of the four components of the
 * ARGB color. (Alpha, Red, Green, Blue.) Once a color has been computed using
 * {@link Color#argb(int, int, int, int)}, it is set togethe with the blend mode on the background
 * image using
 * {@link android.widget.ImageView#setColorFilter(int, android.graphics.PorterDuff.Mode)}.
 */
public void updateTint(int color, PorterDuff.Mode mode) {
    // Set the color hint of the image: ARGB
    mHintColor = color;

    // Set the color tint mode based on the selection of the Spinner
    mMode = mode;

    // Log selection
    Log.d(TAG, String.format("Updating tint with color [ARGB: %d,%d,%d,%d] and mode [%s]",
            Color.alpha(color), Color.red(color), Color.green(color), Color.blue(color),
            mode.toString()));

    // Apply the color tint for the selected tint mode
    mImage.setColorFilter(color, mMode);

    // Update the text for each label with the value of each channel
    mAlphaText.setText(getString(R.string.value_alpha, Color.alpha(color)));
    mRedText.setText(getString(R.string.value_red, Color.red(color)));
    mGreenText.setText(getString(R.string.value_green, Color.green(color)));
    mBlueText.setText(getString(R.string.value_blue, Color.blue(color)));
}
 
源代码13 项目: giffun   文件: CropImage.java
/**
 * Create a new bitmap that has all pixels beyond the oval shape transparent. Old bitmap is
 * recycled.
 */
public static Bitmap toOvalBitmap(@NonNull Bitmap bitmap) {
  int width = bitmap.getWidth();
  int height = bitmap.getHeight();
  Bitmap output = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);

  Canvas canvas = new Canvas(output);

  int color = 0xff424242;
  Paint paint = new Paint();

  paint.setAntiAlias(true);
  canvas.drawARGB(0, 0, 0, 0);
  paint.setColor(color);

  RectF rect = new RectF(0, 0, width, height);
  canvas.drawOval(rect, paint);
  paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
  canvas.drawBitmap(bitmap, 0, 0, paint);

  bitmap.recycle();

  return output;
}
 
@Override
protected View onCreateDialogView() {
    final View view = super.onCreateDialogView();
    mSeekBarRed = (SeekBar)view.findViewById(R.id.seek_bar_dialog_bar_red);
    mSeekBarRed.setMax(255);
    mSeekBarRed.setOnSeekBarChangeListener(this);
    mSeekBarRed.getProgressDrawable().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
    mSeekBarRed.getThumb().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
    mSeekBarGreen = (SeekBar)view.findViewById(R.id.seek_bar_dialog_bar_green);
    mSeekBarGreen.setMax(255);
    mSeekBarGreen.setOnSeekBarChangeListener(this);
    mSeekBarGreen.getThumb().setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_IN);
    mSeekBarGreen.getProgressDrawable().setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_IN);
    mSeekBarBlue = (SeekBar)view.findViewById(R.id.seek_bar_dialog_bar_blue);
    mSeekBarBlue.setMax(255);
    mSeekBarBlue.setOnSeekBarChangeListener(this);
    mSeekBarBlue.getThumb().setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_IN);
    mSeekBarBlue.getProgressDrawable().setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_IN);
    mValueView = (TextView)view.findViewById(R.id.seek_bar_dialog_value);
    return view;
}
 
源代码15 项目: TelePlus-Android   文件: Switch.java
@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));
    }
}
 
源代码16 项目: TelePlus-Android   文件: LocationPoweredCell.java
public LocationPoweredCell(Context context) {
    super(context);

    LinearLayout linearLayout = new LinearLayout(context);
    addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));

    textView = new TextView(context);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText3));
    textView.setText("Powered by");
    linearLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));

    imageView = new ImageView(context);
    imageView.setImageResource(R.drawable.foursquare);
    imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText3), PorterDuff.Mode.MULTIPLY));
    imageView.setPadding(0, AndroidUtilities.dp(2), 0, 0);
    linearLayout.addView(imageView, LayoutHelper.createLinear(35, LayoutHelper.WRAP_CONTENT));

    textView2 = new TextView(context);
    textView2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView2.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText3));
    textView2.setText("Foursquare");
    linearLayout.addView(textView2, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
}
 
源代码17 项目: Tok-Android   文件: BaseMsgHolder.java
void showProgressBar(Message msg, ProgressView progressView, ImageView imgView, View errView) {
    if (msg != null && progressView != null) {
        if (msg.getSentStatus() == GlobalParams.SEND_ING) {
            if (msg.getMessageId() != -1) {
                setProgress(msg, progressView);
                if (imgView != null) {
                    imgView.setColorFilter(Color.DKGRAY, PorterDuff.Mode.MULTIPLY);
                }
            } else {
                //FIXME this should be "Failed" - fix the DB bug
                LogUtil.i(TAG, "send file failed");
                progressView.setSuccess();
                if (imgView != null) {
                    imgView.clearColorFilter();
                }
            }
        } else {
            if (msg.getMessageId() != -1) {
                if (msg.isMine()) {
                    LogUtil.i(TAG, "the file is mine");
                } else {
                    //todo: no need confirm,receive
                    //State.transferManager()
                    //    .acceptFile((FriendKey) msg.key(), msg.messageId(),
                    //        TokApplication.getInstance());
                }
                if (imgView != null) {
                    imgView.setColorFilter(Color.DKGRAY, PorterDuff.Mode.MULTIPLY);
                }
            } else {
                //fileHolder.setProgressText(R.string.file_rejected)
                LogUtil.i(TAG, "the file is success");
                progressView.setSuccess();
                if (imgView != null) {
                    imgView.clearColorFilter();
                }
            }
        }
    }
}
 
源代码18 项目: TelePlus-Android   文件: VideoTimelinePlayView.java
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));
}
 
源代码19 项目: leafpicrevived   文件: AlertDialogsHelper.java
public static AlertDialog getInsertTextDialog(ThemedActivity activity, EditText editText, @StringRes int title) {

        AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(activity, activity.getDialogStyle());
        View dialogLayout = activity.getLayoutInflater().inflate(com.alienpants.leafpicrevived.R.layout.dialog_insert_text, null);
        TextView textViewTitle = dialogLayout.findViewById(R.id.rename_title);

        ((CardView) dialogLayout.findViewById(com.alienpants.leafpicrevived.R.id.dialog_chose_provider_title)).setCardBackgroundColor(activity.getCardBackgroundColor());
        textViewTitle.setBackgroundColor(activity.getPrimaryColor());
        textViewTitle.setText(title);
        ThemeHelper.setCursorColor(editText, activity.getTextColor());

        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        editText.setLayoutParams(layoutParams);
        editText.setSingleLine(true);
        editText.getBackground().mutate().setColorFilter(activity.getTextColor(), PorterDuff.Mode.SRC_IN);
        editText.setTextColor(activity.getTextColor());

        try {
            Field f = TextView.class.getDeclaredField("mCursorDrawableRes");
            f.setAccessible(true);
            f.set(editText, null);
        } catch (Exception ignored) {
        }

        ((RelativeLayout) dialogLayout.findViewById(com.alienpants.leafpicrevived.R.id.container_edit_text)).addView(editText);

        dialogBuilder.setView(dialogLayout);
        return dialogBuilder.create();
    }
 
源代码20 项目: TelePlus-Android   文件: Switch.java
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));
    }
}
 
源代码21 项目: TelePlus-Android   文件: AdminedChannelCell.java
public AdminedChannelCell(Context context, View.OnClickListener onClickListener) {
    super(context);

    avatarDrawable = new AvatarDrawable();

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

    nameTextView = new SimpleTextView(context);
    nameTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    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 ? 62 : 73, 15.5f, LocaleController.isRTL ? 73 : 62, 0));

    statusTextView = new SimpleTextView(context);
    statusTextView.setTextSize(14);
    statusTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText));
    statusTextView.setLinkTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteLinkText));
    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 ? 62 : 73, 38.5f, LocaleController.isRTL ? 73 : 62, 0));

    deleteButton = new ImageView(context);
    deleteButton.setScaleType(ImageView.ScaleType.CENTER);
    deleteButton.setImageResource(R.drawable.msg_panel_clear);
    deleteButton.setOnClickListener(onClickListener);
    deleteButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText), PorterDuff.Mode.MULTIPLY));
    addView(deleteButton, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, LocaleController.isRTL ? 7 : 0, 12, LocaleController.isRTL ? 0 : 7, 0));
}
 
源代码22 项目: a   文件: MBaseSimpleActivity.java
/**
 * 设置MENU图标颜色
 */
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    int primaryTextColor = MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.primaryColor(this)));
    for (int i = 0; i < menu.size(); i++) {
        Drawable drawable = menu.getItem(i).getIcon();
        if (drawable != null) {
            drawable.mutate();
            drawable.setColorFilter(primaryTextColor, PorterDuff.Mode.SRC_ATOP);
        }
    }
    return super.onCreateOptionsMenu(menu);
}
 
源代码23 项目: TelePlus-Android   文件: AlertDialog.java
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;
}
 
源代码24 项目: TelePlus-Android   文件: AudioCell.java
private void setPlayDrawable(boolean play) {
    Drawable circle = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(46), Theme.getColor(Theme.key_musicPicker_buttonBackground), Theme.getColor(Theme.key_musicPicker_buttonBackground));
    Drawable drawable = getResources().getDrawable(play ? R.drawable.audiosend_pause : R.drawable.audiosend_play);
    drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_musicPicker_buttonIcon), PorterDuff.Mode.MULTIPLY));
    CombinedDrawable combinedDrawable = new CombinedDrawable(circle, drawable);
    combinedDrawable.setCustomSize(AndroidUtilities.dp(46), AndroidUtilities.dp(46));
    playButton.setBackgroundDrawable(combinedDrawable);
}
 
源代码25 项目: mollyim-android   文件: VerifyIdentityActivity.java
private void animateVerifiedSuccess() {
  Bitmap qrBitmap  = ((BitmapDrawable)qrCode.getDrawable()).getBitmap();
  Bitmap qrSuccess = createVerifiedBitmap(qrBitmap.getWidth(), qrBitmap.getHeight(), R.drawable.ic_check_white_48dp);

  qrVerified.setImageBitmap(qrSuccess);
  qrVerified.getBackground().setColorFilter(getResources().getColor(R.color.green_500), PorterDuff.Mode.MULTIPLY);

  animateVerified();
}
 
源代码26 项目: mollyim-android   文件: VerifyIdentityActivity.java
private void animateVerifiedFailure() {
  Bitmap qrBitmap  = ((BitmapDrawable)qrCode.getDrawable()).getBitmap();
  Bitmap qrSuccess = createVerifiedBitmap(qrBitmap.getWidth(), qrBitmap.getHeight(), R.drawable.ic_close_white_48dp);

  qrVerified.setImageBitmap(qrSuccess);
  qrVerified.getBackground().setColorFilter(getResources().getColor(R.color.red_500), PorterDuff.Mode.MULTIPLY);

  animateVerified();
}
 
源代码27 项目: a   文件: RippleView.java
private Bitmap getCircleBitmap(final int radius) {
    final Bitmap output = Bitmap.createBitmap(originBitmap.getWidth(), originBitmap.getHeight(), Bitmap.Config.ARGB_8888);
    final Canvas canvas = new Canvas(output);
    final Paint paint = new Paint();
    final Rect rect = new Rect((int)(x - radius), (int)(y - radius), (int)(x + radius), (int)(y + radius));

    paint.setAntiAlias(true);
    canvas.drawARGB(0, 0, 0, 0);
    canvas.drawCircle(x, y, radius, paint);

    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
    canvas.drawBitmap(originBitmap, rect, rect, paint);

    return output;
}
 
源代码28 项目: TelePlus-Android   文件: BackupImageView.java
public void setImageResource(int resId, int color) {
    Drawable drawable = getResources().getDrawable(resId);
    if (drawable != null) {
        drawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
    }
    imageReceiver.setImageBitmap(drawable);
    invalidate();
}
 
源代码29 项目: TelePlus-Android   文件: AccountSelectCell.java
public AccountSelectCell(Context context) {
    super(context);

    avatarDrawable = new AvatarDrawable();
    avatarDrawable.setTextSize(AndroidUtilities.dp(12));

    imageView = new BackupImageView(context);
    imageView.setRoundRadius(AndroidUtilities.dp(18));
    addView(imageView, LayoutHelper.createFrame(36, 36, Gravity.LEFT | Gravity.TOP, 10, 10, 0, 0));

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem));
    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.setEllipsize(TextUtils.TruncateAt.END);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.LEFT | Gravity.TOP, 61, 0, 56, 0));

    checkImageView = new ImageView(context);
    checkImageView.setImageResource(R.drawable.account_check);
    checkImageView.setScaleType(ImageView.ScaleType.CENTER);
    checkImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_menuItemCheck), PorterDuff.Mode.MULTIPLY));
    addView(checkImageView, LayoutHelper.createFrame(40, LayoutHelper.MATCH_PARENT, Gravity.RIGHT | Gravity.TOP, 0, 0, 6, 0));
}
 
源代码30 项目: mollyim-android   文件: CornerMask.java
public CornerMask(@NonNull View view) {
  view.setLayerType(View.LAYER_TYPE_HARDWARE, null);

  clearPaint.setColor(Color.BLACK);
  clearPaint.setStyle(Paint.Style.FILL);
  clearPaint.setAntiAlias(true);
  clearPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
}
 
 类所在包
 类方法
 同包方法