mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-31 22:26:06 +02:00
Added inline nav menu pinning
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user