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

Commit 6f53b67

Browse files
committed
Spec: Title & Line Style
Signed-off-by: Fung <[email protected]>
1 parent be54656 commit 6f53b67

File tree

8 files changed

+32
-6
lines changed

8 files changed

+32
-6
lines changed

.readme/vertical.gif

-24.6 KB
Loading

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ There will be more styles in the future.
3333

3434
### Vertical Stepper View
3535

36-
[![Vertical Stepper View Demo](.readme/vertical.gif)](https://youtu.be/NCalAAP0y4o)
36+
[![Vertical Stepper View Demo](.readme/vertical.gif)](https://www.youtube.com/watch?v=y9gSwHKwxVM)
3737

38-
Instructions will be add later. You can read demo source code to learn how to use.
38+
Instructions will be added later. You can read demo source code to learn how to use.
3939

4040
## Support me
4141

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ ext {
2525
targetSdkVersion = 26
2626
buildToolsVersion = "26.0.1"
2727
versionCode = 1
28-
versionName = '0.1.0'
28+
versionName = '0.1.1'
2929
}

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public VerticalStepperItemView(Context context, AttributeSet attrs, int defStyle
7474

7575
prepareViews(context);
7676

77-
mNormalColor = getResources().getColor(R.color.material_grey_500);
77+
mNormalColor = ViewUtils.getColorFromAttr(context, android.R.attr.textColorSecondary);
7878
mActivatedColor = ViewUtils.getColorFromAttr(context, R.attr.colorPrimary);
7979
mDoneIcon = getResources().getDrawable(R.drawable.ic_done_white_16dp);
8080
mAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime);
@@ -196,6 +196,14 @@ public void setState(@State int state) {
196196
mPointNumber.setAlpha(state == STATE_DONE ? 0f : 1f);
197197
}
198198

199+
// Set title style
200+
mTitleText.setTextAppearance(getContext(), state == STATE_DONE ?
201+
R.style.TextAppearance_Widget_Stepper_Done : (
202+
state == STATE_NORMAL ?
203+
R.style.TextAppearance_Widget_Stepper_Normal :
204+
R.style.TextAppearance_Widget_Stepper_Selected
205+
));
206+
199207
// Set the visibility of views
200208
mSummaryText.setVisibility(state != STATE_SELECTED && !TextUtils.isEmpty(mSummary) ? View.VISIBLE : View.GONE);
201209
mCustomView.setVisibility(state == STATE_SELECTED ? View.VISIBLE : View.GONE);

library/src/main/res/layout/vertical_stepper_item_view_layout.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@
5050
<!-- Vertical Stepper Line -->
5151
<View
5252
android:id="@+id/stepper_line"
53-
android:layout_width="0.5dp"
53+
android:layout_width="@dimen/vertical_stepper_line_width"
5454
android:layout_height="0dp"
5555
android:layout_weight="1"
5656
android:layout_marginTop="@dimen/vertical_stepper_line_margin_top"
57-
android:background="@color/material_grey_500"/>
57+
android:background="@color/material_grey_400"/>
5858

5959
</LinearLayout>
6060

library/src/main/res/values/colors.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
<resources>
33

44
<color name="material_grey_500">#9E9E9E</color>
5+
<color name="material_grey_400">#BDBDBD</color>
56

67
</resources>

library/src/main/res/values/dimens.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<dimen name="vertical_stepper_point_margin_start">24dp</dimen>
1111
<dimen name="vertical_stepper_point_margin_end">12dp</dimen>
1212
<dimen name="vertical_stepper_line_margin_top">8dp</dimen>
13+
<dimen name="vertical_stepper_line_width">1dp</dimen>
1314
<dimen name="vertical_stepper_item_space_height">8dp</dimen>
1415

1516
</resources>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<style name="TextAppearance.Widget.Stepper.Done" parent="TextAppearance.AppCompat.Body1">
5+
6+
</style>
7+
8+
<style name="TextAppearance.Widget.Stepper.Selected" parent="TextAppearance.AppCompat.Body2">
9+
10+
</style>
11+
12+
<style name="TextAppearance.Widget.Stepper.Normal" parent="TextAppearance.AppCompat.Body1">
13+
<item name="android:textColor">?android:textColorSecondary</item>
14+
</style>
15+
16+
</resources>

0 commit comments

Comments
 (0)