All Projects → andyb129 → ZigzagRecyclerView

andyb129 / ZigzagRecyclerView

Licence: other
A library that gives you a slant on the traditional Grid Recycler View ♻️

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to ZigzagRecyclerView

Pursuit-Core-Android
Pursuit Core Android
Stars: ✭ 45 (+66.67%)
Mutual labels:  recyclerview, picasso
Android Cardview Recyclerview
Let's play with Android CardView, RecyclerView, Retrofit and Picasso Library. You can read details procedure about those library in my Bengali blog site.
Stars: ✭ 72 (+166.67%)
Mutual labels:  recyclerview, picasso
FastWaiMai
仿写美团外卖电商项目
Stars: ✭ 123 (+355.56%)
Mutual labels:  recyclerview
SwipeAndDragRecyclerView
通过 ItemTouchHelper.Callback 实现 RecyclerView Item 的拖拽和侧滑删除
Stars: ✭ 39 (+44.44%)
Mutual labels:  recyclerview
SmartStickyHeader
A Custom Header View With Multiple Items to make selection from categories
Stars: ✭ 36 (+33.33%)
Mutual labels:  recyclerview
MetalRecyclerPagerView
RecyclerView implementation for Android which makes it look and feel like ViewPager with item margins support (mutliple views effect).
Stars: ✭ 26 (-3.7%)
Mutual labels:  recyclerview
AdapterCommands
Drop in solution to animate RecyclerView's dataset changes by using command pattern
Stars: ✭ 74 (+174.07%)
Mutual labels:  recyclerview
AutoPlayVideoRecyclerView
Android library to auto play video from url in Recyclerview.
Stars: ✭ 44 (+62.96%)
Mutual labels:  recyclerview
ParkingDemo
Taipei City Parking Lot Information Query System Demo
Stars: ✭ 18 (-33.33%)
Mutual labels:  recyclerview
ui
android examples for ui
Stars: ✭ 28 (+3.7%)
Mutual labels:  recyclerview
TabSync
A lightweight synchronizer between Android's Tabs and Lists. Available on the View system and Jetpack Compose.
Stars: ✭ 98 (+262.96%)
Mutual labels:  recyclerview
Modular2Recycler
Modular²Recycler is a RecyclerView.Adapter that is modular squared.
Stars: ✭ 72 (+166.67%)
Mutual labels:  recyclerview
MultiTypeAdapter
RecyclerView通用多类型适配器MultiTypeAdapter,以布局文件为单位更细粒度的条目复用。
Stars: ✭ 18 (-33.33%)
Mutual labels:  recyclerview
ShimmerRecyclerView
A custom Shimmer RecyclerView which adopt to list / grid transition automatically and also supports multiple view types while shimmering.
Stars: ✭ 184 (+581.48%)
Mutual labels:  recyclerview
AndroidStarterAlt
A sample View-based Android app using the MVP architecture. It uses Mosby, Dagger2, RxJava, retrofit, LoganSquare, requery, EventBus, Conductor.
Stars: ✭ 27 (+0%)
Mutual labels:  picasso
RollingLayoutManager
vrgsoft.net
Stars: ✭ 57 (+111.11%)
Mutual labels:  recyclerview
BaseRecyclerViewAdapter
RecyclerView通用适配器
Stars: ✭ 14 (-48.15%)
Mutual labels:  recyclerview
recyclerview-expandable
RecyclerView implementation of traex's ExpandableLayout
Stars: ✭ 70 (+159.26%)
Mutual labels:  recyclerview
android-thinkmap-treeview
Tree View; Mind map; Think map; tree map; custom view; 自定义;关系图;树状图;思维导图;组织机构图;层次图
Stars: ✭ 314 (+1062.96%)
Mutual labels:  recyclerview
RecyclerViewExtensionsDemo
RecyclerView列表优化方案
Stars: ✭ 45 (+66.67%)
Mutual labels:  recyclerview

