Welcome to mirror list, hosted at ThFree Co, Russian Federation.

AbstractPickerAdapter.java « picker « attachments « card « ui « deck « nextcloud « niedermann « it « java « main « src « app - github.com/stefan-niedermann/nextcloud-deck.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 901d204cd6fbc1466806243422bb5cb802353996 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package it.niedermann.nextcloud.deck.ui.card.attachments.picker;

import androidx.recyclerview.widget.RecyclerView;

public abstract class AbstractPickerAdapter<T extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<T> {

    protected static final int VIEW_TYPE_NONE = -1;
    protected static final int VIEW_TYPE_ITEM = 0;
    protected static final int VIEW_TYPE_ITEM_NATIVE = 1;

    @Override
    public int getItemViewType(int position) {
        if (position > 0) {
            return VIEW_TYPE_ITEM;
        } else if (position == 0) {
            return VIEW_TYPE_ITEM_NATIVE;
        } else {
            return VIEW_TYPE_NONE;
        }
    }

    /**
     * Call this method when the {@link AbstractPickerAdapter} is no longer need to free resources.
     */
    public abstract void onDestroy();
}