mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-31 22:26:06 +02:00
Fixed focus pinned nav menu
This commit is contained in:
@@ -25,11 +25,16 @@ import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class DrawerLayoutEx extends DrawerLayout {
|
||||
public DrawerLayoutEx(@NonNull Context context) {
|
||||
super(context);
|
||||
@@ -89,4 +94,20 @@ public class DrawerLayoutEx extends DrawerLayout {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user