Java Code Examples for android.widget.Spinner#INVALID_POSITION
The following examples show how to use
android.widget.Spinner#INVALID_POSITION .
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 File: ItemsFragment.java From ChipsLayoutManager with Apache License 2.0 | 6 votes |
@OnClick(R.id.btnMove) public void onMoveClicked(View view) { int position = spinnerPosition.getSelectedItemPosition(); if (position == Spinner.INVALID_POSITION) return; int positionMoveTo = spinnerMoveTo.getSelectedItemPosition(); if (positionMoveTo == Spinner.INVALID_POSITION) return; if (position == positionMoveTo) return; Object item = items.remove(position); items.add(positionMoveTo, item); adapter.notifyItemMoved(position, positionMoveTo); }
Example 2
Source File: TestActivity.java From ChipsLayoutManager with Apache License 2.0 | 6 votes |
public void onMoveClicked(View view) { int position = spinnerPosition.getSelectedItemPosition(); if (position == Spinner.INVALID_POSITION) return; int positionMoveTo = spinnerMoveTo.getSelectedItemPosition(); if (positionMoveTo == Spinner.INVALID_POSITION) return; if (position == positionMoveTo) return; Object item = items.remove(position); items.add(positionMoveTo, item); adapter.notifyItemMoved(position, positionMoveTo); }
Example 3
Source File: Android_Mapas.java From android with GNU General Public License v2.0 | 6 votes |
private void localizarGasolinera() { if (spGasolineras.getSelectedItemPosition() == Spinner.INVALID_POSITION) { return; } Gasolinera gasolinera = listaGasolineras.get(spGasolineras.getSelectedItemPosition()); // Prepara y añade una nueva marca al mapa mapa.addMarker(new MarkerOptions() .position(gasolinera.getPosicion()) .title(gasolinera.getNombre())); // Posiciona la vista del usuario en el punto que se acaba de agregar CameraUpdate camara = CameraUpdateFactory.newLatLng(gasolinera.getPosicion()); // Coloca la vista del mapa sobre la posición del restaurante // y activa el zoom para verlo de cerca mapa.moveCamera(camara); mapa.animateCamera(CameraUpdateFactory.zoomTo(12.0f)); }
Example 4
Source File: AudioDevicePreference.java From vinyl-cast with MIT License | 5 votes |
private int findSpinnerIndexOfValue(String value) { CharSequence[] entryValues = getEntryValues(); if (value != null && entryValues != null) { for (int i = entryValues.length - 1; i >= 0; i--) { if (entryValues[i].equals(value)) { return i; } } } return Spinner.INVALID_POSITION; }
Example 5
Source File: CreateCredentialActivity.java From OpenYOLO-Android with Apache License 2.0 | 5 votes |
@OnItemSelected(R.id.credential_authority) @OnTextChanged({R.id.credential_id, R.id.credential_password}) void onFieldsChanged() { boolean validCredential = mCredentialAuthority.getSelectedItemPosition() != Spinner.INVALID_POSITION && mCredentialId.length() >= MIN_ID_LENGTH && mCredentialPassword.length() >= MIN_PASS_LENGTH; if (mDoneButton != null) { mDoneButton.setEnabled(validCredential); } }
Example 6
Source File: ItemsFragment.java From ChipsLayoutManager with Apache License 2.0 | 5 votes |
@OnClick(R.id.btnRevert) public void onRevertClicked(View view) { int position = spinnerPosition.getSelectedItemPosition(); if (position == Spinner.INVALID_POSITION) return; int positionMoveTo = spinnerMoveTo.getSelectedItemPosition(); if (positionMoveTo == Spinner.INVALID_POSITION) return; if (position == positionMoveTo) return; spinnerPosition.setSelection(positionMoveTo); spinnerMoveTo.setSelection(position); }
Example 7
Source File: ItemsFragment.java From ChipsLayoutManager with Apache License 2.0 | 5 votes |
@OnClick(R.id.btnDelete) public void onDeleteClicked(View view) { int position = spinnerPosition.getSelectedItemPosition(); if (position == Spinner.INVALID_POSITION) return; items.remove(position); Log.i("activity", "delete at " + position); adapter.notifyItemRemoved(position); updateSpinners(); }
Example 8
Source File: ItemsFragment.java From ChipsLayoutManager with Apache License 2.0 | 5 votes |
@OnClick(R.id.btnInsert) public void onInsertClicked(View view) { int position = spinnerPosition.getSelectedItemPosition(); if (position == Spinner.INVALID_POSITION) position = 0; items.add(position, itemsFactory.createOneItemForPosition(position)); Log.i("activity", "insert at " + position); adapter.notifyItemInserted(position); updateSpinners(); }
Example 9
Source File: TestActivity.java From ChipsLayoutManager with Apache License 2.0 | 5 votes |
public void onRevertClicked(View view) { int position = spinnerPosition.getSelectedItemPosition(); if (position == Spinner.INVALID_POSITION) return; int positionMoveTo = spinnerMoveTo.getSelectedItemPosition(); if (positionMoveTo == Spinner.INVALID_POSITION) return; if (position == positionMoveTo) return; spinnerPosition.setSelection(positionMoveTo); spinnerMoveTo.setSelection(position); }
Example 10
Source File: TestActivity.java From ChipsLayoutManager with Apache License 2.0 | 5 votes |
public void onDeleteClicked(View view) { int position = spinnerPosition.getSelectedItemPosition(); if (position == Spinner.INVALID_POSITION) return; items.remove(position); Log.i("activity", "delete at " + position); adapter.notifyItemRemoved(position); updateSpinners(); }
Example 11
Source File: TestActivity.java From ChipsLayoutManager with Apache License 2.0 | 5 votes |
public void onInsertClicked(View view) { int position = spinnerPosition.getSelectedItemPosition(); if (position == Spinner.INVALID_POSITION) position = 0; items.add(position, itemsFactory.createOneItemForPosition(position)); Log.i("activity", "insert at " + position); adapter.notifyItemInserted(position); updateSpinners(); }
Example 12
Source File: DropDownPreference.java From MaterialPreference with Apache License 2.0 | 5 votes |
/** * @hide */ @RestrictTo(LIBRARY_GROUP) public int findSpinnerIndexOfValue(String value) { CharSequence[] entryValues = getEntryValues(); if (value != null && entryValues != null) { for (int i = entryValues.length - 1; i >= 0; i--) { if (entryValues[i].equals(value)) { return i; } } } return Spinner.INVALID_POSITION; }
Example 13
Source File: PlaylistFragment.java From Android-Remote with GNU General Public License v3.0 | 5 votes |
private LinkedList<MySong> getSelectedPlaylistSongs() { int pos = getSelectedPlaylistPosition(); if (pos == Spinner.INVALID_POSITION || pos >= mPlaylists.size()) return new LinkedList<>(); else return mPlaylists.get(pos).getPlaylistSongs(); }
Example 14
Source File: PlaylistFragment.java From Android-Remote with GNU General Public License v3.0 | 5 votes |
private int getSelectedPlaylistPosition() { int pos = mPlaylistsSpinner.getSelectedItemPosition(); if (pos == Spinner.INVALID_POSITION || pos >= mPlaylists.size()) { pos = mPlaylists.indexOf(mPlaylistManager.getActivePlaylist()); mPlaylistsSpinner.setSelection(pos); } return pos; }