Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions app/src/main/res/layout/activity_grid.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2017 Harish Sridharan


Expand All @@ -21,8 +20,8 @@ limitations under the License.
android:id="@+id/shimmer_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
app:shimmer_demo_layout="@layout/layout_demo_grid"
app:shimmer_demo_layout_manager_type="grid"
app:shimmer_demo_layout_manager_type="grid_vertical"
app:shimmer_demo_shimmer_color="#21ffffff" />
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_second_grid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
android:paddingTop="10dp"
app:shimmer_demo_angle="20"
app:shimmer_demo_layout="@layout/layout_second_demo_grid"
app:shimmer_demo_layout_manager_type="grid"
app:shimmer_demo_layout_manager_type="grid_vertical"
app:shimmer_demo_shimmer_color="@color/shimmer_color"
app:shimmer_demo_view_holder_item_background="@drawable/bg_sharp_card" />
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public class ShimmerRecyclerView extends RecyclerView {

public enum LayoutMangerType {
LINEAR_VERTICAL, LINEAR_HORIZONTAL, GRID
LINEAR_VERTICAL, LINEAR_HORIZONTAL, GRID_VERTICAL, GRID_HORIZONTAL
}

private Adapter mActualAdapter;
Expand Down Expand Up @@ -83,7 +83,10 @@ private void init(Context context, AttributeSet attrs) {
setDemoLayoutManager(LayoutMangerType.LINEAR_HORIZONTAL);
break;
case 2:
setDemoLayoutManager(LayoutMangerType.GRID);
setDemoLayoutManager(LayoutMangerType.GRID_VERTICAL);
break;
case 3:
setDemoLayoutManager(LayoutMangerType.GRID_HORIZONTAL);
break;
default:
throw new IllegalArgumentException("This value for layout manager is not valid!");
Expand Down Expand Up @@ -242,13 +245,20 @@ public boolean canScrollHorizontally() {
}
};
break;
case GRID:
case GRID_VERTICAL:
mShimmerLayoutManager = new GridLayoutManager(getContext(), mGridCount) {
public boolean canScrollVertically() {
return mCanScroll;
}
};
break;
case GRID_HORIZONTAL:
mShimmerLayoutManager = new GridLayoutManager(getContext(), mGridCount, LinearLayoutManager.HORIZONTAL, false) {
public boolean canScrollVertically() {
return mCanScroll;
}
};
break;
}
}

Expand Down
6 changes: 3 additions & 3 deletions shimmer/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2017 Harish Sridharan


Expand All @@ -23,7 +22,8 @@ limitations under the License.
<attr name="shimmer_demo_layout_manager_type" format="enum">
<enum name="linear_vertical" value="0" />
<enum name="linear_horizontal" value="1" />
<enum name="grid" value="2" />
<enum name="grid_vertical" value="2" />
<enum name="grid_horizontal" value="3" />
</attr>
<attr name="shimmer_demo_grid_child_count" format="integer|reference" />
<attr name="shimmer_demo_shimmer_color" format="color|reference" />
Expand Down