Example usage for android.widget LinearLayout getRight

List of usage examples for android.widget LinearLayout getRight

Introduction

In this page you can find the example usage for android.widget LinearLayout getRight.

Prototype

@ViewDebug.CapturedViewProperty
public final int getRight() 

Source Link

Document

Right position of this view relative to its parent.

Usage

From source file:shetye.prathamesh.notifyme.Utilities.java

public void showView(LinearLayout lview) {
    // get the center for the clipping circle
    int cx = (lview.getLeft() + lview.getRight()) / 2;
    int cy = (lview.getTop() + lview.getBottom()) / 2;
    // get the final radius for the clipping circle
    int finalRadius = Math.max(lview.getWidth(), lview.getHeight());
    // create the animator for this view (the start radius is zero)
    Animator anim = ViewAnimationUtils.createCircularReveal(lview, cx, cy, 0, finalRadius);
    // make the view visible and start the animation
    lview.setVisibility(View.VISIBLE);
    anim.start();//  w ww.  j  a va 2s. c  om
}

From source file:shetye.prathamesh.notifyme.Utilities.java

public void hideView(final LinearLayout lview) {
    // get the center for the clipping circle
    int cx = (lview.getLeft() + lview.getRight()) / 2;
    int cy = (lview.getTop() + lview.getBottom()) / 2;
    // get the initial radius for the clipping circle
    int initialRadius = lview.getWidth();
    // create the animation (the final radius is zero)
    Animator anim = ViewAnimationUtils.createCircularReveal(lview, cx, cy, initialRadius, 0);
    // make the view invisible when the animation is done
    anim.addListener(new AnimatorListenerAdapter() {
        @Override/* w  w  w . j  a va  2s .c  om*/
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            lview.setVisibility(View.INVISIBLE);
        }
    });
    anim.start();
}

From source file:com.example.mego.adas.directions.ui.DirectionsFragment.java

/**
 * method used to show the reveal effect to the edit text
 *///  ww w.j  av  a  2 s.co m
private void revealEditText(LinearLayout view) {
    int centerX = view.getRight() - 30;
    int centerY = view.getBottom() - 60;
    int finalRadius = Math.max(view.getWidth(), view.getHeight());

    //work with api 21 or above
    Animator animator = null;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, 0, finalRadius);
    }
    view.setVisibility(View.VISIBLE);

    isEditTextVisible = true;
    if (animator != null) {
        animator.start();
    }
}

From source file:com.example.mego.adas.directions.ui.DirectionsFragment.java

/**
 * method to hide edit text with animation
 *//*from ww w  . j a  v  a2  s  .co  m*/
private void hideEditText(final LinearLayout view) {
    int cx = view.getRight() - 30;
    int cy = view.getBottom() - 60;
    int initialRadius = view.getWidth();
    Animator anim = null;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initialRadius, 0);
    }
    if (anim != null) {
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                view.setVisibility(View.INVISIBLE);
            }
        });
    }
    isEditTextVisible = false;
    if (anim != null) {
        anim.start();
    }
}

From source file:com.mobicage.rogerthat.plugins.friends.ServiceSearchActivity.java

private void displayTab(int tab) {
    final int childCount = mSearchCategoryViewFlipper.getChildCount();
    if (childCount == 0) {
        return;/*from w ww .j a v  a  2s  .com*/
    }
    while (tab < 0)
        tab += childCount;
    tab = tab % childCount;
    mSearchCategoryViewFlipper.setDisplayedChild(tab);
    for (int i = 0; i < childCount; i++) {
        SearchInfo si = mSearchInfoByListView.get(mSearchCategoryViewFlipper.getChildAt(i));
        if (si == null) {
            L.bug("Could not find list view!");
            return;
        }
        final boolean selected = tab == i;
        final LinearLayout v = si.label;
        setCatorySelected(v, selected);
        if (selected) {
            final HorizontalScrollView sv = (HorizontalScrollView) findViewById(
                    R.id.search_category_scroll_container);
            sv.post(new SafeRunnable() {
                @Override
                public void safeRun() {
                    int vLeft = v.getLeft();
                    int vRight = v.getRight();
                    int width = v.getWidth();
                    sv.smoothScrollTo(((vLeft + vRight) / 2) - (width), 0);
                }
            });
        }
    }
}

From source file:com.numix.calculator.EventListener.java

private void deleteAnimation(View view) {
    final TextView colorLayout = (TextView) view.getRootView().findViewById(R.id.deleteColor);
    final LinearLayout displayView = (LinearLayout) view.getRootView().findViewById(R.id.displayLayout);
    final CalculatorDisplay calculatorDisplay = (CalculatorDisplay) view.getRootView()
            .findViewById(R.id.display);

    int finalRadius = Math.max(displayView.getWidth(), displayView.getHeight());

    // create the animator for this view (the start radius is zero)
    Animator colorAnim;/*from   w  w w.  j  a va 2  s . c  om*/
    colorAnim = ViewAnimationUtils.createCircularReveal(colorLayout, (int) displayView.getRight(),
            (int) displayView.getBottom(), 0, finalRadius);
    final AlphaAnimation fadeAnim = new AlphaAnimation(1.0f, 0.0f);
    final AlphaAnimation fadeDisplay = new AlphaAnimation(1.0f, 0.0f);
    fadeAnim.setDuration(250);
    fadeAnim.setInterpolator(new AccelerateInterpolator());
    fadeAnim.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            colorLayout.setVisibility(View.GONE);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });

    fadeDisplay.setDuration(250);
    fadeDisplay.setInterpolator(new AccelerateInterpolator());
    fadeDisplay.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            mHandler.onClear();
            displayView.setAlpha(1.0f);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });

    colorAnim.setInterpolator(new AccelerateInterpolator());
    colorAnim.addListener(new android.animation.Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(android.animation.Animator animation) {
            calculatorDisplay.startAnimation(fadeDisplay);
        }

        @Override
        public void onAnimationRepeat(android.animation.Animator animation) {
        }

        @Override
        public void onAnimationEnd(android.animation.Animator animation) {
            colorLayout.startAnimation(fadeAnim);
        }

        @Override
        public void onAnimationCancel(android.animation.Animator animation) {
        }
    });

    colorLayout.setVisibility(View.VISIBLE);
    colorAnim.start();
}