Path: blob/v3_openjdk/app_pojavlauncher/src/main/java/com/kdt/DefocusableScrollView.java
2129 views
package com.kdt;12import android.content.Context;3import android.graphics.Rect;4import android.util.AttributeSet;5import android.widget.ScrollView;67/**8Class allowing to ignore the focusing from an item such an EditText within it.9Ignoring it will stop the scrollView from refocusing on the view10*/11public class DefocusableScrollView extends ScrollView {12131415private boolean mKeepFocusing = false;161718public DefocusableScrollView(Context context) {19super(context);20}2122public DefocusableScrollView(Context context, AttributeSet attrs) {23super(context, attrs);24}2526public DefocusableScrollView(Context context, AttributeSet attrs, int defStyleAttr) {27super(context, attrs, defStyleAttr);28}2930public DefocusableScrollView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {31super(context, attrs, defStyleAttr, defStyleRes);32}3334public void setKeepFocusing(boolean shouldKeepFocusing){35mKeepFocusing = shouldKeepFocusing;36}3738public boolean isKeepFocusing(){39return mKeepFocusing;40}4142@Override43protected int computeScrollDeltaToGetChildRectOnScreen(Rect rect) {44if(!mKeepFocusing) return 0;45return super.computeScrollDeltaToGetChildRectOnScreen(rect);46}474849}505152