Java Code Examples for android.widget.ImageView#clearColorFilter()

The following examples show how to use android.widget.ImageView#clearColorFilter() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: GravityBox   File: ModStatusbarColor.java    License: Apache License 2.0 6 votes vote down vote up
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);
    }
}
 
Example 2
Source Project: FuAgoraDemoDroid   File: LiveRoomActivity.java    License: MIT License 6 votes vote down vote up
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();
}
 
Example 3
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();
}
 
Example 4
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();
                }
            }
        }
    }
}
 
Example 5
Source Project: EasyPhotos   File: PuzzleActivity.java    License: Apache License 2.0 5 votes vote down vote up
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();
        }
    }

}
 
Example 6
Source Project: imsdk-android   File: PuzzleActivity.java    License: MIT License 5 votes vote down vote up
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();
        }
    }

}
 
Example 7
Source Project: onpc   File: Utils.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 8
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);
}
 
Example 9
Source Project: GravityBox   File: ModNavigationBar.java    License: Apache License 2.0 5 votes vote down vote up
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);
            }
        }
    }
}
 
Example 10
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();
            }
        }
    }
}
 
Example 11
Source Project: px-android   File: CardDrawerConfiguration.java    License: MIT License 5 votes vote down vote up
private void toGrayScaleIfDisabled(@NonNull final ImageView imageView) {
    if (disabled) {
        ViewUtils.grayScaleView(imageView);
    } else {
        imageView.clearColorFilter();
    }
}
 
Example 12
Source Project: px-android   File: AccountMoneyFragment.java    License: MIT License 5 votes vote down vote up
@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());
    }
}
 
Example 13
private void setViewColor(ImageView view, int color) {
    if (color == ORIGIN_COLOR) {
        view.clearColorFilter();
    } else {
        view.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
    }
}
 
Example 14
Source Project: Kore   File: UIUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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();
    }
}
 
Example 15
private void enableFeature(final ImageView featureButton) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        featureButton.clearColorFilter();
    }
    Utility.setImageAlpha(featureButton, 255);
    featureButton.setOnClickListener(enabledFeatureButtonListener);
}
 
Example 16
/**
 * 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();
    }
}
 
Example 17
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);
    }
}