Skip to content

Commit 3e93d3f

Browse files
committed
use dimensions instead of float for pathWidth
1 parent 7b50aab commit 3e93d3f

File tree

6 files changed

+8
-11
lines changed

6 files changed

+8
-11
lines changed

android-pathview/src/main/java/com/eftimoff/androipathview/PathView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private void getFromAttributes(Context context, AttributeSet attrs) {
126126
try {
127127
if (a != null) {
128128
paint.setColor(a.getColor(R.styleable.PathView_pathColor, 0xff00ff00));
129-
paint.setStrokeWidth(a.getFloat(R.styleable.PathView_pathWidth, 8.0f));
129+
paint.setStrokeWidth(a.getDimensionPixelSize(R.styleable.PathView_pathWidth, 8));
130130
svgResourceId = a.getResourceId(R.styleable.PathView_svg, 0);
131131
}
132132
} finally {
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<declare-styleable name="PathView">
4-
<attr name="pathColor"
5-
format="color"/>
6-
<attr name="pathWidth"
7-
format="float"/>
8-
<attr name="svg"
9-
format="reference"/>
4+
<attr name="pathColor" format="color|reference"/>
5+
<attr name="pathWidth" format="dimension|reference"/>
6+
<attr name="svg" format="reference"/>
107
</declare-styleable>
118
</resources>

sample/src/main/res/layout/activity_second.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
android:layout_height="350dp"
1414
app:svg="@raw/monitor"
1515
app:pathColor="@android:color/white"
16-
app:pathWidth="2"/>
16+
app:pathWidth="2dp"/>
1717

1818
</LinearLayout>

sample/src/main/res/layout/fragment_issues.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
android:id="@+id/pathView"
1111
android:layout_width="58dp"
1212
app:pathColor="@android:color/holo_red_dark"
13-
app:pathWidth="2"
13+
app:pathWidth="2dp"
1414
app:svg="@raw/issues"
1515
android:layout_height="58dp"/>
1616

sample/src/main/res/layout/fragment_logout.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
android:id="@+id/pathView"
1111
android:layout_width="150dp"
1212
app:pathColor="@android:color/black"
13-
app:pathWidth="1"
13+
app:pathWidth="1dp"
1414
android:layout_gravity="center"
1515
app:svg="@raw/logout"
1616
android:layout_height="150dp"/>

sample/src/main/res/layout/fragment_settings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
android:id="@+id/pathView"
1111
android:layout_width="match_parent"
1212
app:pathColor="@android:color/white"
13-
app:pathWidth="10"
13+
app:pathWidth="10dp"
1414
app:svg="@raw/settings"
1515
android:layout_height="match_parent"/>
1616

0 commit comments

Comments
 (0)