mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-29 13:24:52 +02:00
Lock orientation
This commit is contained in:
@@ -22,6 +22,7 @@ package eu.faircode.email;
|
||||
import static android.app.ActionBar.DISPLAY_SHOW_CUSTOM;
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.RecoverableSecurityException;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
@@ -30,6 +31,7 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.IntentSender;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
@@ -85,6 +87,8 @@ public class FragmentBase extends Fragment {
|
||||
private int scrollToResid = 0;
|
||||
private int scrollToOffset = 0;
|
||||
|
||||
private Integer orientation = null;
|
||||
|
||||
private static final int REQUEST_ATTACHMENT = 51;
|
||||
private static final int REQUEST_ATTACHMENTS = 52;
|
||||
private static final int REQUEST_RECOVERABLE_PERMISSION = 53;
|
||||
@@ -409,9 +413,22 @@ public class FragmentBase extends Fragment {
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
Log.i("Destroy " + this);
|
||||
if (orientation != null) {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.setRequestedOrientation(orientation);
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
protected void lockOrientation() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
orientation = activity.getRequestedOrientation();
|
||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHasOptionsMenu(boolean hasMenu) {
|
||||
super.setHasOptionsMenu(!isPane() && hasMenu);
|
||||
|
||||
Reference in New Issue
Block a user