List of usage examples for android.view View ALPHA
Property ALPHA
To view the source code for android.view View ALPHA.
Click Source Link
alpha
functionality handled by the View#setAlpha(float) and View#getAlpha() methods. From source file:com.android.clear.reminder.ItemAnimator.java
@Override public boolean animateAdd(final ViewHolder holder) { endAnimation(holder);//from w ww .ja va 2 s. c o m final float prevAlpha = holder.itemView.getAlpha(); holder.itemView.setAlpha(0f); final Animator addAnimator = ObjectAnimator.ofFloat(holder.itemView, View.ALPHA, 1f) .setDuration(getAddDuration()); addAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animator) { dispatchAddStarting(holder); } @Override public void onAnimationEnd(Animator animator) { animator.removeAllListeners(); mAnimators.remove(holder); holder.itemView.setAlpha(prevAlpha); dispatchAddFinished(holder); } }); mAddAnimatorsList.add(addAnimator); mAnimators.put(holder, addAnimator); return true; }
From source file:org.hawkular.client.android.util.ViewTransformer.java
@UiThread public void hide() { Animator animator = ObjectAnimator.ofFloat(view, View.ALPHA, 1, 0); animator.setInterpolator(new FastOutSlowInInterpolator()); animator.setDuration(Durations.MEDIUM); animator.start();// www .j a v a 2 s.c o m }
From source file:com.google.android.apps.muzei.TutorialFragment.java
@Override public void onViewCreated(final View view, @Nullable final Bundle savedInstanceState) { view.findViewById(R.id.tutorial_icon_affordance).setOnClickListener(new View.OnClickListener() { @Override/*from www.j a v a2 s. c o m*/ public void onClick(View view) { FirebaseAnalytics.getInstance(getContext()).logEvent(FirebaseAnalytics.Event.TUTORIAL_COMPLETE, null); final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); sp.edit().putBoolean(PREF_SEEN_TUTORIAL, true).apply(); } }); if (savedInstanceState == null) { float animateDistance = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, getResources().getDisplayMetrics()); View mainTextView = view.findViewById(R.id.tutorial_main_text); mainTextView.setAlpha(0); mainTextView.setTranslationY(-animateDistance / 5); View subTextView = view.findViewById(R.id.tutorial_sub_text); subTextView.setAlpha(0); subTextView.setTranslationY(-animateDistance / 5); final View affordanceView = view.findViewById(R.id.tutorial_icon_affordance); affordanceView.setAlpha(0); affordanceView.setTranslationY(animateDistance); View iconTextView = view.findViewById(R.id.tutorial_icon_text); iconTextView.setAlpha(0); iconTextView.setTranslationY(animateDistance); mAnimator = new AnimatorSet(); mAnimator.setStartDelay(500); mAnimator.setDuration(250); mAnimator.playTogether(ObjectAnimator.ofFloat(mainTextView, View.ALPHA, 1f), ObjectAnimator.ofFloat(subTextView, View.ALPHA, 1f)); mAnimator.start(); mAnimator = new AnimatorSet(); mAnimator.setStartDelay(2000); // Bug in older versions where set.setInterpolator didn't work Interpolator interpolator = new OvershootInterpolator(); ObjectAnimator a1 = ObjectAnimator.ofFloat(affordanceView, View.TRANSLATION_Y, 0); ObjectAnimator a2 = ObjectAnimator.ofFloat(iconTextView, View.TRANSLATION_Y, 0); ObjectAnimator a3 = ObjectAnimator.ofFloat(mainTextView, View.TRANSLATION_Y, 0); ObjectAnimator a4 = ObjectAnimator.ofFloat(subTextView, View.TRANSLATION_Y, 0); a1.setInterpolator(interpolator); a2.setInterpolator(interpolator); a3.setInterpolator(interpolator); a4.setInterpolator(interpolator); mAnimator.setDuration(500).playTogether(ObjectAnimator.ofFloat(affordanceView, View.ALPHA, 1f), ObjectAnimator.ofFloat(iconTextView, View.ALPHA, 1f), a1, a2, a3, a4); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { mAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (isAdded()) { ImageView emanateView = (ImageView) view.findViewById(R.id.tutorial_icon_emanate); AnimatedVectorDrawable avd = (AnimatedVectorDrawable) getResources() .getDrawable(R.drawable.avd_tutorial_icon_emanate, getContext().getTheme()); emanateView.setImageDrawable(avd); avd.start(); } } }); } mAnimator.start(); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ImageView emanateView = (ImageView) view.findViewById(R.id.tutorial_icon_emanate); AnimatedVectorDrawable avd = (AnimatedVectorDrawable) getResources() .getDrawable(R.drawable.avd_tutorial_icon_emanate, getContext().getTheme()); emanateView.setImageDrawable(avd); avd.start(); } }
From source file:com.angelatech.yeyelive.view.PeriscopeLayout.java
private AnimatorSet getEnterAnimtor(final View target) { ObjectAnimator alpha = ObjectAnimator.ofFloat(target, View.ALPHA, 0.2f, 1f); ObjectAnimator scaleX = ObjectAnimator.ofFloat(target, View.SCALE_X, 0.2f, 1f); ObjectAnimator scaleY = ObjectAnimator.ofFloat(target, View.SCALE_Y, 0.2f, 1f); AnimatorSet enter = new AnimatorSet(); enter.setDuration(500);//from w ww . j a v a 2 s . c o m enter.setInterpolator(new LinearInterpolator()); enter.playTogether(alpha, scaleX, scaleY); enter.setTarget(target); return enter; }
From source file:fr.paug.droidcon.util.LPreviewUtilsBase.java
public void setOrAnimatePlusCheckIcon(final ImageView imageView, boolean isCheck, boolean allowAnimate, int resIdChecked) { final int imageResId = isCheck ? resIdChecked : R.drawable.add_schedule_button_icon_unchecked; if (imageView.getTag() != null) { if (imageView.getTag() instanceof Animator) { Animator anim = (Animator) imageView.getTag(); anim.end();//w ww . j a v a 2 s .co m imageView.setAlpha(1f); } } if (allowAnimate && isCheck) { int duration = mActivity.getResources().getInteger(android.R.integer.config_shortAnimTime); Animator outAnimator = ObjectAnimator.ofFloat(imageView, View.ALPHA, 0f); outAnimator.setDuration(duration / 2); outAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { imageView.setImageResource(imageResId); } }); AnimatorSet inAnimator = new AnimatorSet(); outAnimator.setDuration(duration); inAnimator.playTogether(ObjectAnimator.ofFloat(imageView, View.ALPHA, 1f), ObjectAnimator.ofFloat(imageView, View.SCALE_X, 0f, 1f), ObjectAnimator.ofFloat(imageView, View.SCALE_Y, 0f, 1f)); AnimatorSet set = new AnimatorSet(); set.playSequentially(outAnimator, inAnimator); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { imageView.setTag(null); } }); imageView.setTag(set); set.start(); } else { mHandler.post(new Runnable() { @Override public void run() { imageView.setImageResource(imageResId); } }); } }
From source file:com.google.samples.apps.iosched.util.LPreviewUtilsBase.java
public void setOrAnimatePlusCheckIcon(final ImageView imageView, boolean isCheck, boolean allowAnimate) { final int imageResId = isCheck ? R.drawable.add_schedule_button_icon_checked : R.drawable.add_schedule_button_icon_unchecked; if (imageView.getTag() != null) { if (imageView.getTag() instanceof Animator) { Animator anim = (Animator) imageView.getTag(); anim.end();// w w w . j a v a2 s . com imageView.setAlpha(1f); } } if (allowAnimate && isCheck) { int duration = mActivity.getResources().getInteger(android.R.integer.config_shortAnimTime); Animator outAnimator = ObjectAnimator.ofFloat(imageView, View.ALPHA, 0f); outAnimator.setDuration(duration / 2); outAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { imageView.setImageResource(imageResId); } }); AnimatorSet inAnimator = new AnimatorSet(); outAnimator.setDuration(duration); inAnimator.playTogether(ObjectAnimator.ofFloat(imageView, View.ALPHA, 1f), ObjectAnimator.ofFloat(imageView, View.SCALE_X, 0f, 1f), ObjectAnimator.ofFloat(imageView, View.SCALE_Y, 0f, 1f)); AnimatorSet set = new AnimatorSet(); set.playSequentially(outAnimator, inAnimator); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { imageView.setTag(null); } }); imageView.setTag(set); set.start(); } else { mHandler.post(new Runnable() { @Override public void run() { imageView.setImageResource(imageResId); } }); } }
From source file:com.bartoszlipinski.viewpropertyobjectanimator.ViewPropertyObjectAnimator.java
public ViewPropertyObjectAnimator alpha(float alpha) { animateProperty(View.ALPHA, alpha); return this; }
From source file:com.bartoszlipinski.viewpropertyobjectanimator.ViewPropertyObjectAnimator.java
public ViewPropertyObjectAnimator alphaBy(float alphaBy) { animatePropertyBy(View.ALPHA, alphaBy); return this; }
From source file:com.artemchep.horario.ui.widgets.ContainersLayout.java
private void animateInFrameDetails() { frameDetails.setVisibility(View.VISIBLE); ViewUtils.onLaidOut(frameDetails, new Runnable() { @Override/*from w ww . j av a 2s. com*/ public void run() { ObjectAnimator alpha = ofFloat(frameDetails, View.ALPHA, 0.4f, 1f); ObjectAnimator translate = ofFloat(frameDetails, View.TRANSLATION_Y, frameDetails.getHeight() * 0.3f, 0f); AnimatorSet set = new AnimatorSet(); set.playTogether(alpha, translate); set.setDuration(ANIM_DURATION); set.setInterpolator(new LinearOutSlowInInterpolator()); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); frameMaster.setVisibility(View.GONE); } }); set.start(); } }); }
From source file:org.amahi.anywhere.tv.fragment.IntroFragment.java
private Animator createFadeInAnimator(View view) { return ObjectAnimator.ofFloat(view, View.ALPHA, 0.0f, 1.0f).setDuration(500); }