Skip to content

Commit

Permalink
relase 2.5.0 (#39)
Browse files Browse the repository at this point in the history
* release 2.5.0
  • Loading branch information
zhpanvip authored Nov 23, 2019
1 parent 7611d1e commit f258a13
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 32 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.idea
.DS_Store
/build
/captures
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dependencies {
testImplementation 'junit:junit:4.12'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.github.chrisbanes:PhotoView:2.1.0'
// implementation 'com.github.zhpanvip:BannerViewPager:2.3.5'
// implementation 'com.github.zhpanvip:BannerViewPager:2.5.0'
implementation project(path: ':bannerview')
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ class MainActivity : AppCompatActivity() {

private fun initData() {
val mAdapter = AdapterFragmentPager(supportFragmentManager)
vp_fragment!!.adapter = mAdapter
vp_fragment!!.disableTouchScroll(true)
vp_fragment!!.offscreenPageLimit = 2
vp_fragment!!.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
vp_fragment?.adapter = mAdapter
vp_fragment?.disableTouchScroll(true)
vp_fragment?.offscreenPageLimit = 2
vp_fragment?.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {

}

override fun onPageSelected(position: Int) {
rg_tab!!.check(getCheckedId(position))
rg_tab?.check(getCheckedId(position))
}

override fun onPageScrollStateChanged(state: Int) {
Expand All @@ -54,15 +54,15 @@ class MainActivity : AppCompatActivity() {
}

private fun setListener() {
rg_tab!!.setOnCheckedChangeListener { group, checkedId ->
rg_tab?.setOnCheckedChangeListener { group, checkedId ->
if (checkedId == R.id.rb_home) {
vp_fragment!!.setCurrentItem(AdapterFragmentPager.PAGE_HOME, false)
vp_fragment?.setCurrentItem(AdapterFragmentPager.PAGE_HOME, false)

} else if (checkedId == R.id.rb_find) {
vp_fragment!!.setCurrentItem(AdapterFragmentPager.PAGE_FIND, false)
vp_fragment?.setCurrentItem(AdapterFragmentPager.PAGE_FIND, false)

} else if (checkedId == R.id.rb_add) {
vp_fragment!!.setCurrentItem(AdapterFragmentPager.PAGE_OTHERS, false)
vp_fragment?.setCurrentItem(AdapterFragmentPager.PAGE_OTHERS, false)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class WelcomeActivity : BaseDataActivity(), HolderCreator<CustomPageViewHolder>
}

private fun updateUI(position: Int) {
tv_describe!!.text = des[position]
tv_describe?.text = des[position]
val translationAnim = ObjectAnimator.ofFloat(tv_describe, "translationX", -120f, 0f)
translationAnim.duration = ANIMATION_DURATION.toLong()
translationAnim.interpolator = DecelerateInterpolator()
Expand All @@ -89,13 +89,13 @@ class WelcomeActivity : BaseDataActivity(), HolderCreator<CustomPageViewHolder>
animatorSet.playTogether(translationAnim, alphaAnimator1)
animatorSet.start()

if (position == mViewPager.list.size - 1 && btn_start!!.visibility == View.GONE) {
btn_start!!.visibility = View.VISIBLE
if (position == mViewPager.list.size - 1 && btn_start?.visibility == View.GONE) {
btn_start?.visibility = View.VISIBLE
ObjectAnimator
.ofFloat(btn_start, "alpha", 0f, 1f)
.setDuration(ANIMATION_DURATION.toLong()).start()
} else {
btn_start!!.visibility = View.GONE
btn_start?.visibility = View.GONE
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ private void drawSliderStyle(Canvas canvas) {
canvas.drawRect(left, 0, left + maxWidth, getSliderHeight(), mPaint);
}

public DashIndicatorView setSliderHeight(float sliderHeight) {
this.sliderHeight = sliderHeight;
return this;
}

public float getSliderHeight() {
if (getIndicatorOptions().getSliderHeight() > 0) {
return getIndicatorOptions().getSliderHeight();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import androidx.annotation.Nullable;

import com.zhpan.bannerview.indicator.drawer.BaseDrawer;
import com.zhpan.bannerview.indicator.drawer.DrawerController;
import com.zhpan.bannerview.indicator.drawer.DrawerProxy;
import com.zhpan.bannerview.manager.IndicatorOptions;

/**
Expand All @@ -20,7 +20,7 @@
*/
public class IndicatorView extends BaseIndicatorView implements IIndicator {

private DrawerController mDrawerController;
private DrawerProxy mDrawerProxy;

public IndicatorView(Context context) {
this(context, null);
Expand All @@ -32,25 +32,25 @@ public IndicatorView(Context context, @Nullable AttributeSet attrs) {

public IndicatorView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mDrawerController = new DrawerController(getIndicatorOptions());
mDrawerProxy = new DrawerProxy(getIndicatorOptions());
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
BaseDrawer.MeasureResult measureResult = mDrawerController.measure(widthMeasureSpec, heightMeasureSpec);
BaseDrawer.MeasureResult measureResult = mDrawerProxy.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(measureResult.getMeasureWidth(), measureResult.getMeasureHeight());
}

@Override
public void setIndicatorOptions(IndicatorOptions indicatorOptions) {
super.setIndicatorOptions(indicatorOptions);
mDrawerController.setIndicatorOptions(indicatorOptions);
mDrawerProxy.setIndicatorOptions(indicatorOptions);
}

@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
mDrawerController.draw(canvas);
mDrawerProxy.onDraw(canvas);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
/**
* <pre>
* Created by zhpan on 2019/11/23.
* Description: Indicator Drawer Controller.
* Description: Indicator Drawer Proxy.
* </pre>
*/
public class DrawerController {
public class DrawerProxy implements IDrawer{

private IDrawer mIDrawer;

public DrawerController(IndicatorOptions indicatorOptions) {
public DrawerProxy(IndicatorOptions indicatorOptions) {
init(indicatorOptions);
}

Expand All @@ -36,11 +36,13 @@ public void setIndicatorOptions(IndicatorOptions indicatorOptions) {
init(indicatorOptions);
}

public BaseDrawer.MeasureResult measure(int widthMeasureSpec, int heightMeasureSpec) {
@Override
public BaseDrawer.MeasureResult onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
return mIDrawer.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

public void draw(Canvas canvas) {
@Override
public void onDraw(Canvas canvas) {
mIDrawer.onDraw(canvas);
}
}

0 comments on commit f258a13

Please sign in to comment.