That fuck shit the fascists are using
1package org.tm.archive.components;
2
3import android.content.Context;
4import android.content.res.TypedArray;
5import android.util.AttributeSet;
6import android.widget.ScrollView;
7
8import androidx.annotation.Nullable;
9
10import org.tm.archive.R;
11
12public class MaxHeightScrollView extends ScrollView {
13
14 private int maxHeight = -1;
15
16 public MaxHeightScrollView(Context context) {
17 super(context);
18 initialize(null);
19 }
20
21 public MaxHeightScrollView(Context context, AttributeSet attrs) {
22 super(context, attrs);
23 initialize(attrs);
24 }
25
26 private void initialize(@Nullable AttributeSet attrs) {
27 if (attrs != null) {
28 TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.MaxHeightScrollView, 0, 0);
29
30 maxHeight = typedArray.getDimensionPixelOffset(R.styleable.MaxHeightScrollView_scrollView_maxHeight, -1);
31
32 typedArray.recycle();
33 }
34 }
35
36 @Override
37 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
38 if (maxHeight >= 0) {
39 heightMeasureSpec = MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.AT_MOST);
40 }
41 super.onMeasure(widthMeasureSpec, heightMeasureSpec);
42 }
43}