use of android.widget.MultiAutoCompleteTextView in project Android-skin-support by ximsfei.
the class FirstFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_first, null);
view.findViewById(R.id.image_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getActivity(), "Image Button", Toast.LENGTH_SHORT).show();
}
});
view.findViewById(R.id.checked_text_view).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
CheckedTextView checkedTextView = (CheckedTextView) v;
checkedTextView.toggle();
// checkedMap.put(position, checkedTextView.isChecked());
}
});
MultiAutoCompleteTextView autoCompleteTextView = (MultiAutoCompleteTextView) view.findViewById(R.id.auto);
String[] arr = { "aa", "aab", "aac" };
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, arr);
autoCompleteTextView.setAdapter(arrayAdapter);
autoCompleteTextView.setThreshold(1);
autoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
return view;
}
use of android.widget.MultiAutoCompleteTextView in project Shaarlier by dimtion.
the class AddActivity method handleDialog.
//
// Method made to handle the dialog box
//
private void handleDialog(final String sharedUrl, String givenTitle, String defaultDescription, String defaultTags) {
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.AppTheme));
LayoutInflater inflater = AddActivity.this.getLayoutInflater();
final View dialogView = inflater.inflate(R.layout.share_dialog, null);
((CheckBox) dialogView.findViewById(R.id.private_share)).setChecked(privateShare);
this.a_dialogView = dialogView;
// Init accountSpinner
initAccountSpinner();
// Load title or description:
if ((autoDescription || autoTitle) && NetworkManager.isUrl(sharedUrl)) {
loadAutoTitleAndDescription(sharedUrl, givenTitle, defaultDescription);
}
// Init url :
((EditText) dialogView.findViewById(R.id.url)).setText(sharedUrl);
// Init tags :
MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) dialogView.findViewById(R.id.tags);
((EditText) dialogView.findViewById(R.id.tags)).setText(defaultTags);
new AutoCompleteWrapper(textView, this);
// Init the tweet button if necessary:
CheckBox tweetCheckBox = ((CheckBox) dialogView.findViewById(R.id.tweet));
if (!this.tweet) {
tweetCheckBox.setVisibility(View.GONE);
tweetCheckBox.setChecked(false);
} else {
tweetCheckBox.setVisibility(View.VISIBLE);
tweetCheckBox.setChecked(true);
}
// Open the dialog :
builder.setView(dialogView).setTitle(R.string.share).setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// Retrieve user data
String url = ((EditText) dialogView.findViewById(R.id.url)).getText().toString();
String title = ((EditText) dialogView.findViewById(R.id.title)).getText().toString();
String description = ((EditText) dialogView.findViewById(R.id.description)).getText().toString();
String tags = ((EditText) dialogView.findViewById(R.id.tags)).getText().toString();
privateShare = ((CheckBox) dialogView.findViewById(R.id.private_share)).isChecked();
tweet = ((CheckBox) dialogView.findViewById(R.id.tweet)).isChecked();
chosenAccount = (ShaarliAccount) ((Spinner) dialogView.findViewById(R.id.chooseAccount)).getSelectedItem();
// Finally send everything
handleSendPost(url, title, description, tags, privateShare, chosenAccount, tweet);
}
}).setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finish();
}
}).setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
finish();
}
}).show();
}
use of android.widget.MultiAutoCompleteTextView 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.MultiAutoCompleteTextView in project android-demos by novoda.
the class AutoMultipleContacts method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.multipleselect);
Cursor peopleCursor = getContentResolver().query(Contacts.People.CONTENT_URI, PEOPLE_PROJECTION, null, null, Contacts.People.DEFAULT_SORT_ORDER);
ContactListAdapter contactadapter = new ContactListAdapter(this, peopleCursor);
MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.contacts);
textView.setAdapter(contactadapter);
textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
use of android.widget.MultiAutoCompleteTextView in project android-demos by novoda.
the class SMS method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sms);
btnSendSMS = (Button) findViewById(R.id.btnSendSMS);
txtPhoneNo = (EditText) findViewById(R.id.txtPhoneNo);
txtMessage = (EditText) findViewById(R.id.txtMessage);
btnSendSMS.setOnClickListener(getNewSendSmsListener());
Cursor peopleCursor = getContentResolver().query(Contacts.People.CONTENT_URI, PEOPLE_PROJECTION, null, null, Contacts.People.DEFAULT_SORT_ORDER);
ContactListAdapter contactadapter = new ContactListAdapter(this, peopleCursor);
MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.txtPhoneNo);
textView.setAdapter(contactadapter);
textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
Aggregations