Skip to content

Commit ebcb71b

Browse files
authored
fixed RTL support (issue #19) (#21)
- updated Android Support Library to 25.0.0 - updated library version to 1.0.3
1 parent 1d07427 commit ebcb71b

File tree

9 files changed

+46
-22
lines changed

9 files changed

+46
-22
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Quoting the [documentation](https://www.google.com/design/spec/components/steppe
1111
1212
## Download (from JCenter)
1313
```groovy
14-
compile 'com.stepstone.stepper:material-stepper:1.0.2'
14+
compile 'com.stepstone.stepper:material-stepper:1.0.3'
1515
```
1616

1717
## Supported steppers

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ buildscript {
33
jcenter()
44
}
55
dependencies {
6-
classpath 'com.android.tools.build:gradle:2.1.0'
6+
classpath 'com.android.tools.build:gradle:2.2.2'
77
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
8-
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
8+
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
99

1010
}
1111
}
@@ -22,8 +22,8 @@ configure(allprojects) {
2222
androidMinSdkVersion = 14
2323
androidTargetSdkVersion = 24
2424
androidCompileSdkVersion = 24
25-
androidBuildToolsVersion = "24.0.1"
26-
androidSupportLibraryVersion = "24.1.0"
25+
androidBuildToolsVersion = "25.0.0"
26+
androidSupportLibraryVersion = "25.0.0"
2727

2828
/* Sample only */
2929
butterknifeVersion = "7.0.1"

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919

2020
POM_GROUP_ID=com.stepstone.stepper
2121
POM_ARTIFACT_ID=material-stepper
22-
POM_VERSION=1.0.2
22+
POM_VERSION=1.0.3
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Oct 21 11:34:03 PDT 2015
1+
#Fri Oct 21 16:27:14 CEST 2016
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

material-stepper/src/main/java/com/stepstone/stepper/StepperLayout.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import android.content.res.ColorStateList;
2121
import android.content.res.TypedArray;
2222
import android.graphics.drawable.Drawable;
23+
import android.os.Build;
2324
import android.os.Handler;
2425
import android.support.annotation.AttrRes;
2526
import android.support.annotation.ColorInt;
@@ -320,9 +321,13 @@ private void initNavigation() {
320321
mNextNavigationButton.setText(mNextButtonText);
321322
mCompleteNavigationButton.setText(mCompleteButtonText);
322323

323-
// FIXME: 16/03/16 this is a workaround for tinting TextView's compound drawables on API 16-17 - when set in XML only the default color is used...
324-
Drawable chevronRightDrawable = ResourcesCompat.getDrawable(getContext().getResources(), R.drawable.ic_chevron_right, null);
325-
mNextNavigationButton.setCompoundDrawablesWithIntrinsicBounds(null, null, chevronRightDrawable, null);
324+
//FIXME: 16/03/16 this is a workaround for tinting TextView's compound drawables on API 16-17 - when set in XML only the default color is used...
325+
Drawable chevronEndDrawable = ResourcesCompat.getDrawable(getContext().getResources(), R.drawable.ic_chevron_end, null);
326+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
327+
mNextNavigationButton.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, chevronEndDrawable, null);
328+
} else {
329+
mNextNavigationButton.setCompoundDrawablesWithIntrinsicBounds(null, null, chevronEndDrawable, null);
330+
}
326331

327332
TintUtil.tintTextView(mBackNavigationButton, mBackButtonColor);
328333
TintUtil.tintTextView(mNextNavigationButton, mNextButtonColor);

material-stepper/src/main/java/com/stepstone/stepper/util/TintUtil.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import android.graphics.PorterDuff;
2121
import android.graphics.Rect;
2222
import android.graphics.drawable.Drawable;
23+
import android.os.Build;
2324
import android.support.annotation.ColorInt;
2425
import android.support.annotation.NonNull;
2526
import android.support.annotation.Nullable;
@@ -41,13 +42,21 @@ public class TintUtil {
4142
*/
4243
public static void tintTextView(@NonNull TextView textview, ColorStateList tintColor) {
4344
textview.setTextColor(tintColor);
44-
Drawable[] drawables = textview.getCompoundDrawables();
45-
46-
textview.setCompoundDrawables(
47-
tintDrawable(drawables[0], tintColor),
48-
tintDrawable(drawables[1], tintColor),
49-
tintDrawable(drawables[2], tintColor),
50-
tintDrawable(drawables[3], tintColor));
45+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
46+
Drawable[] drawables = textview.getCompoundDrawablesRelative();
47+
textview.setCompoundDrawablesRelative(
48+
tintDrawable(drawables[0], tintColor),
49+
tintDrawable(drawables[1], tintColor),
50+
tintDrawable(drawables[2], tintColor),
51+
tintDrawable(drawables[3], tintColor));
52+
} else {
53+
Drawable[] drawables = textview.getCompoundDrawables();
54+
textview.setCompoundDrawables(
55+
tintDrawable(drawables[0], tintColor),
56+
tintDrawable(drawables[1], tintColor),
57+
tintDrawable(drawables[2], tintColor),
58+
tintDrawable(drawables[3], tintColor));
59+
}
5160
}
5261

5362
/**

material-stepper/src/main/res/layout/ms_stepper_layout.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
android:layout_alignParentLeft="true"
3030
android:layout_alignParentStart="true"
3131
android:layout_centerVertical="true"
32-
android:drawableLeft="@drawable/ic_chevron_left"
33-
android:drawableStart="@drawable/ic_chevron_left"
32+
android:drawableLeft="@drawable/ic_chevron_start"
33+
android:drawableStart="@drawable/ic_chevron_start"
3434
tools:text="@string/ms_back"
3535
tools:textColor="@color/ms_bottomNavigationButtonTextColor" />
3636

@@ -67,8 +67,8 @@
6767
android:layout_alignParentEnd="true"
6868
android:layout_alignParentRight="true"
6969
android:layout_centerVertical="true"
70-
tools:drawableEnd="@drawable/ic_chevron_right"
71-
tools:drawableRight="@drawable/ic_chevron_right"
70+
tools:drawableEnd="@drawable/ic_chevron_end"
71+
tools:drawableRight="@drawable/ic_chevron_end"
7272
tools:text="@string/ms_next"
7373
tools:textColor="@color/ms_bottomNavigationButtonTextColor"
7474
tools:visibility="gone" />
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<drawable name="ic_chevron_start">@drawable/ic_chevron_right</drawable>
4+
<drawable name="ic_chevron_end">@drawable/ic_chevron_left</drawable>
5+
</resources>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<drawable name="ic_chevron_start">@drawable/ic_chevron_left</drawable>
4+
<drawable name="ic_chevron_end">@drawable/ic_chevron_right</drawable>
5+
</resources>

0 commit comments

Comments
 (0)