public bool Initialize(Activity activity) { if (!IsDualScreenDevice(activity)) { return(false); } try { Activity = activity; DisplayMask = DisplayMask.FromResourcesRectApproximation(Activity); if (DisplayMask == null) { return(false); } } catch (Java.Lang.NoSuchMethodError ex) { ex.PrintStackTrace(); return(false); } catch (Java.Lang.RuntimeException ex) { ex.PrintStackTrace(); return(false); } catch (Java.Lang.NoClassDefFoundError ex) { ex.PrintStackTrace(); return(false); } return(true); }
Rect GetHinge(SurfaceOrientation rotation) { // Hinge's coordinates of its 4 edges in different mode // Double Landscape Rect(0, 1350 - 1800, 1434) // Double Portrait Rect(1350, 0 - 1434, 1800) var boundings = DisplayMask.GetBoundingRectsForRotation(rotation); return(boundings.FirstOrDefault()); }
public void Update() => DisplayMask = DisplayMask.FromResourcesRectApproximation(Activity);