diff --git a/AndroidImageIndicator/.classpath b/AndroidImageIndicator/.classpath
new file mode 100644
index 0000000..a4f1e40
--- /dev/null
+++ b/AndroidImageIndicator/.classpath
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/AndroidImageIndicator/.gitignore b/AndroidImageIndicator/.gitignore
new file mode 100644
index 0000000..04e6b04
--- /dev/null
+++ b/AndroidImageIndicator/.gitignore
@@ -0,0 +1,3 @@
+.settings
+bin/
+gen/
\ No newline at end of file
diff --git a/AndroidImageIndicator/.project b/AndroidImageIndicator/.project
new file mode 100644
index 0000000..1d978ec
--- /dev/null
+++ b/AndroidImageIndicator/.project
@@ -0,0 +1,33 @@
+
+
+ AndroidImageIndicator
+
+
+
+
+
+ com.android.ide.eclipse.adt.ResourceManagerBuilder
+
+
+
+
+ com.android.ide.eclipse.adt.PreCompilerBuilder
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ com.android.ide.eclipse.adt.ApkBuilder
+
+
+
+
+
+ com.android.ide.eclipse.adt.AndroidNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/AndroidImageIndicator/AndroidManifest.xml b/AndroidImageIndicator/AndroidManifest.xml
new file mode 100644
index 0000000..b3d1a8b
--- /dev/null
+++ b/AndroidImageIndicator/AndroidManifest.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AndroidImageIndicator/ic_launcher-web.png b/AndroidImageIndicator/ic_launcher-web.png
new file mode 100644
index 0000000..a18cbb4
Binary files /dev/null and b/AndroidImageIndicator/ic_launcher-web.png differ
diff --git a/AndroidImageIndicator/libs/android-support-v4.jar b/AndroidImageIndicator/libs/android-support-v4.jar
new file mode 100644
index 0000000..65ebaf8
Binary files /dev/null and b/AndroidImageIndicator/libs/android-support-v4.jar differ
diff --git a/AndroidImageIndicator/proguard-project.txt b/AndroidImageIndicator/proguard-project.txt
new file mode 100644
index 0000000..f2fe155
--- /dev/null
+++ b/AndroidImageIndicator/proguard-project.txt
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/AndroidImageIndicator/project.properties b/AndroidImageIndicator/project.properties
new file mode 100644
index 0000000..6a78a6f
--- /dev/null
+++ b/AndroidImageIndicator/project.properties
@@ -0,0 +1,15 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-17
+android.library.reference.1=../android-app-http/android-app-http
diff --git a/AndroidImageIndicator/res/drawable-hdpi/arrow_left.png b/AndroidImageIndicator/res/drawable-hdpi/arrow_left.png
new file mode 100644
index 0000000..5a42e87
Binary files /dev/null and b/AndroidImageIndicator/res/drawable-hdpi/arrow_left.png differ
diff --git a/AndroidImageIndicator/res/drawable-hdpi/arrow_left_focus.png b/AndroidImageIndicator/res/drawable-hdpi/arrow_left_focus.png
new file mode 100644
index 0000000..121b891
Binary files /dev/null and b/AndroidImageIndicator/res/drawable-hdpi/arrow_left_focus.png differ
diff --git a/AndroidImageIndicator/res/drawable-hdpi/arrow_right.png b/AndroidImageIndicator/res/drawable-hdpi/arrow_right.png
new file mode 100644
index 0000000..0a40420
Binary files /dev/null and b/AndroidImageIndicator/res/drawable-hdpi/arrow_right.png differ
diff --git a/AndroidImageIndicator/res/drawable-hdpi/arrow_right_focus.png b/AndroidImageIndicator/res/drawable-hdpi/arrow_right_focus.png
new file mode 100644
index 0000000..2b5a7e6
Binary files /dev/null and b/AndroidImageIndicator/res/drawable-hdpi/arrow_right_focus.png differ
diff --git a/AndroidImageIndicator/res/drawable-hdpi/ic_launcher.png b/AndroidImageIndicator/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..8074c4c
Binary files /dev/null and b/AndroidImageIndicator/res/drawable-hdpi/ic_launcher.png differ
diff --git a/AndroidImageIndicator/res/drawable-hdpi/image_indicator.png b/AndroidImageIndicator/res/drawable-hdpi/image_indicator.png
new file mode 100644
index 0000000..e6495d6
Binary files /dev/null and b/AndroidImageIndicator/res/drawable-hdpi/image_indicator.png differ
diff --git a/AndroidImageIndicator/res/drawable-hdpi/image_indicator_focus.png b/AndroidImageIndicator/res/drawable-hdpi/image_indicator_focus.png
new file mode 100644
index 0000000..15f2a9e
Binary files /dev/null and b/AndroidImageIndicator/res/drawable-hdpi/image_indicator_focus.png differ
diff --git a/AndroidImageIndicator/res/drawable-ldpi/ic_launcher.png b/AndroidImageIndicator/res/drawable-ldpi/ic_launcher.png
new file mode 100644
index 0000000..1095584
Binary files /dev/null and b/AndroidImageIndicator/res/drawable-ldpi/ic_launcher.png differ
diff --git a/AndroidImageIndicator/res/drawable-mdpi/ic_launcher.png b/AndroidImageIndicator/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..a07c69f
Binary files /dev/null and b/AndroidImageIndicator/res/drawable-mdpi/ic_launcher.png differ
diff --git a/AndroidImageIndicator/res/drawable/arrow_left_selector.xml b/AndroidImageIndicator/res/drawable/arrow_left_selector.xml
new file mode 100644
index 0000000..584b670
--- /dev/null
+++ b/AndroidImageIndicator/res/drawable/arrow_left_selector.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AndroidImageIndicator/res/drawable/arrow_right_selector.xml b/AndroidImageIndicator/res/drawable/arrow_right_selector.xml
new file mode 100644
index 0000000..f2e3856
--- /dev/null
+++ b/AndroidImageIndicator/res/drawable/arrow_right_selector.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AndroidImageIndicator/res/layout/activity_indicator.xml b/AndroidImageIndicator/res/layout/activity_indicator.xml
new file mode 100644
index 0000000..2680fca
--- /dev/null
+++ b/AndroidImageIndicator/res/layout/activity_indicator.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/AndroidImageIndicator/res/layout/activity_indicator_auto.xml b/AndroidImageIndicator/res/layout/activity_indicator_auto.xml
new file mode 100644
index 0000000..75512c5
--- /dev/null
+++ b/AndroidImageIndicator/res/layout/activity_indicator_auto.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/AndroidImageIndicator/res/layout/activity_main.xml b/AndroidImageIndicator/res/layout/activity_main.xml
new file mode 100644
index 0000000..f08c4fa
--- /dev/null
+++ b/AndroidImageIndicator/res/layout/activity_main.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AndroidImageIndicator/res/layout/image_indicator_layout.xml b/AndroidImageIndicator/res/layout/image_indicator_layout.xml
new file mode 100644
index 0000000..ddd0175
--- /dev/null
+++ b/AndroidImageIndicator/res/layout/image_indicator_layout.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AndroidImageIndicator/res/values/dimens.xml b/AndroidImageIndicator/res/values/dimens.xml
new file mode 100644
index 0000000..71be703
--- /dev/null
+++ b/AndroidImageIndicator/res/values/dimens.xml
@@ -0,0 +1,7 @@
+
+
+
+ 16dp
+ 16dp
+
+
\ No newline at end of file
diff --git a/AndroidImageIndicator/res/values/strings.xml b/AndroidImageIndicator/res/values/strings.xml
new file mode 100644
index 0000000..eeb0256
--- /dev/null
+++ b/AndroidImageIndicator/res/values/strings.xml
@@ -0,0 +1,8 @@
+
+
+
+ AndroidImageIndicator
+ Settings
+ Hello world!
+
+
\ No newline at end of file
diff --git a/AndroidImageIndicator/res/values/styles.xml b/AndroidImageIndicator/res/values/styles.xml
new file mode 100644
index 0000000..79a39af
--- /dev/null
+++ b/AndroidImageIndicator/res/values/styles.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AndroidImageIndicator/src/com/app/library/common/view/AutoImageIndicatorView.java b/AndroidImageIndicator/src/com/app/library/common/view/AutoImageIndicatorView.java
new file mode 100644
index 0000000..d47efe4
--- /dev/null
+++ b/AndroidImageIndicator/src/com/app/library/common/view/AutoImageIndicatorView.java
@@ -0,0 +1,164 @@
+package com.app.library.common.view;
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import android.content.Context;
+import android.os.Handler;
+import android.util.AttributeSet;
+
+/**
+ * 自动播放的宣传画控件(间隔播放,自动切换方向,循环)
+ *
+ * @author savant-pan
+ *
+ */
+public class AutoImageIndicatorView extends ImageIndicatorView {
+ /**
+ * 定时服务
+ */
+ private ScheduledExecutorService scheduler;
+ /**
+ * 自动播放标志位,默认播放
+ */
+ private boolean broadcastEnagle = false;
+ /**
+ * 自动播放启动默认时间
+ */
+ private static final long DEFAULT_STARTMILS = 3 * 1000;
+ /**
+ * 自动播放间隔默认时间
+ */
+ private static final long DEFAULT_INTEVALMILS = 5 * 1000;
+ /**
+ * 启动时间ms
+ */
+ private long startMils = DEFAULT_STARTMILS;
+ /**
+ * 间隔ms
+ */
+ private long intevalMils = DEFAULT_INTEVALMILS;
+ /**
+ * 向右
+ */
+ private final static int RIGHT = 0;
+ /**
+ * 向左
+ */
+ private final static int LEFT = 1;
+
+ /**
+ * 当前方向
+ */
+ private int direction = RIGHT;
+
+ /**
+ * 自动播放默认次数(无限)
+ */
+ private static final int DEFAULT_TIMES = -1;
+
+ /**
+ * 自动播放次数
+ */
+ private int broadcastTimes = DEFAULT_TIMES;
+
+ /**
+ * 自动播放次数记数
+ */
+ private int timeCount = 0;
+
+ public AutoImageIndicatorView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.init();
+ }
+
+ public AutoImageIndicatorView(Context context) {
+ super(context);
+ this.init();
+ }
+
+ private void init() {
+ this.scheduler = Executors.newScheduledThreadPool(1);
+ }
+
+ /**
+ * 设置自动播放启动时间和间隔
+ *
+ * @param startMils
+ * 启动时间ms(默认为8s)
+ * @param intevelMils
+ * 间隔ms(默认为3s)
+ */
+ public void setBroadcastTimeIntevel(long startMils, long intevelMils) {
+ this.startMils = startMils;
+ this.intevalMils = intevelMils;
+ }
+
+ /**
+ * 设置自动播放开关
+ *
+ * @param flag
+ * 打开或关闭
+ */
+ public void setBroadcastEnable(boolean flag) {
+ this.broadcastEnagle = flag;
+ }
+
+ /**
+ * 设置循环播放次数
+ *
+ * @param times
+ * 循环播放次数
+ */
+ public void setBroadCastTimes(int times) {
+ this.broadcastTimes = times;
+ }
+
+ @Override
+ public void show() {
+ super.show();
+ // 定时播放服务
+ this.scheduler.scheduleAtFixedRate(new Runnable() {
+ @Override
+ public void run() {
+ if (broadcastEnagle) {
+ if (System.currentTimeMillis() - getRefreshTime() < 5 * 1000) {// 最近一次划动间隔小于5s
+ return;
+ }
+ if ((broadcastTimes != DEFAULT_TIMES) && (timeCount > broadcastTimes)) {// 循环次数用完
+ return;
+ }
+ broadcastHandler.sendEmptyMessage(0);
+ }
+ }
+ }, this.startMils, this.intevalMils, TimeUnit.MILLISECONDS);
+ }
+
+ /**
+ * 循环播放
+ */
+ private Handler broadcastHandler = new Handler() {
+ public void handleMessage(android.os.Message msg) {
+ if (direction == RIGHT) {// roll right
+ if (getCurrentIndex() < getTotalCount()) {
+ if (getCurrentIndex() == getTotalCount() - 1) {
+ timeCount++;// 循环次数次数加1
+ direction = LEFT;
+ } else {
+ getViewPager().setCurrentItem(getCurrentIndex() + 1, true);
+ }
+ }
+ } else {// roll left
+ if (getCurrentIndex() >= 0) {
+ if (getCurrentIndex() == 0) {
+ direction = RIGHT;
+ } else {
+ getViewPager().setCurrentItem(getCurrentIndex() - 1, true);
+ }
+ }
+ }
+ }
+ };
+
+}
diff --git a/AndroidImageIndicator/src/com/app/library/common/view/ImageIndicatorView.java b/AndroidImageIndicator/src/com/app/library/common/view/ImageIndicatorView.java
new file mode 100644
index 0000000..925f96d
--- /dev/null
+++ b/AndroidImageIndicator/src/com/app/library/common/view/ImageIndicatorView.java
@@ -0,0 +1,483 @@
+package com.app.library.common.view;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import android.content.Context;
+import android.os.Handler;
+import android.os.Message;
+import android.os.Parcelable;
+import android.support.v4.view.PagerAdapter;
+import android.support.v4.view.ViewPager;
+import android.support.v4.view.ViewPager.OnPageChangeListener;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.ImageView.ScaleType;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+
+import com.app.library.http.WebImageView;
+import com.example.androidimageindicator.R;
+
+/**
+ * 用户指引,宣传画控件(类似于Gallery效果)
+ *
+ * @author savant-pan
+ *
+ */
+public class ImageIndicatorView extends RelativeLayout {
+ /**
+ * ViewPager控件
+ */
+ private ViewPager viewPager;
+ /**
+ * 指示器容器
+ */
+ private LinearLayout indicateLayout;
+
+ /**
+ * 向左划箭头
+ */
+ private Button leftButton;
+
+ /**
+ * 向右划箭头
+ */
+ private Button rightButton;
+
+ /**
+ * 页面列表
+ */
+ private List viewList = new ArrayList();
+
+ private Handler refreshHandler;
+
+ /**
+ * 滑动位置通知回调监听对象
+ */
+ private OnItemChangeListener onItemChangeListener;
+
+ /**
+ * 单个界面点击回调监听对象
+ */
+ private OnItemClickListener onItemClickListener;
+ /**
+ * 总页面条数
+ */
+ private int totelCount = 0;
+ /**
+ * 当前页索引
+ */
+ private int currentIndex = 0;
+
+ /**
+ * 圆形列表+箭头提示器
+ */
+ public static final int INDICATE_ARROW_ROUND_STYLE = 0;
+
+ /**
+ * 操作导引提示器
+ */
+ public static final int INDICATE_USERGUIDE_STYLE = 1;
+
+ /**
+ * INDICATOR样式
+ */
+ private int indicatorStyle = INDICATE_ARROW_ROUND_STYLE;
+
+ /**
+ * 最近一次划动时间
+ */
+ private long refreshTime = 0l;
+
+ /**
+ * 广告位置监听接口
+ */
+ public interface OnItemChangeListener {
+ void onPosition(int position, int totalCount);
+ }
+
+ /**
+ * 条目点击事件监听接口
+ */
+ public interface OnItemClickListener {
+ void OnItemClick(View view, int position);
+ }
+
+ public ImageIndicatorView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.init(context);
+ }
+
+ public ImageIndicatorView(Context context) {
+ super(context);
+ this.init(context);
+ }
+
+ /**
+ * @param context
+ */
+ private void init(Context context) {
+ LayoutInflater.from(context).inflate(R.layout.image_indicator_layout, this);
+ this.viewPager = (ViewPager) findViewById(R.id.view_pager);
+ this.indicateLayout = (LinearLayout) findViewById(R.id.indicater_layout);
+ this.leftButton = (Button) findViewById(R.id.left_button);
+ this.rightButton = (Button) findViewById(R.id.right_button);
+
+ this.leftButton.setVisibility(View.GONE);
+ this.rightButton.setVisibility(View.GONE);
+
+ this.viewPager.setOnPageChangeListener(new PageChangeListener());
+
+ final ArrowClickListener arrowClickListener = new ArrowClickListener();
+ this.leftButton.setOnClickListener(arrowClickListener);
+ this.rightButton.setOnClickListener(arrowClickListener);
+
+ this.refreshHandler = new ScrollIndicateHandler(ImageIndicatorView.this);
+ }
+
+ /**
+ * 取ViewPager实例
+ *
+ * @return
+ */
+ protected ViewPager getViewPager() {
+ return viewPager;
+ }
+
+ /**
+ * 取当前位置Index值
+ */
+ protected int getCurrentIndex() {
+ return this.currentIndex;
+ }
+
+ /**
+ * 取总VIEW数目
+ */
+ protected int getTotalCount() {
+ return this.totelCount;
+ }
+
+ /**
+ * 取最近一次刷新时间
+ */
+ protected long getRefreshTime() {
+ return this.refreshTime;
+ }
+
+ /**
+ * 添加单个View
+ *
+ * @param view
+ */
+ public void addViewItem(View view) {
+ final int position = viewList.size();
+ view.setOnClickListener(new ItemClickListener(position));
+ this.viewList.add(view);
+ }
+
+ /**
+ * 条目点击事件监听类
+ */
+ private class ItemClickListener implements View.OnClickListener {
+ private int position = 0;
+
+ public ItemClickListener(int position) {
+ this.position = position;
+ }
+
+ @Override
+ public void onClick(View view) {
+ if (onItemClickListener != null) {
+ onItemClickListener.OnItemClick(view, position);
+ }
+ }
+ }
+
+ /**
+ * 设置显示图片Drawable数组
+ *
+ * @param resArray
+ * Drawable数组
+ */
+ public void setupLayoutByDrawable(final Integer resArray[]) {
+ if (resArray == null)
+ throw new NullPointerException();
+
+ this.setupLayoutByDrawable(Arrays.asList(resArray));
+ }
+
+ /**
+ * 设置显示图片Drawable列表
+ *
+ * @param resList
+ * Drawable列表
+ */
+ public void setupLayoutByDrawable(final List resList) {
+ if (resList == null)
+ throw new NullPointerException();
+
+ final int len = resList.size();
+ if (len > 0) {
+ for (int index = 0; index < len; index++) {
+ final View pageItem = new ImageView(getContext());
+ pageItem.setBackgroundResource(resList.get(index));
+ addViewItem(pageItem);
+ }
+ }
+ }
+
+ /**
+ * 设置显示图片URL列表
+ *
+ * @param urlList
+ * URL列表
+ */
+ public void setupLayoutByImageUrl(final List urlList) {
+ if (urlList == null)
+ throw new NullPointerException();
+
+ final int len = urlList.size();
+ if (len > 0) {
+ for (int index = 0; index < len; index++) {
+ final WebImageView pageItem = new WebImageView(getContext());
+ pageItem.setScaleType(ScaleType.FIT_XY);
+ pageItem.setURLAsync(urlList.get(index));
+ addViewItem(pageItem);
+ }
+ }
+ }
+
+ /**
+ * 设置当前显示项
+ *
+ * @param index
+ * postion
+ */
+ public void setCurrentItem(int index) {
+ this.currentIndex = index;
+ }
+
+ /**
+ * 设置指示器样式,默认为INDICATOR_ARROW_ROUND_STYLE
+ *
+ * @param style
+ * INDICATOR_USERGUIDE_STYLE或INDICATOR_ARROW_ROUND_STYLE
+ */
+ public void setIndicateStyle(int style) {
+ this.indicatorStyle = style;
+ }
+
+ /**
+ * 添加位置监听回调
+ *
+ * @param onGuideListener
+ */
+ public void setOnItemChangeListener(OnItemChangeListener onItemChangeListener) {
+ if (onItemChangeListener == null) {
+ throw new NullPointerException();
+ }
+ this.onItemChangeListener = onItemChangeListener;
+ }
+
+ /**
+ * 设置条目点击监听对象
+ *
+ * @param onItemClickListener
+ */
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.onItemClickListener = onItemClickListener;
+ }
+
+ /**
+ * 显示
+ */
+ public void show() {
+ this.totelCount = viewList.size();
+ final LayoutParams params = (LayoutParams) indicateLayout.getLayoutParams();
+ if (INDICATE_USERGUIDE_STYLE == this.indicatorStyle) {// 操作指引
+ params.bottomMargin = 45;
+ }
+ this.indicateLayout.setLayoutParams(params);
+ // 初始化指示器
+ for (int index = 0; index < this.totelCount; index++) {
+ final View indicater = new ImageView(getContext());
+ this.indicateLayout.addView(indicater, index);
+ }
+ this.refreshHandler.sendEmptyMessage(currentIndex);
+ // 为ViewPager配置数据
+ this.viewPager.setAdapter(new MyPagerAdapter(this.viewList));
+ this.viewPager.setCurrentItem(currentIndex, false);
+ }
+
+ /**
+ * 箭头点击事件处理
+ */
+ private class ArrowClickListener implements View.OnClickListener {
+ @Override
+ public void onClick(View view) {
+ if (view == leftButton) {
+ if (currentIndex >= (totelCount - 1)) {
+ return;
+ } else {
+ viewPager.setCurrentItem(currentIndex + 1, true);
+ }
+ } else {
+ if (totelCount <= 0) {
+ return;
+ } else {
+ viewPager.setCurrentItem(currentIndex - 1, true);
+ }
+ }
+ }
+ }
+
+ /**
+ * 页面变更监听
+ */
+ private class PageChangeListener implements OnPageChangeListener {
+ @Override
+ public void onPageSelected(int index) {
+ currentIndex = index;
+ refreshHandler.sendEmptyMessage(index);
+ }
+
+ @Override
+ public void onPageScrolled(int arg0, float arg1, int arg2) {
+ }
+
+ @Override
+ public void onPageScrollStateChanged(int arg0) {
+
+ }
+ }
+
+ /**
+ * 刷新提示器
+ */
+ protected void refreshIndicateView() {
+ this.refreshTime = System.currentTimeMillis();
+
+ for (int index = 0; index < totelCount; index++) {
+ final ImageView imageView = (ImageView) this.indicateLayout.getChildAt(index);
+ if (this.currentIndex == index) {
+ imageView.setBackgroundResource(R.drawable.image_indicator_focus);
+ } else {
+ imageView.setBackgroundResource(R.drawable.image_indicator);
+ }
+ }
+
+ if (INDICATE_USERGUIDE_STYLE == this.indicatorStyle) {// 操作指引不显示箭头
+ this.leftButton.setVisibility(View.GONE);
+ this.rightButton.setVisibility(View.GONE);
+ } else {// 显示箭头各状态
+ if (totelCount <= 1) {
+ leftButton.setVisibility(View.GONE);
+ rightButton.setVisibility(View.GONE);
+ } else if (totelCount == 2) {
+ if (currentIndex == 0) {
+ leftButton.setVisibility(View.VISIBLE);
+ rightButton.setVisibility(View.GONE);
+ } else {
+ leftButton.setVisibility(View.GONE);
+ rightButton.setVisibility(View.VISIBLE);
+ }
+ } else {
+ if (currentIndex == 0) {
+ leftButton.setVisibility(View.VISIBLE);
+ rightButton.setVisibility(View.GONE);
+ } else if (currentIndex == (totelCount - 1)) {
+ leftButton.setVisibility(View.GONE);
+ rightButton.setVisibility(View.VISIBLE);
+ } else {
+ leftButton.setVisibility(View.VISIBLE);
+ rightButton.setVisibility(View.VISIBLE);
+ }
+ }
+ }
+ if (this.onItemChangeListener != null) {// 页面改更了
+ try {
+ this.onItemChangeListener.onPosition(this.currentIndex, this.totelCount);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public class MyPagerAdapter extends PagerAdapter {
+ private List pageViews = new ArrayList();
+
+ public MyPagerAdapter(List pageViews) {
+ this.pageViews = pageViews;
+ }
+
+ @Override
+ public int getCount() {
+ return pageViews.size();
+ }
+
+ @Override
+ public boolean isViewFromObject(View arg0, Object arg1) {
+ return arg0 == arg1;
+ }
+
+ @Override
+ public int getItemPosition(Object object) {
+ return super.getItemPosition(object);
+ }
+
+ @Override
+ public void destroyItem(View arg0, int arg1, Object arg2) {
+ ((ViewPager) arg0).removeView(pageViews.get(arg1));
+ }
+
+ @Override
+ public Object instantiateItem(View arg0, int arg1) {
+ ((ViewPager) arg0).addView(pageViews.get(arg1));
+ return pageViews.get(arg1);
+ }
+
+ @Override
+ public void restoreState(Parcelable arg0, ClassLoader arg1) {
+
+ }
+
+ @Override
+ public Parcelable saveState() {
+ return null;
+ }
+
+ @Override
+ public void startUpdate(View arg0) {
+
+ }
+
+ @Override
+ public void finishUpdate(View arg0) {
+
+ }
+ }
+
+}
+
+class ScrollIndicateHandler extends Handler {
+ private ImageIndicatorView scrollIndicateView;
+
+ public ScrollIndicateHandler(ImageIndicatorView scrollIndicateView) {
+ this.scrollIndicateView = scrollIndicateView;
+
+ }
+
+ @Override
+ public void handleMessage(Message msg) {
+ super.handleMessage(msg);
+ if (this.scrollIndicateView != null) {
+ scrollIndicateView.refreshIndicateView();
+ }
+ }
+}
diff --git a/AndroidImageIndicator/src/com/app/library/common/view/sample/AutoScrollIndicateActivity.java b/AndroidImageIndicator/src/com/app/library/common/view/sample/AutoScrollIndicateActivity.java
new file mode 100644
index 0000000..adec0a8
--- /dev/null
+++ b/AndroidImageIndicator/src/com/app/library/common/view/sample/AutoScrollIndicateActivity.java
@@ -0,0 +1,44 @@
+package com.app.library.common.view.sample;
+
+import com.app.library.common.view.AutoImageIndicatorView;
+import com.app.library.common.view.ImageIndicatorView;
+import com.example.androidimageindicator.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class AutoScrollIndicateActivity extends Activity {
+ private AutoImageIndicatorView scrollIndicateView;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_indicator_auto);
+
+ scrollIndicateView = (AutoImageIndicatorView) findViewById(R.id.auto_scroll_indicate_view);
+ scrollIndicateView.setOnItemChangeListener(new ImageIndicatorView.OnItemChangeListener() {
+ @Override
+ public void onPosition(int position, int totalCount) {
+
+ }
+ });
+ scrollIndicateView.setOnItemChangeListener(new ImageIndicatorView.OnItemChangeListener() {
+ @Override
+ public void onPosition(int position, int totalCount) {
+
+ }
+ });
+
+ initView();
+ }
+
+ private void initView() {
+ final Integer[] resArray = new Integer[] { R.drawable.ic_launcher, R.drawable.ic_launcher };
+ scrollIndicateView.setBroadcastEnable(true);
+ scrollIndicateView.setBroadCastTimes(5);//循环播放5次
+ scrollIndicateView.setBroadcastTimeIntevel(2 * 1000, 3 * 1000);//播放启动时间及间隔
+ scrollIndicateView.setupLayoutByDrawable(resArray);//图片
+ scrollIndicateView.show();
+ }
+
+}
diff --git a/AndroidImageIndicator/src/com/app/library/common/view/sample/SampleActivity.java b/AndroidImageIndicator/src/com/app/library/common/view/sample/SampleActivity.java
new file mode 100644
index 0000000..d340dae
--- /dev/null
+++ b/AndroidImageIndicator/src/com/app/library/common/view/sample/SampleActivity.java
@@ -0,0 +1,34 @@
+package com.app.library.common.view.sample;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+
+import com.example.androidimageindicator.R;
+
+public class SampleActivity extends Activity implements OnClickListener {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ findViewById(R.id.button1).setOnClickListener(this);
+ findViewById(R.id.button2).setOnClickListener(this);
+ findViewById(R.id.button3).setOnClickListener(this);
+ }
+
+ @Override
+ public void onClick(View v) {
+ final int resId = v.getId();
+ if (resId == R.id.button1) {
+ startActivity(new Intent(this, ScrollIndicateActivity.class));
+ } else if (resId == R.id.button2) {
+ startActivity(new Intent(this, AutoScrollIndicateActivity.class));
+ } else if (resId == R.id.button3) {
+
+ }
+ }
+}
diff --git a/AndroidImageIndicator/src/com/app/library/common/view/sample/ScrollIndicateActivity.java b/AndroidImageIndicator/src/com/app/library/common/view/sample/ScrollIndicateActivity.java
new file mode 100644
index 0000000..2054878
--- /dev/null
+++ b/AndroidImageIndicator/src/com/app/library/common/view/sample/ScrollIndicateActivity.java
@@ -0,0 +1,40 @@
+package com.app.library.common.view.sample;
+
+import com.app.library.common.view.ImageIndicatorView;
+import com.example.androidimageindicator.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class ScrollIndicateActivity extends Activity {
+ private ImageIndicatorView scrollIndicateView;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_indicator);
+
+ this.scrollIndicateView = (ImageIndicatorView) findViewById(R.id.scroll_indicate_view);
+ this.scrollIndicateView.setOnItemChangeListener(new ImageIndicatorView.OnItemChangeListener() {
+ @Override
+ public void onPosition(int position, int totalCount) {
+
+ }
+ });
+ this.scrollIndicateView.setOnItemChangeListener(new ImageIndicatorView.OnItemChangeListener() {
+ @Override
+ public void onPosition(int position, int totalCount) {
+
+ }
+ });
+
+ this.initView();
+ }
+
+ private void initView() {
+ final Integer[] resArray = new Integer[] { R.drawable.ic_launcher, R.drawable.ic_launcher };
+ this.scrollIndicateView.setupLayoutByDrawable(resArray);
+ this.scrollIndicateView.setIndicateStyle(ImageIndicatorView.INDICATE_USERGUIDE_STYLE);
+ this.scrollIndicateView.show();
+ }
+}