From cf4bd43db83ca0fb50d8c8fc39309509a3cdd42d Mon Sep 17 00:00:00 2001 From: RealAndyLawton Date: Sat, 3 Oct 2015 01:24:29 -0400 Subject: [PATCH 1/2] Prefixed declared attribues with lcp_ to avoid collisions, specifically with orientation --- .../src/main/java/uz/shift/colorpicker/LineColorPicker.java | 6 +++--- shiftcolorpicker/src/main/res/values/attrs.xml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/shiftcolorpicker/src/main/java/uz/shift/colorpicker/LineColorPicker.java b/shiftcolorpicker/src/main/java/uz/shift/colorpicker/LineColorPicker.java index 5492a62..9836e4f 100644 --- a/shiftcolorpicker/src/main/java/uz/shift/colorpicker/LineColorPicker.java +++ b/shiftcolorpicker/src/main/java/uz/shift/colorpicker/LineColorPicker.java @@ -49,10 +49,10 @@ public LineColorPicker(Context context, AttributeSet attrs) { final TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.LineColorPicker, 0, 0); try { - mOrientation = a.getInteger(R.styleable.LineColorPicker_orientation, HORIZONTAL); + mOrientation = a.getInteger(R.styleable.LineColorPicker_lcp_orientation, HORIZONTAL); if (!isInEditMode()) { - final int colorsArrayResId = a.getResourceId(R.styleable.LineColorPicker_colors, -1); + final int colorsArrayResId = a.getResourceId(R.styleable.LineColorPicker_lcp_colors, -1); if (colorsArrayResId > 0) { final int[] colors = context.getResources().getIntArray(colorsArrayResId); @@ -60,7 +60,7 @@ public LineColorPicker(Context context, AttributeSet attrs) { } } - final int selected = a.getInteger(R.styleable.LineColorPicker_selectedColorIndex, -1); + final int selected = a.getInteger(R.styleable.LineColorPicker_lcp_selectedColorIndex, -1); if (selected != -1) { final int[] currentColors = getColors(); diff --git a/shiftcolorpicker/src/main/res/values/attrs.xml b/shiftcolorpicker/src/main/res/values/attrs.xml index 1afac6c..e44cee3 100644 --- a/shiftcolorpicker/src/main/res/values/attrs.xml +++ b/shiftcolorpicker/src/main/res/values/attrs.xml @@ -2,12 +2,12 @@ - + - - + + \ No newline at end of file From ec2220a902d7f39096fc22b6fe31f60ec41b715a Mon Sep 17 00:00:00 2001 From: RealAndyLawton Date: Sat, 3 Oct 2015 01:37:16 -0400 Subject: [PATCH 2/2] Sample projects using lcp_ prefix --- sample/src/main/res/layout/activity_main.xml | 8 ++++---- sample2/src/main/res/layout/fragment_color_chooser.xml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml index 728de22..12fb0dc 100644 --- a/sample/src/main/res/layout/activity_main.xml +++ b/sample/src/main/res/layout/activity_main.xml @@ -22,21 +22,21 @@ android:layout_width="match_parent" android:layout_height="60dp" android:layout_marginTop="48dp" - app:orientation="horizontal" /> + app:lcp_orientation="horizontal" /> + app:lcp_orientation="horizontal" /> + app:lcp_selectedColorIndex="3" + app:lcp_colors="@array/sample_colors"/> diff --git a/sample2/src/main/res/layout/fragment_color_chooser.xml b/sample2/src/main/res/layout/fragment_color_chooser.xml index 935cb90..eb25f97 100644 --- a/sample2/src/main/res/layout/fragment_color_chooser.xml +++ b/sample2/src/main/res/layout/fragment_color_chooser.xml @@ -12,9 +12,9 @@ android:id="@+id/picker" android:layout_width="match_parent" android:layout_height="60dp" - app:colors="@array/rainbow" - app:selectedColorIndex="3" - app:orientation="horizontal" + app:lcp_colors="@array/rainbow" + app:lcp_selectedColorIndex="3" + app:lcp_orientation="horizontal" android:layout_alignParentTop="true" android:layout_marginTop="32dp" android:layout_alignParentLeft="true"