List of usage examples for android.widget ImageView setAlpha
@Deprecated @RemotableViewMethod public void setAlpha(int alpha)
From source file:Main.java
public static void setUnlocked(ImageView v) { v.setColorFilter(null); v.setAlpha(255); }
From source file:Main.java
public static void setImageViewAlpha(ImageView imageView, int alpha) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { imageView.setAlpha(alpha); } else {//from w w w . j a va2 s . co m imageView.setImageAlpha(alpha); } }
From source file:Main.java
public static void setAlpha(ImageView imageView, int alpha) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { imageView.setImageAlpha(alpha);//ww w .j av a2s .c o m } else { imageView.setAlpha(alpha); } }
From source file:Main.java
@SuppressWarnings("deprecation") public static void setAlpha(ImageView iv, int alpha) { if (iv.getBackground() != null) { iv.getBackground().setAlpha(alpha); return;/*w ww . j a va2 s. c o m*/ } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { iv.setImageAlpha(alpha); } else { iv.setAlpha(alpha); } }
From source file:Main.java
public static void animatePhotoLike(final ImageView likeBg, final ImageView likeIcon) { likeBg.setVisibility(View.VISIBLE); likeIcon.setVisibility(View.VISIBLE); likeBg.setScaleY(0.1f);/* w ww. j a v a2s . c o m*/ likeBg.setScaleX(0.1f); likeBg.setAlpha(1f); likeIcon.setScaleY(0.1f); likeIcon.setScaleX(0.1f); AnimatorSet animatorSet = new AnimatorSet(); ObjectAnimator bgScaleYAnim = ObjectAnimator.ofFloat(likeBg, "scaleY", 0.1f, 1f); bgScaleYAnim.setDuration(200); bgScaleYAnim.setInterpolator(DECCELERATE_INTERPOLATOR); ObjectAnimator bgScaleXAnim = ObjectAnimator.ofFloat(likeBg, "scaleX", 0.1f, 1f); bgScaleXAnim.setDuration(200); bgScaleXAnim.setInterpolator(DECCELERATE_INTERPOLATOR); ObjectAnimator bgAlphaAnim = ObjectAnimator.ofFloat(likeBg, "alpha", 1f, 0f); bgAlphaAnim.setDuration(200); bgAlphaAnim.setStartDelay(150); bgAlphaAnim.setInterpolator(DECCELERATE_INTERPOLATOR); ObjectAnimator imgScaleUpYAnim = ObjectAnimator.ofFloat(likeIcon, "scaleY", 0.1f, 1f); imgScaleUpYAnim.setDuration(300); imgScaleUpYAnim.setInterpolator(DECCELERATE_INTERPOLATOR); ObjectAnimator imgScaleUpXAnim = ObjectAnimator.ofFloat(likeIcon, "scaleX", 0.1f, 1f); imgScaleUpXAnim.setDuration(300); imgScaleUpXAnim.setInterpolator(DECCELERATE_INTERPOLATOR); ObjectAnimator imgScaleDownYAnim = ObjectAnimator.ofFloat(likeIcon, "scaleY", 1f, 0f); imgScaleDownYAnim.setDuration(300); imgScaleDownYAnim.setInterpolator(ACCELERATE_INTERPOLATOR); ObjectAnimator imgScaleDownXAnim = ObjectAnimator.ofFloat(likeIcon, "scaleX", 1f, 0f); imgScaleDownXAnim.setDuration(300); imgScaleDownXAnim.setInterpolator(ACCELERATE_INTERPOLATOR); animatorSet.playTogether(bgScaleYAnim, bgScaleXAnim, bgAlphaAnim, imgScaleUpYAnim, imgScaleUpXAnim); animatorSet.play(imgScaleDownYAnim).with(imgScaleDownXAnim).after(imgScaleUpYAnim); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { resetLikeAnimationState(likeBg, likeIcon); } }); animatorSet.start(); }
From source file:at.jclehner.rxdroid.DoseView.java
@TargetApi(16) @SuppressWarnings("deprecation") private static void setImageAlpha(ImageView image, int alpha) { if (Version.SDK_IS_JELLYBEAN_OR_NEWER) image.setImageAlpha(alpha);//from ww w . j a v a2s . c om else image.setAlpha(alpha); }
From source file:com.battlelancer.seriesguide.util.Utils.java
/** * Tries to load the given TVDb show poster into the given {@link android.widget.ImageView} * without any resizing or cropping. In addition sets alpha on the view. *///from w ww.ja v a 2s . c o m @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public static void loadPosterBackground(Context context, ImageView imageView, String posterPath) { if (AndroidUtils.isJellyBeanOrHigher()) { imageView.setImageAlpha(30); } else { imageView.setAlpha(30); } loadPoster(context, imageView, posterPath); }
From source file:com.coinblesk.client.utils.UIUtils.java
private static void formatConnectionIcon(Context context, ImageView icon, int state) { if (icon == null) { return;/*from w ww.j a v a2 s . co m*/ } if (state == -1) { icon.setAlpha(CONNECTION_ICON_HALF); icon.setColorFilter(ContextCompat.getColor(context, R.color.colorAccent)); } else if (state == 0) { icon.setAlpha(CONNECTION_ICON_ENABLED); icon.setColorFilter(ContextCompat.getColor(context, R.color.colorAccent)); } else if (state == 1) { icon.setAlpha(CONNECTION_ICON_HALF); icon.setColorFilter(ContextCompat.getColor(context, R.color.white)); } else { icon.setAlpha(CONNECTION_ICON_DISABLED); icon.clearColorFilter(); } }
From source file:com.csipsimple.ui.outgoingcall.OutgoingAccountsAdapter.java
@SuppressWarnings("deprecation") private void setRowViewAlpha(View v, float alpha) { if (Compatibility.isCompatible(11)) { // In honeycomb or upper case, use the new setAlpha method if (setAlphaMethod == null) { try { setAlphaMethod = View.class.getDeclaredMethod("setAlpha", float.class); } catch (NoSuchMethodException e) { // Ignore not found set alpha class. }//from w w w . java2s. c om } if (setAlphaMethod != null) { UtilityWrapper.safelyInvokeMethod(setAlphaMethod, v, alpha); } } else { // Try to set alpha on each component TextView tv; tv = (TextView) v.findViewById(R.id.AccTextView); tv.setTextColor(tv.getTextColors().withAlpha((int) (255 * alpha))); tv = (TextView) v.findViewById(R.id.AccTextStatusView); tv.setTextColor(tv.getTextColors().withAlpha((int) (255 * alpha))); ImageView img = (ImageView) v.findViewById(R.id.wizard_icon); img.setAlpha((int) (255 * alpha)); } }
From source file:com.sip.pwc.sipphone.ui.outgoingcall.OutgoingAccountsAdapter.java
@SuppressWarnings("deprecation") private void setRowViewAlpha(View v, float alpha) { if (Compatibility.isCompatible(11)) { // In honeycomb or upper case, use the new setAlpha method if (setAlphaMethod == null) { try { setAlphaMethod = View.class.getDeclaredMethod("setAlpha", float.class); } catch (NoSuchMethodException e) { // Ignore not found set alpha class. }/*from www .ja va2 s .c om*/ } if (setAlphaMethod != null) { //UtilityWrapper.safelyInvokeMethod(setAlphaMethod, v, alpha); //change tqc try { setAlphaMethod.invoke(v, alpha); } catch (Exception e) { e.printStackTrace(); } } } else { // Try to set alpha on each component TextView tv; tv = (TextView) v.findViewById(R.id.AccTextView); tv.setTextColor(tv.getTextColors().withAlpha((int) (255 * alpha))); tv = (TextView) v.findViewById(R.id.AccTextStatusView); tv.setTextColor(tv.getTextColors().withAlpha((int) (255 * alpha))); ImageView img = (ImageView) v.findViewById(R.id.wizard_icon); img.setAlpha((int) (255 * alpha)); } }