Skip to content

Commit

Permalink
Merge pull request lucasr#128 from jacek-marchwicki/fix-library-confl…
Browse files Browse the repository at this point in the history
…ict2
  • Loading branch information
lucasr committed Oct 20, 2014
2 parents f18eafe + a824978 commit efb5efd
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 58 deletions.
1 change: 1 addition & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies {
android {
compileSdkVersion 21
buildToolsVersion '21.0.1'
resourcePrefix 'twowayview_'

defaultConfig {
minSdkVersion 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static ItemClickSupport addTo(RecyclerView recyclerView) {
ItemClickSupport itemClickSupport = from(recyclerView);
if (itemClickSupport == null) {
itemClickSupport = new ItemClickSupport(recyclerView);
recyclerView.setTag(R.id.item_click_support, itemClickSupport);
recyclerView.setTag(R.id.twowayview_item_click_support, itemClickSupport);
} else {
// TODO: Log warning
}
Expand All @@ -99,15 +99,15 @@ public static void removeFrom(RecyclerView recyclerView) {
}

recyclerView.removeOnItemTouchListener(itemClickSupport.mTouchListener);
recyclerView.setTag(R.id.item_click_support, null);
recyclerView.setTag(R.id.twowayview_item_click_support, null);
}

public static ItemClickSupport from(RecyclerView recyclerView) {
if (recyclerView == null) {
return null;
}

return (ItemClickSupport) recyclerView.getTag(R.id.item_click_support);
return (ItemClickSupport) recyclerView.getTag(R.id.twowayview_item_click_support);
}

private class TouchListener extends ClickItemTouchListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ public static ItemSelectionSupport addTo(RecyclerView recyclerView) {
ItemSelectionSupport itemSelectionSupport = from(recyclerView);
if (itemSelectionSupport == null) {
itemSelectionSupport = new ItemSelectionSupport(recyclerView);
recyclerView.setTag(R.id.item_selection_support, itemSelectionSupport);
recyclerView.setTag(R.id.twowayview_item_selection_support, itemSelectionSupport);
} else {
// TODO: Log warning
}
Expand All @@ -362,15 +362,15 @@ public static void removeFrom(RecyclerView recyclerView) {
itemSelection.clearChoices();

recyclerView.removeOnItemTouchListener(itemSelection.mTouchListener);
recyclerView.setTag(R.id.item_selection_support, null);
recyclerView.setTag(R.id.twowayview_item_selection_support, null);
}

public static ItemSelectionSupport from(RecyclerView recyclerView) {
if (recyclerView == null) {
return null;
}

return (ItemSelectionSupport) recyclerView.getTag(R.id.item_selection_support);
return (ItemSelectionSupport) recyclerView.getTag(R.id.twowayview_item_selection_support);
}

private static class CheckedStates extends SparseBooleanArray implements Parcelable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ public TwoWayLayoutManager(Context context, AttributeSet attrs) {

public TwoWayLayoutManager(Context context, AttributeSet attrs, int defStyle) {
final TypedArray a =
context.obtainStyledAttributes(attrs, R.styleable.TwoWayLayoutManager, defStyle, 0);
context.obtainStyledAttributes(attrs, R.styleable.twowayview_TwoWayLayoutManager, defStyle, 0);

final int indexCount = a.getIndexCount();
for (int i = 0; i < indexCount; i++) {
final int attr = a.getIndex(i);

if (attr == R.styleable.TwoWayLayoutManager_android_orientation) {
if (attr == R.styleable.twowayview_TwoWayLayoutManager_android_orientation) {
final int orientation = a.getInt(attr, -1);
if (orientation >= 0) {
setOrientation(Orientation.values()[orientation]);
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/org/lucasr/twowayview/TwoWayView.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public TwoWayView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);

final TypedArray a =
context.obtainStyledAttributes(attrs, R.styleable.TwoWayView, defStyle, 0);
context.obtainStyledAttributes(attrs, R.styleable.twowayview_TwoWayView, defStyle, 0);

final String name = a.getString(R.styleable.TwoWayView_layoutManager);
final String name = a.getString(R.styleable.twowayview_TwoWayView_twowayview_layoutManager);
if (!TextUtils.isEmpty(name)) {
loadLayoutManagerFromName(context, attrs, name);
}
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
limitations under the License.
-->

<resources>
<resources xmlns:tools="http://schemas.android.com/tools">

<declare-styleable name="TwoWayView">
<attr name="layoutManager" format="string"/>
<declare-styleable name="twowayview_TwoWayView">
<attr name="twowayview_layoutManager" format="string"/>
</declare-styleable>

<declare-styleable name="TwoWayLayoutManager">
<attr name="android:orientation"/>
<declare-styleable name="twowayview_TwoWayLayoutManager">
<attr name="android:orientation" tools:ignore="ResourceName"/>
</declare-styleable>

</resources>
4 changes: 2 additions & 2 deletions core/src/main/res/values/ids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<resources>

<item name="item_click_support" type="id"/>
<item name="item_selection_support" type="id"/>
<item name="twowayview_item_click_support" type="id"/>
<item name="twowayview_item_selection_support" type="id"/>

</resources>
1 change: 1 addition & 0 deletions layouts/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ repositories {
android {
compileSdkVersion 21
buildToolsVersion '21.0.1'
resourcePrefix 'twowayview_'

defaultConfig {
minSdkVersion 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ public DividerItemDecoration(Context context, AttributeSet attrs) {

public DividerItemDecoration(Context context, AttributeSet attrs, int defStyle) {
final TypedArray a =
context.obtainStyledAttributes(attrs, R.styleable.DividerItemDecoration, defStyle, 0);
context.obtainStyledAttributes(attrs, R.styleable.twowayview_DividerItemDecoration, defStyle, 0);

final Drawable divider = a.getDrawable(R.styleable.DividerItemDecoration_android_divider);
final Drawable divider = a.getDrawable(R.styleable.twowayview_DividerItemDecoration_android_divider);
if (divider != null) {
mVerticalDivider = mHorizontalDivider = divider;
} else {
mVerticalDivider = a.getDrawable(R.styleable.DividerItemDecoration_verticalDivider);
mHorizontalDivider = a.getDrawable(R.styleable.DividerItemDecoration_horizontalDivider);
mVerticalDivider = a.getDrawable(R.styleable.twowayview_DividerItemDecoration_twowayview_verticalDivider);
mHorizontalDivider = a.getDrawable(R.styleable.twowayview_DividerItemDecoration_twowayview_horizontalDivider);
}

a.recycle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ protected GridLayoutManager(Context context, AttributeSet attrs, int defStyle,
super(context, attrs, defStyle);

final TypedArray a =
context.obtainStyledAttributes(attrs, R.styleable.GridLayoutManager, defStyle, 0);
context.obtainStyledAttributes(attrs, R.styleable.twowayview_GridLayoutManager, defStyle, 0);

mNumColumns =
Math.max(1, a.getInt(R.styleable.GridLayoutManager_numColumns, defaultNumColumns));
Math.max(1, a.getInt(R.styleable.twowayview_GridLayoutManager_twowayview_numColumns, defaultNumColumns));
mNumRows =
Math.max(1, a.getInt(R.styleable.GridLayoutManager_numRows, defaultNumRows));
Math.max(1, a.getInt(R.styleable.twowayview_GridLayoutManager_twowayview_numRows, defaultNumRows));

a.recycle();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public SpacingItemDecoration(Context context, AttributeSet attrs) {

public SpacingItemDecoration(Context context, AttributeSet attrs, int defStyle) {
final TypedArray a =
context.obtainStyledAttributes(attrs, R.styleable.SpacingItemDecoration, defStyle, 0);
context.obtainStyledAttributes(attrs, R.styleable.twowayview_SpacingItemDecoration, defStyle, 0);

final int verticalSpacing =
Math.max(0, a.getInt(R.styleable.SpacingItemDecoration_android_verticalSpacing, 0));
Math.max(0, a.getInt(R.styleable.twowayview_SpacingItemDecoration_android_verticalSpacing, 0));
final int horizontalSpacing =
Math.max(0, a.getInt(R.styleable.SpacingItemDecoration_android_horizontalSpacing, 0));
Math.max(0, a.getInt(R.styleable.twowayview_SpacingItemDecoration_android_horizontalSpacing, 0));

a.recycle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@ public LayoutParams(int width, int height) {
public LayoutParams(Context c, AttributeSet attrs) {
super(c, attrs);

TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.SpannableGridViewChild);
TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.twowayview_SpannableGridViewChild);
colSpan = Math.max(
DEFAULT_SPAN, a.getInt(R.styleable.SpannableGridViewChild_colSpan, -1));
DEFAULT_SPAN, a.getInt(R.styleable.twowayview_SpannableGridViewChild_twowayview_colSpan, -1));
rowSpan = Math.max(
DEFAULT_SPAN, a.getInt(R.styleable.SpannableGridViewChild_rowSpan, -1));
DEFAULT_SPAN, a.getInt(R.styleable.twowayview_SpannableGridViewChild_twowayview_rowSpan, -1));
a.recycle();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ public LayoutParams(int width, int height) {
public LayoutParams(Context c, AttributeSet attrs) {
super(c, attrs);

TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.StaggeredGridViewChild);
span = Math.max(DEFAULT_SPAN, a.getInt(R.styleable.StaggeredGridViewChild_span, -1));
TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.twowayview_StaggeredGridViewChild);
span = Math.max(DEFAULT_SPAN, a.getInt(R.styleable.twowayview_StaggeredGridViewChild_twowayview_span, -1));
a.recycle();
}

Expand Down
32 changes: 16 additions & 16 deletions layouts/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@
limitations under the License.
-->

<resources>
<resources xmlns:tools="http://schemas.android.com/tools">

<declare-styleable name="GridLayoutManager">
<attr name="numColumns" format="integer"/>
<attr name="numRows" format="integer"/>
<declare-styleable name="twowayview_GridLayoutManager">
<attr name="twowayview_numColumns" format="integer"/>
<attr name="twowayview_numRows" format="integer"/>
</declare-styleable>

<declare-styleable name="SpacingItemDecoration">
<attr name="android:verticalSpacing"/>
<attr name="android:horizontalSpacing"/>
<declare-styleable name="twowayview_SpacingItemDecoration">
<attr name="android:verticalSpacing" tools:ignore="ResourceName"/>
<attr name="android:horizontalSpacing" tools:ignore="ResourceName"/>
</declare-styleable>

<declare-styleable name="DividerItemDecoration">
<attr name="android:divider"/>
<attr name="verticalDivider" format="reference"/>
<attr name="horizontalDivider" format="reference"/>
<declare-styleable name="twowayview_DividerItemDecoration">
<attr name="android:divider" tools:ignore="ResourceName"/>
<attr name="twowayview_verticalDivider" format="reference"/>
<attr name="twowayview_horizontalDivider" format="reference"/>
</declare-styleable>

<declare-styleable name="StaggeredGridViewChild">
<attr name="span" format="integer"/>
<declare-styleable name="twowayview_StaggeredGridViewChild">
<attr name="twowayview_span" format="integer"/>
</declare-styleable>

<declare-styleable name="SpannableGridViewChild">
<attr name="colSpan" format="integer"/>
<attr name="rowSpan" format="integer"/>
<declare-styleable name="twowayview_SpannableGridViewChild">
<attr name="twowayview_colSpan" format="integer"/>
<attr name="twowayview_rowSpan" format="integer"/>
</declare-styleable>

</resources>
6 changes: 3 additions & 3 deletions sample/src/main/res/layout/layout_grid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/TwoWayView"
app:layoutManager="GridLayoutManager"
app:numColumns="3"
app:numRows="3" />
app:twowayview_layoutManager="GridLayoutManager"
app:twowayview_numColumns="3"
app:twowayview_numRows="3" />
2 changes: 1 addition & 1 deletion sample/src/main/res/layout/layout_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/TwoWayView"
app:layoutManager="ListLayoutManager"/>
app:twowayview_layoutManager="ListLayoutManager"/>
6 changes: 3 additions & 3 deletions sample/src/main/res/layout/layout_spannable_grid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/TwoWayView"
app:layoutManager="SpannableGridLayoutManager"
app:numColumns="3"
app:numRows="3" />
app:twowayview_layoutManager="SpannableGridLayoutManager"
app:twowayview_numColumns="3"
app:twowayview_numRows="3" />
6 changes: 3 additions & 3 deletions sample/src/main/res/layout/layout_staggered_grid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/TwoWayView"
app:layoutManager="StaggeredGridLayoutManager"
app:numColumns="2"
app:numRows="2" />
app:twowayview_layoutManager="StaggeredGridLayoutManager"
app:twowayview_numColumns="2"
app:twowayview_numRows="2" />

0 comments on commit efb5efd

Please sign in to comment.