Example usage for android.widget ListView setTextFilterEnabled

List of usage examples for android.widget ListView setTextFilterEnabled

Introduction

In this page you can find the example usage for android.widget ListView setTextFilterEnabled.

Prototype

public void setTextFilterEnabled(boolean textFilterEnabled) 

Source Link

Document

Enables or disables the type filter window.

Usage

From source file:com.pandoroid.PandoroidStationSelect.java

/**
 * Description: Displays the stations to the screen.
 *//*  ww w .  j  av  a2  s  .co m*/
private void showStations() {
    ListView lv = getListView();
    setListAdapter(new StationListAdapter(m_service.getStations(), PandoroidStationSelect.this));
    lv.setTextFilterEnabled(true);
    lv.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String str_id = Long.toString(id);
            m_service.setCurrentStation(str_id);
            m_service.startPlayback();
            m_stations_current_flag = false;
            finish();
        }
    });
}

From source file:com.pentacog.mctracker.MCServerTrackerActivity.java

/** Called when the activity is first created. */
@Override//from ww  w .  ja  v a  2s .co m
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    ListView lv = getListView();
    lv.setTextFilterEnabled(true);
    lv.setCacheColorHint(Color.TRANSPARENT);
    lv.setBackgroundResource(R.drawable.dirt_tile);

    registerForContextMenu(lv);

}

From source file:org.hfoss.posit.android.api.fragment.ListFindsFragment.java

/**
 * Puts the items from the DB table into the rows of the view.
 *//*from   www  . j  a va2s . co m*/
private void fillList(ListAdapter adapter) {
    setListAdapter(adapter);

    ListView lv = getListView();
    lv.setTextFilterEnabled(true);
    lv.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            TextView tv = (TextView) view.findViewById(R.id.id);
            int ormId = Integer.parseInt((String) tv.getText());
            Bundle extras = new Bundle();
            extras.putInt(Find.ORM_ID, ormId);
            displayFind(position, Intent.ACTION_EDIT, extras, null);
        }
    });
}

From source file:org.hfoss.posit.android.plugin.csv.CsvListFindsFragment.java

/**
 * Puts the items from the DB table into the rows of the view.
 *//*from   www  .ja  v  a  2s  . c  om*/
private void fillList(ListAdapter adapter) {
    setListAdapter(adapter);

    ListView lv = getListView();
    lv.setTextFilterEnabled(true);
    lv.setOnItemClickListener(new OnItemClickListener() {

        /**
         * Returns the expedition Id to the TrackerActivity
         */
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            int find_id = Integer.parseInt((String) ((TextView) view.findViewById(R.id.id)).getText());

            Find find = new Find();
            find.setName((String) ((TextView) view.findViewById(R.id.name)).getText());
            find.setDescription((String) ((TextView) view.findViewById(R.id.description_id)).getText());
            find.setLatitude(
                    Double.parseDouble((String) ((TextView) view.findViewById(R.id.latitude)).getText()));
            find.setLongitude(
                    Double.parseDouble((String) ((TextView) view.findViewById(R.id.longitude)).getText()));
            Intent intent = new Intent(parent.getContext(), CsvFindActivity.class);

            find.setGuid((String) ((TextView) view.findViewById(R.id.id)).getText());

            intent.setAction(ACTION_CSV_FINDS);
            intent.putExtra(ACTION_CSV_FINDS, Integer.parseInt(find.getGuid())); // CsvFind use integer guids, 1, 2, 3 ...
            intent.putExtra("findbundle", find.getDbEntries());
            startActivity(intent);
        }
    });
}

From source file:org.solovyev.android.calculator.history.AbstractCalculatorHistoryFragment.java

