Skip to content

Commit

Permalink
1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
LuckyJayce committed Sep 2, 2016
1 parent 5e07692 commit b5da326
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ViewPagerIndicator
###7.导入方式
<1>gradle导入

compile 'com.shizhefei:ViewPagerIndicator:1.1.2'
compile 'com.shizhefei:ViewPagerIndicator:1.1.3'
由于用到了v4和recyclerview所以也要导入他们
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:recyclerview-v7:23.2.1'
Expand Down Expand Up @@ -221,6 +221,10 @@ Fragment继承该类实现 显示Framgment的时候才会去创建你自己的
有什么建议可以发到我的邮箱 [email protected]

## 版本更新 ##
1.1.3

修复SpringBar点击最后一个tab,第一个tab显示的问题
IndicatorViewPager添加setClickIndicatorAnim(boolean anim),用于配置点击tab的是否执行viewPager的切换动画
1.1.2

修复LazyFragment 的 onCreateViewLazy(Bundle savedInstanceState) 避免获取不到savedInstanceState
Expand Down
8 changes: 4 additions & 4 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 9
targetSdkVersion 23
versionCode 13
versionName "1.1.2"
versionCode 14
versionName "1.1.3"
}
buildTypes {
release {
Expand All @@ -27,7 +27,7 @@ task buildJar(dependsOn: ['compileReleaseJavaWithJavac'], type: Jar) {

appendix = "demo"
baseName = "androidJar"
version = "1.1.2"
version = "1.1.3"
classifier = "release"
//后缀名
extension = "jar"
Expand Down Expand Up @@ -64,7 +64,7 @@ publish {
userOrg = 'luckyjayce'//bintray.com用户名
groupId = 'com.shizhefei'//jcenter上的路径
artifactId = 'ViewPagerIndicator'//项目名称
publishVersion = '1.1.2'//版本号
publishVersion = '1.1.3'//版本号
desc = '实现滑动tab,引导页等效果'//描述,不重要
website = 'https://github.com/LuckyJayce/ViewPagerIndicator'//网站,不重要;尽量模拟github上的地址,例如我这样的;当然你有地址最好了
}
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ private void drawSlideBar(Canvas canvas) {

//如果绘制的scrollbar超出了IndicatorView,那么就把超出的部分绘制在最前面,相当于loop的展示,末尾的部分又重新回到最开始的位置
//为了实现这一点,首先要把scrollbar先绘制到cacheBitmap上,然后就可以把分两部分通过canvas绘制到view上
if (offsetX + scrollBarWidth > indicatorWidth) {
if (mAdapter.isLoop() && offsetX + scrollBarWidth > indicatorWidth) {

//创建一个和IndicatorView一样大小的Bitmap用于绘制
if (cacheBitmap == null || cacheBitmap.getWidth() < scrollBarWidth || cacheBitmap.getWidth() < scrollBarHeight) {
Expand Down
10 changes: 10 additions & 0 deletions library/src/main/java/com/shizhefei/view/indicator/Indicator.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ public interface Indicator {
* 适配器
*/
public static abstract class IndicatorAdapter {
private boolean isLoop;

boolean isLoop() {
return isLoop;
}

void setIsLoop(boolean isLoop) {
this.isLoop = isLoop;
}

private Set<DataSetObserver> observers = new LinkedHashSet<DataSetObserver>(2);

public abstract int getCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,29 @@
* 将indicatorView,ViewPager联合使用
*/
public class IndicatorViewPager {
private final boolean indicatorClickable;
protected Indicator indicatorView;
protected ViewPager viewPager;
private IndicatorPagerAdapter adapter;
protected OnIndicatorPageChangeListener onIndicatorPageChangeListener;
private boolean anim = true;

public IndicatorViewPager(Indicator indicator, ViewPager viewPager) {
this(indicator, viewPager, true);
}

public IndicatorViewPager(Indicator indicator, ViewPager viewPager, boolean indicatorClickable) {
super();
this.indicatorClickable = indicatorClickable;
this.indicatorView = indicator;
this.viewPager = viewPager;
indicator.setItemClickable(indicatorClickable);
iniOnItemSelectedListener();
iniOnPageChangeListener();
}

public void setClickIndicatorAnim(boolean anim) {
this.anim = anim;
}

protected void iniOnItemSelectedListener() {
indicatorView.setOnItemSelectListener(new Indicator.OnItemSelectedListener() {

Expand All @@ -61,7 +64,7 @@ public void onItemSelected(View selectItemView, int select, int preSelect) {
if (viewPager instanceof SViewPager) {
viewPager.setCurrentItem(select, ((SViewPager) viewPager).isCanScroll());
} else {
viewPager.setCurrentItem(select, true);
viewPager.setCurrentItem(select, anim);
}
}
});
Expand Down Expand Up @@ -267,6 +270,7 @@ int getRealPosition(int position) {
@Override
void setLoop(boolean loop) {
this.loop = loop;
indicatorAdapter.setIsLoop(loop);
}


Expand Down Expand Up @@ -379,6 +383,7 @@ int getRealPosition(int position) {
@Override
void setLoop(boolean loop) {
this.loop = loop;
indicatorAdapter.setIsLoop(loop);
}

public IndicatorFragmentPagerAdapter(FragmentManager fragmentManager) {
Expand Down

0 comments on commit b5da326

Please sign in to comment.