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

GalleryItemDecoration.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: c70dc827779b99dfd8e0ee27f1afd2bfa911e7ad (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
27
28
29
package it.niedermann.nextcloud.deck.ui.card.attachments.picker;

import android.graphics.Rect;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Px;
import androidx.recyclerview.widget.RecyclerView;

public class GalleryItemDecoration extends RecyclerView.ItemDecoration {

    @Px
    private final int gutter;

    public GalleryItemDecoration(@Px int gutter) {
        this.gutter = gutter;
    }

    @Override
    public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
        final int position = parent.getChildAdapterPosition(view);
        if (position >= 0) {
            outRect.left = gutter;
            outRect.top = gutter;
            outRect.right = gutter;
            outRect.bottom = gutter;
        }
    }
}