Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
update atrributes
Browse files Browse the repository at this point in the history
  • Loading branch information
shuhart committed Mar 11, 2018
1 parent 06b5b87 commit fc0de23
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 86 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Usage
-----

1. Add jcenter() to repositories block in your gradle file.
2. Add `implementation 'com.shuhart.stepview:stepview:1.2.5'` to your dependencies.
2. Add `implementation 'com.shuhart.stepview:stepview:1.2.6'` to your dependencies.
3. Add `StepView` into your layouts or view hierarchy.

Supported animations:
Expand Down Expand Up @@ -52,22 +52,22 @@ Styling:
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
app:selectedCircleColor="@color/colorAccent"
app:selectedTextColor="@color/colorAccent"
app:stepLineWidth="1dp"
app:stepPadding="4dp"
app:nextTextColor="@color/colorAccent"
app:nextStepLineColor="@color/colorAccent"
app:doneCircleColor="@color/colorAccent"
app:doneStepLineColor="@color/colorAccent"
app:doneCircleRadius="12dp"
app:selectedCircleRadius="12dp"
app:selectedStepNumberColor="@color/colorPrimary"
app:stepViewStyle="@style/StepView"
app:doneStepMarkColor="@color/colorPrimary"
app:stepNumberTextSize="12sp"
app:animationType="Line"
android:typeface="@font/roboto_italic"/>
app:sv_selectedCircleColor="@color/colorAccent"
app:sv_selectedTextColor="@color/colorAccent"
app:sv_stepLineWidth="1dp"
app:sv_stepPadding="4dp"
app:sv_nextTextColor="@color/colorAccent"
app:sv_nextStepLineColor="@color/colorAccent"
app:sv_doneCircleColor="@color/colorAccent"
app:sv_doneStepLineColor="@color/colorAccent"
app:sv_doneCircleRadius="12dp"
app:sv_selectedCircleRadius="12dp"
app:sv_selectedStepNumberColor="@color/colorPrimary"
app:sv_stepViewStyle="@style/StepView"
app:sv_doneStepMarkColor="@color/colorPrimary"
app:sv_stepNumberTextSize="12sp"
app:sv_animationType="Line"
app:sv_typeface="@font/roboto_italic"/>
```

or instantiate and setup it in runtime with handy state builder:
Expand Down
8 changes: 4 additions & 4 deletions sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:typeface="@font/iran_sans_mobile"
app:animationType="All"
app:stepPadding="12dp"
app:steps="@array/steps" />
app:sv_animationType="All"
app:sv_stepPadding="12dp"
app:sv_steps="@array/steps"
app:sv_typeface="@font/iran_sans_mobile" />

<Button
android:id="@+id/next"
Expand Down
2 changes: 1 addition & 1 deletion stepview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ext {
siteUrl = 'https://github.com/shuhart/StepView'
gitUrl = 'https://github.com/shuhart/StepView.git'

libraryVersion = '1.2.5'
libraryVersion = '1.2.6'

developerId = 'shuhart'
developerName = 'Redrick Shuhart'
Expand Down
46 changes: 23 additions & 23 deletions stepview/src/main/java/com/shuhart/stepview/StepView.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public StepView(Context context) {
}

public StepView(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.stepViewStyle);
this(context, attrs, R.attr.sv_stepViewStyle);
}

public StepView(Context context, AttributeSet attrs, int defStyleAttr) {
Expand All @@ -123,26 +123,26 @@ public StepView(Context context, AttributeSet attrs, int defStyleAttr) {

private void applyStyles(Context context, AttributeSet attrs, int defStyleAttr) {
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.StepView, defStyleAttr, R.style.StepView);
selectedCircleColor = ta.getColor(R.styleable.StepView_selectedCircleColor, 0);
selectedCircleRadius = ta.getDimensionPixelSize(R.styleable.StepView_selectedCircleRadius, 0);
selectedTextColor = ta.getColor(R.styleable.StepView_selectedTextColor, 0);
selectedStepNumberColor = ta.getColor(R.styleable.StepView_selectedStepNumberColor, 0);
doneStepMarkColor = ta.getColor(R.styleable.StepView_doneStepMarkColor, 0);
doneCircleColor = ta.getColor(R.styleable.StepView_doneCircleColor, 0);
doneCircleRadius = ta.getDimensionPixelSize(R.styleable.StepView_doneCircleRadius, 0);
doneTextColor = ta.getColor(R.styleable.StepView_doneTextColor, 0);
nextTextColor = ta.getColor(R.styleable.StepView_nextTextColor, 0);
stepPadding = ta.getDimensionPixelSize(R.styleable.StepView_stepPadding, 0);
nextStepLineColor = ta.getColor(R.styleable.StepView_nextStepLineColor, 0);
doneStepLineColor = ta.getColor(R.styleable.StepView_doneStepLineColor, 0);
stepLineWidth = ta.getDimensionPixelSize(R.styleable.StepView_stepLineWidth, 0);
textPadding = ta.getDimensionPixelSize(R.styleable.StepView_textPadding, 0);
stepNumberTextSize = ta.getDimension(R.styleable.StepView_stepNumberTextSize, 0);
textSize = ta.getDimension(R.styleable.StepView_android_textSize, 0);
animationDuration = ta.getInteger(R.styleable.StepView_android_animationDuration, 0);
animationType = ta.getInteger(R.styleable.StepView_animationType, 0);
stepsNumber = ta.getInteger(R.styleable.StepView_stepsNumber, 0);
CharSequence[] descriptions = ta.getTextArray(R.styleable.StepView_steps);
selectedCircleColor = ta.getColor(R.styleable.StepView_sv_selectedCircleColor, 0);
selectedCircleRadius = ta.getDimensionPixelSize(R.styleable.StepView_sv_selectedCircleRadius, 0);
selectedTextColor = ta.getColor(R.styleable.StepView_sv_selectedTextColor, 0);
selectedStepNumberColor = ta.getColor(R.styleable.StepView_sv_selectedStepNumberColor, 0);
doneStepMarkColor = ta.getColor(R.styleable.StepView_sv_doneStepMarkColor, 0);
doneCircleColor = ta.getColor(R.styleable.StepView_sv_doneCircleColor, 0);
doneCircleRadius = ta.getDimensionPixelSize(R.styleable.StepView_sv_doneCircleRadius, 0);
doneTextColor = ta.getColor(R.styleable.StepView_sv_doneTextColor, 0);
nextTextColor = ta.getColor(R.styleable.StepView_sv_nextTextColor, 0);
stepPadding = ta.getDimensionPixelSize(R.styleable.StepView_sv_stepPadding, 0);
nextStepLineColor = ta.getColor(R.styleable.StepView_sv_nextStepLineColor, 0);
doneStepLineColor = ta.getColor(R.styleable.StepView_sv_doneStepLineColor, 0);
stepLineWidth = ta.getDimensionPixelSize(R.styleable.StepView_sv_stepLineWidth, 0);
textPadding = ta.getDimensionPixelSize(R.styleable.StepView_sv_textPadding, 0);
stepNumberTextSize = ta.getDimension(R.styleable.StepView_sv_stepNumberTextSize, 0);
textSize = ta.getDimension(R.styleable.StepView_sv_textSize, 0);
animationDuration = ta.getInteger(R.styleable.StepView_sv_animationDuration, 0);
animationType = ta.getInteger(R.styleable.StepView_sv_animationType, 0);
stepsNumber = ta.getInteger(R.styleable.StepView_sv_stepsNumber, 0);
CharSequence[] descriptions = ta.getTextArray(R.styleable.StepView_sv_steps);
if (descriptions != null) {
for (CharSequence item : descriptions) {
steps.add(item.toString());
Expand All @@ -151,11 +151,11 @@ private void applyStyles(Context context, AttributeSet attrs, int defStyleAttr)
} else {
displayMode = DISPLAY_MODE_NO_TEXT;
}
Drawable background = ta.getDrawable(R.styleable.StepView_android_background);
Drawable background = ta.getDrawable(R.styleable.StepView_sv_background);
if (background != null) {
setBackgroundDrawable(background);
}
int fontId = ta.getResourceId(R.styleable.StepView_android_typeface, 0);
int fontId = ta.getResourceId(R.styleable.StepView_sv_typeface, 0);
if (fontId != 0) {
Typeface typeface = ResourcesCompat.getFont(context, fontId);
if (typeface != null) {
Expand Down
46 changes: 23 additions & 23 deletions stepview/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="StepView">
<attr name="selectedCircleColor" format="color" />
<attr name="selectedCircleRadius" format="dimension" />
<attr name="selectedTextColor" format="color" />
<attr name="selectedStepNumberColor" format="color" />
<attr name="stepNumberTextSize" format="dimension" />
<attr name="doneStepMarkColor" format="color" />
<attr name="doneCircleColor" format="color" />
<attr name="doneCircleRadius" format="dimension" />
<attr name="doneTextColor" format="color" />
<attr name="nextTextColor" format="color" />
<attr name="nextStepLineColor" format="color" />
<attr name="doneStepLineColor" format="color" />
<attr name="stepPadding" format="dimension" />
<attr name="textPadding" format="dimension" />
<attr name="stepLineWidth" format="dimension" />
<attr name="android:textSize" />
<attr name="android:background" />
<attr name="android:animationDuration" />
<attr name="stepViewStyle" format="reference" />
<attr name="animationType" format="enum">
<attr name="sv_selectedCircleColor" format="color" />
<attr name="sv_selectedCircleRadius" format="dimension" />
<attr name="sv_selectedTextColor" format="color" />
<attr name="sv_selectedStepNumberColor" format="color" />
<attr name="sv_stepNumberTextSize" format="dimension" />
<attr name="sv_doneStepMarkColor" format="color" />
<attr name="sv_doneCircleColor" format="color" />
<attr name="sv_doneCircleRadius" format="dimension" />
<attr name="sv_doneTextColor" format="color" />
<attr name="sv_nextTextColor" format="color" />
<attr name="sv_nextStepLineColor" format="color" />
<attr name="sv_doneStepLineColor" format="color" />
<attr name="sv_stepPadding" format="dimension" />
<attr name="sv_textPadding" format="dimension" />
<attr name="sv_stepLineWidth" format="dimension" />
<attr name="sv_textSize" />
<attr name="sv_background" />
<attr name="sv_animationDuration" />
<attr name="sv_stepViewStyle" format="reference" />
<attr name="sv_animationType" format="enum">
<enum name="Line" value="0" />
<enum name="Circle" value="1" />
<enum name="All" value="2" />
<enum name="None" value="3" />
</attr>
<attr name="stepsNumber" format="integer" />
<attr name="steps" format="reference" />
<attr name="android:typeface" format="reference" />
<attr name="sv_stepsNumber" format="integer" />
<attr name="sv_steps" format="reference" />
<attr name="sv_typeface" format="reference" />
</declare-styleable>
</resources>
36 changes: 18 additions & 18 deletions stepview/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
<resources>

<style name="StepView">
<item name="selectedCircleColor">@color/stepview_circle_selected</item>
<item name="selectedCircleRadius">14dp</item>
<item name="selectedTextColor">@color/stepview_text_selected</item>
<item name="selectedStepNumberColor">@color/stepview_selected_number</item>
<item name="stepNumberTextSize">12sp</item>
<item name="doneStepMarkColor">@color/stepview_mark</item>
<item name="doneCircleColor">@color/stepview_circle_done</item>
<item name="doneCircleRadius">14dp</item>
<item name="doneTextColor">@color/stepview_text_done</item>
<item name="nextTextColor">@color/stepview_text_next</item>
<item name="nextStepLineColor">@color/stepview_line_next</item>
<item name="doneStepLineColor">@color/stepview_line_done</item>
<item name="stepPadding">12dp</item>
<item name="textPadding">12dp</item>
<item name="stepLineWidth">0.5dp</item>
<item name="android:animationDuration">200</item>
<item name="android:textSize">14sp</item>
<item name="animationType">Line</item>
<item name="sv_selectedCircleColor">@color/stepview_circle_selected</item>
<item name="sv_selectedCircleRadius">14dp</item>
<item name="sv_selectedTextColor">@color/stepview_text_selected</item>
<item name="sv_selectedStepNumberColor">@color/stepview_selected_number</item>
<item name="sv_stepNumberTextSize">12sp</item>
<item name="sv_doneStepMarkColor">@color/stepview_mark</item>
<item name="sv_doneCircleColor">@color/stepview_circle_done</item>
<item name="sv_doneCircleRadius">14dp</item>
<item name="sv_doneTextColor">@color/stepview_text_done</item>
<item name="sv_nextTextColor">@color/stepview_text_next</item>
<item name="sv_nextStepLineColor">@color/stepview_line_next</item>
<item name="sv_doneStepLineColor">@color/stepview_line_done</item>
<item name="sv_stepPadding">12dp</item>
<item name="sv_textPadding">12dp</item>
<item name="sv_stepLineWidth">0.5dp</item>
<item name="sv_animationDuration">200</item>
<item name="sv_textSize">14sp</item>
<item name="sv_animationType">Line</item>
</style>
</resources>

0 comments on commit fc0de23

Please sign in to comment.