CoolViewPager

by HuanHaiLiuXin

HuanHaiLiuXin /CoolViewPager

A Cool ViewPager

432 Stars 45 Forks Last release: over 2 years ago (v1.0.0) Apache License 2.0 98 Commits 1 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

README 中文版

About

CoolViewPager is a custom ViewPager,it contains these follow features: 1. support horizontal scrolling and vertical scrolling 2. support automatic scrolling 3. support setting auto-scrolling direction,auto-scrolling duration,auto-scrolling interval time 4. support executing notifyDataSetChanged to refresh views immediately 5. support setting the color of EdgeEffect 6. contains appropriate PageTransformer for vertical scrolling

Screen Record

horizontal and vertical scrolling direction,duration and interval time for auto-scrolling
executing notifyDataSetChanged to refresh views immediately setting the color of EdgeEffect
contains appropriate PageTransformer for vertical scrolling

Apk

demo.apk

Usage

1 Add the dependency to your build.gradle

JitPack:
  • Add it in your root build.gradle at the end of repositories:
    allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
    }
    
  • Add the dependency in your module build.gradle

    dependencies {
        implementation 'com.github.HuanHaiLiuXin:CoolViewPager:v1.0.0'
    }
    
    Bintray:

    Add the dependency in your module build.gradle

    dependencies {
    implementation 'com.huanhailiuxin.view:coolviewpager:1.0.0'
    }
    
    2 Include the CoolViewPager widget in your layout
    xml
    
    
    3 Gain the CoolViewPager isntance in your Java code,set it's attributes and PagerAdapter ```java public class ActivityEdgeEffectColor extends BaseActivity { private CoolViewPager vp;

    CoolViewPager vp = findViewById(R.id.vp); vp.setScrollMode(CoolViewPager.ScrollMode.HORIZONTAL); vp.setAdapter(adapter);


    } ```

Attributes

We can set the attributes for a CoolViewPager instance via xml or via Java code.

| attribute name | description | |:---|:---| | cvpscrollmode | horizontal or vertical | | cvpautoscroll | true or false: Set whether to open auto-scrolling | | cvpintervalinmillis | auto-scrolling interval time in miliseconds | | cvpautoscrolldirection | auto-scrolling direction: forward or backward | | cvpinfiniteloop | true or false: Set whether to open loop-scrolling | | cvpscrollduration | auto-scrolling consume time in miliseconds | | cvpdrawedgeeffect | true or false: Set whether to draw edgeeffect | | cvpedgeeffectcolor | setting the color of EdgeEffect |

Via XML


Via Java code

public class ActivityEdgeEffectColor extends BaseActivity {
    private CoolViewPager vp;

private void initViewPager(){
    vp = findViewById(R.id.vp);
    vp.setScrollMode(CoolViewPager.ScrollMode.VERTICAL);
    vp.setAutoScroll(true,1000);
    vp.setAutoScrollDirection(CoolViewPager.AutoScrollDirection.BACKWARD);
    vp.setInfiniteLoop(true);
    vp.setScrollDuration(true,600);
    vp.setDrawEdgeEffect(true);
    vp.setEdgeEffectColor(getResources().getColor(R.color.colorPrimary));
}

}

Author

License

Copyright 2018 HuanHaiLiuXin

Licensed 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.0

Unless required by applicable law or agreed to in writing, software distributed 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 and limitations under the License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.