mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-02 07:06:18 +02:00
Open nav menu by default when enabled
This commit is contained in:
@@ -20,7 +20,9 @@ package eu.faircode.email;
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
@@ -28,7 +30,9 @@ import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
public class DrawerLayoutEx extends DrawerLayout {
|
||||
public DrawerLayoutEx(@NonNull Context context) {
|
||||
@@ -43,11 +47,21 @@ public class DrawerLayoutEx extends DrawerLayout {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
void setup(Configuration config, View drawerContainer) {
|
||||
setScrimColor(Helper.resolveColor(getContext(), R.attr.colorDrawerScrim));
|
||||
if (config.orientation != Configuration.ORIENTATION_LANDSCAPE) {
|
||||
setDrawerLockMode(LOCK_MODE_UNLOCKED);
|
||||
void setup(Configuration config, View drawerContainer, ActionBarDrawerToggle drawerToggle) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
boolean normal = config.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL);
|
||||
boolean landscape = prefs.getBoolean("landscape", true);
|
||||
boolean landscape3 = prefs.getBoolean("landscape3", true);
|
||||
|
||||
if (normal && landscape && landscape3 &&
|
||||
config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
setScrimColor(Color.TRANSPARENT);
|
||||
openDrawer(drawerContainer, false);
|
||||
drawerToggle.onDrawerOpened(drawerContainer);
|
||||
} else {
|
||||
setScrimColor(Helper.resolveColor(getContext(), R.attr.colorDrawerScrim));
|
||||
closeDrawer(drawerContainer, false);
|
||||
drawerToggle.onDrawerClosed(drawerContainer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user