mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Fix folder UI open regression when tapping edit text / Fix NPE
Bug: 149835166 Bug: 149839789 Change-Id: I295cc72e4228249794eae11f177226179f2a175f
This commit is contained in:
@@ -326,7 +326,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
(FolderNameInfo[]) mInfo.suggestedFolderNames.getParcelableArrayExtra(
|
||||
FolderInfo.EXTRA_FOLDER_SUGGESTIONS);
|
||||
if (nameInfos != null) {
|
||||
showLabelSuggestion(nameInfos);
|
||||
showLabelSuggestion(nameInfos, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -468,7 +468,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
nameInfos);
|
||||
if (isEmpty(mFolderName.getText().toString())
|
||||
&& !mInfo.hasOption(FLAG_MANUAL_FOLDER_NAME)) {
|
||||
showLabelSuggestion(nameInfos);
|
||||
showLabelSuggestion(nameInfos, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -477,7 +477,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
* Show suggested folder title in FolderEditText if the first suggestion is non-empty, push
|
||||
* InputMethodManager suggestions.
|
||||
*/
|
||||
private void showLabelSuggestion(FolderNameInfo[] nameInfos) {
|
||||
private void showLabelSuggestion(FolderNameInfo[] nameInfos, boolean animate) {
|
||||
if (nameInfos == null) {
|
||||
return;
|
||||
}
|
||||
@@ -493,9 +493,10 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
if (!isEmpty(firstLabel)) {
|
||||
mFolderName.setHint("");
|
||||
mFolderName.setText(firstLabel);
|
||||
mInfo.title = firstLabel;
|
||||
}
|
||||
animateOpen(mInfo.contents, 0, true);
|
||||
if (animate) {
|
||||
animateOpen(mInfo.contents, 0, true);
|
||||
}
|
||||
mFolderName.showKeyboard();
|
||||
mFolderName.displayCompletions(
|
||||
asList(nameInfos).subList(1, nameInfos.length).stream()
|
||||
@@ -1651,6 +1652,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
.getParcelableArrayExtra(FolderInfo.EXTRA_FOLDER_SUGGESTIONS))
|
||||
.map(folderNameInfoArray ->
|
||||
stream(folderNameInfoArray)
|
||||
.filter(Objects::nonNull)
|
||||
.map(FolderNameInfo::getLabel)
|
||||
.map(CharSequence::toString)
|
||||
.toArray(String[]::new));
|
||||
|
||||
@@ -70,11 +70,25 @@ public class FolderNameProvider implements ResourceBasedOverride {
|
||||
return fnp;
|
||||
}
|
||||
|
||||
public static FolderNameProvider newInstance(Context context, List<AppInfo> appInfos,
|
||||
IntSparseArrayMap<FolderInfo> folderInfos) {
|
||||
FolderNameProvider fnp = Overrides.getObject(FolderNameProvider.class,
|
||||
context.getApplicationContext(), R.string.folder_name_provider_class);
|
||||
fnp.load(appInfos, folderInfos);
|
||||
|
||||
return fnp;
|
||||
}
|
||||
|
||||
private void load(Context context) {
|
||||
LauncherAppState.getInstance(context).getModel().enqueueModelUpdateTask(
|
||||
new FolderNameWorker());
|
||||
}
|
||||
|
||||
private void load(List<AppInfo> appInfos, IntSparseArrayMap<FolderInfo> folderInfos) {
|
||||
mAppInfos = appInfos;
|
||||
mFolderInfos = folderInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate and rank the suggested Folder names.
|
||||
*/
|
||||
|
||||
@@ -901,7 +901,8 @@ public class LoaderTask implements Runnable {
|
||||
}
|
||||
|
||||
private void loadFolderNames() {
|
||||
FolderNameProvider provider = FolderNameProvider.newInstance(mApp.getContext());
|
||||
FolderNameProvider provider = FolderNameProvider.newInstance(mApp.getContext(),
|
||||
mBgAllAppsList.data, mBgDataModel.folders);
|
||||
|
||||
synchronized (mBgDataModel) {
|
||||
for (int i = 0; i < mBgDataModel.folders.size(); i++) {
|
||||
|
||||
Reference in New Issue
Block a user