Java Code Examples for android.widget.AdapterView#OnItemSelectedListener

The following examples show how to use android.widget.AdapterView#OnItemSelectedListener . 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: GetTableFragment.java    From EosCommander with MIT License 6 votes vote down vote up
private AppCompatSpinner setDropDownList(int dropDownListId, List<String> data, AdapterView.OnItemSelectedListener itemSelectedListener) {
    AppCompatSpinner spinner = mRootView.findViewById( dropDownListId );
    if ( spinner == null ) {
        return null;
    }

    ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, data);
    adapter.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item );
    spinner.setAdapter( adapter );

    if ( itemSelectedListener != null ) {
        spinner.setOnItemSelectedListener(itemSelectedListener);
    }

    return spinner;
}
 
Example 2
Source File: TodayWidgetConfigureActivity.java    From ETSMobile-Android2 with Apache License 2.0 5 votes vote down vote up
private void setUpColorSpinner(Spinner spinner, AdapterView.OnItemSelectedListener onItemSelectedListener) {
    if (mColorSpinnerAdapter == null) {
        int[] colorsArray = getResources().getIntArray(R.array.widget_bg_colors);
        Integer[] colors = new Integer[colorsArray.length];
        for (int i = 0; i < colorsArray.length; i++) {
            colors[i] = Integer.valueOf(colorsArray[i]);
        }
        mColorSpinnerAdapter = new ColorSpinnerAdapter(this, colors);
    }

    spinner.setAdapter(mColorSpinnerAdapter);
    spinner.setOnItemSelectedListener(onItemSelectedListener);
    spinner.setSelection(0);
}
 
Example 3
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
public Card(String title, String desc, String prop, int currentItem, ArrayList<String> spinnerEntries, ActionBarActivity fa, AdapterView.OnItemSelectedListener onItemSelectedListener) {
    this.title = title;
    this.desc = desc;
    this.spinnerEntries = spinnerEntries;
    this.fa = fa;
    this.onItemSelectedListener = onItemSelectedListener;
    this.prop = prop;
    this.currentItem = currentItem;
}
 
Example 4
Source File: SettingsActivity.java    From biermacht with Apache License 2.0 5 votes vote down vote up
@Override
public void configureSpinnerListener() {
  spinnerListener = new AdapterView.OnItemSelectedListener() {
    @Override
    public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {

    }

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

    }
  };
}
 
Example 5
Source File: CardSpinner.java    From Pimp_my_Z1 with GNU General Public License v2.0 4 votes vote down vote up
public CardSpinner(String title, String desc, String color, String prop, int currentItem, ArrayList<String> spinnerEntries, ActionBarActivity fa, AdapterView.OnItemSelectedListener onItemSelectedListener) {
    super(title, desc, color, prop, currentItem, spinnerEntries, fa, onItemSelectedListener);
}
 
Example 6
Source File: DSL.java    From anvil with MIT License 4 votes vote down vote up
public static Void onItemSelected(AdapterView.OnItemSelectedListener arg) {
  return BaseDSL.attr("onItemSelected", arg);
}
 
Example 7
Source File: OnItemSelectedListenerWrapper.java    From MVPAndroidBootstrap with Apache License 2.0 4 votes vote down vote up
public OnItemSelectedListenerWrapper(AdapterView.OnItemSelectedListener listener) {
    lastPosition = 0;
    this.listener = listener;
}
 
Example 8
Source File: ViewFinderImpl.java    From RendererRecyclerViewAdapter with Apache License 2.0 4 votes vote down vote up
@NonNull
@Override
public ViewFinder setOnItemSelectedListener(final int ID, final AdapterView.OnItemSelectedListener listener) {
	((AdapterView) find(ID)).setOnItemSelectedListener(listener);
	return this;
}
 
Example 9
Source File: RewriteAlertDialog.java    From FoodOrdering with Apache License 2.0 4 votes vote down vote up
public Builder setOnItemSelectedListener(
		final AdapterView.OnItemSelectedListener listener) {
	P.mOnItemSelectedListener = listener;
	return this;
}
 
Example 10
Source File: AddMashProfileActivity.java    From biermacht with Apache License 2.0 4 votes vote down vote up
@Override
public void configureSpinnerListener() {

  mashTypeSpinnerListener = new AdapterView.OnItemSelectedListener() {

    public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
      mProfile.setMashType(mashTypeArray.get(position));

      if (mashTypeArray.get(position).equals(MashProfile.MASH_TYPE_BIAB)) {
        // Set the spargeTypeSpinner to BIAB.
        spargeTypeSpinner.setSelection(spargeTypeArray.indexOf(MashProfile.SPARGE_TYPE_BIAB));

        // Make some undesired views disappear.
        spargeTypeSpinner.setVisibility(View.GONE);
        spargeTempView.setVisibility(View.GONE);
        tunTempView.setVisibility(View.GONE);
      }
      else {
        spargeTypeSpinner.setVisibility(View.VISIBLE);
        spargeTempView.setVisibility(View.VISIBLE);
        tunTempView.setVisibility(View.VISIBLE);
      }

      callback.call();
    }

    public void onNothingSelected(AdapterView<?> parentView) {
    }

  };

  spargeTypeSpinnerListener = new AdapterView.OnItemSelectedListener() {

    public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position,
                               long id) {
      mProfile.setSpargeType(spargeTypeArray.get(position));
      callback.call();
    }

    public void onNothingSelected(AdapterView<?> parentView) {
    }

  };
}
 
