Java Examples for android.view.inputmethod.EditorInfo
The following java examples will help you to understand the usage of android.view.inputmethod.EditorInfo. These source code samples are taken from different open source projects.
Example 1
| Project: container-master File: WindowGainedFocus.java View source code |
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
if (noEditorInfo == null) {
editorInfoIndex = ArrayUtils.indexOfFirst(args, EditorInfo.class);
noEditorInfo = editorInfoIndex == -1;
}
if (!noEditorInfo) {
EditorInfo attribute = (EditorInfo) args[editorInfoIndex];
if (attribute != null) {
attribute.packageName = getHostPkg();
}
}
return method.invoke(who, args);
}Example 2
| Project: FastHub-master File: FontAutoCompleteEditText.java View source code |
private void init() {
if (isInEditMode())
return;
if (isInEditMode())
return;
setInputType(getInputType() | EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_FLAG_NO_FULLSCREEN);
setImeOptions(getImeOptions() | EditorInfo.IME_FLAG_NO_FULLSCREEN);
TypeFaceHelper.applyTypeface(this);
}Example 3
| Project: Gmote-master File: TouchpadLayout.java View source code |
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
return new BaseInputConnection(this, false) {
@Override
public boolean sendKeyEvent(KeyEvent event) {
return super.sendKeyEvent(event);
}
@Override
public boolean performEditorAction(int actionCode) {
sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
return super.performEditorAction(actionCode);
}
};
}Example 4
| Project: android_packages_inputmethods_LatinIME-master File: EditorInfoCompatUtils.java View source code |
public static String imeActionName(final int imeOptions) {
final int actionId = imeOptions & EditorInfo.IME_MASK_ACTION;
switch(actionId) {
case EditorInfo.IME_ACTION_UNSPECIFIED:
return "actionUnspecified";
case EditorInfo.IME_ACTION_NONE:
return "actionNone";
case EditorInfo.IME_ACTION_GO:
return "actionGo";
case EditorInfo.IME_ACTION_SEARCH:
return "actionSearch";
case EditorInfo.IME_ACTION_SEND:
return "actionSend";
case EditorInfo.IME_ACTION_NEXT:
return "actionNext";
case EditorInfo.IME_ACTION_DONE:
return "actionDone";
case EditorInfo.IME_ACTION_PREVIOUS:
return "actionPrevious";
default:
return "actionUnknown(" + actionId + ")";
}
}Example 5
| Project: cgeo-master File: EditUtils.java View source code |
public static void setActionListener(final EditText editText, final Runnable runnable) {
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(final TextView v, final int actionId, final KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_GO) {
runnable.run();
return true;
}
return false;
}
});
editText.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(final View v, final int keyCode, final KeyEvent event) {
// If the event is a key-down event on the "enter" button
if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) {
runnable.run();
return true;
}
return false;
}
});
}Example 6
| Project: DiceCommander-master File: CharacterWizard.java View source code |
@Override
protected PageList onNewRootPageList() {
Resources res = Application.appContext.getResources();
List<Page> list = new ArrayList<Page>();
list.add(new SingleEditPage(this, res.getString(R.string.char_wizard_name), CHAR_NAME_PAGE, EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS).setRequired(true));
list.add(new SingleEditPage(this, res.getString(R.string.char_wizard_level), CHAR_LEVEL_PAGE, EditorInfo.TYPE_CLASS_NUMBER).setRequired(true));
return new PageList(list.toArray(new Page[] {}));
}Example 7
| Project: iNaturalistAndroid-master File: MultilineEditText.java View source code |
@Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { InputConnection connection = super.onCreateInputConnection(outAttrs); int imeActions = outAttrs.imeOptions & EditorInfo.IME_MASK_ACTION; if ((imeActions & EditorInfo.IME_ACTION_DONE) != 0) { // clear the existing action outAttrs.imeOptions ^= imeActions; // set the DONE action outAttrs.imeOptions |= EditorInfo.IME_ACTION_DONE; } if ((outAttrs.imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) { outAttrs.imeOptions &= ~EditorInfo.IME_FLAG_NO_ENTER_ACTION; } return connection; }
Example 8
| Project: MHacksAndroid-Public-master File: GuestNameFragment.java View source code |
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (EditorInfo.IME_ACTION_DONE == actionId) {
// Return input text to activity
GuestnameDialogListener activity = (GuestnameDialogListener) getActivity();
activity.onFinishEditDialog(mEditText.getText().toString());
this.dismiss();
return true;
}
return false;
}Example 9
| Project: openshop.io-android-master File: OnTouchPasswordListener.java View source code |
@Override
public boolean onTouch(View v, MotionEvent event) {
final int action = event.getAction();
switch(action) {
case MotionEvent.ACTION_DOWN:
mPreviousInputType = passwordET.getInputType();
setInputType(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD, true);
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
setInputType(mPreviousInputType, true);
mPreviousInputType = -1;
break;
}
return false;
}Example 10
| Project: packages_inputmethods_latinime-master File: EditorInfoCompatUtils.java View source code |
public static String imeActionName(final int imeOptions) {
final int actionId = imeOptions & EditorInfo.IME_MASK_ACTION;
switch(actionId) {
case EditorInfo.IME_ACTION_UNSPECIFIED:
return "actionUnspecified";
case EditorInfo.IME_ACTION_NONE:
return "actionNone";
case EditorInfo.IME_ACTION_GO:
return "actionGo";
case EditorInfo.IME_ACTION_SEARCH:
return "actionSearch";
case EditorInfo.IME_ACTION_SEND:
return "actionSend";
case EditorInfo.IME_ACTION_NEXT:
return "actionNext";
case EditorInfo.IME_ACTION_DONE:
return "actionDone";
case EditorInfo.IME_ACTION_PREVIOUS:
return "actionPrevious";
default:
return "actionUnknown(" + actionId + ")";
}
}Example 11
| Project: VirtualApp-master File: MethodProxies.java View source code |
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
if (noEditorInfo == null) {
editorInfoIndex = ArrayUtils.indexOfFirst(args, EditorInfo.class);
noEditorInfo = editorInfoIndex == -1;
}
if (!noEditorInfo) {
EditorInfo attribute = (EditorInfo) args[editorInfoIndex];
if (attribute != null) {
attribute.packageName = getHostPkg();
}
}
return method.invoke(who, args);
}Example 12
| Project: XobotOS-master File: IInputMethod.java View source code |
@Override
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException {
switch(code) {
case INTERFACE_TRANSACTION:
{
reply.writeString(DESCRIPTOR);
return true;
}
case TRANSACTION_attachToken:
{
data.enforceInterface(DESCRIPTOR);
android.os.IBinder _arg0;
_arg0 = data.readStrongBinder();
this.attachToken(_arg0);
return true;
}
case TRANSACTION_bindInput:
{
data.enforceInterface(DESCRIPTOR);
android.view.inputmethod.InputBinding _arg0;
if ((0 != data.readInt())) {
_arg0 = android.view.inputmethod.InputBinding.CREATOR.createFromParcel(data);
} else {
_arg0 = null;
}
this.bindInput(_arg0);
return true;
}
case TRANSACTION_unbindInput:
{
data.enforceInterface(DESCRIPTOR);
this.unbindInput();
return true;
}
case TRANSACTION_startInput:
{
data.enforceInterface(DESCRIPTOR);
com.android.internal.view.IInputContext _arg0;
_arg0 = com.android.internal.view.IInputContext.Stub.asInterface(data.readStrongBinder());
android.view.inputmethod.EditorInfo _arg1;
if ((0 != data.readInt())) {
_arg1 = android.view.inputmethod.EditorInfo.CREATOR.createFromParcel(data);
} else {
_arg1 = null;
}
this.startInput(_arg0, _arg1);
return true;
}
case TRANSACTION_restartInput:
{
data.enforceInterface(DESCRIPTOR);
com.android.internal.view.IInputContext _arg0;
_arg0 = com.android.internal.view.IInputContext.Stub.asInterface(data.readStrongBinder());
android.view.inputmethod.EditorInfo _arg1;
if ((0 != data.readInt())) {
_arg1 = android.view.inputmethod.EditorInfo.CREATOR.createFromParcel(data);
} else {
_arg1 = null;
}
this.restartInput(_arg0, _arg1);
return true;
}
case TRANSACTION_createSession:
{
data.enforceInterface(DESCRIPTOR);
com.android.internal.view.IInputMethodCallback _arg0;
_arg0 = com.android.internal.view.IInputMethodCallback.Stub.asInterface(data.readStrongBinder());
this.createSession(_arg0);
return true;
}
case TRANSACTION_setSessionEnabled:
{
data.enforceInterface(DESCRIPTOR);
com.android.internal.view.IInputMethodSession _arg0;
_arg0 = com.android.internal.view.IInputMethodSession.Stub.asInterface(data.readStrongBinder());
boolean _arg1;
_arg1 = (0 != data.readInt());
this.setSessionEnabled(_arg0, _arg1);
return true;
}
case TRANSACTION_revokeSession:
{
data.enforceInterface(DESCRIPTOR);
com.android.internal.view.IInputMethodSession _arg0;
_arg0 = com.android.internal.view.IInputMethodSession.Stub.asInterface(data.readStrongBinder());
this.revokeSession(_arg0);
return true;
}
case TRANSACTION_showSoftInput:
{
data.enforceInterface(DESCRIPTOR);
int _arg0;
_arg0 = data.readInt();
android.os.ResultReceiver _arg1;
if ((0 != data.readInt())) {
_arg1 = android.os.ResultReceiver.CREATOR.createFromParcel(data);
} else {
_arg1 = null;
}
this.showSoftInput(_arg0, _arg1);
return true;
}
case TRANSACTION_hideSoftInput:
{
data.enforceInterface(DESCRIPTOR);
int _arg0;
_arg0 = data.readInt();
android.os.ResultReceiver _arg1;
if ((0 != data.readInt())) {
_arg1 = android.os.ResultReceiver.CREATOR.createFromParcel(data);
} else {
_arg1 = null;
}
this.hideSoftInput(_arg0, _arg1);
return true;
}
case TRANSACTION_changeInputMethodSubtype:
{
data.enforceInterface(DESCRIPTOR);
android.view.inputmethod.InputMethodSubtype _arg0;
if ((0 != data.readInt())) {
_arg0 = android.view.inputmethod.InputMethodSubtype.CREATOR.createFromParcel(data);
} else {
_arg0 = null;
}
this.changeInputMethodSubtype(_arg0);
return true;
}
}
return super.onTransact(code, data, reply, flags);
}Example 13
| Project: android-test-kit-master File: EditorActionIntegrationTest.java View source code |
@SuppressWarnings("unchecked")
public void testPressImeActionButtonOnSearchBox() {
String searchFor = "rainbows and unicorns";
onView(withId(R.id.search_box)).perform(scrollTo(), ViewActions.typeText(searchFor));
onView(withId(R.id.search_box)).check(matches(hasImeAction(EditorInfo.IME_ACTION_SEARCH))).perform(pressImeActionButton());
onView(withId(R.id.search_result)).perform(scrollTo());
onView(withId(R.id.search_result)).check(matches(allOf(isDisplayed(), withText(containsString(searchFor)))));
}Example 14
| Project: double-espresso-master File: EditorActionIntegrationTest.java View source code |
@SuppressWarnings("unchecked")
public void testPressImeActionButtonOnSearchBox() {
String searchFor = "rainbows and unicorns";
onView(withId(R.id.search_box)).perform(scrollTo(), ViewActions.typeText(searchFor));
onView(withId(R.id.search_box)).check(matches(hasImeAction(EditorInfo.IME_ACTION_SEARCH))).perform(pressImeActionButton());
onView(withId(R.id.search_result)).perform(scrollTo());
onView(withId(R.id.search_result)).check(matches(allOf(isDisplayed(), withText(containsString(searchFor)))));
}Example 15
| Project: jdroid-master File: EmailAutoCompleteTextView.java View source code |
@RequiresPermission(Manifest.permission.GET_ACCOUNTS)
private void init() {
if (!isInEditMode()) {
ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_dropdown_item_1line, AndroidUtils.getAccountsEmails());
setAdapter(adapter);
setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
setImeOptions(EditorInfo.IME_ACTION_NEXT);
}
}Example 16
| Project: kegbot-android-master File: SoftMultiLineEditText.java View source code |
@Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { InputConnection connection = super.onCreateInputConnection(outAttrs); int imeActions = outAttrs.imeOptions & EditorInfo.IME_MASK_ACTION; if ((imeActions & EditorInfo.IME_ACTION_DONE) != 0) { // clear the existing action outAttrs.imeOptions ^= imeActions; // set the DONE action outAttrs.imeOptions |= EditorInfo.IME_ACTION_DONE; } if ((outAttrs.imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) { outAttrs.imeOptions &= ~EditorInfo.IME_FLAG_NO_ENTER_ACTION; } return connection; }
Example 17
| Project: KerKerInput-master File: KerKerInputService.java View source code |
public void onStartInputView(EditorInfo info, boolean restarting) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
_core.setShouldVibrate(prefs.getBoolean("vibration", false));
_core.setShouldMakeNoise(prefs.getBoolean("audio", true));
// Force generate a keyboard
_core.getKeyboardManager().resetKeyboard();
_core.setCurrentMode(InputMode.MODE_ABC);
if (_core.getCurrentInputMethod() != null) {
_core.getCurrentInputMethod().onLeaveInputMethod();
_core.getCurrentInputMethod().onEnterInputMethod();
}
_core.getKeyboardManager().setImeOptions(info.imeOptions);
// Refresh all cache
_currentKBView.closing();
}Example 18
| Project: otm-android-master File: LoginActivity.java View source code |
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_activity);
EditText password = (EditText) findViewById(R.id.login_password);
password.setOnEditorActionListener(( textView, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_DONE) {
login(textView);
return true;
}
return false;
});
}Example 19
| Project: pagarme-android-master File: EditTextShadow.java View source code |
private void initView(AttributeSet attributeSet) {
TypedArray a = getContext().obtainStyledAttributes(attributeSet, R.styleable.EditTextPagarMe);
if (a != null) {
inputType = a.getInt(R.styleable.EditTextPagarMe_android_inputType, EditorInfo.TYPE_TEXT_VARIATION_NORMAL);
textSize = a.getDimensionPixelSize(R.styleable.EditTextPagarMe_android_textSize, 0);
textColor = a.getColor(R.styleable.EditTextPagarMe_android_textColor, 0);
hint = a.getString(R.styleable.EditTextPagarMe_android_hint);
hintColor = a.getColor(R.styleable.EditTextPagarMe_android_textColorHint, 0);
a.recycle();
}
}Example 20
| Project: Prevail-master File: AddEditTextController.java View source code |
@Override
public boolean onEditorAction(final TextView v, final int actionId, final KeyEvent event) {
boolean r = false;
if (actionId == EditorInfo.IME_ACTION_DONE || event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
String s = v.getText().toString();
if (s.length() > 0) {
TodoItem ti = new TodoItem(s);
getDataModelService().insert(ti);
}
mOnEditCompleteListener.onEditComplete(s);
r = true;
}
return r;
}Example 21
| Project: QBShare-Android-master File: QBShareTwitter.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.share_post_twitter);
share = QBShare.getGlobalShare(this);
messageET = (EditText) findViewById(R.id.comment);
((EditText) findViewById(R.id.comment)).setOnEditorActionListener(new EditText.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(messageET.getWindowToken(), 0);
}
return false;
}
});
getBundleExtras();
}Example 22
| Project: RandomActsOfKindness-master File: DonateSettings.java View source code |
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_donate_settings);
donateAmount = (TextView) findViewById(R.id.current_donation_number);
donateAmount = (TextView) findViewById(R.id.current_donation_number);
newDonateAmount = (EditText) findViewById(R.id.donation_edit_text);
df = new DecimalFormat("#.00");
PreferencesLayer preferencesLayer = PreferencesLayer.getInstance();
donateAmount.setText(String.valueOf(df.format(preferencesLayer.getDonationAmountPref())));
newDonateAmount.setHint(String.valueOf(df.format(preferencesLayer.getDonationAmountPref())));
newDonateAmount.setOnEditorActionListener(new TextView.OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
updateDonationFields();
}
return false;
}
});
}Example 23
| Project: slide-master File: SettingsExternalBrowser.java View source code |
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
applyColorTheme();
Settings.changed = true;
setContentView(R.layout.activity_settings_openexternal);
setupAppBar(R.id.toolbar, "Force external browser", true, true);
domain = (EditText) findViewById(R.id.domain);
domain.setOnEditorActionListener(new EditText.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
SettingValues.alwaysExternal = SettingValues.alwaysExternal + ", " + domain.getText().toString();
domain.setText("");
updateFilters();
}
return false;
}
});
updateFilters();
}Example 24
| Project: TalkingSketchpad-master File: LoginActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
mUsernameView = (EditText) findViewById(R.id.username_input);
mUsernameView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == R.id.login || actionId == EditorInfo.IME_NULL) {
attemptLogin();
return true;
}
return false;
}
});
Button signInButton = (Button) findViewById(R.id.sign_in_button);
signInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
attemptLogin();
}
});
}Example 25
| Project: technology-android-master File: ChooseBoardDialogFragment.java View source code |
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mEditText = new EditText(getActivity());
// set id so that it maintains its state
mEditText.setId(1);
mEditText.setSingleLine();
mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
switchBoard(mEditText.getText().toString());
ChooseBoardDialogFragment.this.dismiss();
}
return false;
}
});
return new AlertDialog.Builder(getActivity()).setTitle(getString(R.string.choose_board)).setView(mEditText).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface d, int button) {
switchBoard(mEditText.getText().toString());
}
}).create();
}Example 26
| Project: Tusky-master File: EditTextTyped.java View source code |
@Override
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
InputConnection connection = super.onCreateInputConnection(editorInfo);
if (onCommitContentListener != null) {
Assert.expect(mimeTypes != null);
EditorInfoCompat.setContentMimeTypes(editorInfo, mimeTypes);
return InputConnectionCompat.createWrapper(connection, editorInfo, onCommitContentListener);
} else {
return connection;
}
}Example 27
| Project: YikuairAndroid-master File: CheckActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.check_dialog);
checkResult = (EditText) findViewById(R.id.et_answer);
checkResult.setInputType(EditorInfo.TYPE_CLASS_NUMBER);
checkQuestion = (TextView) findViewById(R.id.tv_question);
checkQuestion.setText(getCheckQuestion());
}Example 28
| Project: aDoubanReader-master File: SearchBar.java View source code |
private void initUI() {
FrameLayout frameLayout = new FrameLayout(getContext());
LayoutInflater vi = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
vi.inflate(R.layout.search_bar, frameLayout, true);
this.addView(frameLayout);
searchArea = (EditText) findViewById(R.id.search_text);
searchArea.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
executeSearch();
return true;
}
return false;
}
});
progressBar = (ProgressBar) findViewById(R.id.search_progress_bar);
}Example 29
| Project: android-1-master File: SearchBar.java View source code |
private void init() {
LayoutInflater.from(getContext()).inflate(R.layout.search_bar, this);
lBadge = (TextView) findViewById(R.id.search_badge);
tSearch = (EditText) findViewById(R.id.search_src_text);
bSearch = (Button) findViewById(R.id.search_go_btn);
bExtra1 = (Button) findViewById(R.id.search_extra1_btn);
root = (LinearLayout) findViewById(R.id.search_bar);
if (isInEditMode())
return;
tSearch.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
if (onSearchListener != null) {
onSearchListener.onSearch(SearchBar.this, tSearch.getText());
}
return true;
}
return false;
}
});
bSearch.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (onSearchListener != null) {
onSearchListener.onSearch(SearchBar.this, tSearch.getText());
}
}
});
lBadge.setVisibility(View.GONE);
}Example 30
| Project: android-examples-master File: MainActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
engine = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
int result = engine.setLanguage(Locale.US);
if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
Log.e("TTS", "This Language is not supported");
}
} else {
Log.e("TTS", "Initilization Failed!");
}
}
});
editText = (EditText) findViewById(R.id.editText);
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == EditorInfo.IME_ACTION_GO) {
speak(editText.getText().toString());
return true;
}
return false;
}
});
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
speak(editText.getText().toString());
}
});
seekbarPitch = (SeekBar) findViewById(R.id.seekBar);
seekbarPitch.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
pitchVal = i;
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}Example 31
| Project: android-priority-jobqueue-examples-master File: EditNameDialog.java View source code |
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (EditorInfo.IME_ACTION_DONE == actionId) {
EditNameDialogListener activity = (EditNameDialogListener) getActivity();
if (!mEditText.getText().toString().isEmpty()) {
activity.onFinishEditDialog(mEditText.getText().toString());
this.dismiss();
return false;
} else {
mEditText.setError("This Field Should Not be kept Empty!");
mEditText.requestFocus();
return true;
}
}
return false;
}Example 32
| Project: android-search-and-stories-master File: DDGAutoCompleteTextView.java View source code |
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
backButtonPressedEventListener.onBackButtonPressed();
return false;
}
if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_UP) {
super.onEditorAction(EditorInfo.IME_ACTION_SEARCH);
return true;
}
return super.dispatchKeyEvent(event);
}Example 33
| Project: android-topeka-master File: FillTwoBlanksQuizView.java View source code |
@Override
protected View createQuizContentView() {
LinearLayout layout = new LinearLayout(getContext());
layout.setOrientation(LinearLayout.VERTICAL);
mAnswerOne = createEditText();
mAnswerOne.setImeOptions(EditorInfo.IME_ACTION_NEXT);
mAnswerTwo = createEditText();
mAnswerTwo.setId(R.id.quiz_edit_text_two);
addEditText(layout, mAnswerOne);
addEditText(layout, mAnswerTwo);
return layout;
}Example 34
| Project: AndroidChromium-master File: LoginPrompt.java View source code |
private void createDialog() {
View v = LayoutInflater.from(mContext).inflate(R.layout.http_auth_dialog, null);
mUsernameView = (EditText) v.findViewById(R.id.username);
mPasswordView = (EditText) v.findViewById(R.id.password);
mPasswordView.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
mDialog.getButton(AlertDialog.BUTTON_POSITIVE).performClick();
return true;
}
return false;
}
});
TextView explanationView = (TextView) v.findViewById(R.id.explanation);
explanationView.setText(mAuthHandler.getMessageBody());
mDialog = new AlertDialog.Builder(mContext, R.style.AlertDialogTheme).setTitle(R.string.login_dialog_title).setView(v).setPositiveButton(R.string.login_dialog_ok_button_label, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
mAuthHandler.proceed(getUsername(), getPassword());
}
}).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
mAuthHandler.cancel();
}
}).setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
mAuthHandler.cancel();
}
}).create();
mDialog.getDelegate().setHandleNativeActionModesEnabled(false);
// Make the IME appear when the dialog is displayed if applicable.
mDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}Example 35
| Project: apps-android-wikipedia-master File: FindInPageActionProvider.java View source code |
@Override
public View onCreateActionView() {
View view = View.inflate(fragment.getContext(), R.layout.group_find_in_page, null);
findInPageNext = view.findViewById(R.id.find_in_page_next);
findInPageNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DeviceUtil.hideSoftKeyboard(view);
if (!pageFragmentValid()) {
return;
}
funnel.addFindNext();
fragment.getWebView().findNext(true);
}
});
findInPagePrev = view.findViewById(R.id.find_in_page_prev);
findInPagePrev.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
fragment.hideSoftKeyboard();
if (!pageFragmentValid()) {
return;
}
funnel.addFindPrev();
fragment.getWebView().findNext(false);
}
});
findInPageMatch = (TextView) view.findViewById(R.id.find_in_page_match);
SearchView searchView = (SearchView) view.findViewById(R.id.find_in_page_input);
searchView.setQueryHint(fragment.getContext().getString(R.string.menu_page_find_in_page));
searchView.setFocusable(true);
searchView.requestFocusFromTouch();
searchView.setOnQueryTextListener(searchQueryListener);
searchView.setOnCloseListener(searchCloseListener);
searchView.setIconified(false);
searchView.setMaxWidth(Integer.MAX_VALUE);
searchView.setInputType(EditorInfo.TYPE_CLASS_TEXT);
searchView.setSubmitButtonEnabled(false);
// remove focus line from search plate
View searchEditPlate = searchView.findViewById(android.support.v7.appcompat.R.id.search_plate);
searchEditPlate.setBackgroundColor(Color.TRANSPARENT);
return view;
}Example 36
| Project: apps-master File: MainActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
engine = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
int result = engine.setLanguage(Locale.US);
if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
Log.e("TTS", "This Language is not supported");
}
} else {
Log.e("TTS", "Initilization Failed!");
}
}
});
editText = (EditText) findViewById(R.id.editText);
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == EditorInfo.IME_ACTION_GO) {
speak(editText.getText().toString());
return true;
}
return false;
}
});
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
speak(editText.getText().toString());
}
});
seekbarPitch = (SeekBar) findViewById(R.id.seekBar);
seekbarPitch.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
pitchVal = i;
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}Example 37
| Project: Appsii-master File: EditTitleDialog.java View source code |
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (EditorInfo.IME_ACTION_DONE == actionId) {
// Return input text to activity
if (mEditTitleDialogListener != null) {
mEditTitleDialogListener.onFinishEditDialog(mTag, mEditText.getText().toString());
}
this.dismiss();
return true;
}
return false;
}Example 38
| Project: BGASwipeBackLayout-Android-master File: EditTextActivity.java View source code |
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_GO) {
String msg = mMsgEt.getText().toString().trim();
if (!TextUtils.isEmpty(msg)) {
mMsgEt.setText("");
mContentAdapter.addLastItem(msg);
mRecyclerViewScrollHelper.scrollToPosition(mContentAdapter.getItemCount() - 1);
}
}
return true;
}Example 39
| Project: buddycloud-android-master File: TypefacedEditText.java View source code |
@Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { InputConnection connection = super.onCreateInputConnection(outAttrs); int imeActions = outAttrs.imeOptions & EditorInfo.IME_MASK_ACTION; if ((outAttrs.imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) { outAttrs.imeOptions &= ~EditorInfo.IME_FLAG_NO_ENTER_ACTION; } return connection; }
Example 40
| Project: ChromeBrowser-master File: WebViewTestActivity.java View source code |
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((actionId != EditorInfo.IME_ACTION_GO) && (event == null || event.getKeyCode() != KeyEvent.KEYCODE_ENTER || event.getKeyCode() != KeyEvent.ACTION_DOWN)) {
return false;
}
String url = mUrlTextView.getText().toString();
if (!url.startsWith("http")) {
url = "http://" + url;
}
mAwTestContainerView.loadUrl(url);
mUrlTextView.clearFocus();
setKeyboardVisibilityForUrl(false);
mAwTestContainerView.requestFocus();
return true;
}Example 41
| Project: collect-mobile-master File: RadioCodeAttributeComponent.java View source code |
private EditText createQualifierInput() {
final EditText editText = new AppCompatEditText(context);
editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus)
saveNode();
}
});
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_NEXT)
saveNode();
return false;
}
});
editText.setText(attribute.getQualifier());
editText.setSingleLine();
return editText;
}Example 42
| Project: DroidPlugin-master File: IInputMethodManagerHookHandle.java View source code |
@Override
protected boolean beforeInvoke(Object receiver, Method method, Object[] args) throws Throwable {
if (args != null && args.length > 0) {
for (Object arg : args) {
if (arg instanceof EditorInfo) {
EditorInfo info = ((EditorInfo) arg);
if (!TextUtils.equals(mHostContext.getPackageName(), info.packageName)) {
info.packageName = mHostContext.getPackageName();
}
}
}
}
return super.beforeInvoke(receiver, method, args);
}Example 43
| Project: FluxyAndroidTodo-master File: TodoListArrayAdapter.java View source code |
private void setHolderListeners(final ViewHolder holder, final TodoItem item) {
holder.todoDescription.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
DialogFragment editOrDeleteDialog = new EditOrDeleteDialogFragment();
Bundle args = new Bundle();
args.putLong("todoItemId", item.getId());
editOrDeleteDialog.setArguments(args);
editOrDeleteDialog.show(activity.getFragmentManager(), String.valueOf(item.getId()));
return true;
}
});
holder.todoEditDescription.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
boolean handled = false;
if (actionId == EditorInfo.IME_ACTION_DONE) {
actionCreator.createEditTodoAction(item.getId(), v.getText().toString());
handled = true;
}
return handled;
}
});
holder.todoCheckBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
actionCreator.createToggleTodoCompleteAction(item.getId());
}
});
}Example 44
| Project: fresco-master File: MainActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.simple_drawee_view);
final EditText editText = (EditText) findViewById(R.id.uri_edit_text);
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
final boolean isEnterKeyDown = (actionId == EditorInfo.IME_NULL) && (event.getAction() == KeyEvent.ACTION_DOWN);
if (isEnterKeyDown || actionId == EditorInfo.IME_ACTION_DONE) {
updateImageUri(Uri.parse(v.getText().toString()));
}
return false;
}
});
final Button clearButton = (Button) findViewById(R.id.clear_uri);
clearButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editText.getText().clear();
}
});
}Example 45
| Project: HareIME-master File: EditorInfoCompatUtils.java View source code |
public static String imeActionName(int imeOptions) {
final int actionId = imeOptions & EditorInfo.IME_MASK_ACTION;
switch(actionId) {
case EditorInfo.IME_ACTION_UNSPECIFIED:
return "actionUnspecified";
case EditorInfo.IME_ACTION_NONE:
return "actionNone";
case EditorInfo.IME_ACTION_GO:
return "actionGo";
case EditorInfo.IME_ACTION_SEARCH:
return "actionSearch";
case EditorInfo.IME_ACTION_SEND:
return "actionSend";
case EditorInfo.IME_ACTION_NEXT:
return "actionNext";
case EditorInfo.IME_ACTION_DONE:
return "actionDone";
case EditorInfo.IME_ACTION_PREVIOUS:
return "actionPrevious";
default:
return "actionUnknown(" + actionId + ")";
}
}Example 46
| Project: Indic-Keyboard-master File: EditorInfoCompatUtils.java View source code |
public static String imeActionName(final int imeOptions) {
final int actionId = imeOptions & EditorInfo.IME_MASK_ACTION;
switch(actionId) {
case EditorInfo.IME_ACTION_UNSPECIFIED:
return "actionUnspecified";
case EditorInfo.IME_ACTION_NONE:
return "actionNone";
case EditorInfo.IME_ACTION_GO:
return "actionGo";
case EditorInfo.IME_ACTION_SEARCH:
return "actionSearch";
case EditorInfo.IME_ACTION_SEND:
return "actionSend";
case EditorInfo.IME_ACTION_NEXT:
return "actionNext";
case EditorInfo.IME_ACTION_DONE:
return "actionDone";
case EditorInfo.IME_ACTION_PREVIOUS:
return "actionPrevious";
default:
return "actionUnknown(" + actionId + ")";
}
}Example 47
| Project: kasahorow-Keyboard-For-Android-master File: Workarounds.java View source code |
public static boolean doubleActionKeyDisableWorkAround(EditorInfo editor) {
if (editor != null) {
//in firmware 2, 2.1
if (ms_ApiLevel <= 6 && ms_ApiLevel >= 5 && editor.packageName.contentEquals("com.android.mms") && (editor.fieldId == 2131361817)) {
Log.d(TAG, "Android Ecliar Messaging MESSAGE field");
return true;
}
}
return false;
}Example 48
| Project: Lampshade-master File: EditColorTempFragment.java View source code |
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
int temp;
try {
temp = Integer.parseInt((mTempEditText.getText().toString()));
} catch (NumberFormatException e) {
temp = Integer.MAX_VALUE;
}
temp = Math.max(temp, SEEK_BAR_OFFSET);
temp = Math.min(temp, SEEK_BAR_OFFSET + mSeekBar.getMax());
mTempEditText.setText(temp + "");
mSeekBar.setProgress(temp - SEEK_BAR_OFFSET);
mBulbState.setKelvinCT(temp);
mParent.setStateIfVisible(mBulbState, EditColorTempFragment.this, EditStatePager.TEMP_PAGE);
}
return false;
}Example 49
| Project: latinime-cangjie-master File: EditorInfoCompatUtils.java View source code |
public static String imeActionName(int imeOptions) {
final int actionId = imeOptions & EditorInfo.IME_MASK_ACTION;
switch(actionId) {
case EditorInfo.IME_ACTION_UNSPECIFIED:
return "actionUnspecified";
case EditorInfo.IME_ACTION_NONE:
return "actionNone";
case EditorInfo.IME_ACTION_GO:
return "actionGo";
case EditorInfo.IME_ACTION_SEARCH:
return "actionSearch";
case EditorInfo.IME_ACTION_SEND:
return "actionSend";
case EditorInfo.IME_ACTION_NEXT:
return "actionNext";
case EditorInfo.IME_ACTION_DONE:
return "actionDone";
case EditorInfo.IME_ACTION_PREVIOUS:
return "actionPrevious";
default:
return "actionUnknown(" + actionId + ")";
}
}Example 50
| Project: material-components-android-master File: TextInputEditText.java View source code |
@Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { final InputConnection ic = super.onCreateInputConnection(outAttrs); if (ic != null && outAttrs.hintText == null) { // If we don't have a hint and our parent is a TextInputLayout, use it's hint for the // EditorInfo. This allows us to display a hint in 'extract mode'. ViewParent parent = getParent(); while (parent instanceof View) { if (parent instanceof TextInputLayout) { outAttrs.hintText = ((TextInputLayout) parent).getHint(); break; } parent = parent.getParent(); } } return ic; }
Example 51
| Project: maxs-master File: EditTextWatcher.java View source code |
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
switch(actionId) {
// Enter key pressed
case EditorInfo.IME_NULL:
case EditorInfo.IME_ACTION_DONE:
case EditorInfo.IME_ACTION_GO:
case EditorInfo.IME_ACTION_NEXT:
maybeCallLostFocusOrDone(v);
break;
default:
break;
}
return false;
}Example 52
| Project: memorygame-master File: MainMenu.java View source code |
public void changeNickname(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.change_nickname);
final EditText input = new EditText(this);
input.setHeight(100);
input.setWidth(340);
input.setGravity(Gravity.CENTER);
input.setImeOptions(EditorInfo.IME_ACTION_DONE);
builder.setView(input);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
sp.edit().putString("nickname", input.getText().toString()).apply();
alert.dismiss();
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (isFirstLoad) {
alert.dismiss();
changeNickname(null);
Toast.makeText(getApplicationContext(), "Please choose a nickname", Toast.LENGTH_LONG).show();
} else {
alert.dismiss();
}
}
});
alert = builder.create();
alert.show();
}Example 53
| Project: MentorMe-master File: EditProfileLocationFragment.java View source code |
private void setupViews(View v) {
v.setFocusableInTouchMode(true);
v.requestFocus();
// Suppress back button for this fragment.
v.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true;
}
return false;
}
});
etAddress = (EditText) v.findViewById(R.id.etAddress);
etAboutme = (EditText) v.findViewById(R.id.etAboutme);
btnGoToStep2 = (Button) v.findViewById(R.id.btnGoToStep2);
OnEditorActionListener listener = new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_NEXT) {
saveUserData();
}
return false;
}
};
etAddress.setOnEditorActionListener(listener);
}Example 54
| Project: mobile-ecommerce-android-education-master File: MainActivity01.java View source code |
protected void addUiListeners() {
editText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
addCustomer();
return true;
}
return false;
}
});
final View button = findViewById(R.id.buttonAdd);
button.setEnabled(false);
editText.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
boolean enable = s.length() != 0;
button.setEnabled(enable);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void afterTextChanged(Editable s) {
}
});
}Example 55
| Project: mOrgAnd-master File: BaseEditFragment.java View source code |
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
if (EditorInfo.IME_ACTION_DONE == actionId) {
if (controller != null) {
OrgNode editedNode = getEditedNode();
controller.save(editedNode);
Application.getBus().post(new DataUpdatedEvent());
}
dismiss();
return true;
}
return false;
}Example 56
| Project: Moxy-master File: SignInActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_in);
ButterKnife.bind(this);
mPasswordView.setOnEditorActionListener(( textView, id, keyEvent) -> {
if (id == R.id.login || id == EditorInfo.IME_NULL) {
attemptLogin();
return true;
}
return false;
});
mSignInButton.setOnClickListener( view -> attemptLogin());
}Example 57
| Project: openintents-master File: PickBar.java View source code |
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_GO || (event.getAction() == KeyEvent.ACTION_DOWN && (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER || event.getKeyCode() == KeyEvent.KEYCODE_ENTER))) {
if (mListener != null)
mListener.pickRequested(mEditText.getText().toString());
return true;
}
return false;
}Example 58
| Project: platform_frameworks_support-master File: TextInputEditText.java View source code |
@Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { final InputConnection ic = super.onCreateInputConnection(outAttrs); if (ic != null && outAttrs.hintText == null) { // If we don't have a hint and our parent is a TextInputLayout, use it's hint for the // EditorInfo. This allows us to display a hint in 'extract mode'. ViewParent parent = getParent(); while (parent instanceof View) { if (parent instanceof TextInputLayout) { outAttrs.hintText = ((TextInputLayout) parent).getHint(); break; } parent = parent.getParent(); } } return ic; }
Example 59
| Project: pluginframework-master File: IInputMethodManagerHookHandle.java View source code |
@Override
protected boolean beforeInvoke(Object receiver, Method method, Object[] args) throws Throwable {
if (args != null && args.length > 0) {
for (Object arg : args) {
if (arg instanceof EditorInfo) {
EditorInfo info = ((EditorInfo) arg);
if (!TextUtils.equals(mHostContext.getPackageName(), info.packageName)) {
info.packageName = mHostContext.getPackageName();
}
}
}
}
return super.beforeInvoke(receiver, method, args);
}Example 60
| Project: ruboto-irb-master File: HistoryEditText.java View source code |
public boolean onEditorAction(TextView arg0, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_NULL) {
String line = getText().toString();
if (line.length() == 0)
return true;
for (int i = 0; i < adapter.getCount(); i++) {
if (adapter.getItem(i).equals(line)) {
adapter.remove(adapter.getItem(i));
break;
}
}
adapter.insert(line, 0);
if (listener != null) {
listener.onNewLine(line);
return true;
}
}
return false;
}Example 61
| Project: silent-text-android-master File: RequiredFieldListener.java View source code |
@Override
public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
switch(actionId) {
case EditorInfo.IME_ACTION_NEXT:
case EditorInfo.IME_ACTION_DONE:
case EditorInfo.IME_ACTION_SEND:
case EditorInfo.IME_ACTION_GO:
if (ViewUtils.isEmpty(view)) {
ViewUtils.focus(view);
return true;
}
}
return false;
}Example 62
| Project: sophia_oss-master File: EditorInfoCompatUtils.java View source code |
public static String imeActionName(int imeOptions) {
final int actionId = imeOptions & EditorInfo.IME_MASK_ACTION;
switch(actionId) {
case EditorInfo.IME_ACTION_UNSPECIFIED:
return "actionUnspecified";
case EditorInfo.IME_ACTION_NONE:
return "actionNone";
case EditorInfo.IME_ACTION_GO:
return "actionGo";
case EditorInfo.IME_ACTION_SEARCH:
return "actionSearch";
case EditorInfo.IME_ACTION_SEND:
return "actionSend";
case EditorInfo.IME_ACTION_NEXT:
return "actionNext";
case EditorInfo.IME_ACTION_DONE:
return "actionDone";
case EditorInfo.IME_ACTION_PREVIOUS:
return "actionPrevious";
default:
return "actionUnknown(" + actionId + ")";
}
}Example 63
| Project: SpeechWriter-master File: EditTextActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.edit_text_activity);
getActionBar().setDisplayHomeAsUpEnabled(true);
textField = (EditText) findViewById(R.id.edit_text_speech_title);
// Create a speech object from data passed from list activity.
final Intent intent = this.getIntent();
// Get the variables passed as extras.
position = intent.getIntExtra("position", DefaultValues.DEFAULT_INT_VALUE);
id = intent.getLongExtra("id", DefaultValues.DEFAULT_LONG_VALUE);
retrievedText = intent.getStringExtra("text");
// Populate the text field with the speech data.
textField.setText(retrievedText);
textField.setSelection(retrievedText.length());
// Add the done button listener.
textField.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
saveAndFinish(textField, position);
}
return false;
}
});
}Example 64
| Project: Timy-master File: InputDialog.java View source code |
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (EditorInfo.IME_ACTION_DONE == actionId) {
// Return input text to activity
EditNameDialogListener activity = (EditNameDialogListener) getActivity();
activity.onFinishEditDialog(mInput.getText().toString(), mCategoryId, -1);
this.dismiss();
return true;
}
return false;
}Example 65
| Project: woontua-master File: EditorInfoCompatUtils.java View source code |
public static String imeActionName(int imeOptions) {
final int actionId = imeOptions & EditorInfo.IME_MASK_ACTION;
switch(actionId) {
case EditorInfo.IME_ACTION_UNSPECIFIED:
return "actionUnspecified";
case EditorInfo.IME_ACTION_NONE:
return "actionNone";
case EditorInfo.IME_ACTION_GO:
return "actionGo";
case EditorInfo.IME_ACTION_SEARCH:
return "actionSearch";
case EditorInfo.IME_ACTION_SEND:
return "actionSend";
case EditorInfo.IME_ACTION_NEXT:
return "actionNext";
case EditorInfo.IME_ACTION_DONE:
return "actionDone";
case EditorInfo.IME_ACTION_PREVIOUS:
return "actionPrevious";
default:
return "actionUnknown(" + actionId + ")";
}
}Example 66
| Project: xinkvpn-master File: L2tpIpsecPskProfileEditor.java View source code |
@Override
protected void initSpecificWidgets(final ViewGroup content) {
TextView lblKey = new TextView(this);
//$NON-NLS-1$
lblKey.setText(getString(R.string.psk));
content.addView(lblKey);
txtKey = new EditText(this);
txtKey.setLines(1);
txtKey.setImeOptions(EditorInfo.IME_ACTION_NEXT);
txtKey.setTransformationMethod(new PasswordTransformationMethod());
content.addView(txtKey);
super.initSpecificWidgets(content);
}Example 67
| Project: zip4j-master File: PasswordDialog.java View source code |
/*
* (non-Javadoc)
* @see android.support.v4.app.DialogFragment#onCreateDialog(android.os.Bundle)
*/
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.zip_password_fragment, null, false);
EditText passwordEdit = (EditText) view.findViewById(R.id.zip_password_edittext);
mPasswordEdit = passwordEdit;
passwordEdit.requestFocus();
passwordEdit.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (EditorInfo.IME_ACTION_DONE == actionId) {
mListener.onOkButtonPressed(mZipEntry, mPasswordEdit.getText().toString());
PasswordDialog.this.dismiss();
return true;
}
return false;
}
});
if (savedInstanceState != null) {
String password = savedInstanceState.getString(KEY_PASSWORD);
if (!TextUtils.isEmpty(password)) {
mPasswordEdit.setText(password);
}
}
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Encrypted zip file");
builder.setPositiveButton(android.R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mListener.onOkButtonPressed(mZipEntry, mPasswordEdit.getText().toString());
}
});
builder.setView(view);
Dialog d = builder.create();
d.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
return d;
}Example 68
| Project: Android-SDK-Samples-master File: LatinKeyboard.java View source code |
/**
* This looks at the ime options given by the current editor, to set the
* appropriate label on the keyboard's enter key (if it has one).
*/
void setImeOptions(Resources res, int options) {
if (mEnterKey == null) {
return;
}
switch(options & (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION)) {
case EditorInfo.IME_ACTION_GO:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_go_key);
break;
case EditorInfo.IME_ACTION_NEXT:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_next_key);
break;
case EditorInfo.IME_ACTION_SEARCH:
mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_search);
mEnterKey.label = null;
break;
case EditorInfo.IME_ACTION_SEND:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_send_key);
break;
default:
mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_return);
mEnterKey.label = null;
break;
}
}Example 69
| Project: android-testmatos-master File: NumericCriteriaAdapter.java View source code |
@Override
public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
if (actionId != EditorInfo.IME_ACTION_DONE) {
return false;
}
EditText et = (EditText) view;
int position = (Integer) et.getTag();
Cursor c = getItem(position);
String value = et.getEditableText().toString();
String action = c.getString(c.getColumnIndexOrThrow(DBHelper.ADVANCED_SELECT_DETAILLINK_KEY)).replaceAll("%@", value);
Log.d("SQL", action);
// value = "'" + value + "'";
helper.rawQuery(action, null).moveToFirst();
if (action.startsWith("DELETE")) {
try {
Integer.valueOf(value);
Cursor cursor = getItem(position);
String newAction = cursor.getString(c.getColumnIndexOrThrow(DBHelper.ADVANCED_SELECT_DETAILLINK_KEY)).replaceAll("%@", value);
helper.rawQuery(newAction, null);
} catch (NumberFormatException e) {
}
}
// report to self and parent listview dataset has been
// changed
notifyDataSetChanged();
c = getItem(position);
return true;
}Example 70
| Project: android-thaiime-master File: SuggestTestsBase.java View source code |
protected KeyboardId createKeyboardId(Locale locale, int orientation) {
final DisplayMetrics dm = getContext().getResources().getDisplayMetrics();
final int width;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
width = Math.max(dm.widthPixels, dm.heightPixels);
} else if (orientation == Configuration.ORIENTATION_PORTRAIT) {
width = Math.min(dm.widthPixels, dm.heightPixels);
} else {
fail("Orientation should be ORIENTATION_LANDSCAPE or ORIENTATION_PORTRAIT: " + "orientation=" + orientation);
return null;
}
return new KeyboardId(locale.toString() + " keyboard", com.sugree.inputmethod.latin.R.xml.kbd_qwerty, locale, orientation, width, KeyboardId.MODE_TEXT, new EditorInfo(), false, KeyboardId.F2KEY_MODE_NONE, false, false, false);
}Example 71
| Project: AndroidChat-master File: MainActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Make sure we have a mUsername
setupUsername();
setTitle("Chatting as " + mUsername);
// Setup our Firebase mFirebaseRef
mFirebaseRef = new Firebase(FIREBASE_URL).child("chat");
// Setup our input methods. Enter key on the keyboard or pushing the send button
EditText inputText = (EditText) findViewById(R.id.messageInput);
inputText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
if (actionId == EditorInfo.IME_NULL && keyEvent.getAction() == KeyEvent.ACTION_DOWN) {
sendMessage();
}
return true;
}
});
findViewById(R.id.sendButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sendMessage();
}
});
}Example 72
| Project: archi-master File: MainViewModelTest.java View source code |
@Test
public void shouldSearchUsernameWithRepos() {
String username = "usernameWithRepos";
TextView textView = new TextView(application);
textView.setText(username);
List<Repository> mockRepos = MockModelFabric.newListOfRepositories(10);
doReturn(rx.Observable.just(mockRepos)).when(githubService).publicRepositories(username);
mainViewModel.onSearchAction(textView, EditorInfo.IME_ACTION_SEARCH, null);
verify(dataListener).onRepositoriesChanged(mockRepos);
assertEquals(mainViewModel.infoMessageVisibility.get(), View.INVISIBLE);
assertEquals(mainViewModel.progressVisibility.get(), View.INVISIBLE);
assertEquals(mainViewModel.recyclerViewVisibility.get(), View.VISIBLE);
}Example 73
| Project: BLEMeshChat-master File: MessagingFragment.java View source code |
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (mDataStore == null)
throw new IllegalStateException("MessageListFragment must be equipped with a DataStore. Did you call #setDataStore");
// Inflate the layout for this fragment
mRoot = inflater.inflate(R.layout.fragment_message, container, false);
mMessageEntry = (EditText) mRoot.findViewById(R.id.messageEntry);
mMessageEntry.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEND) {
sendMessage(v.getText().toString());
v.setText("");
return true;
}
return false;
}
});
mRoot.findViewById(R.id.sendMessageButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onSendMessageButtonClick(v);
}
});
mRecyclerView = (RecyclerView) mRoot.findViewById(R.id.recyclerView);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mAdapter = new MessageAdapter(getActivity(), null, mDataStore, this, MessageAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
mRecyclerView.setAdapter(mAdapter);
return mRoot;
}Example 74
| Project: Bleu-master File: MainActivity.java View source code |
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_edit_name) {
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
final SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
String username = sharedPref.getString("username", bluetoothAdapter.getName());
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
final EditText nameInput = new EditText(this);
nameInput.setSingleLine();
nameInput.setImeOptions(EditorInfo.IME_ACTION_DONE);
nameInput.setText(username);
nameInput.setSelectAllOnFocus(true);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Enter your username");
builder.setView(nameInput);
builder.setPositiveButton("Submit", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int which) {
imm.hideSoftInputFromWindow(nameInput.getWindowToken(), 0);
sharedPref.edit().putString("username", nameInput.getText().toString()).apply();
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
imm.hideSoftInputFromWindow(nameInput.getWindowToken(), 0);
}
});
final AlertDialog dialog = builder.show();
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
nameInput.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
if (charSequence.length() > 0 && charSequence.length() <= 22) {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(true);
} else {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
}
}
@Override
public void afterTextChanged(Editable editable) {
}
});
return true;
}
return super.onOptionsItemSelected(item);
}Example 75
| Project: blue-chat-master File: MainActivity.java View source code |
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_edit_name) {
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
final SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
String username = sharedPref.getString("username", bluetoothAdapter.getName());
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
final EditText nameInput = new EditText(this);
nameInput.setSingleLine();
nameInput.setImeOptions(EditorInfo.IME_ACTION_DONE);
nameInput.setText(username);
nameInput.setSelectAllOnFocus(true);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(getString(R.string.enter_your_username));
builder.setView(nameInput);
builder.setPositiveButton(getString(R.string.submit), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int which) {
imm.hideSoftInputFromWindow(nameInput.getWindowToken(), 0);
sharedPref.edit().putString(getString(R.string.username), nameInput.getText().toString()).apply();
}
});
builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
imm.hideSoftInputFromWindow(nameInput.getWindowToken(), 0);
}
});
final AlertDialog dialog = builder.show();
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
nameInput.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
if (charSequence.length() > 0 && charSequence.length() <= 22) {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(true);
} else {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
}
}
@Override
public void afterTextChanged(Editable editable) {
}
});
return true;
}
return super.onOptionsItemSelected(item);
}Example 76
| Project: bowser-master File: UserAgentListPreference.java View source code |
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId != EditorInfo.IME_ACTION_DONE) {
return false;
}
String ua = editText.getText().toString().trim();
if (ua.isEmpty()) {
NinjaToast.show(getContext(), R.string.toast_input_empty);
return true;
} else {
sp.edit().putString(getContext().getString(R.string.sp_user_agent), "2").commit();
sp.edit().putString(getContext().getString(R.string.sp_user_agent_custom), ua).commit();
hideSoftInput(editText);
dialog.hide();
dialog.dismiss();
return false;
}
}Example 77
| Project: bulkey-master File: FieldContext.java View source code |
private static void addEditorInfoToBundle(EditorInfo info, Bundle bundle) {
if (info == null) {
return;
}
bundle.putString(LABEL, safeToString(info.label));
bundle.putString(HINT, safeToString(info.hintText));
bundle.putString(PACKAGE_NAME, safeToString(info.packageName));
bundle.putInt(FIELD_ID, info.fieldId);
bundle.putString(FIELD_NAME, safeToString(info.fieldName));
bundle.putInt(INPUT_TYPE, info.inputType);
bundle.putInt(IME_OPTIONS, info.imeOptions);
}Example 78
| Project: CameraV-master File: LoginActivity.java View source code |
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
packageName = this.getPackageName();
setContentView(R.layout.activity_login);
rootView = findViewById(R.id.llRoot);
boolean prefStealthIcon = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("prefStealthIcon", false);
if (prefStealthIcon) {
ImageView iv = (ImageView) findViewById(R.id.loginLogo);
iv.setImageResource(R.drawable.ic_launcher_alt);
}
password = (EditText) findViewById(R.id.login_password);
password.setImeOptions(EditorInfo.IME_ACTION_DONE);
password.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView arg0, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
doLogin();
}
return true;
}
});
/**
commit = (Button) findViewById(R.id.login_commit);
commit.setOnClickListener(this);
*/
waiter = (ProgressBar) findViewById(R.id.login_waiter);
checkForCrashes();
checkForUpdates();
}Example 79
| Project: chat-sdk-android-master File: ChatSDKLoginActivity.java View source code |
private void initListeners() {
/* Registering listeners.*/
btnLogin.setOnClickListener(this);
btnReg.setOnClickListener(this);
btnAnon.setOnClickListener(this);
btnTwitter.setOnClickListener(this);
etPass.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
btnLogin.callOnClick();
}
return false;
}
});
}Example 80
| Project: Collageify-master File: LatinKeyboard.java View source code |
/**
* This looks at the ime options given by the current editor, to set the
* appropriate label on the keyboard's enter key (if it has one).
*/
void setImeOptions(Resources res, int options) {
if (mEnterKey == null) {
return;
}
switch(options & (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION)) {
case EditorInfo.IME_ACTION_GO:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_go_key);
break;
case EditorInfo.IME_ACTION_NEXT:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_next_key);
break;
case EditorInfo.IME_ACTION_SEARCH:
mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_search);
mEnterKey.label = null;
break;
case EditorInfo.IME_ACTION_SEND:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_send_key);
break;
default:
mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_return);
mEnterKey.label = null;
break;
}
}Example 81
| Project: CSipSimple-master File: PickupSipUri.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pickup_uri);
//Set window size
// LayoutParams params = getWindow().getAttributes();
// params.width = LayoutParams.FILL_PARENT;
// getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);
//Set title
// TODO -- use dialog instead
// ((TextView) findViewById(R.id.my_title)).setText(R.string.pickup_sip_uri);
// ((ImageView) findViewById(R.id.my_icon)).setImageResource(android.R.drawable.ic_menu_call);
okBtn = (Button) findViewById(R.id.ok);
okBtn.setOnClickListener(this);
Button btn = (Button) findViewById(R.id.cancel);
btn.setOnClickListener(this);
sipUri = (EditSipUri) findViewById(R.id.sip_uri);
sipUri.getTextField().setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView tv, int action, KeyEvent arg2) {
if (action == EditorInfo.IME_ACTION_GO) {
sendPositiveResult();
return true;
}
return false;
}
});
sipUri.setShowExternals(false);
}Example 82
| Project: CSipSimple-old-master File: PickupSipUri.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pickup_uri);
//Set window size
// LayoutParams params = getWindow().getAttributes();
// params.width = LayoutParams.FILL_PARENT;
// getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);
//Set title
// TODO -- use dialog instead
// ((TextView) findViewById(R.id.my_title)).setText(R.string.pickup_sip_uri);
// ((ImageView) findViewById(R.id.my_icon)).setImageResource(android.R.drawable.ic_menu_call);
okBtn = (Button) findViewById(R.id.ok);
okBtn.setOnClickListener(this);
Button btn = (Button) findViewById(R.id.cancel);
btn.setOnClickListener(this);
sipUri = (EditSipUri) findViewById(R.id.sip_uri);
sipUri.getTextField().setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView tv, int action, KeyEvent arg2) {
if (action == EditorInfo.IME_ACTION_GO) {
sendPositiveResult();
return true;
}
return false;
}
});
sipUri.setShowExternals(false);
}Example 83
| Project: development_apps_spareparts-master File: LatinKeyboard.java View source code |
/**
* This looks at the ime options given by the current editor, to set the
* appropriate label on the keyboard's enter key (if it has one).
*/
void setImeOptions(Resources res, int options) {
if (mEnterKey == null) {
return;
}
switch(options & (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION)) {
case EditorInfo.IME_ACTION_GO:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_go_key);
break;
case EditorInfo.IME_ACTION_NEXT:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_next_key);
break;
case EditorInfo.IME_ACTION_SEARCH:
mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_search);
mEnterKey.label = null;
break;
case EditorInfo.IME_ACTION_SEND:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_send_key);
break;
default:
mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_return);
mEnterKey.label = null;
break;
}
}Example 84
| Project: digits-android-master File: DigitsActivityDelegateImpl.java View source code |
public void setUpEditText(final Activity activity, final DigitsController controller, EditText editText) {
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_NEXT) {
controller.clearError();
controller.executeRequest(activity);
return true;
}
return false;
}
});
editText.addTextChangedListener(controller.getTextWatcher());
}Example 85
| Project: Fake-Checkin-master File: Search.java View source code |
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
venueSearchList = new ArrayList<Venue>();
new LoadVenues().execute(CheckIn.staticLocation, venueSearchList, currentAct, LoadVenues.CONST_SUGGESTVENUES, ((EditText) findViewById(R.id.editTxtSearch)).getText().toString());
InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
return true;
}
return false;
}Example 86
| Project: Galaxy-Tab-Gingerbread-Stock-Keyboard-master File: FieldContext.java View source code |
private static void addEditorInfoToBundle(EditorInfo info, Bundle bundle) {
if (info == null) {
return;
}
bundle.putString(LABEL, safeToString(info.label));
bundle.putString(HINT, safeToString(info.hintText));
bundle.putString(PACKAGE_NAME, safeToString(info.packageName));
bundle.putInt(FIELD_ID, info.fieldId);
bundle.putString(FIELD_NAME, safeToString(info.fieldName));
bundle.putInt(INPUT_TYPE, info.inputType);
bundle.putInt(IME_OPTIONS, info.imeOptions);
}Example 87
| Project: Gingerbread-Keyboard-master File: FieldContext.java View source code |
private static void addEditorInfoToBundle(EditorInfo info, Bundle bundle) {
if (info == null) {
return;
}
bundle.putString(LABEL, safeToString(info.label));
bundle.putString(HINT, safeToString(info.hintText));
bundle.putString(PACKAGE_NAME, safeToString(info.packageName));
bundle.putInt(FIELD_ID, info.fieldId);
bundle.putString(FIELD_NAME, safeToString(info.fieldName));
bundle.putInt(INPUT_TYPE, info.inputType);
bundle.putInt(IME_OPTIONS, info.imeOptions);
}Example 88
| Project: greenDAO-master File: MainActivity.java View source code |
protected void setUpViews() {
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerViewNotes);
//noinspection ConstantConditions
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
notesAdapter = new NotesAdapter(noteClickListener);
recyclerView.setAdapter(notesAdapter);
addNoteButton = findViewById(R.id.buttonAdd);
editText = (EditText) findViewById(R.id.editTextNote);
//noinspection ConstantConditions
RxTextView.editorActions(editText).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Integer>() {
@Override
public void call(Integer actionId) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
addNote();
}
}
});
RxTextView.afterTextChangeEvents(editText).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<TextViewAfterTextChangeEvent>() {
@Override
public void call(TextViewAfterTextChangeEvent textViewAfterTextChangeEvent) {
boolean enable = textViewAfterTextChangeEvent.editable().length() > 0;
addNoteButton.setEnabled(enable);
}
});
}Example 89
| Project: GreenDao-SQLCipher-master File: NoteActivity.java View source code |
protected void addUiListeners() {
editText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
addNote();
return true;
}
return false;
}
});
final View button = findViewById(R.id.buttonAdd);
button.setEnabled(false);
editText.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
boolean enable = s.length() != 0;
button.setEnabled(enable);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void afterTextChanged(Editable s) {
}
});
}Example 90
| Project: Grinnell-DB-Android-master File: BasicSearchFragment.java View source code |
public void initializeViews(Context c) {
firstNameText = (TextView) mView.findViewById(R.id.first_text);
lastNameText = (TextView) mView.findViewById(R.id.last_text);
OnEditorActionListener editTextListener = new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
boolean handled = false;
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
sendQuery();
handled = true;
}
return handled;
}
};
firstNameText.setOnEditorActionListener(editTextListener);
lastNameText.setOnEditorActionListener(editTextListener);
}Example 91
| Project: GroceryGo-master File: ShopCartAddFragment.java View source code |
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.shopcart_add_fragment, container, false);
final Button confirmButton = (Button) v.findViewById(R.id.positive_button);
confirmButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addItem();
}
});
final Button clearButton = (Button) v.findViewById(R.id.negative_button);
clearButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clearFocus();
}
});
// Disable both buttons by default
confirmButton.setEnabled(false);
clearButton.setEnabled(false);
mEditText = (EditText) v.findViewById(R.id.cart_grocery_edit_name);
mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_GO) {
addItem();
return true;
}
return false;
}
});
mEditText.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
if (s == null || s.length() == 0) {
confirmButton.setEnabled(false);
clearButton.setEnabled(false);
} else {
confirmButton.setEnabled(true);
clearButton.setEnabled(true);
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
});
return v;
}Example 92
| Project: ICS_LatinIME_QHD-master File: SuggestTestsBase.java View source code |
protected KeyboardId createKeyboardId(Locale locale, int orientation) {
final DisplayMetrics dm = getContext().getResources().getDisplayMetrics();
final int width;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
width = Math.max(dm.widthPixels, dm.heightPixels);
} else if (orientation == Configuration.ORIENTATION_PORTRAIT) {
width = Math.min(dm.widthPixels, dm.heightPixels);
} else {
fail("Orientation should be ORIENTATION_LANDSCAPE or ORIENTATION_PORTRAIT: " + "orientation=" + orientation);
return null;
}
return new KeyboardId(locale.toString() + " keyboard", com.android.inputmethod.latin.R.xml.kbd_qwerty, locale, orientation, width, KeyboardId.MODE_TEXT, new EditorInfo(), false, KeyboardId.F2KEY_MODE_NONE, false, false, false);
}Example 93
| Project: LatinIME-master File: SuggestTestsBase.java View source code |
protected KeyboardId createKeyboardId(Locale locale, int orientation) {
final DisplayMetrics dm = getContext().getResources().getDisplayMetrics();
final int width;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
width = Math.max(dm.widthPixels, dm.heightPixels);
} else if (orientation == Configuration.ORIENTATION_PORTRAIT) {
width = Math.min(dm.widthPixels, dm.heightPixels);
} else {
fail("Orientation should be ORIENTATION_LANDSCAPE or ORIENTATION_PORTRAIT: " + "orientation=" + orientation);
return null;
}
return new KeyboardId(locale.toString() + " keyboard", com.android.inputmethod.latin.R.xml.kbd_qwerty, locale, orientation, width, KeyboardId.MODE_TEXT, new EditorInfo(), false, KeyboardId.F2KEY_MODE_NONE, false, false, false);
}Example 94
| Project: limehd_fork-master File: TestLimeService.java View source code |
public void testLIMEServiceStart() {
Log.i(TAG, "testLIMEServiceStart() starting...");
try {
Intent intent = new Intent();
startService(intent);
LIMEService Serv = getService();
assertNotNull(Serv);
SystemClock.sleep(1000);
Serv.onCreateInputView();
Serv.onCreateCandidatesView();
EditorInfo attribute = new EditorInfo();
attribute.inputType = EditorInfo.TYPE_CLASS_TEXT;
Serv.onStartInput(attribute, false);
SystemClock.sleep(1000);
//Testing parameters--------------------------------
boolean doRandomTest = true;
int radomIterations = 10;
String[] testCodes = { "m", "eeeeeeeeeeee" };
Debug.startMethodTracing("LimeService");
if (doRandomTest) {
randomTypingTest(Serv, radomIterations);
} else {
for (String code : testCodes) {
simulateInput(Serv, code, true);
}
}
Debug.stopMethodTracing();
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
} finally {
Log.i(TAG, "testLIMEServiceStart() ended.");
}
}Example 95
| Project: MasterTap-master File: EnterPasswordDialog.java View source code |
@Override
public void onResume() {
super.onResume();
final AlertDialog alertDialog = (AlertDialog) getDialog();
// Set OnCancelListener.
alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
final MainActivity ctx = (MainActivity) getActivity();
ctx.finish();
}
});
// Set OnEditorActionListener for EditText.
EditText passwordInput = (EditText) alertDialog.findViewById(R.id.passwordInput);
passwordInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
submitPassword(alertDialog);
return true;
} else {
return false;
}
}
});
// Set OnClickListener for save button.
Button saveButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
saveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View onClick) {
submitPassword(alertDialog);
}
});
}Example 96
| Project: mfh-app-framework-master File: CustomSearchView.java View source code |
private void initView() {
View.inflate(context, R.layout.custom_search_view, this);
etQueryText = (EditText) findViewById(R.id.et_query);
//设置键盘回车类型
etQueryText.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
etQueryText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == EditorInfo.IME_ACTION_SEARCH || (keyEvent != null && keyEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
if (listener != null) {
listener.doSearch(getQueryText());
}
return true;
}
return false;
}
});
etQueryText.addTextChangedListener(queryTextWatcher);
ibClear = (ImageButton) findViewById(R.id.search_clear);
ibClear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// etQueryText.setText("");
etQueryText.getText().clear();
}
});
}Example 97
| Project: ObjectBoxExamples-master File: ReactiveNoteActivity.java View source code |
protected void setUpViews() {
ListView listView = (ListView) findViewById(R.id.listViewNotes);
listView.setOnItemClickListener(noteClickListener);
notesAdapter = new NotesAdapter();
listView.setAdapter(notesAdapter);
addNoteButton = findViewById(R.id.buttonAdd);
addNoteButton.setEnabled(false);
editText = (EditText) findViewById(R.id.editTextNote);
editText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
addNote();
return true;
}
return false;
}
});
editText.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
boolean enable = s.length() != 0;
addNoteButton.setEnabled(enable);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void afterTextChanged(Editable s) {
}
});
}Example 98
| Project: openrocket-master File: MotorDelayDialogFragment.java View source code |
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
String s = v.getText().toString();
if (// note requires ems=10
s != null) {
long value = Long.parseLong(s);
if (delaySelectedListener != null) {
delaySelectedListener.onDelaySelected(value);
}
}
return true;
}
return false;
}Example 99
| Project: PageTurner-master File: DialogFactory.java View source code |
public void showSearchDialog(int titleId, int questionId, final SearchCallBack callBack) {
final AlertDialog.Builder searchInputDialogBuilder = new AlertDialog.Builder(context);
searchInputDialogBuilder.setTitle(titleId);
searchInputDialogBuilder.setMessage(questionId);
// Set an EditText view to get user input
final EditText input = new EditText(context);
input.setInputType(InputType.TYPE_CLASS_TEXT);
searchInputDialogBuilder.setView(input);
searchInputDialogBuilder.setPositiveButton(android.R.string.search_go, ( dialog, which) -> callBack.performSearch(input.getText().toString()));
searchInputDialogBuilder.setNegativeButton(android.R.string.cancel, ( dialog, which) -> {
});
final AlertDialog searchInputDialog = searchInputDialogBuilder.show();
input.setOnEditorActionListener(( v, actionId, event) -> {
if (event == null) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
callBack.performSearch(input.getText().toString());
searchInputDialog.dismiss();
return true;
}
} else if (actionId == EditorInfo.IME_NULL) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
callBack.performSearch(input.getText().toString());
searchInputDialog.dismiss();
}
return true;
}
return false;
});
}Example 100
| Project: platform_development-master File: LatinKeyboard.java View source code |
/**
* This looks at the ime options given by the current editor, to set the
* appropriate label on the keyboard's enter key (if it has one).
*/
void setImeOptions(Resources res, int options) {
if (mEnterKey == null) {
return;
}
switch(options & (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION)) {
case EditorInfo.IME_ACTION_GO:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_go_key);
break;
case EditorInfo.IME_ACTION_NEXT:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_next_key);
break;
case EditorInfo.IME_ACTION_SEARCH:
mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_search);
mEnterKey.label = null;
break;
case EditorInfo.IME_ACTION_SEND:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_send_key);
break;
default:
mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_return);
mEnterKey.label = null;
break;
}
}Example 101
| Project: PlayTunes-master File: CreatePlaylistDialogFragment.java View source code |
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (EditorInfo.IME_ACTION_DONE == actionId) {
// Return input text to activity
//EditNameDialogListener activity = (EditNameDialogListener) getActivity();
//activity.onFinishEditDialog(mEditText.getText().toString());
createPlaylist();
return true;
}
return false;
}