Loading res/layout/all_apps_icon_twoline.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2021 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. --> <com.android.launcher3.BubbleTextView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:launcher="http://schemas.android.com/apk/res-auto" style="@style/BaseIcon.AllApps" android:id="@+id/icon" android:singleLine="false" android:lines="2" android:inputType="textMultiLine" launcher:iconDisplay="all_apps" launcher:centerVertically="true" /> res/values/dimens.xml +2 −1 Original line number Diff line number Diff line Loading @@ -104,8 +104,9 @@ <dimen name="all_apps_divider_height">2dp</dimen> <dimen name="all_apps_divider_width">128dp</dimen> <dimen name="all_apps_content_fade_in_offset">150dp</dimen> <dimen name="all_apps_tip_bottom_margin">8dp</dimen> <dimen name="all_apps_height_extra">6dp</dimen> <!-- The size of corner radius of the arrow in the arrow toast. --> <dimen name="arrow_toast_corner_radius">2dp</dimen> <dimen name="arrow_toast_elevation">2dp</dimen> Loading src/com/android/launcher3/allapps/AllAppsGridAdapter.java +10 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.BubbleTextView; import com.android.launcher3.R; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.util.PackageManagerHelper; Loading Loading @@ -273,6 +274,8 @@ public class AllAppsGridAdapter extends // The intent to send off to the market app, updated each time the search query changes. private Intent mMarketSearchIntent; private final int mExtraHeight; public AllAppsGridAdapter(BaseDraggingActivity launcher, LayoutInflater inflater, AlphabeticalAppsList apps, BaseAdapterProvider[] adapterProviders) { Resources res = launcher.getResources(); Loading @@ -288,6 +291,7 @@ public class AllAppsGridAdapter extends mAdapterProviders = adapterProviders; setAppsPerRow(mLauncher.getDeviceProfile().numShownAllAppsColumns); mExtraHeight = launcher.getResources().getDimensionPixelSize(R.dimen.all_apps_height_extra); } public void setAppsPerRow(int appsPerRow) { Loading Loading @@ -347,14 +351,19 @@ public class AllAppsGridAdapter extends public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case VIEW_TYPE_ICON: int layout = !FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get() ? R.layout.all_apps_icon : R.layout.all_apps_icon_twoline; BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate( R.layout.all_apps_icon, parent, false); layout, parent, false); icon.setLongPressTimeoutFactor(1f); icon.setOnFocusChangeListener(mIconFocusListener); icon.setOnClickListener(mOnIconClickListener); icon.setOnLongClickListener(mOnIconLongClickListener); // Ensure the all apps icon height matches the workspace icons in portrait mode. icon.getLayoutParams().height = mLauncher.getDeviceProfile().allAppsCellHeightPx; if (FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get()) { icon.getLayoutParams().height += mExtraHeight; } return new ViewHolder(icon); case VIEW_TYPE_EMPTY_SEARCH: return new ViewHolder(mLayoutInflater.inflate(R.layout.all_apps_empty_search, Loading src/com/android/launcher3/config/FeatureFlags.java +3 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,9 @@ public final class FeatureFlags { public static final BooleanFlag ENABLE_ONE_SEARCH = new DeviceFlag("ENABLE_ONE_SEARCH", false, "Use homescreen search box to complete allApps searches"); public static final BooleanFlag ENABLE_TWOLINE_ALLAPPS = getDebugFlag( "ENABLE_TWOLINE_ALLAPPS", false, "Enables two line label inside all apps."); public static final BooleanFlag ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING = new DeviceFlag( "ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING", true, "Allows on device search in all apps logging"); Loading Loading
res/layout/all_apps_icon_twoline.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2021 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. --> <com.android.launcher3.BubbleTextView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:launcher="http://schemas.android.com/apk/res-auto" style="@style/BaseIcon.AllApps" android:id="@+id/icon" android:singleLine="false" android:lines="2" android:inputType="textMultiLine" launcher:iconDisplay="all_apps" launcher:centerVertically="true" />
res/values/dimens.xml +2 −1 Original line number Diff line number Diff line Loading @@ -104,8 +104,9 @@ <dimen name="all_apps_divider_height">2dp</dimen> <dimen name="all_apps_divider_width">128dp</dimen> <dimen name="all_apps_content_fade_in_offset">150dp</dimen> <dimen name="all_apps_tip_bottom_margin">8dp</dimen> <dimen name="all_apps_height_extra">6dp</dimen> <!-- The size of corner radius of the arrow in the arrow toast. --> <dimen name="arrow_toast_corner_radius">2dp</dimen> <dimen name="arrow_toast_elevation">2dp</dimen> Loading
src/com/android/launcher3/allapps/AllAppsGridAdapter.java +10 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.BubbleTextView; import com.android.launcher3.R; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.util.PackageManagerHelper; Loading Loading @@ -273,6 +274,8 @@ public class AllAppsGridAdapter extends // The intent to send off to the market app, updated each time the search query changes. private Intent mMarketSearchIntent; private final int mExtraHeight; public AllAppsGridAdapter(BaseDraggingActivity launcher, LayoutInflater inflater, AlphabeticalAppsList apps, BaseAdapterProvider[] adapterProviders) { Resources res = launcher.getResources(); Loading @@ -288,6 +291,7 @@ public class AllAppsGridAdapter extends mAdapterProviders = adapterProviders; setAppsPerRow(mLauncher.getDeviceProfile().numShownAllAppsColumns); mExtraHeight = launcher.getResources().getDimensionPixelSize(R.dimen.all_apps_height_extra); } public void setAppsPerRow(int appsPerRow) { Loading Loading @@ -347,14 +351,19 @@ public class AllAppsGridAdapter extends public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case VIEW_TYPE_ICON: int layout = !FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get() ? R.layout.all_apps_icon : R.layout.all_apps_icon_twoline; BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate( R.layout.all_apps_icon, parent, false); layout, parent, false); icon.setLongPressTimeoutFactor(1f); icon.setOnFocusChangeListener(mIconFocusListener); icon.setOnClickListener(mOnIconClickListener); icon.setOnLongClickListener(mOnIconLongClickListener); // Ensure the all apps icon height matches the workspace icons in portrait mode. icon.getLayoutParams().height = mLauncher.getDeviceProfile().allAppsCellHeightPx; if (FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get()) { icon.getLayoutParams().height += mExtraHeight; } return new ViewHolder(icon); case VIEW_TYPE_EMPTY_SEARCH: return new ViewHolder(mLayoutInflater.inflate(R.layout.all_apps_empty_search, Loading
src/com/android/launcher3/config/FeatureFlags.java +3 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,9 @@ public final class FeatureFlags { public static final BooleanFlag ENABLE_ONE_SEARCH = new DeviceFlag("ENABLE_ONE_SEARCH", false, "Use homescreen search box to complete allApps searches"); public static final BooleanFlag ENABLE_TWOLINE_ALLAPPS = getDebugFlag( "ENABLE_TWOLINE_ALLAPPS", false, "Enables two line label inside all apps."); public static final BooleanFlag ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING = new DeviceFlag( "ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING", true, "Allows on device search in all apps logging"); Loading