Added inline nav menu pinning

This commit is contained in:
M66B
2021-08-11 18:37:41 +02:00
parent b1a0ae247a
commit 5d069f5e9c
16 changed files with 187 additions and 157 deletions

View File

@@ -20,9 +20,6 @@ package eu.faircode.email;
*/
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.Gravity;
@@ -31,9 +28,7 @@ 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) {
@@ -48,28 +43,11 @@ public class DrawerLayoutEx extends DrawerLayout {
super(context, attrs, defStyle);
}
void setup(Configuration config, View drawerContainer, ActionBarDrawerToggle drawerToggle) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean portrait3 = prefs.getBoolean("portrait3", false);
boolean landscape3 = prefs.getBoolean("landscape3", true);
if (((portrait3 && config.orientation == Configuration.ORIENTATION_PORTRAIT) ||
(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);
}
}
public boolean isLocked(View view) {
return (getDrawerLockMode(view) != LOCK_MODE_UNLOCKED);
}
public boolean isLocked() {
private boolean isLocked() {
return (getDrawerLockMode(Gravity.LEFT) == LOCK_MODE_LOCKED_OPEN ||
getDrawerLockMode(Gravity.RIGHT) == LOCK_MODE_LOCKED_OPEN);
}