Skip to content

Commit

Permalink
1.支持开始时左滑动
Browse files Browse the repository at this point in the history
  • Loading branch information
caikaidev committed Oct 24, 2016
1 parent dcf488e commit a84e3a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public void init(AutoViewPager viewPager,BaseViewPagerAdapter adapter){
}

public void start(){
//先停止
onStop();

if (mTimer == null) {
mTimer = new Timer();
}
Expand Down Expand Up @@ -108,14 +111,9 @@ public void onResume(){
public boolean onTouchEvent(MotionEvent ev) {
switch (ev.getAction()){
case MotionEvent.ACTION_DOWN:
Log.i(TAG,"down");
onStop();
break;
case MotionEvent.ACTION_MOVE:
Log.i(TAG,"move");
break;
case MotionEvent.ACTION_UP:
Log.i(TAG,"up");
onResume();
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public void init(AutoViewPager viewPager,BaseViewPagerAdapter adapter){
if (data == null || data.size() == 0){
return;
}
mView.setCurrentItem(0);
//设置初始为中间,这样一开始就能够往左滑动了
int position = Integer.MAX_VALUE/2 - (Integer.MAX_VALUE/2) % getRealCount();
mView.setCurrentItem(position);

mView.start();
mView.updatePointView(getRealCount());
Expand Down

0 comments on commit a84e3a8

Please sign in to comment.