mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 15:56:49 +00:00
Merge "Create test for default grid" into tm-qpr-dev am: 267d7179cd
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20347132 Change-Id: I6cb50a223aa63323812133b50499fb84b6c19698 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -324,6 +324,11 @@ public class InvariantDeviceProfile {
|
||||
return displayOption.grid.name;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public static String getDefaultGridName(Context context) {
|
||||
return new InvariantDeviceProfile().initGrid(context, null);
|
||||
}
|
||||
|
||||
private void initGrid(Context context, Info displayInfo, DisplayOption displayOption,
|
||||
@DeviceType int deviceType) {
|
||||
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
|
||||
|
||||
@@ -521,6 +521,11 @@ public final class Utilities {
|
||||
return (int) (dp * Resources.getSystem().getDisplayMetrics().density);
|
||||
}
|
||||
|
||||
/** Converts a dp value to pixels for a certain density. */
|
||||
public static int dpToPx(float dp, int densityDpi) {
|
||||
float densityRatio = (float) densityDpi / DisplayMetrics.DENSITY_DEFAULT;
|
||||
return (int) (dp * densityRatio);
|
||||
}
|
||||
|
||||
public static int pxFromSp(float size, DisplayMetrics metrics) {
|
||||
return pxFromSp(size, metrics, 1f);
|
||||
|
||||
Reference in New Issue
Block a user