diff --git a/README.md b/README.md index e5ca13809941f0ee54074b817009ac829c04b11e..7f3d977ddef60ffee99efc4c94f4bcbcd65d2706 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ - 功能:竖直样式的 Stepper 组件,未来将会加入更多的样式。你可以自定义正常/激活的圆点颜色、完成图标、动画时长、是否启用动画、线条颜色以及错误高亮颜色之类的参数。 - 项目移植状态:主功能已完成 - 调用差异:无 -- 开发版本:sdk5,DevEco Studio2.1 beta3 +- 开发版本:sdk5,DevEco Studio 2.1 Release - 基线版本:MaterialStepperView组件Tags 0.2.5 #### 效果演示 diff --git a/library/src/main/java/moe/feng/common/stepperview/IStepperAdapter.java b/library/src/main/java/moe/feng/common/stepperview/IStepperAdapter.java index 52a8f1f512f126da37383f195d5efdf4ea43dbb0..e90e59fdabc105b6e414e51d489609abe50f6a40 100644 --- a/library/src/main/java/moe/feng/common/stepperview/IStepperAdapter.java +++ b/library/src/main/java/moe/feng/common/stepperview/IStepperAdapter.java @@ -51,18 +51,10 @@ public interface IStepperAdapter { */ Component onCreateCustomView(int index, Context context, VerticalStepperItemView parent); - /** - * This method will be called when a stepper is showed. - * - * @param index The index of stepper showed - */ + void onShow(int index); - /** - * This method will be called when a stepper is hidden. - * - * @param index The index of stepper hidden - */ + void onHide(int index); } diff --git a/library/src/main/java/moe/feng/common/stepperview/VerticalStepperView.java b/library/src/main/java/moe/feng/common/stepperview/VerticalStepperView.java index 17d56e752088633ea20e47be0189152e5a7813cc..810623bc37b8d0259de74d608edc4d2620f5668e 100644 --- a/library/src/main/java/moe/feng/common/stepperview/VerticalStepperView.java +++ b/library/src/main/java/moe/feng/common/stepperview/VerticalStepperView.java @@ -77,11 +77,7 @@ public class VerticalStepperView extends StackLayout implements IStepperView { addComponent(mListView, new ComponentContainer.LayoutConfig(ComponentContainer.LayoutConfig.MATCH_PARENT, ComponentContainer.LayoutConfig.MATCH_PARENT)); } - /** - * Set up the stepper adapter - * - * @param stepperAdapter Stepper Adapter - */ + public void setStepperAdapter(IStepperAdapter stepperAdapter,Context context) { mStepperAdapter = stepperAdapter; mListView.setItemProvider(null); @@ -90,9 +86,7 @@ public class VerticalStepperView extends StackLayout implements IStepperView { updateSteppers(); } - /** - * Notify the stepper adapter changed - */ + public void updateSteppers() { if (mErrorTexts == null || mErrorTexts.length != mStepperAdapter.size()) { mErrorTexts = new String[mStepperAdapter.size()]; @@ -100,11 +94,7 @@ public class VerticalStepperView extends StackLayout implements IStepperView { mAdapter.notifyDataChanged(); } - /** - * Set should show summary always. - * - * @param alwaysShowSummary new value - */ + public void setAlwaysShowSummary(boolean alwaysShowSummary) { mAlwaysShowSummary = alwaysShowSummary; updateSteppers(); @@ -120,12 +110,7 @@ public class VerticalStepperView extends StackLayout implements IStepperView { return mAlwaysShowSummary; } - /** - * Set error text for item. If you want to remove error text, the errorText param should be null. - * - * @param index Index - * @param errorText Error text or null - */ + public void setErrorText(int index, String errorText) { if (mErrorTexts == null) { mErrorTexts = new String[mStepperAdapter.size()]; @@ -234,11 +219,7 @@ public class VerticalStepperView extends StackLayout implements IStepperView { return mCurrentStep; } - /** - * Set normal point color - * - * @param color Normal Point Color - */ + public void setNormalColor(int color) { mNormalColor = color; mAdapter.notifyDataChanged(); @@ -254,11 +235,7 @@ public class VerticalStepperView extends StackLayout implements IStepperView { return mNormalColor; } - /** - * Set activated point color - * - * @param color Activated Point Color - */ + public void setActivatedColor(int color) { mActivatedColor = color; mAdapter.notifyDataChanged(); @@ -274,11 +251,7 @@ public class VerticalStepperView extends StackLayout implements IStepperView { return mActivatedColor; } - /** - * Set error highlight color - * - * @param color Error Highlight Color - */ + public void setErrorColor(int color) { mErrorColor = color; mAdapter.notifyDataChanged(); @@ -294,11 +267,7 @@ public class VerticalStepperView extends StackLayout implements IStepperView { return mErrorColor; } - /** - * Set line color - * - * @param color Line Color - */ + public void setLineColor(int color) { mLineColor = color; mAdapter.notifyDataChanged(); @@ -334,11 +303,7 @@ public class VerticalStepperView extends StackLayout implements IStepperView { return mDoneIcon; } - /** - * Set if animation should be enabled - * - * @param enabled If animation should be enabled - */ + public void setAnimationEnabled(boolean enabled) { mAnimationEnabled = enabled; } @@ -352,11 +317,7 @@ public class VerticalStepperView extends StackLayout implements IStepperView { return mAnimationEnabled; } - /** - * Set the current step by index - * - * @param currentStep The index of current step - */ + public void setCurrentStep(int currentStep) { int minIndex = Math.min(currentStep, mCurrentStep); int count = Math.abs(mCurrentStep - currentStep) + 1; @@ -369,9 +330,7 @@ public class VerticalStepperView extends StackLayout implements IStepperView { } } - /** - * Internal RecyclerView Adapter to show item views - */ + class ItemAdapter extends BaseItemProvider { private Context context;