This repository has been archived by the owner on Mar 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some bugs with label (missing requestLayout call)
Add possibility to use custom done icon
- Loading branch information
Showing
10 changed files
with
305 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
286 changes: 181 additions & 105 deletions
286
library/src/main/java/com/badoualy/stepperindicator/StepperIndicator.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources xmlns:tools="http://schemas.android.com/tools"> | ||
<declare-styleable name="StepperIndicator" tools:ignore="ResourceName"> | ||
<attr format="integer" name="stpi_stepCount"/> | ||
<attr format="integer" name="stpi_animDuration"/> | ||
|
||
<attr format="color" name="stpi_circleColor"/> | ||
<attr format="dimension" name="stpi_circleRadius"/> | ||
<attr format="dimension" name="stpi_circleStrokeWidth"/> | ||
|
||
<attr format="color" name="stpi_indicatorColor"/> | ||
<attr format="dimension" name="stpi_indicatorRadius"/> | ||
|
||
<attr format="color" name="stpi_lineColor"/> | ||
<attr format="color" name="stpi_lineDoneColor"/> | ||
<attr format="dimension" name="stpi_lineStrokeWidth"/> | ||
<attr format="dimension" name="stpi_lineMargin"/> | ||
|
||
<attr format="boolean" name="stpi_showDoneIcon"/> | ||
<attr format="boolean" name="stpi_showStepNumberInstead"/> | ||
|
||
<attr format="boolean" name="stpi_useBottomIndicator"/> | ||
<attr format="boolean" name="stpi_useBottomIndicatorWithStepColors"/> | ||
<attr format="dimension" name="stpi_bottomIndicatorHeight"/> | ||
<attr format="dimension" name="stpi_bottomIndicatorWidth"/> | ||
<attr format="dimension" name="stpi_bottomIndicatorMarginTop"/> | ||
|
||
<attr format="reference" name="stpi_stepsCircleColors"/> | ||
<attr format="reference" name="stpi_stepsIndicatorColors"/> | ||
|
||
|
||
<attr format="reference" name="stpi_labels"/> | ||
<attr format="boolean" name="stpi_showLabels"/> | ||
<attr format="dimension" name="stpi_labelMarginTop"/> | ||
<attr format="dimension" name="stpi_labelSize"/> | ||
<attr format="color" name="stpi_labelColor"/> | ||
<attr name="stpi_stepCount" format="integer"/> | ||
<attr name="stpi_animDuration" format="integer"/> | ||
|
||
<attr name="stpi_circleColor" format="color"/> | ||
<attr name="stpi_circleRadius" format="dimension"/> | ||
<attr name="stpi_circleStrokeWidth" format="dimension"/> | ||
|
||
<attr name="stpi_indicatorColor" format="color"/> | ||
<attr name="stpi_indicatorRadius" format="dimension"/> | ||
|
||
<attr name="stpi_lineColor" format="color"/> | ||
<attr name="stpi_lineDoneColor" format="color"/> | ||
<attr name="stpi_lineStrokeWidth" format="dimension"/> | ||
<attr name="stpi_lineMargin" format="dimension"/> | ||
|
||
<attr name="stpi_showDoneIcon" format="boolean"/> | ||
<attr name="stpi_showStepNumberInstead" format="boolean"/> | ||
<attr name="stpi_doneIconDrawable" format="reference"/> | ||
|
||
<attr name="stpi_useBottomIndicator" format="boolean"/> | ||
<attr name="stpi_useBottomIndicatorWithStepColors" format="boolean"/> | ||
<attr name="stpi_bottomIndicatorHeight" format="dimension"/> | ||
<attr name="stpi_bottomIndicatorWidth" format="dimension"/> | ||
<attr name="stpi_bottomIndicatorMarginTop" format="dimension"/> | ||
|
||
<attr name="stpi_stepsCircleColors" format="reference"/> | ||
<attr name="stpi_stepsIndicatorColors" format="reference"/> | ||
|
||
<attr name="stpi_labels" format="reference"/> | ||
<attr name="stpi_showLabels" format="boolean"/> | ||
<attr name="stpi_labelMarginTop" format="dimension"/> | ||
<attr name="stpi_labelSize" format="dimension"/> | ||
<attr name="stpi_labelColor" format="color"/> | ||
</declare-styleable> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
sample/src/main/java/com/badoualy/stepperindicator/sample/PageFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.badoualy.stepperindicator.sample; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
public class PageFragment extends Fragment { | ||
|
||
private TextView lblPage; | ||
|
||
public static PageFragment newInstance(int page, boolean isLast) { | ||
Bundle args = new Bundle(); | ||
args.putInt("page", page); | ||
if (isLast) | ||
args.putBoolean("isLast", true); | ||
final PageFragment fragment = new PageFragment(); | ||
fragment.setArguments(args); | ||
return fragment; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
final View view = inflater.inflate(R.layout.fragment_page, container, false); | ||
lblPage = (TextView) view.findViewById(R.id.lbl_page); | ||
return view; | ||
} | ||
|
||
@Override | ||
public void onActivityCreated(@Nullable Bundle savedInstanceState) { | ||
super.onActivityCreated(savedInstanceState); | ||
final int page = getArguments().getInt("page", 0); | ||
if (getArguments().containsKey("isLast")) | ||
lblPage.setText("You're done!"); | ||
else | ||
lblPage.setText(Integer.toString(page)); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
sample/src/main/java/com/badoualy/stepperindicator/sample/PagerAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.badoualy.stepperindicator.sample; | ||
|
||
import android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentManager; | ||
import android.support.v4.app.FragmentPagerAdapter; | ||
|
||
class PagerAdapter extends FragmentPagerAdapter { | ||
|
||
public PagerAdapter(FragmentManager fm) { | ||
super(fm); | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
return 5; | ||
} | ||
|
||
@Override | ||
public Fragment getItem(int position) { | ||
return PageFragment.newInstance(position + 1, position == getCount() - 1); | ||
} | ||
|
||
@Override | ||
public CharSequence getPageTitle(int position) { | ||
return "Page " + position; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters