1package com.example.android.nativemididemo;
2
3import android.content.Context;
4import android.view.MotionEvent;
5import android.util.AttributeSet;
6import android.widget.ScrollView;
7
8public class TouchableScrollView extends ScrollView {
9    public boolean isTouched;
10
11    public TouchableScrollView(Context context) {
12        super(context);
13    }
14
15    public TouchableScrollView(Context context, AttributeSet attrs) {
16        super(context, attrs);
17    }
18
19    @Override
20    public boolean onTouchEvent(MotionEvent event) {
21        switch (event.getAction()) {
22            case MotionEvent.ACTION_DOWN:
23                isTouched = true;
24                break;
25            case MotionEvent.ACTION_CANCEL:
26            case MotionEvent.ACTION_UP:
27                isTouched = false;
28                break;
29        }
30        return super.onTouchEvent(event);
31    }
32}
33