Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
FIx #53
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAfc committed Sep 7, 2017
1 parent ab0a3da commit 3fd9064
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;

import com.tmall.ultraviewpager.transformer.UltraVerticalTransformer;

/**
Expand Down Expand Up @@ -234,7 +235,7 @@ public int getNextItem() {
/**
* Set the currently selected page.
*
* @param item Item index to select
* @param item Item index to select
* @param smoothScroll True to smoothly scroll to the new item, false to transition immediately
*/
void setCurrentItemFake(int item, boolean smoothScroll) {
Expand All @@ -255,15 +256,7 @@ public void setMultiScreen(float ratio) {
needsMeasurePage = true;
}
float pageMargin = (1 - ratio) * getResources().getDisplayMetrics().widthPixels;
if(scrollMode == UltraViewPager.ScrollMode.VERTICAL){
setPageMargin((int) (pageMargin));
}else{
setPageMargin((int) (-(pageMargin + convertDp2Px(getContext(), 1f))));
}
}

private int convertDp2Px(Context context, float dp) {
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics());
setPageMargin((int) (pageMargin));
}

public void setEnableLoop(boolean status) {
Expand Down

0 comments on commit 3fd9064

Please sign in to comment.