⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

List of edit mode, including delete, sort function.

Notifications You must be signed in to change notification settings

NanBox/EditMode

Repository files navigation

EditMode

List of edit mode, including delete, sort function.

Usage

Add the dependencies to your gradle file:

dependencies {
    compile 'com.southernbox:EditMode:1.0.0'
}

In the activity layout file, replace the RecyclerView with EditRecyclerView:

<com.southernbox.editmode.EditRecyclerView
    android:id="@+id/recycler_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

Use EditLayout in the item layout file:

<com.southernbox.editmode.EditLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/edit_layout"
    android:layout_width="match_parent"
    android:layout_height="@dimen/item_height">

    <!--Delete Button-->

    <!--Content-->

    <!--PreDelete button-->

    <!--Content-->

    <!--Sort Button-->

</com.southernbox.editmode.EditLayout>

Extend EditAdapter:

public class MyAdapter extends EditAdapter<Entity> {

    MyAdapter(Context context, List<Entity> list) {
        super(context, list);
    }

    @Override
    public EditViewHolder onCreateEditViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_list, parent, false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindEditViewHolder(EditViewHolder holder, int position) {
        // bind holder.vContent
    }

    private static class ViewHolder extends EditViewHolder {
        // ...
    }
}

About

List of edit mode, including delete, sort function.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages