List of usage examples for android.view View setAlpha
public void setAlpha(@FloatRange(from = 0.0, to = 1.0) float alpha)
From source file:com.erevacation.challenge.rxjavaanimator.ViewAnimatorCreator.java
private static ViewPropertyAnimator animateTranslate(View view, int duration, int delay, int dx, TimeInterpolator interpolator) { Timber.d("Translate for dx: " + dx); view.setAlpha(1); ViewPropertyAnimator propertyAnimator = view.animate().translationX(dx).setStartDelay(delay) .setDuration(duration);/*from ww w . j a v a 2s . co m*/ if (interpolator != null) { propertyAnimator.setInterpolator(interpolator); } else { propertyAnimator.setInterpolator(new FastOutLinearInInterpolator()); } return propertyAnimator; }
From source file:Main.java
public static void hide(final View view, final boolean makeInvisible) { if (Build.VERSION.SDK_INT >= 11) { final Animation animation = new Animation() { @TargetApi(11)/* w w w.jav a 2 s . co m*/ @Override protected void applyTransformation(final float interpolatedTime, final Transformation t) { view.setAlpha(1.f - interpolatedTime); } }; animation.setDuration(ANIMATION_DURATION); // return animation; view.startAnimation(animation); } else { view.setVisibility(View.INVISIBLE); } }
From source file:Main.java
private static Animator createFade(final View targetView, int startAlpha, int endAlpha) { ValueAnimator a = ValueAnimator.ofFloat(startAlpha, endAlpha); a.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override// ww w .ja va 2s. com public void onAnimationUpdate(ValueAnimator valueAnimator) { targetView.setAlpha((float) valueAnimator.getAnimatedValue()); } }); return a; }
From source file:Main.java
public static void showViewAlphaAnim(final View view, TimeInterpolator interpolator, final boolean visible) { if (visible && view.getVisibility() == View.VISIBLE || !visible && view.getVisibility() != View.VISIBLE) { return;/*from www. j ava 2 s .c o m*/ } float fromAlpha = visible ? 0.0F : 1.0F; float toAlpha = visible ? 1.0F : 0.0F; view.setAlpha(fromAlpha); view.setVisibility(View.VISIBLE); view.animate().alpha(toAlpha).setDuration(DURATION).setInterpolator(interpolator) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animator) { if (visible) { view.setAlpha(1.0F); view.setVisibility(View.VISIBLE); } else { view.setAlpha(0.0F); view.setVisibility(View.INVISIBLE); } } }).start(); }
From source file:com.findme.views.ExpandableTextView.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private static void applyAlphaAnimation(View view, float alpha) { if (isPostHoneycomb()) { view.setAlpha(alpha); } else {/*from w ww . j av a2 s. c om*/ AlphaAnimation alphaAnimation = new AlphaAnimation(alpha, alpha); // make it instant alphaAnimation.setDuration(0); alphaAnimation.setFillAfter(true); view.startAnimation(alphaAnimation); } }
From source file:Main.java
/** * Disable all the childs of the selected root view * * @param rootView View to iterate in order to disable all its childs * @param alpha Alpha to set to disabled elements *///from w w w.ja va 2 s. com public static void disableView(ViewGroup rootView, float alpha) { int count = rootView.getChildCount(); View v; //Go over the child list of the view and disable all for (int i = 0; i < count; i++) { v = rootView.getChildAt(i); if (v != null) { if (v instanceof ViewGroup) disableView((ViewGroup) v, alpha); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO) v.setAlpha(alpha); v.setEnabled(false); } } }
From source file:io.github.prefanatic.cleantap.util.AnimUtils.java
public static void showChildren(ViewGroup group) { FastOutLinearInInterpolator interpolator = new FastOutLinearInInterpolator(); for (int i = 0; i < group.getChildCount(); i++) { View view = group.getChildAt(i); view.setTranslationY(view.getHeight() / 3); view.setAlpha(0f); view.animate().alpha(1f).translationY(0f).setStartDelay(0L).setDuration(150L) //.setInterpolator(interpolator) .start();/* ww w . j a v a2 s.c o m*/ } }
From source file:Main.java
/** * Update alpha/*from w ww.j a v a 2 s .c o m*/ */ public static void updateAlpha(final View view, float fromValue, float toValue) { ValueAnimator animator = ValueAnimator.ofFloat(fromValue, toValue); animator.setDuration(150); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { float animatedValue = (float) valueAnimator.getAnimatedValue(); view.setAlpha(animatedValue); } }); animator.start(); }
From source file:io.github.prefanatic.cleantap.util.AnimUtils.java
public static void show(View view) { if (view.getVisibility() == View.VISIBLE) return;/* w ww. j av a2s .c o m*/ view.setVisibility(View.VISIBLE); view.setAlpha(0f); view.animate().alpha(1f).start(); }
From source file:io.github.prefanatic.cleantap.util.AnimUtils.java
public static void showAsTranslationY(View view) { if (view.getVisibility() == View.VISIBLE) return;// ww w .j a va 2 s . c o m view.setVisibility(View.VISIBLE); view.setAlpha(0f); view.setTranslationY(-200); view.animate().alpha(1f).translationY(0f).setStartDelay(0L).setDuration(400L).start(); }