If Folders would show extremely cropped title, hide title.
This is an edge case, not standard behavior. This only happens when the text / display size is at the highest level, and when a folder has 10+ page indicator dots. Bug: 394355070 Test: Verified manually that this works well, and looks great in LTR mode and RTL mode. Flag: com.android.launcher3.enable_launcher_visual_refresh Change-Id: Id31aad47b94d20d9945495366d5381de27282153
This commit is contained in:
@@ -315,7 +315,7 @@
|
||||
<dimen name="page_indicator_gap_width">4dp</dimen>
|
||||
<dimen name="page_indicator_size">10dp</dimen>
|
||||
|
||||
|
||||
<dimen name="folder_title_min_width">100dp</dimen>
|
||||
<dimen name="folder_cell_x_padding">9dp</dimen>
|
||||
<dimen name="folder_cell_y_padding">6dp</dimen>
|
||||
<!-- label text size = workspace text size multiplied by this scale -->
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.launcher3.folder;
|
||||
|
||||
import static android.text.TextUtils.isEmpty;
|
||||
|
||||
import static com.android.launcher3.Flags.enableLauncherVisualRefresh;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY;
|
||||
import static com.android.launcher3.LauncherState.EDIT_MODE;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
@@ -299,6 +300,13 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
mContent.setFolder(this);
|
||||
|
||||
mPageIndicator = findViewById(R.id.folder_page_indicator);
|
||||
if (enableLauncherVisualRefresh()) {
|
||||
MarginLayoutParams params = ((MarginLayoutParams) mPageIndicator.getLayoutParams());
|
||||
int horizontalMargin = getContext().getResources()
|
||||
.getDimensionPixelSize(R.dimen.folder_footer_horiz_padding);
|
||||
params.setMarginStart(horizontalMargin);
|
||||
params.setMarginEnd(horizontalMargin);
|
||||
}
|
||||
mFooter = findViewById(R.id.folder_footer);
|
||||
mFooterHeight = dp.folderFooterHeightPx;
|
||||
mFolderName = findViewById(R.id.folder_name);
|
||||
@@ -312,7 +320,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
| InputType.TYPE_TEXT_FLAG_CAP_WORDS);
|
||||
mFolderName.forceDisableSuggestions(true);
|
||||
|
||||
|
||||
mKeyboardInsetAnimationCallback = new KeyboardInsetAnimationCallback(this);
|
||||
setWindowInsetsAnimationCallback(mKeyboardInsetAnimationCallback);
|
||||
}
|
||||
@@ -1269,6 +1276,23 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
setMeasuredDimension(folderWidth, folderHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the Folder Title has less than 100dp of available width, we hide it. The reason we do this
|
||||
* calculation in onSizeChange is because this callback is called 1x when the folder is opened.
|
||||
* <p>
|
||||
* The PageIndicator and the Folder Title share the same horizontal linear layout, but both
|
||||
* are dynamically sized. Therefore, we are setting visibility of the folder title AFTER the
|
||||
* layout is measured.
|
||||
*/
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
int minTitleWidth = getResources().getDimensionPixelSize(R.dimen.folder_title_min_width);
|
||||
if (enableLauncherVisualRefresh() && mFolderName.getMeasuredWidth() < minTitleWidth) {
|
||||
mFolderName.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rearranges the children based on their rank.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user