Example 11
Source File: ViewHolderImpl.java    From commonadapter with MIT License 4 votes vote down vote up
public void setOnItemSelectedClickListener(int viewId, AdapterView.OnItemSelectedListener listener) {
    AdapterView view = findViewById(viewId);
    view.setOnItemSelectedListener(listener);
}
 
Example 12
Source File: BaseViewHolder.java    From BaseProject with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the listview or gridview's item selected click listener of the view
 *
 * @param viewId   The view id.
 * @param listener The item selected click listener;
 * @return The BaseViewHolder for chaining.
 */
public BaseViewHolder setOnItemSelectedClickListener(@IdRes int viewId, AdapterView.OnItemSelectedListener listener) {
    AdapterView view = getView(viewId);
    view.setOnItemSelectedListener(listener);
    return this;
}
 
Example 13
Source File: ListPopupWindow.java    From material with Apache License 2.0 2 votes vote down vote up
/**
 * Sets a listener to receive events when a list item is selected.
 *
 * @param selectedListener Listener to register.
 *
 * @see ListView#setOnItemSelectedListener(AdapterView.OnItemSelectedListener)
 */
public void setOnItemSelectedListener(AdapterView.OnItemSelectedListener selectedListener) {
    mItemSelectedListener = selectedListener;
}
 
Example 14
Source File: ModuleSpinnerProperty.java    From slidingdebugmenu with Apache License 2.0 2 votes vote down vote up
/**
 * Set Spinner Item Selected callback
 *
 * @param listener
 */
public void setOnSpinnerItemSelectedListener(AdapterView.OnItemSelectedListener listener) {
    mPropertySpinner.setOnItemSelectedListener(listener);
}
 
Example 15
Source File: BaseViewHolder.java    From demo4Fish with MIT License 2 votes vote down vote up
/**
 * Sets the listview or gridview's item selected click listener of the view
 *
 * @param viewId   The view id.
 * @param listener The item selected click listener;
 * @return The BaseViewHolder for chaining.
 */
public BaseViewHolder setOnItemSelectedClickListener(int viewId, AdapterView.OnItemSelectedListener listener) {
    AdapterView view = getView(viewId);
    view.setOnItemSelectedListener(listener);
    return this;
}
 
Example 16
Source File: AccentAlertDialog.java    From holoaccent with Apache License 2.0 2 votes vote down vote up
/**
 * Sets a listener to be invoked when an item in the list is selected.
 * 
 * @param listener The listener to be invoked.
 * @see AdapterView#setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener)
 *
 * @return This Builder object to allow for chaining of calls to set methods
 */
public Builder setOnItemSelectedListener(final AdapterView.OnItemSelectedListener listener) {
	mBuilder.setOnItemSelectedListener(listener);
    return this;
}
 
Example 17
Source File: BaseViewHolder.java    From JD-Test with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the listview or gridview's item selected click listener of the view
 *
 * @param viewId   The view id.
 * @param listener The item selected click listener;
 * @return The BaseViewHolder for chaining.
 */
public BaseViewHolder setOnItemSelectedClickListener(int viewId, AdapterView.OnItemSelectedListener listener) {
    AdapterView view = getView(viewId);
    view.setOnItemSelectedListener(listener);
    return this;
}
 
Example 18
Source File: MLAlertDialog.java    From NewXmPluginSDK with Apache License 2.0 2 votes vote down vote up
/**
 * Sets a listener to be invoked when an item in the list is selected.
 * 
 * @param listener The listener to be invoked.
 * @return This Builder object to allow for chaining of calls to set
 *         methods
 * @see AdapterView#setOnItemSelectedListener(AdapterView.OnItemSelectedListener)
 */
public Builder setOnItemSelectedListener(final AdapterView.OnItemSelectedListener listener) {
    P.mOnItemSelectedListener = listener;
    return this;
}
 
Example 19
Source File: EditText.java    From MDPreference with Apache License 2.0 2 votes vote down vote up
/**
 * <p>Sets the listener that will be notified when the user selects an item
 * in the drop down list.</p>
 * <p>Only work when autoComplete mode is {@link #AUTOCOMPLETE_MODE_SINGLE} or {@link #AUTOCOMPLETE_MODE_MULTI}</p>
 *
 * @param l the item selected listener
 */
public void setOnItemSelectedListener(AdapterView.OnItemSelectedListener l) {
    if(mAutoCompleteMode == AUTOCOMPLETE_MODE_NONE)
        return;
    ((AutoCompleteTextView)mInputView).setOnItemSelectedListener(l);
}
 
Example 20
Source File: BaseViewHolder.java    From NIM_Android_UIKit with MIT License 2 votes vote down vote up
/**
 * Sets the listview or gridview's item selected click listener of the view
 *
 * @param viewId   The view id.
 * @param listener The item selected click listener;
 * @return The BaseViewHolder for chaining.
 */
public BaseViewHolder setOnItemSelectedClickListener(int viewId, AdapterView.OnItemSelectedListener listener) {
    AdapterView view = getView(viewId);
    view.setOnItemSelectedListener(listener);
    return this;
}