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

Commit

Permalink
Code: Add javadoc & rename methods
Browse files Browse the repository at this point in the history
Signed-off-by: Fung <[email protected]>
  • Loading branch information
fython committed Aug 9, 2017
1 parent 78cc9d8 commit d9ab7b2
Show file tree
Hide file tree
Showing 5 changed files with 410 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
Expand All @@ -26,16 +28,16 @@ public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle saved
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
mVerticalStepperView = view.findViewById(R.id.vertical_stepper_view);
mVerticalStepperView.setViewAdapter(this);
mVerticalStepperView.setStepperAdapter(this);
}

@Override
public String getTitle(int index) {
public @NonNull String getTitle(int index) {
return "Step " + index;
}

@Override
public String getSummary(int index) {
public @Nullable String getSummary(int index) {
switch (index) {
case 0:
return "Summarized if needed";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,71 @@
package moe.feng.common.stepperview;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.ViewGroup;

/**
* Base interface providing the adapter to populate steps inside of
* a {@link IStepperAdapter}. You have to implement this and create your
* own adapter to configure steps.
*
* Or you can use a more specific implementation of this, such as
* {@link ViewBasedStepperAdapter}.
*/
public interface IStepperAdapter {

String getTitle(int index);
/**
* This method will be called by the VerticalStepperView to obtain a title string
* to describe the title of specified step. The string cannot be null.
*
* @param index The index of the title requested
* @return A title for the requested step
*/
@NonNull String getTitle(int index);

String getSummary(int index);
/**
* This method may be called by the VerticalStepperView to obtain a title string
* to describe the summary of specified step. It may return null indicating
* no summary for this step.
*
* @param index The index of the summary requested
* @return A summary for the requested step
*/
@Nullable String getSummary(int index);

/**
* Get the count of steppers
*
* @return The size of adapter
*/
int size();

/**
* When the specified step need a custom view, this method will be called
* for creating custom view. If you want to add it to ItemView by yourself,
* it can return null. The returned view will be added to ItemView.
*
* @param index Index
* @param context Context
* @param parent Vertical Stepper Item View
* @return The custom view created
*/
View 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);

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,55 @@
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorInt;

/**
* Base interface providing a view base of stepper component.
* You have to implement this and create your own stepper view.
*
* We have made some stepper view:
* - {@link VerticalStepperView}
*/
interface IStepperView {

IStepperAdapter getViewAdapter();
/**
* Get stepper adapter
*
* @return Stepper Adapter
*/
IStepperAdapter getStepperAdapter();

/**
* Return the index of current step
*
* @return Index
*/
int getCurrentStep();

/**
* Get normal point color
*
* @return Normal Point Color
*/
@ColorInt int getNormalColor();

/**
* Get activated point color
*
* @return Activated Point Color
*/
@ColorInt int getActivatedColor();

/**
* Get animation duration
*
* @return Animation Duration
*/
int getAnimationDuration();

/**
* Get done icon drawable
*
* @return Done icon drawable
*/
Drawable getDoneIcon();

}
Loading

0 comments on commit d9ab7b2

Please sign in to comment.