Search in sources :

Example 46 with AutoCompleteTextView

use of android.widget.AutoCompleteTextView in project HistoryEditText by zenlibs.

the class SimpleHistoryActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try {
        InputStream inputStream = getResources().openRawResource(R.raw.countries);
        BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
        String line;
        while ((line = reader.readLine()) != null) {
            mCountries.add(line);
        }
        reader.close();
    } catch (IOException e) {
    }
    setContentView(R.layout.activity_simple);
    mHistoryEditText = (HistoryEditText) findViewById(R.id.historyEditText);
    mHistoryEditText.setAdapter(createAdapter());
    mHistoryEditText2 = (HistoryEditText) findViewById(R.id.historyEditText2);
    mHistoryEditText2.setAdapter(createAdapter());
    autoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView);
    autoCompleteTextView.setAdapter(createAdapter());
    autoCompleteTextView.setThreshold(1);
    autoCompleteTextView.setOnFocusChangeListener(new View.OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                autoCompleteTextView.showDropDown();
            } else {
                autoCompleteTextView.dismissDropDown();
            }
        }
    });
}
Also used : InputStreamReader(java.io.InputStreamReader) InputStream(java.io.InputStream) BufferedReader(java.io.BufferedReader) IOException(java.io.IOException) AutoCompleteTextView(android.widget.AutoCompleteTextView) View(android.view.View)

Example 47 with AutoCompleteTextView

use of android.widget.AutoCompleteTextView in project weiciyuan by qii.

the class AbstractWriteActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.abstractwriteactivity_layout);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayShowCustomEnabled(true);
    int avatarWidth = getResources().getDimensionPixelSize(R.dimen.timeline_avatar_width);
    int avatarHeight = getResources().getDimensionPixelSize(R.dimen.timeline_avatar_height);
    Bitmap bitmap = ImageUtility.getWriteWeiboRoundedCornerPic(getCurrentAccountBean().getInfo().getAvatar_large(), avatarWidth, avatarHeight, FileLocationMethod.avatar_large);
    if (bitmap == null) {
        bitmap = ImageUtility.getWriteWeiboRoundedCornerPic(getCurrentAccountBean().getInfo().getProfile_image_url(), avatarWidth, avatarHeight, FileLocationMethod.avatar_small);
    }
    if (bitmap != null) {
        actionBar.setIcon(new BitmapDrawable(getResources(), bitmap));
    }
    token = getIntent().getStringExtra("token");
    View title = getLayoutInflater().inflate(R.layout.writeweiboactivity_title_layout, null);
    actionBar.setCustomView(title, new ActionBar.LayoutParams(Gravity.RIGHT));
    et = ((AutoCompleteTextView) findViewById(R.id.status_new_content));
    et.addTextChangedListener(new TextNumLimitWatcher((TextView) findViewById(R.id.menu_send), et, this));
    AutoCompleteAdapter adapter = new AutoCompleteAdapter(this, et, (ProgressBar) title.findViewById(R.id.have_suggest_progressbar));
    et.setAdapter(adapter);
    findViewById(R.id.menu_topic).setOnClickListener(this);
    findViewById(R.id.menu_at).setOnClickListener(this);
    findViewById(R.id.menu_emoticon).setOnClickListener(this);
    findViewById(R.id.menu_send).setOnClickListener(this);
    CheatSheet.setup(AbstractWriteActivity.this, findViewById(R.id.menu_at), R.string.at_other);
    CheatSheet.setup(AbstractWriteActivity.this, findViewById(R.id.menu_emoticon), R.string.add_emoticon);
    CheatSheet.setup(AbstractWriteActivity.this, findViewById(R.id.menu_topic), R.string.add_topic);
    CheatSheet.setup(AbstractWriteActivity.this, findViewById(R.id.menu_send), R.string.send);
    smiley = (SmileyPicker) findViewById(R.id.smiley_picker);
    smiley.setEditText(AbstractWriteActivity.this, ((LinearLayout) findViewById(R.id.root_layout)), et);
    container = (RelativeLayout) findViewById(R.id.container);
    et.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            hideSmileyPicker(true);
        }
    });
}
Also used : BitmapDrawable(android.graphics.drawable.BitmapDrawable) View(android.view.View) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) Bitmap(android.graphics.Bitmap) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) ActionBar(android.app.ActionBar) LinearLayout(android.widget.LinearLayout) AutoCompleteTextView(android.widget.AutoCompleteTextView)

