android.widget.ImageView#clearColorFilter ( )源码实例Demo

下面列出了android.widget.ImageView#clearColorFilter ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: GravityBox   文件: ModStatusbarColor.java
private static void updateSettingsButton() {
    if (mPhoneStatusBar == null || SysUiManagers.IconManager == null) return;
    try {
        Object header = XposedHelpers.getObjectField(mPhoneStatusBar, "mHeader");
        ImageView settingsButton = (ImageView) XposedHelpers.getObjectField(
                header, Utils.isSamsungRom() ? "mSettingButton" : "mSettingsButton");
        if (SysUiManagers.IconManager.isColoringEnabled()) {
            settingsButton.setColorFilter(SysUiManagers.IconManager.getIconColor(),
                    PorterDuff.Mode.SRC_IN);
        } else {
            settingsButton.clearColorFilter();
        }
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
源代码2 项目: FuAgoraDemoDroid   文件: LiveRoomActivity.java
private void audienceUI(final ImageView button1, ImageView button2, ImageView button3) {
    button1.setTag(null);
    button1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Object tag = v.getTag();
            button1.setEnabled(false);
            if (tag != null && (boolean) tag) {
                doSwitchToBroadcaster(false);
            } else {
                doSwitchToBroadcaster(true);
            }
        }
    });
    button1.clearColorFilter();
    button2.setVisibility(View.GONE);
    button3.setTag(null);
    button3.setVisibility(View.GONE);
    button3.clearColorFilter();
}
 
private void bindOneImage(int position, ImageView monsterImageView, Integer monsterId, boolean alreadyIgnored) {
	MyLog.entry("position = " + position);

	monsterImageView.clearColorFilter();

	if (monsterId != null && mTaskFragment.getMonsterInfoHelper() != null) {
		monsterImageView.setVisibility(View.VISIBLE);
		try {
			final MonsterInfoModel monsterInfo = mTaskFragment.getMonsterInfoHelper().getMonsterInfo(monsterId);
			mImageHelper.fillImage(monsterImageView, monsterInfo);

			if (!alreadyIgnored) {
				monsterImageView.setColorFilter(Color.parseColor("#99000000"), PorterDuff.Mode.DARKEN);
			}
		} catch (UnknownMonsterException e) {
			Picasso.with(getContext())
					.load(R.drawable.no_monster_image)
					.into(monsterImageView);
		}
	} else {
		MyLog.debug("no monster at " + position + ", ignored");
		monsterImageView.setVisibility(View.INVISIBLE);
	}
	MyLog.exit();
}
 
源代码4 项目: 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();
                }
            }
        }
    }
}
 
源代码5 项目: EasyPhotos   文件: PuzzleActivity.java
private void toggleIvMenu(@IdRes int resId) {
    for (ImageView ivMenu : ivMenus) {
        if (ivMenu.getId() == resId) {
            ivMenu.setColorFilter(ContextCompat.getColor(this, R.color.easy_photos_fg_accent));
        } else {
            ivMenu.clearColorFilter();
        }
    }

}
 
源代码6 项目: imsdk-android   文件: PuzzleActivity.java
private void toggleIvMenu(@IdRes int resId) {
    for (ImageView ivMenu : ivMenus) {
        if (ivMenu.getId() == resId) {
            ivMenu.setColorFilter(ContextCompat.getColor(this, R.color.easy_photos_fg_accent));
        } else {
            ivMenu.clearColorFilter();
        }
    }

}
 
源代码7 项目: onpc   文件: Utils.java
/**
 * Procedure sets ImageView background color given by attribute ID
 */
public static void setImageViewColorAttr(Context context, ImageView b, @AttrRes int resId)
{
    final int c = getThemeColorAttr(context, resId);
    b.clearColorFilter();
    b.setColorFilter(c, PorterDuff.Mode.SRC_ATOP);
}
 
源代码8 项目: microMathematics   文件: SimpleDialog.java
public void setImage(final ImageView image, int res, int color)
{
    image.setVisibility(View.VISIBLE);
    image.setImageResource(res);
    image.clearColorFilter();
    image.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
}
 
源代码9 项目: GravityBox   文件: ModNavigationBar.java
private static void setKeyColorRecursive(ViewGroup vg) {
    if (vg == null) return;
    final int childCount = vg.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = vg.getChildAt(i);
        if (child instanceof ViewGroup) {
            setKeyColorRecursive((ViewGroup) child);
        } else if (child instanceof ImageView) {
            ImageView imgv = (ImageView) vg.getChildAt(i);
            if (mNavbarColorsEnabled) {
                imgv.setColorFilter(mKeyColor, PorterDuff.Mode.SRC_ATOP);
            } else {
                imgv.clearColorFilter();
            }
            if (imgv.getClass().getName().equals(CLASS_KEY_BUTTON_VIEW) &&
                    !mNavbarColorsEnabled) {
                Drawable ripple = imgv.getBackground();
                if (ripple != null &&
                        ripple.getClass().getName().equals(CLASS_KEY_BUTTON_RIPPLE)) {
                    Paint paint = (Paint) XposedHelpers.getObjectField(ripple, "mRipplePaint");
                    if (paint != null) {
                        paint.setColor(0xffffffff);
                    }
                }
            } else if (imgv instanceof KeyButtonView) {
                ((KeyButtonView) imgv).setGlowColor(mNavbarColorsEnabled ?
                        mKeyGlowColor : mKeyDefaultGlowColor);
            }
        }
    }
}
 
