aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/SwipeLockLinearLayoutManager.java
blob: 0ab8e67846fedf58685c4cfb66020e0cfa7ee2de (plain) (blame)
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
30
31
package ml.docilealligator.infinityforreddit.customviews;

import android.content.Context;
import android.view.View;

import androidx.annotation.Nullable;

public class SwipeLockLinearLayoutManager extends LinearLayoutManagerBugFixed {

    @Nullable
    private final SwipeLockInterface swipeLockInterface;

    public SwipeLockLinearLayoutManager(Context context,
                                        @Nullable SwipeLockInterface swipeLockInterface) {
        super(context);
        this.swipeLockInterface = swipeLockInterface;
    }

    public SwipeLockLinearLayoutManager(Context context, int orientation, boolean reverseLayout, @Nullable SwipeLockInterface swipeLockInterface) {
        super(context, orientation, reverseLayout);
        this.swipeLockInterface = swipeLockInterface;
    }

    @Override
    public void addView(View child) {
        super.addView(child);
        if (child instanceof SwipeLockView) {
            ((SwipeLockView) child).setSwipeLockInterface(swipeLockInterface);
        }
    }
}