@Override
public void onViewCreated(View root, Bundle savedInstanceState) {
    super.onViewCreated(root, savedInstanceState);

    final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
    final Boolean showDatetime = CalculatorPreferences.History.showDatetime.getPreference(preferences);

    fragmentHelper.onViewCreated(this, root);

    adapter = new HistoryArrayAdapter(this.getActivity(), getItemLayoutId(),
            org.solovyev.android.calculator.R.id.history_item, new ArrayList<CalculatorHistoryState>(),
            showDatetime);/*from  w  w  w . j av  a  2s. c o m*/
    setListAdapter(adapter);

    final ListView lv = getListView();
    lv.setTextFilterEnabled(true);

    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public void onItemClick(final AdapterView<?> parent, final View view, final int position,
                final long id) {

            useHistoryItem((CalculatorHistoryState) parent.getItemAtPosition(position));
        }
    });

    lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
            final CalculatorHistoryState historyState = (CalculatorHistoryState) parent
                    .getItemAtPosition(position);

            final FragmentActivity activity = getActivity();

            final HistoryItemMenuData data = new HistoryItemMenuData(historyState, adapter);

            final List<HistoryItemMenuItem> menuItems = Collections.asList(HistoryItemMenuItem.values());

            if (historyState.isSaved()) {
                menuItems.remove(HistoryItemMenuItem.save);
            } else {
                if (isAlreadySaved(historyState)) {
                    menuItems.remove(HistoryItemMenuItem.save);
                }
                menuItems.remove(HistoryItemMenuItem.remove);
                menuItems.remove(HistoryItemMenuItem.edit);
            }

            if (historyState.getDisplayState().isValid()
                    && Strings.isEmpty(historyState.getDisplayState().getEditorState().getText())) {
                menuItems.remove(HistoryItemMenuItem.copy_result);
            }

            final ContextMenuBuilder<HistoryItemMenuItem, HistoryItemMenuData> menuBuilder = ContextMenuBuilder
                    .newInstance(activity, "history-menu", ListContextMenu.newInstance(menuItems));
            menuBuilder.build(data).show();

            return true;
        }
    });
}

From source file:mobisocial.musubi.ui.fragments.ContactsFragment.java

public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    listType = ContactListType.values()[getArguments().getInt(CONTACT_LIST_TYPE)];

    mDatabaseSource = App.getDatabaseSource(this.mActivity);
    mIdentityManager = new IdentitiesManager(mDatabaseSource);
    mFeedManager = new FeedManager(mDatabaseSource);
    mAccountManager = new MyAccountManager(mDatabaseSource);
    Cursor identities;//from  www . ja  v  a  2  s.c om

    if (listType == ContactListType.GRAY_LIST) {
        identities = mIdentityManager.getGrayListIdentitiesCursor();
    } else {
        identities = mIdentityManager.getWhiteListIdentitiesCursor();
    }

    mContacts = new ContactListCursorAdapter(this.mActivity, identities);

    ListView lv = (ListView) getView().findViewById(android.R.id.list);
    lv.setAdapter(mContacts);
    lv.setTextFilterEnabled(true);
    lv.setFastScrollEnabled(true);
    registerForContextMenu(lv);
    lv.setOnItemClickListener(this);
}

From source file:com.ProfessorPopTart.alternateouyastore.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    GameList = new ArrayList<String>();
    GameListAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, GameList);
    final ListView myListView = (ListView) findViewById(R.id.appsLBX);
    final TextView myGameName = (TextView) findViewById(R.id.gameName);
    myListView.setAdapter(GameListAdapter);
    myListView.setTextFilterEnabled(true);

    //assign onclick event to getListBTN
    Button myGetListBTN = (Button) findViewById(R.id.getListBTN);
    myGetListBTN.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            populateList();/*from w w w  . j a  va 2s .com*/
        }
    });

    //assign onclick event to downloadGameBTN
    Button myDownloadBTN = (Button) findViewById(R.id.donwloadBTN);
    myDownloadBTN.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            buildDownloadRequest(myGameName.getText().toString());
        }
    });

    //assign onSelected event to appsLBX
    myListView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            String selectedFromList = (myListView.getItemAtPosition(i).toString());
            displayImage(getImgUrl(selectedFromList));
            myGameName.setText(selectedFromList);
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {

        }
    });
}

From source file:com.apotheosis.acceleration.monitor.MainMenuActivity.java

