Introduce folder name type (auto vs manual).

Bug: 147769158

- Use both InputConnectionWrapper and TextWatcher to detect
manual input
- Also fix a bug in FolderNameProvider

Change-Id: I7bc0f380c6641481d934a53e9feb77caa19c674a
This commit is contained in:
Hyunyoung Song
2020-01-12 00:41:06 -08:00
parent 01f0964129
commit 48e6489871
6 changed files with 151 additions and 30 deletions

View File

@@ -21,15 +21,11 @@ import android.util.AttributeSet;
import android.view.DragEvent;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.CompletionInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import com.android.launcher3.folder.FolderNameProvider;
import com.android.launcher3.util.UiThreadHelper;
import java.util.List;
/**
* The edit text that reports back when the back key has been pressed.
@@ -105,25 +101,6 @@ public class ExtendedEditText extends EditText {
UiThreadHelper.hideKeyboardAsync(getContext(), getWindowToken());
}
@Override
public void onCommitCompletion(CompletionInfo text) {
setText(text.getText());
setSelection(text.getText().length());
}
/**
* Currently only used for folder name suggestion.
*/
public void displayCompletions(List<String> suggestList) {
int cnt = Math.min(suggestList.size(), FolderNameProvider.SUGGEST_MAX);
CompletionInfo[] cInfo = new CompletionInfo[cnt];
for (int i = 0; i < cnt; i++) {
cInfo[i] = new CompletionInfo(i, i, suggestList.get(i));
}
post(() -> getContext().getSystemService(InputMethodManager.class)
.displayCompletions(this, cInfo));
}
private boolean showSoftInput() {
return requestFocus() &&
getContext().getSystemService(InputMethodManager.class)