Do a vertical check for two line text, if it clips dont show two line.

Added extra 16dp to the cell height in DeviceProfile as per spec: https://docs.google.com/presentation/d/1dSt-zY_wRrOmd9a9nsQG458CIK0RUqVJsHJxLHP_0Nc/edit#slide=id.g237e909075a_2_6
Updated tests andincluded vertical check to see if two line can be fully rendered without being clipped. Otherwise just show one line.
Since existing cell height is 104dp, we add 16dp to be up to spec (120dp)
- Clean up FeatureFlag ENABLE_TWOLINE_ALLAPPS and now use aconfig flag

bug: 270390937
Test: manually - photos
Regular font: https://screenshot.googleplex.com/ArUcgZgHqR4ZWBQ
Bigger font than regular that makes text to one line because it wouldve truncate: https://screenshot.googleplex.com/6s8EdMAbBLsYhLi
Bigger font than regular with predicted app row (twoline):
https://screenshot.googleplex.com/38TEQei5GvPiCc7
Super big font: https://screenshot.googleplex.com/3JUYYprJRQ32Hsq
big display and regular font: https://screenshot.googleplex.com/55rBKVQ8htSe9Vc
big display and bigger than regular font: https://screenshot.googleplex.com/3atzKzJUbfM7YQW
flag: is off

Change-Id: I6998ea5da35d3e00ac75327d16b5ca676fb11c1a
This commit is contained in:
Brandon Dayauon
2023-08-22 21:26:37 -07:00
parent 512d711a67
commit 3cdb32cc1f
6 changed files with 226 additions and 178 deletions
@@ -29,7 +29,6 @@ import androidx.recyclerview.widget.RecyclerView;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.Flags;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.search.SearchAdapterProvider;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.data.AppInfo;
@@ -138,7 +137,6 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
protected final OnClickListener mOnIconClickListener;
protected final OnLongClickListener mOnIconLongClickListener;
protected OnFocusChangeListener mIconFocusListener;
private final int mExtraTextHeight;
public BaseAllAppsAdapter(T activityContext, LayoutInflater inflater,
AlphabeticalAppsList<T> apps, SearchAdapterProvider<?> adapterProvider) {
@@ -150,8 +148,6 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
mOnIconLongClickListener = mActivityContext.getAllAppsItemLongClickListener();
mAdapterProvider = adapterProvider;
mExtraTextHeight = Utilities.calculateTextHeight(
mActivityContext.getDeviceProfile().allAppsIconTextSizePx);
}
/** Checks if the passed viewType represents all apps divider. */
@@ -177,9 +173,7 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
switch (viewType) {
case VIEW_TYPE_ICON:
int layout =
!(Flags.enableTwolineAllapps() || FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get())
? R.layout.all_apps_icon
int layout = !FeatureFlags.enableTwolineAllapps() ? R.layout.all_apps_icon
: R.layout.all_apps_icon_twoline;
BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate(
layout, parent, false);
@@ -190,9 +184,6 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
// Ensure the all apps icon height matches the workspace icons in portrait mode.
icon.getLayoutParams().height =
mActivityContext.getDeviceProfile().allAppsCellHeightPx;
if (Flags.enableTwolineAllapps() || FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get()) {
icon.getLayoutParams().height += mExtraTextHeight;
}
return new ViewHolder(icon);
case VIEW_TYPE_EMPTY_SEARCH:
return new ViewHolder(mLayoutInflater.inflate(R.layout.all_apps_empty_search,