From e1ee42c588fd0c9973600dde917779f530e1ff92 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 24 Jul 2017 01:02:38 -0700 Subject: Simplifying FeatureFlags by moving common flags to a base class. Only the modified flags need to be redefined. Bug: 63967896 Change-Id: I521018a45a4c6b3280a4fbcf97cac698f8470a03 --- .../com/android/launcher3/config/FeatureFlags.java | 42 +------------ src/com/android/launcher3/config/BaseFlags.java | 73 ++++++++++++++++++++++ .../com/android/launcher3/config/FeatureFlags.java | 46 +------------- 3 files changed, 75 insertions(+), 86 deletions(-) create mode 100644 src/com/android/launcher3/config/BaseFlags.java diff --git a/go/src_flags/com/android/launcher3/config/FeatureFlags.java b/go/src_flags/com/android/launcher3/config/FeatureFlags.java index a1b644c42..5bb2ac9a2 100644 --- a/go/src_flags/com/android/launcher3/config/FeatureFlags.java +++ b/go/src_flags/com/android/launcher3/config/FeatureFlags.java @@ -19,50 +19,10 @@ package com.android.launcher3.config; /** * Defines a set of flags used to control various launcher behaviors */ -public final class FeatureFlags { - - public static final boolean IS_DOGFOOD_BUILD = false; +public final class FeatureFlags extends BaseFlags { private FeatureFlags() {} - // Custom flags go below this - public static boolean LAUNCHER3_DISABLE_ICON_NORMALIZATION = false; - public static boolean LAUNCHER3_LEGACY_FOLDER_ICON = false; - public static boolean LAUNCHER3_DISABLE_PINCH_TO_OVERVIEW = false; - public static boolean LAUNCHER3_ALL_APPS_PULL_UP = true; - public static boolean LAUNCHER3_NEW_FOLDER_ANIMATION = true; - // When enabled allows to use any point on the fast scrollbar to start dragging. - public static boolean LAUNCHER3_DIRECT_SCROLL = true; - // When enabled while all-apps open, the soft input will be set to adjust resize . - public static boolean LAUNCHER3_UPDATE_SOFT_INPUT_MODE = true; - // When enabled the promise icon is visible in all apps while installation an app. - public static boolean LAUNCHER3_PROMISE_APPS_IN_ALL_APPS = false; - // When enabled uses the AllAppsRadialGradientAndScrimDrawable for all apps - public static boolean LAUNCHER3_GRADIENT_ALL_APPS = true; - // When enabled allows use of physics based motions in the Launcher. - public static boolean LAUNCHER3_PHYSICS = true; - // When enabled allows use of spring motions on the icons. - public static boolean LAUNCHER3_SPRING_ICONS = true; - - // Feature flag to enable moving the QSB on the 0th screen of the workspace. - public static final boolean QSB_ON_FIRST_SCREEN = true; - // When enabled the all-apps icon is not added to the hotseat. - public static final boolean NO_ALL_APPS_ICON = true; - // When enabled fling down gesture on the first workspace triggers search. - public static final boolean PULLDOWN_SEARCH = false; - // When enabled the status bar may show dark icons based on the top of the wallpaper. - public static final boolean LIGHT_STATUS_BAR = false; - // When enabled icons are badged with the number of notifications associated with that app. - public static final boolean BADGE_ICONS = true; - // When enabled, icons not supporting {@link AdaptiveIconDrawable} will be wrapped in {@link FixedScaleDrawable}. - public static final boolean LEGACY_ICON_TREATMENT = true; - // When enabled, adaptive icons would have shadows baked when being stored to icon cache. - public static final boolean ADAPTIVE_ICON_SHADOW = true; - // When enabled, app discovery will be enabled if service is implemented - public static final boolean DISCOVERY_ENABLED = false; - // When enabled, the qsb will be moved to the hotseat. - public static final boolean QSB_IN_HOTSEAT = true; - // Features to control Launcher3Go behavior public static final boolean GO_DISABLE_WIDGETS = true; } diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java new file mode 100644 index 000000000..9e0a3b3b5 --- /dev/null +++ b/src/com/android/launcher3/config/BaseFlags.java @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.launcher3.config; + +/** + * Defines a set of flags used to control various launcher behaviors. + * + * All the flags should be defined here with appropriate default values. To override a value, + * redefine it in {@link FeatureFlags}. + * + * This class is kept package-private to prevent direct access. + */ +abstract class BaseFlags { + + BaseFlags() {} + + public static final boolean IS_DOGFOOD_BUILD = false; + + // Custom flags go below this + public static boolean LAUNCHER3_DISABLE_ICON_NORMALIZATION = false; + public static boolean LAUNCHER3_LEGACY_FOLDER_ICON = false; + public static boolean LAUNCHER3_DISABLE_PINCH_TO_OVERVIEW = false; + public static boolean LAUNCHER3_ALL_APPS_PULL_UP = true; + public static boolean LAUNCHER3_NEW_FOLDER_ANIMATION = true; + // When enabled allows to use any point on the fast scrollbar to start dragging. + public static final boolean LAUNCHER3_DIRECT_SCROLL = true; + // When enabled while all-apps open, the soft input will be set to adjust resize . + public static final boolean LAUNCHER3_UPDATE_SOFT_INPUT_MODE = true; + // When enabled the promise icon is visible in all apps while installation an app. + public static final boolean LAUNCHER3_PROMISE_APPS_IN_ALL_APPS = false; + // When enabled uses the AllAppsRadialGradientAndScrimDrawable for all apps + public static final boolean LAUNCHER3_GRADIENT_ALL_APPS = true; + // When enabled allows use of physics based motions in the Launcher. + public static final boolean LAUNCHER3_PHYSICS = true; + // When enabled allows use of spring motions on the icons. + public static final boolean LAUNCHER3_SPRING_ICONS = true; + + // Feature flag to enable moving the QSB on the 0th screen of the workspace. + public static final boolean QSB_ON_FIRST_SCREEN = true; + // When enabled the all-apps icon is not added to the hotseat. + public static final boolean NO_ALL_APPS_ICON = true; + // When enabled fling down gesture on the first workspace triggers search. + public static final boolean PULLDOWN_SEARCH = false; + // When enabled the status bar may show dark icons based on the top of the wallpaper. + public static final boolean LIGHT_STATUS_BAR = false; + // When enabled icons are badged with the number of notifications associated with that app. + public static final boolean BADGE_ICONS = true; + // When enabled, icons not supporting {@link AdaptiveIconDrawable} will be wrapped in {@link FixedScaleDrawable}. + public static final boolean LEGACY_ICON_TREATMENT = true; + // When enabled, adaptive icons would have shadows baked when being stored to icon cache. + public static final boolean ADAPTIVE_ICON_SHADOW = true; + // When enabled, app discovery will be enabled if service is implemented + public static final boolean DISCOVERY_ENABLED = false; + // When enabled, the qsb will be moved to the hotseat. + public static final boolean QSB_IN_HOTSEAT = true; + + // Features to control Launcher3Go behavior + public static final boolean GO_DISABLE_WIDGETS = false; +} diff --git a/src_flags/com/android/launcher3/config/FeatureFlags.java b/src_flags/com/android/launcher3/config/FeatureFlags.java index 69840edd5..3ffb6c937 100644 --- a/src_flags/com/android/launcher3/config/FeatureFlags.java +++ b/src_flags/com/android/launcher3/config/FeatureFlags.java @@ -19,51 +19,7 @@ package com.android.launcher3.config; /** * Defines a set of flags used to control various launcher behaviors */ -public final class FeatureFlags { - - public static final boolean IS_DOGFOOD_BUILD = false; +public final class FeatureFlags extends BaseFlags { private FeatureFlags() {} - - // Custom flags go below this - public static boolean LAUNCHER3_DISABLE_ICON_NORMALIZATION = false; - public static boolean LAUNCHER3_LEGACY_FOLDER_ICON = false; - public static boolean LAUNCHER3_DISABLE_PINCH_TO_OVERVIEW = false; - public static boolean LAUNCHER3_ALL_APPS_PULL_UP = true; - public static boolean LAUNCHER3_NEW_FOLDER_ANIMATION = true; - // When enabled allows to use any point on the fast scrollbar to start dragging. - public static boolean LAUNCHER3_DIRECT_SCROLL = true; - // When enabled while all-apps open, the soft input will be set to adjust resize . - public static boolean LAUNCHER3_UPDATE_SOFT_INPUT_MODE = true; - // When enabled the promise icon is visible in all apps while installation an app. - public static boolean LAUNCHER3_PROMISE_APPS_IN_ALL_APPS = false; - // When enabled uses the AllAppsRadialGradientAndScrimDrawable for all apps - public static boolean LAUNCHER3_GRADIENT_ALL_APPS = true; - // When enabled allows use of physics based motions in the Launcher. - public static boolean LAUNCHER3_PHYSICS = true; - // When enabled allows use of spring motions on the icons. - public static boolean LAUNCHER3_SPRING_ICONS = true; - - // Feature flag to enable moving the QSB on the 0th screen of the workspace. - public static final boolean QSB_ON_FIRST_SCREEN = true; - // When enabled the all-apps icon is not added to the hotseat. - public static final boolean NO_ALL_APPS_ICON = true; - // When enabled fling down gesture on the first workspace triggers search. - public static final boolean PULLDOWN_SEARCH = false; - // When enabled the status bar may show dark icons based on the top of the wallpaper. - public static final boolean LIGHT_STATUS_BAR = false; - // When enabled icons are badged with the number of notifications associated with that app. - public static final boolean BADGE_ICONS = true; - // When enabled, icons not supporting {@link AdaptiveIconDrawable} will be wrapped in {@link FixedScaleDrawable}. - public static final boolean LEGACY_ICON_TREATMENT = true; - // When enabled, adaptive icons would have shadows baked when being stored to icon cache. - public static final boolean ADAPTIVE_ICON_SHADOW = true; - // When enabled, app discovery will be enabled if service is implemented - public static final boolean DISCOVERY_ENABLED = false; - // When enabled, the qsb will be moved to the hotseat. - public static final boolean QSB_IN_HOTSEAT = true; - - // Features to control Launcher3Go behavior - public static final boolean GO_DISABLE_WIDGETS = false; - } -- cgit v1.2.3