List of usage examples for android.view View setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:Main.java
public static void circleReveal(final View targetView, int centerX, int centerY, boolean isReverse) { if (targetView == null || !targetView.isAttachedToWindow()) return;//from www .j a v a 2s . com int radius = (int) Math.hypot(targetView.getHeight(), targetView.getWidth()); Animator animator; if (isReverse) { animator = isCircleRevealSupported() ? ViewAnimationUtils.createCircularReveal(targetView, centerX, centerY, radius, 0) : createFade(targetView, 1, 0); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { targetView.setVisibility(View.GONE); } }); } else { animator = isCircleRevealSupported() ? ViewAnimationUtils.createCircularReveal(targetView, centerX, centerY, 0, radius) : createFade(targetView, 0, 1); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { targetView.setVisibility(View.VISIBLE); } }); } animator.setDuration(DURATION); animator.start(); }
From source file:by.gdgminsk.animationguide.util.AnimUtils.java
public static void scaleOut(final View view, int delay) { PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.0f); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0.4f); ObjectAnimator scaleOutAnimation = ObjectAnimator.ofPropertyValuesHolder(view, alpha, scaleX, scaleY); scaleOutAnimation.setInterpolator(EASE_OUT_INTERPOLATOR); scaleOutAnimation.addListener(new AnimatorListenerAdapter() { @Override/*from ww w .jav a 2 s .c om*/ public void onAnimationEnd(Animator animation) { view.setVisibility(View.GONE); } @Override public void onAnimationStart(Animator animation) { view.setVisibility(View.VISIBLE); } @Override public void onAnimationCancel(Animator animation) { view.setScaleX(0.0f); view.setScaleY(0.0f); view.setVisibility(View.GONE); } }); scaleOutAnimation.setDuration(view.getResources().getInteger(R.integer.duration_fab_scale_out)); scaleOutAnimation.setStartDelay(delay); scaleOutAnimation.start(); }
From source file:Main.java
@SuppressLint("NewApi") public static void revealView(View toBeRevealed, View frame) { try {/*from w ww . j a v a2 s .c om*/ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { // get the center for the clipping circle int cx = (frame.getLeft() + frame.getRight()) / 2; int cy = (frame.getTop() + frame.getBottom()) / 2; // get the final radius for the clipping circle int finalRadius = Math.max(frame.getWidth(), frame.getHeight()); // create the animator for this view (the start radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(toBeRevealed, cx, cy, 0, finalRadius); // make the view visible and start the animation toBeRevealed.setVisibility(View.VISIBLE); anim.start(); } else { toBeRevealed.setVisibility(View.VISIBLE); } } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static Animator createCircularShowAnimator(final View view) { if (view.getVisibility() == View.VISIBLE || view.getWindowToken() == null) return null; // get the center for the clipping circle int cx = (view.getLeft() + view.getRight()) / 2; int cy = (view.getTop() + view.getBottom()) / 2; // get the final radius for the clipping circle int finalRadius = view.getWidth(); // create and start the animator for this view // (the start radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius); anim.addListener(new AnimatorListenerAdapter() { @Override/*from w w w . j a v a 2s . c o m*/ public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); view.setVisibility(View.VISIBLE); } }); return anim; }
From source file:Main.java
public static void toggleBottomView(View view, boolean isShow, int duration) { if (view != null) { float fromYDelta = 0; float toYDelta = 0; int visibility; if (isShow) { fromYDelta = view.getHeight(); visibility = View.VISIBLE; } else {// www . ja va 2s.com toYDelta = view.getHeight(); visibility = View.GONE; } if (fromYDelta == toYDelta) { setMeasureSpec(view); if (isShow) { fromYDelta = view.getMeasuredHeight(); } else { toYDelta = view.getMeasuredHeight(); } } view.setAnimation(translate(0, 0, fromYDelta, toYDelta, duration)); view.setVisibility(visibility); } }
From source file:Main.java
@SuppressLint("NewApi") public static void revealView(View toBeRevealed, View frame) { try {//from w w w . j a va2s . com if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { // get the center for the clipping circle int cx = (frame.getLeft() + frame.getRight()) / 2; int cy = (frame.getTop() + frame.getBottom()) / 2; // get the final radius for the clipping circle int finalRadius = Math.max(frame.getWidth(), frame.getHeight()); Log.v("INFO", "Radius: " + finalRadius); // create the animator for this view (the start radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(toBeRevealed, cx, cy, 0, finalRadius); // make the view visible and start the animation toBeRevealed.setVisibility(View.VISIBLE); anim.start(); } else { toBeRevealed.setVisibility(View.VISIBLE); } } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static Animator createCircularHideAnimator(final View view, @Nullable Animator.AnimatorListener listener) { if (view.getWindowToken() == null || view.getVisibility() == View.INVISIBLE) return null; // get the center for the clipping circle int cx = (view.getLeft() + view.getRight()) / 2; int cy = (view.getTop() + view.getBottom()) / 2; // get the initial radius for the clipping circle int initialRadius = view.getWidth(); // create the animation (the final radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initialRadius, 0); anim.addListener(new AnimatorListenerAdapter() { @Override// ww w.j a v a2 s. c o m public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.INVISIBLE); } }); if (listener != null) { anim.addListener(listener); } return anim; }
From source file:by.gdgminsk.animationguide.util.AnimUtils.java
public static void scaleIn(final View view, int delay) { view.setAlpha(0.0f);// ww w . j av a2 s . co m view.setScaleX(0.0f); view.setScaleY(0.0f); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1.0f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); ObjectAnimator scaleInAnimation = ObjectAnimator.ofPropertyValuesHolder(view, alpha, scaleX, scaleY); scaleInAnimation.setDuration(view.getResources().getInteger(R.integer.duration_fab_scale_in)); scaleInAnimation.setStartDelay(delay); scaleInAnimation.setInterpolator(EASE_IN_INTERPOLATOR); scaleInAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { view.setVisibility(View.VISIBLE); } @Override public void onAnimationCancel(Animator animation) { view.setAlpha(1.0f); view.setScaleX(1.0f); view.setScaleY(1.0f); } }); scaleInAnimation.start(); }
From source file:android.support.v7.app.AlertController.java
private static void manageScrollIndicators(View v, View upIndicator, View downIndicator) { if (upIndicator != null) { upIndicator.setVisibility(ViewCompat.canScrollVertically(v, -1) ? View.VISIBLE : View.INVISIBLE); }/*www .j a v a2s . c o m*/ if (downIndicator != null) { downIndicator.setVisibility(ViewCompat.canScrollVertically(v, 1) ? View.VISIBLE : View.INVISIBLE); } }
From source file:Main.java
public static void enterReveal(final View view) { view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override//from w w w .j ava2 s . c o m public void onGlobalLayout() { Animator animator = null; view.getViewTreeObserver().removeOnGlobalLayoutListener(this); int cx = view.getMeasuredWidth() / 2; int cy = view.getMeasuredHeight() / 2; try { final int finalRadius = Math.max(view.getWidth(), view.getHeight()) / 2 + 125; animator = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); } }); } catch (Exception ignored) { } view.setVisibility(View.VISIBLE); if (animator != null) { animator.start(); } } }); }