Example 48 with AutoCompleteTextView

use of android.widget.AutoCompleteTextView in project weiciyuan by qii.

the class DMSelectUserActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dmselectuseractivity_layout);
    getActionBar().setTitle(R.string.select_dm_receiver);
    getActionBar().setDisplayShowHomeEnabled(false);
    getActionBar().setDisplayShowTitleEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    View title = getLayoutInflater().inflate(R.layout.dmselectuseractivity_title_layout, null);
    suggestProgressBar = (ProgressBar) title.findViewById(R.id.have_suggest_progressbar);
    getActionBar().setCustomView(title, new ActionBar.LayoutParams(Gravity.RIGHT));
    getActionBar().setDisplayShowCustomEnabled(true);
    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction().replace(R.id.list_content, SelectFriendsListFragment.newInstance(GlobalContext.getInstance().getAccountBean().getInfo())).commit();
    }
    AutoCompleteTextView search = (AutoCompleteTextView) findViewById(R.id.search);
    AutoCompleteAdapter adapter = new AutoCompleteAdapter(this, android.R.layout.simple_dropdown_item_1line);
    search.setAdapter(adapter);
    search.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = new Intent();
            intent.putExtra("user", data.get(position));
            setResult(0, intent);
            finish();
        }
    });
}
Also used : AdapterView(android.widget.AdapterView) Intent(android.content.Intent) PerformanceImageView(org.qii.weiciyuan.support.lib.PerformanceImageView) View(android.view.View) AdapterView(android.widget.AdapterView) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) ActionBar(android.app.ActionBar) AutoCompleteTextView(android.widget.AutoCompleteTextView)

Example 49 with AutoCompleteTextView

use of android.widget.AutoCompleteTextView in project musicbrainz-android by jdamcd.

the class SearchFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = inflater.inflate(R.layout.fragment_dash_search, container);
    searchTypeSpinner = (Spinner) layout.findViewById(R.id.search_spin);
    searchField = (AutoCompleteTextView) layout.findViewById(R.id.query_input);
    searchField.setOnEditorActionListener(this);
    layout.findViewById(R.id.search_btn).setOnClickListener(this);
    return layout;
}
Also used : AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 50 with AutoCompleteTextView

use of android.widget.AutoCompleteTextView in project coursera-android by aporter.

the class AutoCompleteActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    String[] mCountries = getResources().getStringArray(R.array.country_names);
    // Get a reference to the AutoCompleteTextView
    final AutoCompleteTextView textView = findViewById(R.id.autocomplete_country);
    // Create an ArrayAdapter containing country names
    ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.list_item, mCountries);
    // Set the adapter for the AutoCompleteTextView
    textView.setAdapter(adapter);
    // Display a Toast Message when the user clicks on an item in the AutoCompleteTextView
    textView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View view, int arg2, long arg3) {
            Toast.makeText(getApplicationContext(), getString(R.string.winner_is_string, arg0.getAdapter().getItem(arg2)), Toast.LENGTH_LONG).show();
            textView.setText("");
        }
    });
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) View(android.view.View) AdapterView(android.widget.AdapterView) AutoCompleteTextView(android.widget.AutoCompleteTextView) ArrayAdapter(android.widget.ArrayAdapter) AutoCompleteTextView(android.widget.AutoCompleteTextView)

Aggregations

AutoCompleteTextView (android.widget.AutoCompleteTextView)106 View (android.view.View)62 TextView (android.widget.TextView)44 ArrayAdapter (android.widget.ArrayAdapter)38 Button (android.widget.Button)27 EditText (android.widget.EditText)21 OnClickListener (android.view.View.OnClickListener)20 KeyEvent (android.view.KeyEvent)19 AdapterView (android.widget.AdapterView)17 Intent (android.content.Intent)16 ImageView (android.widget.ImageView)14 Editable (android.text.Editable)10 TextWatcher (android.text.TextWatcher)10 ArrayList (java.util.ArrayList)9 Dialog (android.app.Dialog)8 ListView (android.widget.ListView)8 Spinner (android.widget.Spinner)8 DialogInterface (android.content.DialogInterface)7 InputMethodManager (android.view.inputmethod.InputMethodManager)7 SuppressLint (android.annotation.SuppressLint)6