|
|
@ -25,11 +25,16 @@ import android.util.AttributeSet;
|
|
|
|
import android.view.Gravity;
|
|
|
|
import android.view.Gravity;
|
|
|
|
import android.view.MotionEvent;
|
|
|
|
import android.view.MotionEvent;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View;
|
|
|
|
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
|
|
|
import androidx.core.view.GravityCompat;
|
|
|
|
|
|
|
|
import androidx.core.view.ViewCompat;
|
|
|
|
import androidx.drawerlayout.widget.DrawerLayout;
|
|
|
|
import androidx.drawerlayout.widget.DrawerLayout;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
|
|
|
|
public class DrawerLayoutEx extends DrawerLayout {
|
|
|
|
public class DrawerLayoutEx extends DrawerLayout {
|
|
|
|
public DrawerLayoutEx(@NonNull Context context) {
|
|
|
|
public DrawerLayoutEx(@NonNull Context context) {
|
|
|
|
super(context);
|
|
|
|
super(context);
|
|
|
@ -89,4 +94,20 @@ public class DrawerLayoutEx extends DrawerLayout {
|
|
|
|
|
|
|
|
|
|
|
|
return super.dispatchGenericMotionEvent(ev);
|
|
|
|
return super.dispatchGenericMotionEvent(ev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void addFocusables(ArrayList<View> views, int direction, int focusableMode) {
|
|
|
|
|
|
|
|
if (getDrawerLockMode(Gravity.LEFT) == LOCK_MODE_LOCKED_OPEN) {
|
|
|
|
|
|
|
|
for (int i = 0; i < getChildCount(); i++) {
|
|
|
|
|
|
|
|
View child = getChildAt(i);
|
|
|
|
|
|
|
|
if (child.getVisibility() == View.VISIBLE && isContentView(child))
|
|
|
|
|
|
|
|
child.addFocusables(views, direction, focusableMode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
super.addFocusables(views, direction, focusableMode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean isContentView(View child) {
|
|
|
|
|
|
|
|
return ((LayoutParams) child.getLayoutParams()).gravity == Gravity.NO_GRAVITY;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|