List of usage examples for android.view View GONE
int GONE
To view the source code for android.view View GONE.
Click Source Link
From source file:Main.java
public static void fade_GONE(final View view, int duration) { view.animate().alpha(0.0f).setDuration(duration).setListener(new AnimatorListenerAdapter() { @Override/*from ww w . ja v a 2 s . co m*/ public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.GONE); } }); }
From source file:Main.java
/** * Fade in or fade out a given view./*from ww w .j a v a 2s .c om*/ */ public static void animateViewSetVisible(final boolean visible, final View view) { view.setVisibility(View.VISIBLE); view.setAlpha(visible ? 0 : 1); view.animate().setDuration(300).alpha(visible ? 1 : 0).setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { view.setVisibility(visible ? View.VISIBLE : View.GONE); } }); }
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 {//from w ww. j ava 2 s . c o m 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
private static void setText(TextView view, String text, boolean keepHtml) { CharSequence displayText = null; if (text != null) { displayText = keepHtml ? Html.fromHtml(text) : Html.fromHtml(text).toString(); }/*from w w w . j av a 2s.co m*/ if (view != null) { if (displayText != null && !"".equals(displayText)) { view.setVisibility(View.VISIBLE); view.setText(displayText); } else { view.setVisibility(View.GONE); } } }
From source file:Main.java
public static void collapse(final View v) { final int initialHeight = v.getMeasuredHeight(); Animation a = new Animation() { @Override//from www. ja v a 2 s . c o m protected void applyTransformation(float interpolatedTime, Transformation t) { if (interpolatedTime == 1) { v.setVisibility(View.GONE); } else { v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime); v.requestLayout(); } } @Override public boolean willChangeBounds() { return true; } }; a.setDuration(300); v.startAnimation(a); }
From source file:Main.java
public static void setText(TextView textView, boolean visible, String text) { if (textView != null) { if (visible && !TextUtils.isEmpty(text)) { textView.setVisibility(View.VISIBLE); textView.setText(text);//from w w w. ja va 2 s. c om } else { textView.setVisibility(View.GONE); } } }
From source file:Main.java
public static void collapse(final View v, boolean isHalf) { final int initialHeight = v.getMeasuredHeight(); remainHeigt = 0;//from w ww . j a va2s. co m if (isHalf) { remainHeigt = initialHeight / 2; } else { remainHeigt = initialHeight; } Animation a = new Animation() { @Override protected void applyTransformation(float interpolatedTime, Transformation t) { if (interpolatedTime == 1) { v.setVisibility(View.GONE); } else { v.getLayoutParams().height = initialHeight - (int) (remainHeigt * interpolatedTime); v.requestLayout(); } } @Override public boolean willChangeBounds() { return true; } }; // 1dp/ms a.setDuration((int) (initialHeight / v.getContext().getResources().getDisplayMetrics().density)); v.startAnimation(a); }
From source file:Main.java
public static void animHide(final View v, int duration, float from, float to, final boolean gone) { v.clearAnimation();//from w w w .j a v a 2s .c o m ObjectAnimator anim = ObjectAnimator.ofFloat(v, "alpha", from, to).setDuration(duration); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); if (gone) { v.setVisibility(View.GONE); } } }); anim.start(); }
From source file:Main.java
public static void switchOutIn(View toBeGone, View toBeVisible) { toBeVisible.setVisibility(View.VISIBLE); toBeGone.setVisibility(View.GONE); }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private static Animator createHideAnim(final View viewRoot, int x, int y) { float initialRadius = (float) Math.hypot(viewRoot.getWidth(), viewRoot.getHeight()); Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, x, y, initialRadius, 0); anim.addListener(new AnimatorListenerAdapter() { @Override/* w w w . ja v a 2 s . co m*/ public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); viewRoot.setVisibility(View.GONE); } }); anim.start(); return anim; }