Improved Surface Duo support

This commit is contained in:
M66B 2021-01-25 18:22:18 +01:00
parent 43d01b305e
commit b78404445b
2 changed files with 5 additions and 3 deletions

View File

@ -186,15 +186,17 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
content_separator = findViewById(R.id.content_separator);
content_pane = findViewById(R.id.content_pane);
if (Helper.isFoldable() &&
if (Helper.isSurfaceDuo() &&
(viewId == R.layout.activity_view_portrait_split ||
viewId == R.layout.activity_view_landscape_split)) {
View content_frame = findViewById(R.id.content_frame);
ViewGroup.LayoutParams lparam = content_frame.getLayoutParams();
if (lparam instanceof LinearLayout.LayoutParams) {
((LinearLayout.LayoutParams) lparam).weight = 1;
((LinearLayout.LayoutParams) lparam).weight = 1; // 50/50
content_frame.setLayoutParams(lparam);
}
// https://docs.microsoft.com/en-us/dual-screen/android/duo-dimensions
content_separator.getLayoutParams().width = Helper.dp2pixels(this, 34);
}
drawerLayout = findViewById(R.id.drawer_layout);

View File

@ -739,7 +739,7 @@ public class Helper {
return 0;
}
static boolean isFoldable() {
static boolean isSurfaceDuo() {
return ("Microsoft".equalsIgnoreCase(Build.MANUFACTURER) && "Surface Duo".equals(Build.MODEL));
}