chore: Cleanup, and hidden feature logged
Signed-off-by: Pun Butrach <pun.butrach@gmail.com>
This commit is contained in:
1 parent
5180c3d4c4
commit
11f7abcb66
1818 files changed
+104945
-147848
No files matched your search
@@ -16,10 +16,10 @@
|
||||
|
||||
package com.android.launcher3;
|
||||
|
||||
import static com.android.launcher3.Flags.enableMouseInteractionChanges;
|
||||
import static com.android.launcher3.BuildConfigs.WIDGET_ON_FIRST_SCREEN;
|
||||
import static com.android.launcher3.Flags.enableSmartspaceAsAWidget;
|
||||
import static com.android.launcher3.graphics.ShapeDelegate.DEFAULT_PATH_SIZE;
|
||||
import static com.android.launcher3.icons.BitmapInfo.FLAG_THEMED;
|
||||
import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_MAIN;
|
||||
@@ -171,13 +171,16 @@ public final class Utilities {
|
||||
* @deprecated Use {@link BuildConfig#IS_DEBUG_DEVICE} directly
|
||||
*/
|
||||
@Deprecated
|
||||
public static final boolean IS_DEBUG_DEVICE = BuildConfigs.IS_DEBUG_DEVICE;
|
||||
public static final boolean IS_DEBUG_DEVICE = false;
|
||||
|
||||
public static final int TRANSLATE_UP = 0;
|
||||
public static final int TRANSLATE_DOWN = 1;
|
||||
public static final int TRANSLATE_LEFT = 2;
|
||||
public static final int TRANSLATE_RIGHT = 3;
|
||||
|
||||
public static final boolean SHOULD_SHOW_FIRST_PAGE_WIDGET =
|
||||
enableSmartspaceAsAWidget() && WIDGET_ON_FIRST_SCREEN;
|
||||
|
||||
@IntDef({TRANSLATE_UP, TRANSLATE_DOWN, TRANSLATE_LEFT, TRANSLATE_RIGHT})
|
||||
public @interface AdjustmentDirection{}
|
||||
|
||||
@@ -262,7 +265,7 @@ public final class Utilities {
|
||||
public static boolean isPropertyEnabled(String propertyName) {
|
||||
return Log.isLoggable(propertyName, Log.VERBOSE);
|
||||
}
|
||||
|
||||
|
||||
public static boolean showStyleWallpapers(Context context) {
|
||||
return existsStyleWallpapers(context) || existsStyleWallpapersAlt(context);
|
||||
}
|
||||
@@ -538,25 +541,6 @@ public final class Utilities {
|
||||
return (int) mapRange(interpolator.getInterpolation(progress), toMin, toMax);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO(b/235886078): workaround needed because of this bug
|
||||
* Icons are 10% larger on XML than their visual size, so remove that extra space to get
|
||||
* some dimensions correct.
|
||||
*
|
||||
* When this bug is resolved this method will no longer be needed and we would be able to
|
||||
* replace all instances where this method is called with iconSizePx.
|
||||
*/
|
||||
public static int getIconVisibleSizePx(int iconSizePx) {
|
||||
return Math.round(ICON_VISIBLE_AREA_FACTOR * iconSizePx);
|
||||
}
|
||||
|
||||
public static int getNormalizedIconDrawablePadding(int iconSizePx, int iconDrawablePadding) {
|
||||
return Math.max(
|
||||
0,
|
||||
iconDrawablePadding - ((iconSizePx - getIconVisibleSizePx(iconSizePx)) / 2)
|
||||
);
|
||||
}
|
||||
|
||||
/** Bounds t between a lower and upper bound and maps the result to a range. */
|
||||
public static float mapBoundToRange(float t, float lowerBound, float upperBound,
|
||||
float toMin, float toMax, Interpolator interpolator) {
|
||||
@@ -613,11 +597,6 @@ public final class Utilities {
|
||||
return (int) (dp * Resources.getSystem().getDisplayMetrics().density);
|
||||
}
|
||||
|
||||
/** Converts a dp value to pixels for the current context. */
|
||||
public static int dpToPx(float dp, Context context) {
|
||||
return (int) (dp * context.getResources().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;
|
||||
@@ -831,12 +810,12 @@ public final class Utilities {
|
||||
IconThemeController themeController =
|
||||
ThemeManager.INSTANCE.get(context).getThemeController();
|
||||
if (themeController != null) {
|
||||
result = themeController.createThemedAdaptiveIcon(
|
||||
AdaptiveIconDrawable themed = themeController.createThemedAdaptiveIcon(
|
||||
context,
|
||||
result,
|
||||
info instanceof ItemInfoWithIcon iiwi ? iiwi.bitmap : null);
|
||||
if (result == null) {
|
||||
return null;
|
||||
if (themed != null) {
|
||||
result = themed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -969,12 +948,9 @@ public final class Utilities {
|
||||
*/
|
||||
public static List<SplitPositionOption> getSplitPositionOptions(
|
||||
DeviceProfile dp) {
|
||||
int splitIconRes;
|
||||
if (dp.isLeftRightSplit) {
|
||||
splitIconRes = R.drawable.ic_split_horizontal;
|
||||
} else {
|
||||
splitIconRes = R.drawable.ic_split_vertical;
|
||||
}
|
||||
int splitIconRes = dp.isLeftRightSplit
|
||||
? R.drawable.ic_split_horizontal
|
||||
: R.drawable.ic_split_vertical;
|
||||
int stagePosition = dp.isLeftRightSplit
|
||||
? STAGE_POSITION_BOTTOM_OR_RIGHT
|
||||
: STAGE_POSITION_TOP_OR_LEFT;
|
||||
@@ -1101,17 +1077,8 @@ public final class Utilities {
|
||||
* <p>Debug devices by default include -eng and -userdebug builds, but not -user builds.
|
||||
*/
|
||||
public static void debugLog(String tag, String message) {
|
||||
if (BuildConfigs.IS_DEBUG_DEVICE) {
|
||||
if (false) {
|
||||
Log.d(tag, message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether mouse interaction changes intended for the desktop form factor should be
|
||||
* enabled.
|
||||
*/
|
||||
public static boolean shouldEnableMouseInteractionChanges(Context context) {
|
||||
return enableMouseInteractionChanges() && context.getResources().getBoolean(
|
||||
R.bool.desktop_form_factor);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user