private void setUpListView() {
    ListView lv = (ListView) findViewById(R.id.fileList);

    List<String> fileNames = FileUtilities.getFileList();

    if (fileNames != null) {
        FileListAdapter listAdapter = new FileListAdapter(this);

        lv.setAdapter(listAdapter);//from w w  w .  ja va2s  .co m
        lv.setTextFilterEnabled(true);

        lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.mainDrawerLayout);
                boolean isDrawerOpen = drawerLayout.isDrawerOpen(findViewById(R.id.side_drawer));

                if (isDrawerOpen)
                    drawerLayout.closeDrawers();

                new LoadData(TimeXYZDataPackage.DataType.ACCELERATION, MainMenuActivity.this,
                        parent.getAdapter().getItem(position).toString()).execute((Void[]) null);
            }
        });

        lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
            public boolean onItemLongClick(AdapterView<?> parent, View v, int position, long id) {
                final String fileName = parent.getAdapter().getItem(position).toString();
                final AlertDialog.Builder optionsMenu = new AlertDialog.Builder(MainMenuActivity.this);
                optionsMenu.setItems(new String[] { "Open Acceleration Graph", "Open Raw Data", "Share Data",
                        "Delete Data", "Cancel" }, new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {

                                DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.mainDrawerLayout);
                                boolean isDrawerOpen = drawerLayout
                                        .isDrawerOpen(findViewById(R.id.side_drawer));

                                Intent i;
                                Tracker tracker;
                                switch (which) {
                                case 0:
                                    dialog.dismiss();

                                    if (isDrawerOpen)
                                        drawerLayout.closeDrawers();

                                    new LoadData(TimeXYZDataPackage.DataType.ACCELERATION,
                                            MainMenuActivity.this, fileName).execute((Void[]) null);
                                    break;

                                case 1:

                                    if (isDrawerOpen)
                                        drawerLayout.closeDrawers();

                                    new LoadData(TimeXYZDataPackage.DataType.RAW_DATA, MainMenuActivity.this,
                                            fileName).execute((Void[]) null);

                                    break;

                                case 2:

                                    if (isDrawerOpen)
                                        drawerLayout.closeDrawers();

                                    tracker = AnalyticsTrackers.getInstance().get(AnalyticsTrackers.Target.APP);
                                    tracker.send(new HitBuilders.EventBuilder().setCategory("Data Function")
                                            .setAction("Share Data").build());

                                    i = new Intent(Intent.ACTION_SEND);
                                    i.setType("text/xml");
                                    i.putExtra(Intent.EXTRA_SUBJECT, "Sending " + fileName + "as attachment");
                                    i.putExtra(Intent.EXTRA_TEXT, fileName + "is attached.");
                                    File f = new File(FileUtilities.path + fileName + ".csv");
                                    i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f));
                                    startActivity(Intent.createChooser(i, "Choose an application..."));
                                    break;

                                case 3:
                                    final AlertDialog.Builder confirmDelete = new AlertDialog.Builder(
                                            MainMenuActivity.this);
                                    confirmDelete
                                            .setMessage("Are you sure you want to delete " + fileName + "?");
                                    confirmDelete.setPositiveButton("Yes",
                                            new DialogInterface.OnClickListener() {
                                                public void onClick(DialogInterface dialog, int which) {
                                                    File f = new File(FileUtilities.path + fileName + ".csv");
                                                    Log.d("DELETION_SUCESS", String.valueOf(f.delete()));
                                                    setUpListView();
                                                }
                                            });
                                    confirmDelete.setNegativeButton("No",
                                            new DialogInterface.OnClickListener() {
                                                public void onClick(DialogInterface dialog, int which) {
                                                    dialog.dismiss();
                                                }
                                            });
                                    confirmDelete.setOnCancelListener(new DialogInterface.OnCancelListener() {
                                        public void onCancel(DialogInterface dialog) {
                                            dialog.dismiss();
                                        }
                                    });
                                    confirmDelete.show();
                                    break;
                                }
                            }
                        });

                optionsMenu.show();
                return true;
            }
        });
    }
}

From source file:com.android.music.AlbumBrowserActivity.java

