use of android.widget.TextView.OnEditorActionListener in project androidannotations by androidannotations.
the class EditorActionsActivityTest method testValueReturnedFromNonVoidEditorActionMethod.
@Test
public void testValueReturnedFromNonVoidEditorActionMethod() {
TextView editText = (TextView) activity.findViewById(R.id.textView2);
OnEditorActionListener listener = getOnEditorActionListener(editText);
assertThat(listener.onEditorAction(editText, 0, null)).isFalse();
}
use of android.widget.TextView.OnEditorActionListener in project androidannotations by androidannotations.
the class EditorActionsActivityTest method testTrueReturnedFromVoidEditorActionMethod.
@Test
public void testTrueReturnedFromVoidEditorActionMethod() {
EditText editText = (EditText) activity.findViewById(R.id.editText3);
OnEditorActionListener listener = getOnEditorActionListener(editText);
assertThat(listener.onEditorAction(editText, 0, null)).isTrue();
}
use of android.widget.TextView.OnEditorActionListener in project android-delicious by lexs.
the class AddBookmarkActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_bookmark);
setTitle(R.string.activity_add_bookmark_title);
// Enable up button
getActionBar().setHomeButtonEnabled(true);
errorDrawable = DeliciousApplication.getErrorDrawable();
titleFetcher = new TitleFetcher(this);
receiver = new DetachableResultReceiver(new Handler());
urlView = (EditText) findViewById(R.id.url);
titleView = (EditText) findViewById(R.id.title);
notesView = (EditText) findViewById(R.id.notes);
tagsView = (MultiAutoCompleteTextView) findViewById(R.id.tags);
privateView = (CheckBox) findViewById(R.id.mark_private);
// TODO: Implement tag suggestion
/*ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_dropdown_item, TAGS);
tagsView.setAdapter(adapter);
tagsView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());*/
// Enable user to press enter when done
tagsView.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
saveBookmark();
return true;
} else {
return false;
}
}
});
Intent intent = getIntent();
if (Intent.ACTION_SEND.equals(intent.getAction())) {
String url = intent.getStringExtra(Intent.EXTRA_TEXT);
String title = intent.getStringExtra(Intent.EXTRA_SUBJECT);
urlView.setText(url);
titleView.setText(title);
// Check were focus should go
if (TextUtils.isEmpty(url)) {
urlView.requestFocus();
} else if (TextUtils.isEmpty(title)) {
titleView.requestFocus();
} else {
// Focus tags because it can't be prefilled
tagsView.requestFocus();
}
}
// Fetch title if necessary
titleFetcher.maybeFetchTitle();
}
use of android.widget.TextView.OnEditorActionListener in project roboguice by roboguice.
the class AstroboyMasterConsole method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
// @Inject, @InjectResource, and @InjectExtra injection happens during super.onCreate()
super.onCreate(savedInstanceState);
sayText.setOnEditorActionListener(new OnEditorActionListener() {
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
// Have the remoteControl tell Astroboy to say something
remoteControl.say(textView.getText().toString());
textView.setText(null);
return true;
}
});
brushTeethButton.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
remoteControl.brushTeeth();
}
});
selfDestructButton.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
// Self destruct the remoteControl
vibrator.vibrate(2000);
remoteControl.selfDestruct();
}
});
// Fighting the forces of evil deserves its own activity
fightEvilButton.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
startActivity(new Intent(AstroboyMasterConsole.this, FightForcesOfEvilActivity.class));
}
});
}
use of android.widget.TextView.OnEditorActionListener in project mobile-android by photo.
the class TagsFragment method init.
public void init(View v) {
final EditText search = (EditText) v.findViewById(R.id.edit_search);
search.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (event != null) {
switch(event.getKeyCode()) {
case KeyEvent.KEYCODE_ENTER:
CommonUtils.debug(TAG, "Key code enter");
if (KeyEvent.ACTION_DOWN == event.getAction()) {
CommonUtils.debug(TAG, "Opening gallery");
search.post(new Runnable() {
@Override
public void run() {
galleryOpenControl.openGallery(search.getText().toString().trim(), null);
}
});
return true;
}
break;
}
}
return false;
}
});
Button filterBtn = (Button) v.findViewById(R.id.filterBtn);
filterBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
TrackerUtils.trackButtonClickEvent("filterBtn", TagsFragment.this);
galleryOpenControl.openGallery(mAdapter.getSelectedTags(), null);
}
});
refresh(v);
}
Aggregations