源代码10 项目: GravityBox   文件: StatusbarSignalCluster.java
protected void updateIconColorRecursive(ViewGroup vg) {
    if (mIconManager == null) return;

    int count = vg.getChildCount();
    for (int i = 0; i < count; i++) {
        View child = vg.getChildAt(i);
        if (child instanceof ViewGroup) {
            if (child.getId() != View.NO_ID) {
                String resName = mResources.getResourceEntryName(child.getId());
                if (resName.startsWith("mobile_combo")) {
                    mobileGroupIdx++;
                }
            }
            updateIconColorRecursive((ViewGroup) child);
        } else if (child instanceof ImageView) {
            ImageView iv = (ImageView) child;
            if ("gbDataActivity".equals(iv.getTag())) {
                continue;
            }
            if (mIconManager.isColoringEnabled() && mIconManager.getSignalIconMode() !=
                    StatusBarIconManager.SI_MODE_DISABLED) {
                int color = mobileGroupIdx > 1 ?
                        mIconManager.getIconColor(1) : mIconManager.getIconColor(0);
                iv.setColorFilter(color, PorterDuff.Mode.SRC_IN);
            } else {
                iv.clearColorFilter();
            }
        }
    }
}
 
源代码11 项目: px-android   文件: CardDrawerConfiguration.java
private void toGrayScaleIfDisabled(@NonNull final ImageView imageView) {
    if (disabled) {
        ViewUtils.grayScaleView(imageView);
    } else {
        imageView.clearColorFilter();
    }
}
 
源代码12 项目: px-android   文件: AccountMoneyFragment.java
@Override
public void disable() {
    super.disable();
    final View view = getView();
    final DisableConfiguration disableConfiguration = new DisableConfiguration(getContext());
    if (view != null) {
        final ViewGroup card = view.findViewById(R.id.payment_method);
        final ImageView background = view.findViewById(R.id.background);

        ViewUtils.grayScaleViewGroup(card);
        background.clearColorFilter();
        background.setImageResource(0);
        background.setBackgroundColor(disableConfiguration.getBackgroundColor());
    }
}
 
源代码13 项目: InterestingTitleBar   文件: CustomTitleBar.java
private void setViewColor(ImageView view, int color) {
    if (color == ORIGIN_COLOR) {
        view.clearColorFilter();
    } else {
        view.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
    }
}
 
源代码14 项目: Kore   文件: UIUtils.java
/**
 * Highlights an image view
 * @param context
 * @param view
 * @param highlight true if the image view should be highlighted, false otherwise
 */
public static void highlightImageView(Context context, ImageView view, boolean highlight) {
    if (highlight) {
        Resources.Theme theme = context.getTheme();
        TypedArray styledAttributes = theme.obtainStyledAttributes(new int[]{
                R.attr.colorAccent});
        view.setColorFilter(
                styledAttributes.getColor(styledAttributes.getIndex(0),
                                          context.getResources().getColor(R.color.default_accent)));
        styledAttributes.recycle();
    } else {
        view.clearColorFilter();
    }
}
 
源代码15 项目: utexas-utilities   文件: UTilitiesActivity.java
private void enableFeature(final ImageView featureButton) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        featureButton.clearColorFilter();
    }
    Utility.setImageAlpha(featureButton, 255);
    featureButton.setOnClickListener(enabledFeatureButtonListener);
}
 
源代码16 项目: BluetoothHidEmu   文件: ButtonClickListener.java
/**
 * Set properties for the button to be drawn as normal or "on hold".
 * @param view
 * @param isHold
 */
private void drawButton(View view, boolean isHold) {
    ImageView imgView = (ImageView) view;
    if (isHold) {
        imgView.setColorFilter(new LightingColorFilter(0xff4a6c9b, 0xff000055));
    } else {
        imgView.clearColorFilter();
    }
}
 
public static void decorate(
        @Nullable final TextView title,
        @Nullable final ImageView image,
        @Nullable final TextView imageText,
        Song song,
        @NonNull final AppCompatActivity activity,
        boolean showAlbumImage)
{
    final boolean isPlaying = MusicPlayerRemote.isPlaying(song);

    if (title != null) {
        title.setTypeface(null, isPlaying ? Typeface.BOLD : Typeface.NORMAL);
    }

    if (image != null) {
        image.setVisibility((isPlaying || showAlbumImage) ? View.VISIBLE : View.GONE);
        final boolean animateIcon = PreferenceUtil.getInstance().animatePlayingSongIcon();

        if (isPlaying) {
            image.setScaleType(ImageView.ScaleType.CENTER);

            final int color = ATHUtil.resolveColor(activity, R.attr.iconColor, ThemeStore.textColorSecondary(activity));
            image.setColorFilter(color, PorterDuff.Mode.SRC_IN);

            final int size = (int)(24 * activity.getResources().getDisplayMetrics().density);

            // Note: No transition for Glide, the animation is explicitly controlled
            GlideApp.with(activity)
                    .asBitmap()
                    .load(sIconPlaying)
                    .override(size)
                    .into(image);

            if (animateIcon) { image.startAnimation(sIconAnimation); }
        }
        else {
            image.clearColorFilter();
            if (animateIcon) { image.clearAnimation(); }
        }
    }

    if (imageText != null) {
        imageText.setVisibility((isPlaying || showAlbumImage) ? View.GONE : View.VISIBLE);
    }
}