Java Code Examples for android.widget.ListView#setTextFilterEnabled()

The following examples show how to use android.widget.ListView#setTextFilterEnabled() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: AndroidQuick   File: BottomDialogFragment.java    License: MIT License 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    Bundle bundle = getArguments();
    itemData = bundle.getStringArray("key");
    // 去掉默认的标题
    getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
    View view = View.inflate(getContext(), R.layout.fragment_bottom, null);
    ListView listView = view.findViewById(R.id.lv_result);
    ArrayAdapter<String> mAdapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_expandable_list_item_1, itemData);
    listView.setAdapter(mAdapter);
    listView.setTextFilterEnabled(true);
    listView.setOnItemClickListener((parent, v, position, id) -> {
        listener.onClick(position);
        dismiss();
    });
    return view;
}
 
Example 2
Source Project: CountDownTask   File: LauncherActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ListView listView = new ListView(this);
    setContentView(listView);

    Log.d(TAG, TAG + " task id: " + getTaskId());

    Intent intent = getIntent();
    String path = intent.getStringExtra(getPackageName() + ".Path");

    if (path == null) {
        path = "";
    }

    listView.setAdapter(new SimpleAdapter(this, getData(path),
            android.R.layout.simple_list_item_1, new String[]{"title"},
            new int[]{android.R.id.text1}));
    listView.setTextFilterEnabled(true);
    listView.setOnItemClickListener(this);
}
 
Example 3
Source Project: coursera-android   File: ListViewActivity.java    License: MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	// Create a new Adapter containing a list of colors
	// Set the adapter on this ListActivity's built-in ListView
	setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item,
			getResources().getStringArray(R.array.colors)));

	ListView lv = getListView();

	// Enable filtering when the user types in the virtual keyboard
	lv.setTextFilterEnabled(true);

	// Set an setOnItemClickListener on the ListView
	lv.setOnItemClickListener(new OnItemClickListener() {
		public void onItemClick(AdapterView<?> parent, View view,
				int position, long id) {

			// Display a Toast message indicting the selected item
			Toast.makeText(getApplicationContext(),
					((TextView) view).getText(), Toast.LENGTH_SHORT).show();
		}
	});
}
 
Example 4
Source Project: coursera-android   File: ListViewActivity.java    License: MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	// Create a new Adapter containing a list of colors
	// Set the adapter on this ListActivity's built-in ListView
	setListAdapter(new ArrayAdapter<>(this, R.layout.list_item,
			getResources().getStringArray(R.array.colors)));

	ListView lv = getListView();

	// Enable filtering when the user types in the virtual keyboard
	lv.setTextFilterEnabled(true);

	// Set an setOnItemClickListener on the ListView
	lv.setOnItemClickListener(new OnItemClickListener() {
		public void onItemClick(AdapterView<?> parent, View view,
				int position, long id) {

			// Display a Toast message indicting the selected item
			Toast.makeText(getApplicationContext(),
					((TextView) view).getText(), Toast.LENGTH_SHORT).show();
		}
	});
}
 
Example 5
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
	Utils.setLanguageOverride();
	super.onCreate(savedInstanceState);
	setResult(RESULT_CANCELED);
	setContentView(R.layout.manage_patches);
	ListView lv = getListView();
	lv.setTextFilterEnabled(true);
	lv.setOnItemClickListener(new OnItemClickListener() {
		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			openManagePatchWindow(patches.get(position));
		}
	});
	importButton = (ImageButton) findViewById(R.id.manage_patches_import_button);
	importButton.setOnClickListener(this);
	ScriptManager.androidContext = this.getApplicationContext();
	//if (!versionIsSupported()) {
	//	showDialog(DIALOG_VERSION_INCOMPATIBLE);
	//}
	patches = new ArrayList<ContentListItem>();
	adapter = new ContentListAdapter(ManageScriptsActivity.this, R.layout.patch_list_item, patches);
	setListAdapter(adapter);

}
 
Example 6
/**
 * Function to init activity view
 */
