mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-25 00:22:50 -06:00
141 lines
4.6 KiB
Java
141 lines
4.6 KiB
Java
package androidx.emoji2.viewsintegration;
|
|
|
|
import android.text.method.KeyListener;
|
|
import android.text.method.NumberKeyListener;
|
|
import android.view.inputmethod.EditorInfo;
|
|
import android.view.inputmethod.InputConnection;
|
|
import android.widget.EditText;
|
|
import androidx.core.util.Preconditions;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class EmojiEditTextHelper {
|
|
private int mEmojiReplaceStrategy;
|
|
private final HelperInternal mHelper;
|
|
private int mMaxEmojiCount;
|
|
|
|
public int getEmojiReplaceStrategy() {
|
|
return this.mEmojiReplaceStrategy;
|
|
}
|
|
|
|
public int getMaxEmojiCount() {
|
|
return this.mMaxEmojiCount;
|
|
}
|
|
|
|
public EmojiEditTextHelper(EditText editText) {
|
|
this(editText, true);
|
|
}
|
|
|
|
public EmojiEditTextHelper(EditText editText, boolean z) {
|
|
this.mMaxEmojiCount = Integer.MAX_VALUE;
|
|
this.mEmojiReplaceStrategy = 0;
|
|
Preconditions.checkNotNull(editText, "editText cannot be null");
|
|
this.mHelper = new HelperInternal19(editText, z);
|
|
}
|
|
|
|
public void setMaxEmojiCount(int i) {
|
|
Preconditions.checkArgumentNonnegative(i, "maxEmojiCount should be greater than 0");
|
|
this.mMaxEmojiCount = i;
|
|
this.mHelper.setMaxEmojiCount(i);
|
|
}
|
|
|
|
public KeyListener getKeyListener(KeyListener keyListener) {
|
|
return this.mHelper.getKeyListener(keyListener);
|
|
}
|
|
|
|
public InputConnection onCreateInputConnection(InputConnection inputConnection, EditorInfo editorInfo) {
|
|
if (inputConnection == null) {
|
|
return null;
|
|
}
|
|
return this.mHelper.onCreateInputConnection(inputConnection, editorInfo);
|
|
}
|
|
|
|
public void setEmojiReplaceStrategy(int i) {
|
|
this.mEmojiReplaceStrategy = i;
|
|
this.mHelper.setEmojiReplaceStrategy(i);
|
|
}
|
|
|
|
public boolean isEnabled() {
|
|
return this.mHelper.isEnabled();
|
|
}
|
|
|
|
public void setEnabled(boolean z) {
|
|
this.mHelper.setEnabled(z);
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
static class HelperInternal {
|
|
KeyListener getKeyListener(KeyListener keyListener) {
|
|
return keyListener;
|
|
}
|
|
|
|
boolean isEnabled() {
|
|
return false;
|
|
}
|
|
|
|
InputConnection onCreateInputConnection(InputConnection inputConnection, EditorInfo editorInfo) {
|
|
return inputConnection;
|
|
}
|
|
|
|
void setEmojiReplaceStrategy(int i) {
|
|
}
|
|
|
|
void setEnabled(boolean z) {
|
|
}
|
|
|
|
void setMaxEmojiCount(int i) {
|
|
}
|
|
|
|
HelperInternal() {
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
private static class HelperInternal19 extends HelperInternal {
|
|
private final EditText mEditText;
|
|
private final EmojiTextWatcher mTextWatcher;
|
|
|
|
HelperInternal19(EditText editText, boolean z) {
|
|
this.mEditText = editText;
|
|
EmojiTextWatcher emojiTextWatcher = new EmojiTextWatcher(editText, z);
|
|
this.mTextWatcher = emojiTextWatcher;
|
|
editText.addTextChangedListener(emojiTextWatcher);
|
|
editText.setEditableFactory(EmojiEditableFactory.getInstance());
|
|
}
|
|
|
|
@Override // androidx.emoji2.viewsintegration.EmojiEditTextHelper.HelperInternal
|
|
void setMaxEmojiCount(int i) {
|
|
this.mTextWatcher.setMaxEmojiCount(i);
|
|
}
|
|
|
|
@Override // androidx.emoji2.viewsintegration.EmojiEditTextHelper.HelperInternal
|
|
void setEmojiReplaceStrategy(int i) {
|
|
this.mTextWatcher.setEmojiReplaceStrategy(i);
|
|
}
|
|
|
|
@Override // androidx.emoji2.viewsintegration.EmojiEditTextHelper.HelperInternal
|
|
KeyListener getKeyListener(KeyListener keyListener) {
|
|
if (keyListener instanceof EmojiKeyListener) {
|
|
return keyListener;
|
|
}
|
|
if (keyListener == null) {
|
|
return null;
|
|
}
|
|
return keyListener instanceof NumberKeyListener ? keyListener : new EmojiKeyListener(keyListener);
|
|
}
|
|
|
|
@Override // androidx.emoji2.viewsintegration.EmojiEditTextHelper.HelperInternal
|
|
InputConnection onCreateInputConnection(InputConnection inputConnection, EditorInfo editorInfo) {
|
|
return inputConnection instanceof EmojiInputConnection ? inputConnection : new EmojiInputConnection(this.mEditText, inputConnection, editorInfo);
|
|
}
|
|
|
|
@Override // androidx.emoji2.viewsintegration.EmojiEditTextHelper.HelperInternal
|
|
void setEnabled(boolean z) {
|
|
this.mTextWatcher.setEnabled(z);
|
|
}
|
|
|
|
@Override // androidx.emoji2.viewsintegration.EmojiEditTextHelper.HelperInternal
|
|
boolean isEnabled() {
|
|
return this.mTextWatcher.isEnabled();
|
|
}
|
|
}
|
|
}
|