Skip to content

Commit

Permalink
update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
lightSky committed Nov 8, 2016
1 parent 4d999bf commit 5af14ee
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 66 deletions.
53 changes: 26 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -48,35 +47,39 @@ 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<Page> pageViews;
private InfiniteIndicator mAnimCircleIndicator;
private InfiniteIndicator mAnimLineIndicator;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
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));

}

Expand Down Expand Up @@ -111,12 +114,8 @@ public class AnimIndicatorActivity extends FragmentActivity implements ViewPager
@Override
public void onPageScrollStateChanged(int state) {

}

}
}



```

Thanks
Expand Down
Binary file modified apk/demo.apk
Binary file not shown.
17 changes: 8 additions & 9 deletions demo/demo.iml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
Expand All @@ -82,9 +74,16 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
Expand Down
9 changes: 7 additions & 2 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<activity
android:name="cn.lightsky.infiniteindicator.AnimIndicatorActivity"
android:screenOrientation="portrait"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -27,9 +28,13 @@
</intent-filter>
</activity>-->

<activity android:name="cn.lightsky.infiniteindicator.DefaultCircleIndicatorActivity"/>
<activity
android:screenOrientation="portrait"
android:name="cn.lightsky.infiniteindicator.DefaultCircleIndicatorActivity"/>

<activity android:name="test.AddSlidersActivity"/>
<activity
android:screenOrientation="portrait"
android:name="test.AddSlidersActivity"/>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -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));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}
}
}
3 changes: 2 additions & 1 deletion demo/src/main/java/test/addSlidersActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Page> pageViews;
private InfiniteIndicator mAnimCircleIndicator;
private List refreshPageViews = new ArrayList();
Expand Down
6 changes: 6 additions & 0 deletions demo/src/main/res/layout/layout_custome_page.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/slider_image"
android:scaleType="fitCenter"
android:layout_width="match_parent"
android:layout_height="match_parent" />
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 10 additions & 9 deletions library/library.iml
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
Expand All @@ -83,8 +75,15 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
Expand All @@ -101,7 +100,9 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/typedefs.txt" />
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/poms" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform (3)" jdkType="Android SDK" />
Expand Down

0 comments on commit 5af14ee

Please sign in to comment.