mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-08 01:53:25 +02:00
Added option to launch adjacent portrait/landscape
This commit is contained in:
@@ -1008,12 +1008,7 @@ public class Helper {
|
||||
intent.setDataAndTypeAndNormalize(uri, type);
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
|
||||
// https://developer.android.com/guide/topics/large-screens/multi-window-support#launch_adjacent
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean adjacent = prefs.getBoolean("adjacent", false);
|
||||
if (adjacent &&
|
||||
context instanceof ActivityView &&
|
||||
!((ActivityView) context).isSplit())
|
||||
if (launchAdjacent(context))
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
if (!TextUtils.isEmpty(name))
|
||||
@@ -1127,11 +1122,7 @@ public class Helper {
|
||||
if (task)
|
||||
view.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
// https://developer.android.com/guide/topics/large-screens/multi-window-support#launch_adjacent
|
||||
boolean adjacent = prefs.getBoolean("adjacent", false);
|
||||
if (adjacent &&
|
||||
context instanceof ActivityView &&
|
||||
!((ActivityView) context).isSplit())
|
||||
if (launchAdjacent(context))
|
||||
view.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
if ("chooser".equals(open_with_pkg) && !open_with_tabs) {
|
||||
@@ -1212,6 +1203,14 @@ public class Helper {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean launchAdjacent(Context context) {
|
||||
// https://developer.android.com/guide/topics/large-screens/multi-window-support#launch_adjacent
|
||||
Configuration config = context.getResources().getConfiguration();
|
||||
boolean portrait = (config.orientation == Configuration.ORIENTATION_PORTRAIT);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
return prefs.getBoolean("adjacent_" + (portrait ? "portrait" : "landscape"), false);
|
||||
}
|
||||
|
||||
static boolean customTabsWarmup(Context context) {
|
||||
if (context == null)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user