diff --git a/README.md b/README.md index 48249a5..ca9302b 100644 --- a/README.md +++ b/README.md @@ -16,29 +16,28 @@ You can config all feature in the `IndicatorConfiguration` class.It adopt builde - `interval(long)` set interval time of scroll in milliseconds, default is `DEFAULT_INTERVAL`. -- `direction(int)` set auto scroll direction, default is `RIGHT`. +- `direction(int)` set scroll direction, default is `RIGHT`. - `isLoop(boolean)` set whether still scroll when scroll to the end page,default is true -- `isDrawIndicator(boolean)` whether draw indicator,default is true. - `isAutoScroll(boolean)` whether start scroll while notiyDataChange. - `scrollDurationFactor(double)` set the factor of scroll duration - `isStopWhenTouch(boolean)` whether stop scroll while touching, default is true. -- `position` set the position of indicator.You can reference `IndicatorConfiguration.IndicatorPosition` enum -- `pageResId` set custome page layout,if your page has imageview and want change it by res,you the id of imageview must is `slider_image` and you sholud provide a iamgeLoader -- `imageLoader(ImageLoader)` set the loader engine to load image while page sliding.You can use any image loader library you what,there are several imageloader of Glide ,Picasso and UIL,decide how to load image,is absolutely free. +- `position` set the position of indicator.More value,you can reference `IndicatorConfiguration.IndicatorPosition` enum - `onPageChangeListener` set click listener to page +- `imageLoader(ImageLoader)` set the loader engine to load image while page sliding.You can use any image loader library you what,there are several imageloader of Glide ,Picasso and UIL,decide how to load image,is absolutely free. + `indicator_type` -the style enum of Indicator,you can set the `indicator_type` in the xml layout to -change the indicator style. +the style of Indicator,you can set `indicator_type` attribute in the xml +layout to change the indicator style. - `indicator_default` CirCleIndicator - `indicator_anim_circle` AnimCircleIndicator -- `indicator_anim_line` is AnimLineIndicator +- `indicator_anim_line` AnimLineIndicator ## Including In Your Project -`compile 'cn.lightsky.infiniteindicator:library:1.1.0'` +`compile 'cn.lightsky.infiniteindicator:library:1.2.0'` ## Usage @@ -48,14 +47,12 @@ change the indicator style. app:indicator_type="indicator_anim_circle" android:layout_height="wrap_content" android:layout_width="match_parent"/> - ``` -```java -public class AnimIndicatorActivity extends FragmentActivity implements ViewPager.OnPageChangeListener,OnPageClickListener{ +``` java +class AnimIndicatorActivity extends FragmentActivity implements ViewPager.OnPageChangeListener,OnPageClickListener { private ArrayList pageViews; private InfiniteIndicator mAnimCircleIndicator; - private InfiniteIndicator mAnimLineIndicator; @Override protected void onCreate(Bundle savedInstanceState) { @@ -63,20 +60,26 @@ public class AnimIndicatorActivity extends FragmentActivity implements ViewPager setContentView(R.layout.activity_anim_indicator); initData(); - mAnimCircleIndicator = (InfiniteIndicator)findViewById(R.id.infinite_anim_circle); - mAnimCircleIndicator.setImageLoader(new UILoader()); - mAnimCircleIndicator.addPages(pageViews); - mAnimCircleIndicator.setPosition(InfiniteIndicator.IndicatorPosition.Center); - mAnimCircleIndicator.setOnPageChangeListener(this); + mAnimCircleIndicator = (InfiniteIndicator) findViewById(R.id.infinite_anim_circle); + IndicatorConfiguration configuration = new IndicatorConfiguration.Builder() + .imageLoader(new UILoader()) + .isStopWhileTouch(true) + .onPageChangeListener(this) + .onPageClickListener(this) + .direction(LEFT) + .position(IndicatorConfiguration.IndicatorPosition.Center) + .build(); + mAnimCircleIndicator.init(configuration); + mAnimCircleIndicator.notifyDataChange(pageViews); } private void initData() { pageViews = new ArrayList<>(); - pageViews.add(new Page("A ", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/a.jpg",this)); - pageViews.add(new Page("B ", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/b.jpg",this)); - pageViews.add(new Page("C ", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/c.jpg",this)); - pageViews.add(new Page("D ", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/d.jpg",this)); + pageViews.add(new Page("A", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/a.jpg",this)); + pageViews.add(new Page("B", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/b.jpg",this)); + pageViews.add(new Page("C", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/c.jpg",this)); + pageViews.add(new Page("D", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/d.jpg",this)); } @@ -111,12 +114,8 @@ public class AnimIndicatorActivity extends FragmentActivity implements ViewPager @Override public void onPageScrollStateChanged(int state) { - } - + } } - - - ``` Thanks diff --git a/apk/demo.apk b/apk/demo.apk index 0520b3a..9d252ca 100644 Binary files a/apk/demo.apk and b/apk/demo.apk differ diff --git a/demo/demo.iml b/demo/demo.iml index 514e40b..5e08ffe 100644 --- a/demo/demo.iml +++ b/demo/demo.iml @@ -66,14 +66,6 @@ - - - - - - - - @@ -82,9 +74,16 @@ + + + + + + + + - diff --git a/demo/src/main/AndroidManifest.xml b/demo/src/main/AndroidManifest.xml index 443f817..6880cd4 100644 --- a/demo/src/main/AndroidManifest.xml +++ b/demo/src/main/AndroidManifest.xml @@ -9,6 +9,7 @@ @@ -27,9 +28,13 @@ --> - + - + diff --git a/demo/src/main/java/cn/lightsky/infiniteindicator/AnimIndicatorActivity.java b/demo/src/main/java/cn/lightsky/infiniteindicator/AnimIndicatorActivity.java index 42e4c83..68055d1 100644 --- a/demo/src/main/java/cn/lightsky/infiniteindicator/AnimIndicatorActivity.java +++ b/demo/src/main/java/cn/lightsky/infiniteindicator/AnimIndicatorActivity.java @@ -37,14 +37,10 @@ private void initData() { // pageViews.add(new Page("C ", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/c.jpg", this)); // pageViews.add(new Page("D ", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/d.jpg", this)); - /** - * drawabel:// is Universal-Image-Loader 's local drawable data format - * Picasso or Glide support drawable id directly - */ - pageViews.add(new Page("A ", "drawable://" + R.drawable.a, this)); - pageViews.add(new Page("B ", "drawable://" + R.drawable.b, this)); - pageViews.add(new Page("C ", "drawable://" + R.drawable.c, this)); - pageViews.add(new Page("D ", "drawable://" + R.drawable.d, this)); + pageViews.add(new Page("A", R.drawable.a, this)); + pageViews.add(new Page("B", R.drawable.b, this)); + pageViews.add(new Page("C", R.drawable.c, this)); + pageViews.add(new Page("D", R.drawable.d, this)); } diff --git a/demo/src/main/java/cn/lightsky/infiniteindicator/DefaultCircleIndicatorActivity.java b/demo/src/main/java/cn/lightsky/infiniteindicator/DefaultCircleIndicatorActivity.java index c9f052e..a46ada0 100644 --- a/demo/src/main/java/cn/lightsky/infiniteindicator/DefaultCircleIndicatorActivity.java +++ b/demo/src/main/java/cn/lightsky/infiniteindicator/DefaultCircleIndicatorActivity.java @@ -27,14 +27,10 @@ protected void onCreate(Bundle savedInstanceState) { // pageViews.add(new Page("Page C", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/c.jpg")); // pageViews.add(new Page("Page D", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/d.jpg")); - pageViews.add(new Page("A ", "drawable://" + R.drawable.a)); - pageViews.add(new Page("B ", "drawable://" + R.drawable.b)); - pageViews.add(new Page("C ", "drawable://" + R.drawable.c)); - pageViews.add(new Page("D ", "drawable://" + R.drawable.d)); - pageViews.add(new Page("D ", "drawable://" + R.drawable.d)); - pageViews.add(new Page("D ", "drawable://" + R.drawable.d)); - pageViews.add(new Page("D ", "drawable://" + R.drawable.d)); - pageViews.add(new Page("D ", "drawable://" + R.drawable.d)); + pageViews.add(new Page("A ", R.drawable.a)); + pageViews.add(new Page("B ", R.drawable.b)); + pageViews.add(new Page("C ", R.drawable.c)); + pageViews.add(new Page("D ", R.drawable.d)); testCircleIndicator(); testCustomeCircleIndicator(); } diff --git a/demo/src/main/java/cn/lightsky/infiniteindicator/UILoader.java b/demo/src/main/java/cn/lightsky/infiniteindicator/UILoader.java index 4c79343..56c1b05 100644 --- a/demo/src/main/java/cn/lightsky/infiniteindicator/UILoader.java +++ b/demo/src/main/java/cn/lightsky/infiniteindicator/UILoader.java @@ -50,6 +50,10 @@ public void load(Context context,ImageView targetView, Object res) { if (res instanceof String) { com.nostra13.universalimageloader.core.ImageLoader.getInstance().displayImage((String) res, targetView,options); + } else { + com.nostra13.universalimageloader.core.ImageLoader.getInstance() + .displayImage("drawable://" + res, targetView,options); + } } } diff --git a/demo/src/main/java/test/addSlidersActivity.java b/demo/src/main/java/test/addSlidersActivity.java index 13e991b..b36bd18 100644 --- a/demo/src/main/java/test/addSlidersActivity.java +++ b/demo/src/main/java/test/addSlidersActivity.java @@ -14,7 +14,8 @@ import cn.lightsky.infiniteindicator.OnPageClickListener; import cn.lightsky.infiniteindicator.Page; -public class AddSlidersActivity extends FragmentActivity implements OnPageClickListener { +public class AddSlidersActivity extends FragmentActivity implements + OnPageClickListener { private ArrayList pageViews; private InfiniteIndicator mAnimCircleIndicator; private List refreshPageViews = new ArrayList(); diff --git a/demo/src/main/res/layout/layout_custome_page.xml b/demo/src/main/res/layout/layout_custome_page.xml new file mode 100644 index 0000000..80e1b47 --- /dev/null +++ b/demo/src/main/res/layout/layout_custome_page.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d38a836..e9be5df 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip \ No newline at end of file diff --git a/library/build.gradle b/library/build.gradle index 919e80e..141f000 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'com.github.dcendents.android-maven' apply plugin: 'com.jfrog.bintray' -version = "1.2.0-SNAPSHOT" +version = "1.2.0" android { compileSdkVersion 23 diff --git a/library/library.iml b/library/library.iml index f9b2e15..4783fe8 100644 --- a/library/library.iml +++ b/library/library.iml @@ -67,14 +67,6 @@ - - - - - - - - @@ -83,8 +75,15 @@ + + + + + + + + - @@ -101,7 +100,9 @@ + +