From 8fe9f6c555a2555bdc67b096e619001f6c865dfc Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 29 Apr 2023 20:39:04 +0200 Subject: [PATCH] Added Surface Duo 2 support --- .../main/java/eu/faircode/email/ActivityView.java | 3 ++- app/src/main/java/eu/faircode/email/Helper.java | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ActivityView.java b/app/src/main/java/eu/faircode/email/ActivityView.java index 22156c68e7..c3d76a3563 100644 --- a/app/src/main/java/eu/faircode/email/ActivityView.java +++ b/app/src/main/java/eu/faircode/email/ActivityView.java @@ -280,7 +280,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB content_frame.setLayoutParams(lparam); } // https://docs.microsoft.com/en-us/dual-screen/android/duo-dimensions - content_separator.getLayoutParams().width = Helper.dp2pixels(this, 34); + int seam = (Helper.isSurfaceDuo2() ? 26 : 34); + content_separator.getLayoutParams().width = Helper.dp2pixels(this, seam); } else { int column_width = prefs.getInt("column_width", 67); ViewGroup.LayoutParams lparam = content_pane.getLayoutParams(); diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java index 41970b9f88..0e8f8ed8b9 100644 --- a/app/src/main/java/eu/faircode/email/Helper.java +++ b/app/src/main/java/eu/faircode/email/Helper.java @@ -1472,7 +1472,19 @@ public class Helper { } static boolean isSurfaceDuo() { - return ("Microsoft".equalsIgnoreCase(Build.MANUFACTURER) && "Surface Duo".equals(Build.MODEL)); + return (isSurfaceDuo2() || + ("Microsoft".equalsIgnoreCase(Build.MANUFACTURER) && "Surface Duo".equals(Build.MODEL))); + } + + static boolean isSurfaceDuo2() { + /* + Brand: surface + Manufacturer: Microsoft + Model: Surface Duo 2 + Product: duo2 + Device: duo2 + */ + return ("Microsoft".equalsIgnoreCase(Build.MANUFACTURER) && "Surface Duo 2".equals(Build.MODEL)); } static boolean isArc() {