Skip to content

Commit

Permalink
merge code (#37)
Browse files Browse the repository at this point in the history
* optimize indicator
  • Loading branch information
zhpanvip authored Nov 22, 2019
1 parent 936d6fe commit 7611d1e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
/**
* <pre>
* Created by zhpan on 2019/11/23.
* Description:The Indicator in BannerViewPager.
* Description:The Indicator in BannerViewPager,this include two indicator style,as below:
* {@link com.zhpan.bannerview.constants.IndicatorStyle#CIRCLE }
* {@link com.zhpan.bannerview.constants.IndicatorStyle#DASH}
* </pre>
*/
public class IndicatorView extends BaseIndicatorView implements IIndicator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ public abstract class BaseDrawer implements IDrawer {
mMeasureResult = new MeasureResult();
}

@Override
public void setIndicatorOptions(IndicatorOptions indicatorOptions) {
this.mIndicatorOptions = indicatorOptions;
}

public class MeasureResult {

public int measureWidth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,26 @@
* </pre>
*/
public class DrawerController {

private IndicatorOptions mIndicatorOptions;


private IDrawer mIDrawer;

public DrawerController(IndicatorOptions indicatorOptions) {
this.mIndicatorOptions = indicatorOptions;
init();
init(indicatorOptions);
}

private void init() {
switch (mIndicatorOptions.getIndicatorStyle()) {
private void init(IndicatorOptions indicatorOptions) {
switch (indicatorOptions.getIndicatorStyle()) {
case CIRCLE:
mIDrawer = new CircleDrawer(mIndicatorOptions);
mIDrawer = new CircleDrawer(indicatorOptions);
break;
case DASH:
mIDrawer = new DashDrawer(mIndicatorOptions);
mIDrawer = new DashDrawer(indicatorOptions);
break;
}
}

public void setIndicatorOptions(IndicatorOptions indicatorOptions) {
mIndicatorOptions = indicatorOptions;
mIDrawer.setIndicatorOptions(indicatorOptions);
init();
init(indicatorOptions);
}

public BaseDrawer.MeasureResult measure(int widthMeasureSpec, int heightMeasureSpec) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,4 @@ public interface IDrawer {
BaseDrawer.MeasureResult onMeasure(int widthMeasureSpec, int heightMeasureSpec);

void onDraw(Canvas canvas);

void setIndicatorOptions(IndicatorOptions indicatorOptions);

}

0 comments on commit 7611d1e

Please sign in to comment.