Search in sources :

Example 86 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project toshi-android-client by toshiapp.

the class RecyclerViewDivider method onDrawOver.

@Override
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
    final int left = parent.getPaddingLeft() + padding;
    final int right = parent.getWidth() - parent.getPaddingRight() - padding;
    int childCount = parent.getChildCount();
    for (int i = 0; i < childCount - 1; i++) {
        final View child = parent.getChildAt(i);
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
        final int top = child.getBottom() + params.bottomMargin;
        final int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 87 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project Auto.js by hyb1996.

the class GridDividerDecoration method drawHorizontal.

/**
 * Draw dividers to the right of each child view
 */
public void drawHorizontal(Canvas c, RecyclerView parent) {
    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
        final int left = child.getRight() + params.rightMargin + mInsets;
        final int right = left + mDivider.getIntrinsicWidth();
        final int top = child.getTop() - params.topMargin - mInsets;
        final int bottom = child.getBottom() + params.bottomMargin + mInsets;
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 88 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project Instafood by Gear61.

the class SimpleDividerItemDecoration method onDrawOver.

@Override
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
    int left = parent.getPaddingLeft();
    int right = parent.getWidth() - parent.getPaddingRight();
    int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = parent.getChildAt(i);
        RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
        int top = child.getBottom() + params.bottomMargin;
        int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 89 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project iosched by google.

the class SearchActivity method doExitAnim.

/**
 * On Lollipop+ perform a circular animation (a contracting circular mask) when hiding the
 * search panel.
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void doExitAnim() {
    final View searchPanel = findViewById(R.id.search_panel);
    // Center the animation on the top right of the panel i.e. near to the search button which
    // launched this screen. The starting radius therefore is the diagonal distance from the top
    // right to the bottom left
    final int revealRadius = (int) Math.hypot(searchPanel.getWidth(), searchPanel.getHeight());
    // Animating the radius to 0 produces the contracting effect
    Animator shrink = ViewAnimationUtils.createCircularReveal(searchPanel, searchPanel.getRight(), searchPanel.getTop(), revealRadius, 0f);
    shrink.setDuration(200L);
    shrink.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this, android.R.interpolator.fast_out_slow_in));
    shrink.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            searchPanel.setVisibility(View.INVISIBLE);
            ActivityCompat.finishAfterTransition(SearchActivity.this);
        }
    });
    shrink.start();
    // We also animate out the translucent background at the same time.
    findViewById(R.id.scrim).animate().alpha(0f).setDuration(200L).setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this, android.R.interpolator.fast_out_slow_in)).start();
}
Also used : Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) SearchView(android.support.v7.widget.SearchView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) TargetApi(android.annotation.TargetApi)

Example 90 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project iosched by google.

the class SearchActivity method doEnterAnim.

/**
 * On Lollipop+ perform a circular reveal animation (an expanding circular mask) when showing
 * the search panel.
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void doEnterAnim() {
    // Fade in a background scrim as this is a floating window. We could have used a
    // translucent window background but this approach allows us to turn off window animation &
    // overlap the fade with the reveal animation – making it feel snappier.
    View scrim = findViewById(R.id.scrim);
    scrim.animate().alpha(1f).setDuration(500L).setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in)).start();
    // Next perform the circular reveal on the search panel
    final View searchPanel = findViewById(R.id.search_panel);
    if (searchPanel != null) {
        // We use a view tree observer to set this up once the view is measured & laid out
        searchPanel.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {

            @Override
            public boolean onPreDraw() {
                searchPanel.getViewTreeObserver().removeOnPreDrawListener(this);
                // As the height will change once the initial suggestions are delivered by the
                // loader, we can't use the search panels height to calculate the final radius
                // so we fall back to it's parent to be safe
                final ViewGroup searchPanelParent = (ViewGroup) searchPanel.getParent();
                final int revealRadius = (int) Math.hypot(searchPanelParent.getWidth(), searchPanelParent.getHeight());
                // Center the animation on the top right of the panel i.e. near to the
                // search button which launched this screen.
                Animator show = ViewAnimationUtils.createCircularReveal(searchPanel, searchPanel.getRight(), searchPanel.getTop(), 0f, revealRadius);
                show.setDuration(250L);
                show.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this, android.R.interpolator.fast_out_slow_in));
                show.start();
                return false;
            }
        });
    }
}
Also used : Animator(android.animation.Animator) ViewGroup(android.view.ViewGroup) SearchView(android.support.v7.widget.SearchView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ViewTreeObserver(android.view.ViewTreeObserver) TargetApi(android.annotation.TargetApi)

Aggregations

View (android.view.View)315 RecyclerView (android.support.v7.widget.RecyclerView)294 Paint (android.graphics.Paint)47 TextView (android.widget.TextView)46 ImageView (android.widget.ImageView)29 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)27 ViewGroup (android.view.ViewGroup)15 Intent (android.content.Intent)13 Rect (android.graphics.Rect)12 Preference (android.support.v7.preference.Preference)12 GridLayoutManager (android.support.v7.widget.GridLayoutManager)11 SuppressLint (android.annotation.SuppressLint)10 AlertDialog (android.support.v7.app.AlertDialog)10 Bundle (android.os.Bundle)9 Bitmap (android.graphics.Bitmap)8 OnLayoutChangeListener (android.view.View.OnLayoutChangeListener)8 Button (android.widget.Button)8 PreferenceScreen (android.support.v7.preference.PreferenceScreen)7 ArrayList (java.util.ArrayList)7 Animator (android.animation.Animator)6