Skip to content

Commit

Permalink
Merge pull request #29 from myanimal/master
Browse files Browse the repository at this point in the history
Prefix xml custom attributes to avoid conflicts with other libraries
  • Loading branch information
hoang8f committed Aug 21, 2015
2 parents 730b7c5 + ef0f3a0 commit 9ec40f6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
30 changes: 15 additions & 15 deletions demo/src/main/res/layout/fragment_sample.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal"
segmentedgroup:border_width="1dp"
segmentedgroup:corner_radius="10dp"
segmentedgroup:tint_color="#FFEB3B"
segmentedgroup:checked_text_color="#7C4DFF">
segmentedgroup:sc_border_width="1dp"
segmentedgroup:sc_corner_radius="10dp"
segmentedgroup:sc_tint_color="#FFEB3B"
segmentedgroup:sc_checked_text_color="#7C4DFF">

<RadioButton
android:id="@+id/button21"
Expand Down Expand Up @@ -60,9 +60,9 @@
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal"
segmentedgroup:border_width="1dp"
segmentedgroup:corner_radius="5dp"
segmentedgroup:tint_color="#009688">
segmentedgroup:sc_border_width="1dp"
segmentedgroup:sc_corner_radius="5dp"
segmentedgroup:sc_tint_color="#009688">

<RadioButton
android:id="@+id/button31"
Expand Down Expand Up @@ -107,9 +107,9 @@
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical"
segmentedgroup:tint_color="#727272"
segmentedgroup:border_width="1dp"
segmentedgroup:corner_radius="10dp">
segmentedgroup:sc_tint_color="#727272"
segmentedgroup:sc_border_width="1dp"
segmentedgroup:sc_corner_radius="10dp">

<RadioButton
android:layout_width="match_parent"
Expand Down Expand Up @@ -141,9 +141,9 @@
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical"
segmentedgroup:tint_color="#ff33b5e5"
segmentedgroup:border_width="5dp"
segmentedgroup:corner_radius="7dp">
segmentedgroup:sc_tint_color="#ff33b5e5"
segmentedgroup:sc_border_width="5dp"
segmentedgroup:sc_corner_radius="7dp">

<RadioButton
android:layout_width="match_parent"
Expand Down Expand Up @@ -185,8 +185,8 @@
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal"
segmentedgroup:tint_color="@android:color/white"
segmentedgroup:checked_text_color="#ff33b5e5">
segmentedgroup:sc_tint_color="@android:color/white"
segmentedgroup:sc_checked_text_color="#ff33b5e5">

</info.hoang8f.android.segmented.SegmentedGroup>
</RelativeLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ private void initAttrs(AttributeSet attrs) {

try {
mMarginDp = (int) typedArray.getDimension(
R.styleable.SegmentedGroup_border_width,
R.styleable.SegmentedGroup_sc_border_width,
getResources().getDimension(R.dimen.radio_button_stroke_border));

mCornerRadius = typedArray.getDimension(
R.styleable.SegmentedGroup_corner_radius,
R.styleable.SegmentedGroup_sc_corner_radius,
getResources().getDimension(R.dimen.radio_button_conner_radius));

mTintColor = typedArray.getColor(
R.styleable.SegmentedGroup_tint_color,
R.styleable.SegmentedGroup_sc_tint_color,
getResources().getColor(R.color.radio_button_selected_color));

mCheckedTextColor = typedArray.getColor(
R.styleable.SegmentedGroup_checked_text_color,
R.styleable.SegmentedGroup_sc_checked_text_color,
getResources().getColor(android.R.color.white));

} finally {
Expand Down
8 changes: 4 additions & 4 deletions library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="SegmentedGroup">
<attr name="corner_radius" format="dimension" />
<attr name="border_width" format="dimension" />
<attr name="tint_color" format="color" />
<attr name="checked_text_color" format="color" />
<attr name="sc_corner_radius" format="dimension" />
<attr name="sc_border_width" format="dimension" />
<attr name="sc_tint_color" format="color" />
<attr name="sc_checked_text_color" format="color" />
</declare-styleable>

</resources>

0 comments on commit 9ec40f6

Please sign in to comment.