Zigzag Recycler View

Android Arsenal

A library that gives you a slant on the traditional Grid Recycler View!

  • Use a traditional RecyclerView (& just apply the ZigzagGridRecyclerViewAdapter)
  • Load list of images from your own objects (implement ZigzagImage)
  • Change the background colour of the dividers

ZigzagRecyclerView

ZigzagRecyclerView

Setup

To use Zigzag Recycler View in your projects, simply add the library as a dependency to your build.

Gradle
dependencies {
  implementation 'uk.co.barbuzz:zigzagrecyclerview:0.0.3'
}
Maven
<dependency>
  <groupId>uk.co.barbuzz.zigzagrecyclerviewadapter</groupId>
  <artifactId>zigzagrecyclerview</artifactId>
  <version>0.0.3</version>
  <type>pom</type>
</dependency>

Alternatively you can directly import the /library project into your Android Studio project and add it as a dependency in your build.gradle.

The library is currently configured to be built via Gradle only. It has the following dependencies:

  • Support library - com.android.support:appcompat-v7:26.1.0
  • Recyclerview-v7 - com.android.support:recyclerview-v7:26.1.0
  • Picasso 2.3.2 - com.squareup.picasso:picasso:2.5.2
  • Compiled SDK Version - Oreo-26
  • Minimum SDK Version - >= Lollipop-21

Usage

For more detailed code example to use the library, Please refer to the /sample app.

ZigzagGridRecyclerViewAdapter can be used with a standard RecyclerView. Declare the RecyclerView as normal in your layout XML.

<android.support.v7.widget.RecyclerView
        android:id="@+id/zigzag_recycler_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

Make sure your class in the list that your passing into the RecylerView implements the ZigzagImage interface (either returning a value for getZigzagImageResourceId() or getZigzagImageUrl() depending on how you supply your image data).

NOTE: images are loaded by the Picasso library at the moment

public class SnowImage implements ZigzagImage {

    private int snowImageResourceId;

    public SnowImage(int snowImageResourceId) {
        this.snowImageResourceId = snowImageResourceId;
    }

    @Override
    public String getZigzagImageUrl() {
        return null;
    }

    @Override
    public int getZigzagImageResourceId() {
        return snowImageResourceId;
    }
}

Then initialise the RecyclerView & ZigzagGridRecyclerViewAdapter in your activity as below.

LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
ZigzagGridRecyclerViewAdapter zigzagGridRecyclerViewAdapter = new ZigzagGridRecyclerViewAdapter(this, imageList, this);
zigzagGridRecyclerViewAdapter.setBackgroundColourResId(getResources().getColor(R.color.separator));

RecyclerView zigzagRecyclerView = findViewById(R.id.zigzag_recycler_view);
zigzagRecyclerView.setLayoutManager(linearLayoutManager);
zigzagRecyclerView.setAdapter(zigzagGridRecyclerViewAdapter);

You can also optionally change the separator colour (defaults to white) or add a placeholder drawable resource for image loading.

zigzagGridRecyclerViewAdapter.setBackgroundColourResId(getResources().getColor(R.color.separator));

zigzagGridRecyclerViewAdapter.setPlaceholderDrawableResId(R.drawable.placeholder_image);

There is also an ZigzagListOnClickListener that can be implemented to define the behaviour when an image is clicked. Either add it as part of the Adapter constructor (see above) or declare separably as below.

zigzagGridRecyclerViewAdapter.setZigzagListOnClickListener(new ZigzagGridRecyclerViewAdapter.ZigzagListOnClickListener() {
            @Override
            public void onZigzagImageClicked(int position, ZigzagImage zigzagImage) {
                //onClick behaviour here
            }
        });

TODO

  1. Add a optional label to bottom of image
  2. Allow change of the separator width

Thanks

This library has been made by using the amazing library 'Oblique' below. So huge thanks to the author which this is based on.

Licence

Copyright (c) 2018 Andy Barber

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].