Loading res/values-sw600dp/config.xml +0 −1 Original line number Diff line number Diff line <resources> <bool name="is_tablet">true</bool> <bool name="allow_rotation">true</bool> </resources> res/values-sw720dp/config.xml +0 −1 Original line number Diff line number Diff line <resources> <bool name="config_largeHeap">true</bool> <bool name="is_large_tablet">true</bool> <!-- All Apps & Widgets --> <!-- Out of 100, the percent to shrink the workspace during spring loaded mode. --> Loading res/values/config.xml +0 −2 Original line number Diff line number Diff line <resources> <!-- Miscellaneous --> <bool name="config_largeHeap">false</bool> <bool name="is_tablet">false</bool> <bool name="is_large_tablet">false</bool> <bool name="allow_rotation">false</bool> <integer name="extracted_color_gradient_alpha">153</integer> Loading src/com/android/launcher3/DeviceProfile.java +15 −9 Original line number Diff line number Diff line Loading @@ -32,6 +32,10 @@ import com.android.launcher3.util.DefaultDisplay; public class DeviceProfile { private static final float TABLET_MIN_DPS = 600; private static final float LARGE_TABLET_MIN_DPS = 720; public final InvariantDeviceProfile inv; private final DefaultDisplay.Info mInfo; Loading Loading @@ -158,11 +162,12 @@ public class DeviceProfile { } mInfo = info; Resources res = context.getResources(); // Constants from resources isTablet = res.getBoolean(R.bool.is_tablet); isLargeTablet = res.getBoolean(R.bool.is_large_tablet); float swDPs = Utilities.dpiFromPx( Math.min(info.smallestSize.x, info.smallestSize.y), info.metrics); isTablet = swDPs >= TABLET_MIN_DPS; isLargeTablet = swDPs >= LARGE_TABLET_MIN_DPS; isPhone = !isTablet && !isLargeTablet; aspectRatio = ((float) Math.max(widthPx, heightPx)) / Math.min(widthPx, heightPx); boolean isTallDevice = Float.compare(aspectRatio, TALL_DEVICE_ASPECT_RATIO_THRESHOLD) >= 0; Loading @@ -170,10 +175,10 @@ public class DeviceProfile { // Some more constants this.transposeLayoutWithOrientation = transposeLayoutWithOrientation; context = getContext(context, isVerticalBarLayout() context = getContext(context, info, isVerticalBarLayout() ? Configuration.ORIENTATION_LANDSCAPE : Configuration.ORIENTATION_PORTRAIT); res = context.getResources(); final Resources res = context.getResources(); edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin); desiredWorkspaceLeftRightMarginPx = isVerticalBarLayout() ? 0 : edgeMarginPx; Loading Loading @@ -632,10 +637,11 @@ public class DeviceProfile { } } private static Context getContext(Context c, int orientation) { Configuration context = new Configuration(c.getResources().getConfiguration()); context.orientation = orientation; return c.createConfigurationContext(context); private static Context getContext(Context c, DefaultDisplay.Info info, int orientation) { Configuration config = new Configuration(c.getResources().getConfiguration()); config.orientation = orientation; config.densityDpi = info.metrics.densityDpi; return c.createConfigurationContext(config); } /** Loading src/com/android/launcher3/util/DefaultDisplay.java +3 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ */ package com.android.launcher3.util; import static android.view.Display.DEFAULT_DISPLAY; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import android.content.Context; Loading @@ -26,7 +28,6 @@ import android.os.Message; import android.util.DisplayMetrics; import android.util.Log; import android.view.Display; import android.view.WindowManager; import androidx.annotation.VisibleForTesting; Loading Loading @@ -142,7 +143,7 @@ public class DefaultDisplay implements DisplayListener { } private Info(Context context) { this(context.getSystemService(WindowManager.class).getDefaultDisplay()); this(context.getSystemService(DisplayManager.class).getDisplay(DEFAULT_DISPLAY)); } public Info(Display display) { Loading Loading
res/values-sw600dp/config.xml +0 −1 Original line number Diff line number Diff line <resources> <bool name="is_tablet">true</bool> <bool name="allow_rotation">true</bool> </resources>
res/values-sw720dp/config.xml +0 −1 Original line number Diff line number Diff line <resources> <bool name="config_largeHeap">true</bool> <bool name="is_large_tablet">true</bool> <!-- All Apps & Widgets --> <!-- Out of 100, the percent to shrink the workspace during spring loaded mode. --> Loading
res/values/config.xml +0 −2 Original line number Diff line number Diff line <resources> <!-- Miscellaneous --> <bool name="config_largeHeap">false</bool> <bool name="is_tablet">false</bool> <bool name="is_large_tablet">false</bool> <bool name="allow_rotation">false</bool> <integer name="extracted_color_gradient_alpha">153</integer> Loading
src/com/android/launcher3/DeviceProfile.java +15 −9 Original line number Diff line number Diff line Loading @@ -32,6 +32,10 @@ import com.android.launcher3.util.DefaultDisplay; public class DeviceProfile { private static final float TABLET_MIN_DPS = 600; private static final float LARGE_TABLET_MIN_DPS = 720; public final InvariantDeviceProfile inv; private final DefaultDisplay.Info mInfo; Loading Loading @@ -158,11 +162,12 @@ public class DeviceProfile { } mInfo = info; Resources res = context.getResources(); // Constants from resources isTablet = res.getBoolean(R.bool.is_tablet); isLargeTablet = res.getBoolean(R.bool.is_large_tablet); float swDPs = Utilities.dpiFromPx( Math.min(info.smallestSize.x, info.smallestSize.y), info.metrics); isTablet = swDPs >= TABLET_MIN_DPS; isLargeTablet = swDPs >= LARGE_TABLET_MIN_DPS; isPhone = !isTablet && !isLargeTablet; aspectRatio = ((float) Math.max(widthPx, heightPx)) / Math.min(widthPx, heightPx); boolean isTallDevice = Float.compare(aspectRatio, TALL_DEVICE_ASPECT_RATIO_THRESHOLD) >= 0; Loading @@ -170,10 +175,10 @@ public class DeviceProfile { // Some more constants this.transposeLayoutWithOrientation = transposeLayoutWithOrientation; context = getContext(context, isVerticalBarLayout() context = getContext(context, info, isVerticalBarLayout() ? Configuration.ORIENTATION_LANDSCAPE : Configuration.ORIENTATION_PORTRAIT); res = context.getResources(); final Resources res = context.getResources(); edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin); desiredWorkspaceLeftRightMarginPx = isVerticalBarLayout() ? 0 : edgeMarginPx; Loading Loading @@ -632,10 +637,11 @@ public class DeviceProfile { } } private static Context getContext(Context c, int orientation) { Configuration context = new Configuration(c.getResources().getConfiguration()); context.orientation = orientation; return c.createConfigurationContext(context); private static Context getContext(Context c, DefaultDisplay.Info info, int orientation) { Configuration config = new Configuration(c.getResources().getConfiguration()); config.orientation = orientation; config.densityDpi = info.metrics.densityDpi; return c.createConfigurationContext(config); } /** Loading
src/com/android/launcher3/util/DefaultDisplay.java +3 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ */ package com.android.launcher3.util; import static android.view.Display.DEFAULT_DISPLAY; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import android.content.Context; Loading @@ -26,7 +28,6 @@ import android.os.Message; import android.util.DisplayMetrics; import android.util.Log; import android.view.Display; import android.view.WindowManager; import androidx.annotation.VisibleForTesting; Loading Loading @@ -142,7 +143,7 @@ public class DefaultDisplay implements DisplayListener { } private Info(Context context) { this(context.getSystemService(WindowManager.class).getDefaultDisplay()); this(context.getSystemService(DisplayManager.class).getDisplay(DEFAULT_DISPLAY)); } public Info(Display display) { Loading