Skip to content
This repository was archived by the owner on Aug 22, 2020. It is now read-only.

Commit d9ab7b2

Browse files
committed
Code: Add javadoc & rename methods
Signed-off-by: Fung <[email protected]>
1 parent 78cc9d8 commit d9ab7b2

File tree

5 files changed

+410
-14
lines changed

5 files changed

+410
-14
lines changed

demo/src/main/java/moe/feng/common/stepperview/demo/fragment/VerticalStepperAdapterDemoFragment.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import android.content.Context;
44
import android.os.Bundle;
5+
import android.support.annotation.NonNull;
6+
import android.support.annotation.Nullable;
57
import android.support.design.widget.Snackbar;
68
import android.support.v4.app.Fragment;
79
import android.view.LayoutInflater;
@@ -26,16 +28,16 @@ public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle saved
2628
@Override
2729
public void onViewCreated(View view, Bundle savedInstanceState) {
2830
mVerticalStepperView = view.findViewById(R.id.vertical_stepper_view);
29-
mVerticalStepperView.setViewAdapter(this);
31+
mVerticalStepperView.setStepperAdapter(this);
3032
}
3133

3234
@Override
33-
public String getTitle(int index) {
35+
public @NonNull String getTitle(int index) {
3436
return "Step " + index;
3537
}
3638

3739
@Override
38-
public String getSummary(int index) {
40+
public @Nullable String getSummary(int index) {
3941
switch (index) {
4042
case 0:
4143
return "Summarized if needed";
Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,71 @@
11
package moe.feng.common.stepperview;
22

33
import android.content.Context;
4+
import android.support.annotation.NonNull;
5+
import android.support.annotation.Nullable;
46
import android.view.View;
57
import android.view.ViewGroup;
68

9+
/**
10+
* Base interface providing the adapter to populate steps inside of
11+
* a {@link IStepperAdapter}. You have to implement this and create your
12+
* own adapter to configure steps.
13+
*
14+
* Or you can use a more specific implementation of this, such as
15+
* {@link ViewBasedStepperAdapter}.
16+
*/
717
public interface IStepperAdapter {
818

9-
String getTitle(int index);
19+
/**
20+
* This method will be called by the VerticalStepperView to obtain a title string
21+
* to describe the title of specified step. The string cannot be null.
22+
*
23+
* @param index The index of the title requested
24+
* @return A title for the requested step
25+
*/
26+
@NonNull String getTitle(int index);
1027

11-
String getSummary(int index);
28+
/**
29+
* This method may be called by the VerticalStepperView to obtain a title string
30+
* to describe the summary of specified step. It may return null indicating
31+
* no summary for this step.
32+
*
33+
* @param index The index of the summary requested
34+
* @return A summary for the requested step
35+
*/
36+
@Nullable String getSummary(int index);
1237

38+
/**
39+
* Get the count of steppers
40+
*
41+
* @return The size of adapter
42+
*/
1343
int size();
1444

45+
/**
46+
* When the specified step need a custom view, this method will be called
47+
* for creating custom view. If you want to add it to ItemView by yourself,
48+
* it can return null. The returned view will be added to ItemView.
49+
*
50+
* @param index Index
51+
* @param context Context
52+
* @param parent Vertical Stepper Item View
53+
* @return The custom view created
54+
*/
1555
View onCreateCustomView(int index, Context context, VerticalStepperItemView parent);
1656

57+
/**
58+
* This method will be called when a stepper is showed.
59+
*
60+
* @param index The index of stepper showed
61+
*/
1762
void onShow(int index);
1863

64+
/**
65+
* This method will be called when a stepper is hidden.
66+
*
67+
* @param index The index of stepper hidden
68+
*/
1969
void onHide(int index);
2070

2171
}

library/src/main/java/moe/feng/common/stepperview/IStepperView.java

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,55 @@
33
import android.graphics.drawable.Drawable;
44
import android.support.annotation.ColorInt;
55

6+
/**
7+
* Base interface providing a view base of stepper component.
8+
* You have to implement this and create your own stepper view.
9+
*
10+
* We have made some stepper view:
11+
* - {@link VerticalStepperView}
12+
*/
613
interface IStepperView {
714

8-
IStepperAdapter getViewAdapter();
15+
/**
16+
* Get stepper adapter
17+
*
18+
* @return Stepper Adapter
19+
*/
20+
IStepperAdapter getStepperAdapter();
21+
22+
/**
23+
* Return the index of current step
24+
*
25+
* @return Index
26+
*/
927
int getCurrentStep();
1028

29+
/**
30+
* Get normal point color
31+
*
32+
* @return Normal Point Color
33+
*/
1134
@ColorInt int getNormalColor();
35+
36+
/**
37+
* Get activated point color
38+
*
39+
* @return Activated Point Color
40+
*/
1241
@ColorInt int getActivatedColor();
42+
43+
/**
44+
* Get animation duration
45+
*
46+
* @return Animation Duration
47+
*/
1348
int getAnimationDuration();
49+
50+
/**
51+
* Get done icon drawable
52+
*
53+
* @return Done icon drawable
54+
*/
1455
Drawable getDoneIcon();
1556

1657
}

0 commit comments

Comments
 (0)