Adds additional folder label states (UNLABELED & EMPTY_LABEL)

UNLABELED -> title==null and EMPTY_LABEL -> title=="". When adding new items for the folder if the folder is in UNLABELED state, auto-labeling will be enabled.
This change also addresses auto-labeling issue due to false edit from UNLABELED to EMPTY.

Bug: 159164315

Change-Id: Ia17cd27b4afb60420dc15c544f544061fc46ad33
This commit is contained in:
thiruram
2020-06-19 20:10:58 -07:00
parent 5c9a1ef5cd
commit ec75cbd85a
6 changed files with 94 additions and 26 deletions

View File

@@ -26,7 +26,6 @@ import static com.android.launcher3.config.FeatureFlags.ALWAYS_USE_HARDWARE_OPTI
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_LABEL_UPDATED;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED;
import static com.android.launcher3.model.data.FolderInfo.FLAG_MANUAL_FOLDER_NAME;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -339,11 +338,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
if (DEBUG) {
Log.d(TAG, "onBackKey newTitle=" + newTitle);
}
mInfo.setTitle(newTitle);
mInfo.setOption(FLAG_MANUAL_FOLDER_NAME, !mInfo.getAcceptedSuggestionIndex().isPresent(),
mLauncher.getModelWriter());
mInfo.setTitle(newTitle, mLauncher.getModelWriter());
mFolderIcon.onTitleChanged(newTitle);
mLauncher.getModelWriter().updateItemInDatabase(mInfo);
if (TextUtils.isEmpty(mInfo.title)) {
mFolderName.setHint(R.string.folder_hint_text);