RecyclerViewAnimation

来源:互联网 发布:什么软件淘宝返利多 编辑:程序博客网 时间:2024/05/29 17:41

RecyclerViewAnimation

项目地址:ruzhan123/RecyclerViewAnimation
简介:A grace let recycleriew holder add animation, recyclerview animation
更多:作者   提 Bug   
标签:
recyclerview-animation-

A grace recycleriew holder animation library for Android


 

ViewHolder-Slide-Helper use Animation and Scroller, expend recyclerview holder

Gradle

Add it in your root build.gradle at the end of repositories:

    allprojects {        repositories {            ...            maven { url 'https://jitpack.io' }        }    }

Add the dependency:

    dependencies {            compile 'com.github.ruzhan123:ViewHolder-Slide-Helper:v1.3'    }

Usage

1, recyclerview adapter create ISlideHelper

    public class SlideAdapter extends RecyclerView.Adapter {    private ISlideHelper mISlideHelper = new ISlideHelper();

2, use ISlideHelper add holder

    @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {    OneSlideViewHolder oneSlideViewHolder = new OneSlideViewHolder(        LayoutInflater.from(parent.getContext()).inflate(R.layout.one_item, parent, false));    //add holder    mISlideHelper.add(oneSlideViewHolder);    return oneSlideViewHolder;    }

3, extends SlideViewHolder, in onBindViewHolder call holder onBindSlide method

    @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {    ((SlideViewHolder) holder).bind();    }    public class OneSlideViewHolder extends SlideViewHolder {    public void bind() {    //slide offset    setOffset(50);    //slide must call,param is slide view    onBindSlide(mContentRl);    }    }

expend

add animation set, if you holder need

    @Override public void doAnimationSet(int offset, float fraction) {    mContentRl.scrollTo(offset, 0);    itemTv.setScaleX(fraction);    itemTv.setScaleY(fraction);    itemTv.setAlpha(fraction * 255);    titleLl.scrollTo(offset, 0);    }    //static bind anmation state    @Override public void onBindSlideClose(int state) {    titleLl.scrollTo(0, 0);    }    //static bind anmation state    @Override public void doAnimationSetOpen(int state) {    titleLl.scrollTo(-mOffset, 0);    }

Developed by

ruzhan - dev19921116@gmail.com

License

Copyright 2017 ruzhanLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at    http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.