List of usage examples for android.view View setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:Main.java
public static void addAnimationToView(final View view, final int animation) { if (view == null) { return;/* w w w . j a v a2 s. com*/ } Animation anim = AnimationUtils.loadAnimation(view.getContext(), animation); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { view.setVisibility(View.VISIBLE); } }); view.startAnimation(anim); }
From source file:Main.java
public static ObjectAnimator inflateFadeIn(final View v) { PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0f, 1f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0f, 1f); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0f, 1f); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(v, scaleX, scaleY, alpha); animator.setDuration(ANIM_DURATION_INFLATE); animator.addListener(new AnimatorListenerAdapter() { @Override// ww w . j a va 2 s. c o m public void onAnimationStart(Animator animation) { v.setVisibility(View.VISIBLE); } }); return animator; }
From source file:Main.java
public static void fadeAnimation(final View view, final float fromAlpha, final float toAlpha, long duration, final Runnable callback) { Animation anim = new AlphaAnimation(fromAlpha, toAlpha); anim.setDuration(duration);//from w w w . jav a2 s . c o m anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { view.setAlpha(toAlpha); if (toAlpha > 0) view.setVisibility(View.VISIBLE); else view.setVisibility(View.GONE); if (callback != null) callback.run(); } @Override public void onAnimationRepeat(Animation animation) { } }); view.setVisibility(View.VISIBLE); view.startAnimation(anim); }
From source file:com.bt.download.android.gui.util.UIUtils.java
/** * This method sets up the visibility of the support frostwire control (@see {@link DonationsView}) * depending on remote configuration parameters and local configuration preferences. * @param supportFrostWireView/*from w w w. j av a 2s . c o m*/ */ public static void supportFrostWire(View supportFrostWireView) { //remote kill switch if (!ConfigurationManager.instance().getBoolean(Constants.PREF_KEY_GUI_SUPPORT_FROSTWIRE_THRESHOLD)) { supportFrostWireView.setVisibility(View.GONE); Log.v(TAG, "Hiding support, above threshold."); } else if (ConfigurationManager.instance().getBoolean(Constants.PREF_KEY_GUI_SUPPORT_FROSTWIRE)) { supportFrostWireView.setVisibility(View.VISIBLE); if (supportFrostWireView.getLayoutParams() != null) { supportFrostWireView.getLayoutParams().width = LayoutParams.MATCH_PARENT; } } }
From source file:Main.java
public static void alphaHide(@NonNull final View view, final Runnable rWhenDone) { if (view.getWindowToken() == null) { if (rWhenDone != null) rWhenDone.run();//from w w w . java 2s. com return; } ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", 1f, 0f); alpha.setDuration(DURATION_MID); alpha.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { view.setVisibility(View.INVISIBLE); if (rWhenDone != null) rWhenDone.run(); } @Override public void onAnimationCancel(Animator animation) { view.setVisibility(View.INVISIBLE); if (rWhenDone != null) rWhenDone.run(); } @Override public void onAnimationRepeat(Animator animation) { } }); alpha.start(); }
From source file:Main.java
public static void startFadeOutAnimationOn(final View container, boolean forceFade) { if (forceFade || container.getVisibility() == View.VISIBLE) { Animation animation = getFadeOutAnimation(FADE_DURATION); animation.setAnimationListener(new AnimationListener() { @Override// w w w . j a v a2 s.co m public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { container.setVisibility(View.GONE); } }); container.startAnimation(animation); } }
From source file:Main.java
public static void switchViewsVisibilityByFade(final View oldView, final View newView) { final Animation fadeIn = new AlphaAnimation(0, 1); fadeIn.setDuration(700);// w w w.ja va 2 s. co m Animation fadeOut = new AlphaAnimation(1, 0); fadeOut.setDuration(700); fadeOut.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { oldView.setVisibility(View.GONE); newView.setVisibility(View.VISIBLE); newView.startAnimation(fadeIn); } }); oldView.startAnimation(fadeOut); }
From source file:Main.java
protected static void show(final View view) { Animation fadeIn = new AlphaAnimation(0, 1); fadeIn.setStartOffset(500);/*from w w w. j a v a 2 s .co m*/ fadeIn.setDuration(500); Animation collapse = new ScaleAnimation(1, 1, 0, 1); collapse.setDuration(500); AnimationSet animation = new AnimationSet(false); animation.setInterpolator(new AccelerateInterpolator()); animation.addAnimation(collapse); animation.addAnimation(fadeIn); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { view.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { view.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); view.startAnimation(animation); }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static void show(final View view, final int cornerType, int normalAnimRes, final AnimatorListenerAdapter listener) { try {/* w ww. j a va2 s.c o m*/ int[] amaya = calulateCorner(view, cornerType); Animator anim = ViewAnimationUtils.createCircularReveal(view, amaya[0], amaya[1], 0, amaya[2]); anim.setInterpolator(new LinearInterpolator()); anim.setDuration(300); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); view.setVisibility(View.VISIBLE); if (listener != null) { listener.onAnimationStart(animation); } } }); anim.start(); } catch (Exception e) { e.printStackTrace(); view.setVisibility(View.VISIBLE); } }
From source file:Main.java
/** * Applies a fade out animation and set the visibility in * {@link View#GONE}.//from w w w .j a va 2s. co m * @param view view to animate. */ public static void fadeOutView(final View view) { if (view.getVisibility() == View.VISIBLE) { cancelAnimation(view); Animation animation = android.view.animation.AnimationUtils.loadAnimation(view.getContext(), android.R.anim.fade_out); animation.setFillEnabled(true); animation.setFillBefore(true); animation.setFillAfter(true); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { view.setVisibility(View.GONE); view.clearAnimation(); } @Override public void onAnimationRepeat(Animation animation) { } }); view.setAnimation(animation); animation.start(); } }