mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
Moving some calls off the UI thread
This saves ~5ms in onNewIntent Bug: 67305604 Change-Id: Ic97727b1c526e50bd3c8a1d8f511e1d7fd5e05e7
This commit is contained in:
@@ -16,12 +16,16 @@
|
||||
package com.android.launcher3;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.DragEvent;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.android.launcher3.util.UiThreadHelper;
|
||||
|
||||
|
||||
/**
|
||||
* The edit text that reports back when the back key has been pressed.
|
||||
@@ -102,8 +106,7 @@ public class ExtendedEditText extends EditText {
|
||||
}
|
||||
|
||||
public void dispatchBackKey() {
|
||||
((InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE))
|
||||
.hideSoftInputFromWindow(getWindowToken(), 0);
|
||||
UiThreadHelper.hideKeyboardAsync(getContext(), getWindowToken());
|
||||
if (mBackKeyListener != null) {
|
||||
mBackKeyListener.onBackKey();
|
||||
}
|
||||
@@ -121,4 +124,17 @@ public class ExtendedEditText extends EditText {
|
||||
public boolean isSuggestionsEnabled() {
|
||||
return !mForceDisableSuggestions && super.isSuggestionsEnabled();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
if (!TextUtils.isEmpty(getText())) {
|
||||
setText("");
|
||||
}
|
||||
if (isFocused()) {
|
||||
View nextFocus = focusSearch(View.FOCUS_DOWN);
|
||||
if (nextFocus != null) {
|
||||
nextFocus.requestFocus();
|
||||
}
|
||||
}
|
||||
UiThreadHelper.hideKeyboardAsync(getContext(), getWindowToken());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user