/** Called when the activity is first created. */
@Override//from w  ww  .  j a v  a2 s .c  o m
public void onCreate(Bundle icicle) {
    if (icicle != null) {
        mCurrentAlbumId = icicle.getString("selectedalbum");
        mArtistId = icicle.getString("artist");
    } else {
        mArtistId = getIntent().getStringExtra("artist");
    }
    super.onCreate(icicle);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setVolumeControlStream(AudioManager.STREAM_MUSIC);
    mToken = MusicUtils.bindToService(this, this);

    IntentFilter f = new IntentFilter();
    f.addAction(Intent.ACTION_MEDIA_SCANNER_STARTED);
    f.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED);
    f.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
    f.addDataScheme("file");
    registerReceiver(mScanListener, f);

    setContentView(R.layout.media_picker_activity);
    MusicUtils.updateButtonBar(this, R.id.albumtab);
    ListView lv = getListView();
    lv.setOnCreateContextMenuListener(this);
    lv.setTextFilterEnabled(true);

    mAdapter = (AlbumListAdapter) getLastNonConfigurationInstance();
    if (mAdapter == null) {
        //Log.i("@@@", "starting query");
        mAdapter = new AlbumListAdapter(getApplication(), this, R.layout.track_list_item, mAlbumCursor,
                new String[] {}, new int[] {});
        setListAdapter(mAdapter);
        setTitle(R.string.working_albums);
        getAlbumCursor(mAdapter.getQueryHandler(), null);
    } else {
        mAdapter.setActivity(this);
        setListAdapter(mAdapter);
        mAlbumCursor = mAdapter.getCursor();
        if (mAlbumCursor != null) {
            init(mAlbumCursor);
        } else {
            getAlbumCursor(mAdapter.getQueryHandler(), null);
        }
    }

    badSymptoms = new BadSymptoms(this);
}

From source file:com.microsoft.live.sample.skydrive.SkyDriveActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.skydrive);//from  w ww .  jav a2s.c o  m

    mPrevFolderIds = new Stack<String>();

    ListView lv = getListView();
    lv.setTextFilterEnabled(true);
    lv.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            SkyDriveObject skyDriveObj = (SkyDriveObject) parent.getItemAtPosition(position);

            skyDriveObj.accept(new Visitor() {
                @Override
                public void visit(SkyDriveAlbum album) {
                    mPrevFolderIds.push(mCurrentFolderId);
                    loadFolder(album.getId());
                }

                @Override
                public void visit(SkyDrivePhoto photo) {
                    ViewPhotoDialog dialog = new ViewPhotoDialog(SkyDriveActivity.this, photo);
                    dialog.setOwnerActivity(SkyDriveActivity.this);
                    dialog.show();
                }

                @Override
                public void visit(SkyDriveFolder folder) {
                    mPrevFolderIds.push(mCurrentFolderId);
                    loadFolder(folder.getId());
                }

                @Override
                public void visit(SkyDriveFile file) {
                    Bundle b = new Bundle();
                    b.putString(JsonKeys.ID, file.getId());
                    b.putString(JsonKeys.NAME, file.getName());
                    showDialog(DIALOG_DOWNLOAD_ID, b);
                }

                @Override
                public void visit(SkyDriveVideo video) {
                    PlayVideoDialog dialog = new PlayVideoDialog(SkyDriveActivity.this, video);
                    dialog.setOwnerActivity(SkyDriveActivity.this);
                    dialog.show();
                }

                @Override
                public void visit(SkyDriveAudio audio) {
                    PlayAudioDialog audioDialog = new PlayAudioDialog(SkyDriveActivity.this, audio);
                    audioDialog.show();
                }
            });
        }
    });

    LinearLayout layout = new LinearLayout(this);
    Button newFolderButton = new Button(this);
    newFolderButton.setText("New Folder");
    newFolderButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            NewFolderDialog dialog = new NewFolderDialog(SkyDriveActivity.this);
            dialog.setOwnerActivity(SkyDriveActivity.this);
            dialog.show();
        }
    });

    layout.addView(newFolderButton);

    Button uploadFileButton = new Button(this);
    uploadFileButton.setText("Upload File");
    uploadFileButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getApplicationContext(), FilePicker.class);
            startActivityForResult(intent, FilePicker.PICK_FILE_REQUEST);
        }
    });

    layout.addView(uploadFileButton);
    lv.addHeaderView(layout);

    mPhotoAdapter = new SkyDriveListAdapter(this);
    setListAdapter(mPhotoAdapter);

    LiveSdkSampleApplication app = (LiveSdkSampleApplication) getApplication();
    mClient = app.getConnectClient();
}