private void init() {

    //init views
    adapter = new TranslationAdapter(this);
    translationManagmentList = (ListView) findViewById(R.id.download);
    translationManagmentList.setOnItemClickListener(this);
    translationManagmentList.setTextFilterEnabled(true);
    translationManagmentList.setEmptyView(findViewById(R.id.progressBar3));
    translationManagmentList.setAdapter(adapter);

    //async thread to load translations
    new TafaseerLists().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 
Example 7
/**
 * Function to init activity view
 */
private void init() {

    //init views
    adapter = new TranslationAdapter(this);
    translationManagmentList = (ListView) findViewById(R.id.download);
    translationManagmentList.setOnItemClickListener(this);
    translationManagmentList.setTextFilterEnabled(true);
    translationManagmentList.setEmptyView(findViewById(R.id.progressBar3));
    translationManagmentList.setAdapter(adapter);

    //async thread to load translations
    new TafaseerLists().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 
Example 8
Source Project: WayHoo   File: QueryCityActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void initViews() {
	mInflater = LayoutInflater.from(this);
	mRootView = (RelativeLayout) findViewById(R.id.city_add_bg);
	mBackBtn = (ImageView) findViewById(R.id.back_image);
	mLocationTV = (TextView) findViewById(R.id.location_text);
	mQueryCityET = (EditText) findViewById(R.id.queryCityText);
	mQueryCityExitBtn = (ImageButton) findViewById(R.id.queryCityExit);

	mQueryCityListView = (ListView) findViewById(R.id.cityList);
	mQueryCityListView.setOnItemClickListener(this);
	mSearchCityAdapter = new QueryCityAdapter(QueryCityActivity.this,
			mCities);
	mQueryCityListView.setAdapter(mSearchCityAdapter);
	mQueryCityListView.setTextFilterEnabled(true);
	mFilter = mSearchCityAdapter.getFilter();

	// mEmptyCityView = (TextView) findViewById(R.id.noCityText);

	mHotCityGridView = (GridView) findViewById(R.id.hotCityGrid);
	mHotCityGridView.setOnItemClickListener(this);
	mHotCityGridView.setAdapter(new HotCityAdapter());

	mBackBtn.setOnClickListener(this);
	mLocationTV.setOnClickListener(this);
	mQueryCityExitBtn.setOnClickListener(this);
	mQueryCityET.addTextChangedListener(this);

	String cityName = getCityName();
	if (TextUtils.isEmpty(cityName)) {
		startLocation(mCityNameStatus);
	} else {
		mLocationTV.setText(formatBigMessage(cityName));
	}
}
 
Example 9
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);

    setContentView(R.layout.searchview_filter);

    mSearchView = (SearchView) findViewById(R.id.search_view);
    mListView = (ListView) findViewById(R.id.list_view);
    mListView.setAdapter(mAdapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1,
            mStrings));
    mListView.setTextFilterEnabled(true);
    setupSearchView();
}
 
Example 10
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
	Utils.setLanguageOverride();
	super.onCreate(savedInstanceState);
	setResult(RESULT_CANCELED);
	ListView lv = getListView();
	lv.setTextFilterEnabled(true);
	lv.setOnItemClickListener(new OnItemClickListener() {
		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			openManageAddonWindow(addons.get(position));
		}
	});
}
 
Example 11
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

// Accounts spinner
this.accountSpinner = (Spinner) findViewById(R.id.accountSpinner);
Listactivity.currentList = new ArrayList<String>();
// Spinner item selection Listener
this.accountSpinner.setOnItemSelectedListener(this);

imapNotes2Account = new ImapNotes2Account();
Listactivity.accountManager = AccountManager.get(getApplicationContext());
Listactivity.accountManager.addOnAccountsUpdatedListener((OnAccountsUpdateListener)
    new AccountsUpdateListener(), null, true);

status = (TextView)findViewById(R.id.status);

this.spinnerList = new ArrayAdapter<String>
    (this, android.R.layout.simple_spinner_item,Listactivity.currentList);
spinnerList.setDropDownViewResource
    (android.R.layout.simple_spinner_dropdown_item);
this.accountSpinner.setAdapter(spinnerList);

this.noteList = new ArrayList<OneNote>();
((ImapNotes2)this.getApplicationContext()).SetNotesList(this.noteList);
this.listToView = new NotesListAdapter(
    getApplicationContext(),
    this.noteList,
    R.layout.note_element,
    new String[]{"title","date"},
    new int[]{R.id.noteTitle, R.id.noteInformation});
listview = (ListView) findViewById(R.id.notesList);
listview.setAdapter(this.listToView);

listview.setTextFilterEnabled(true);

this.imapFolder = new Imaper();
((ImapNotes2)this.getApplicationContext()).SetImaper(this.imapFolder);

if (Listactivity.storedNotes == null)
    storedNotes = new NotesDb(getApplicationContext());

// When item is clicked, we go to NoteDetailActivity
listview.setOnItemClickListener(new OnItemClickListener() {
    public void onItemClick(AdapterView<?> arg0, View widget, int selectedNote, long arg3) {
        Intent toDetail = new Intent(widget.getContext(), NoteDetailActivity.class);
        toDetail.putExtra("selectedNote", (OneNote)arg0.getItemAtPosition(selectedNote));
        toDetail.putExtra("useSticky", Listactivity.imapNotes2Account.GetUsesticky());
        startActivityForResult(toDetail,SEE_DETAIL); 
    }
  });

  editAccountButton = (Button) findViewById(R.id.editAccountButton);
  editAccountButton.setOnClickListener(clickListenerEditAccount);

}