NDSpinner.java
Go to the documentation of this file.
1 package com.introlab.rtabmap;
2 
3 import android.content.Context;
4 import android.util.AttributeSet;
5 import android.widget.Spinner;
6 
7 
12 public class NDSpinner extends Spinner {
13 
14  public NDSpinner(Context context)
15  { super(context); }
16 
17  public NDSpinner(Context context, AttributeSet attrs)
18  { super(context, attrs); }
19 
20  public NDSpinner(Context context, AttributeSet attrs, int defStyle)
21  { super(context, attrs, defStyle); }
22 
23  @Override
24  public void setSelection(int position, boolean animate) {
25  boolean sameSelected = position == getSelectedItemPosition();
26  super.setSelection(position, animate);
27  if (sameSelected) {
28  // Spinner does not call the OnItemSelectedListener if the same item is selected, so do it manually now
29  //getOnItemSelectedListener().onItemSelected(this, getSelectedView(), position, getSelectedItemId());
30  }
31  }
32 
33  @Override
34  public void setSelection(int position) {
35  boolean sameSelected = position == getSelectedItemPosition();
36  super.setSelection(position);
37  if (sameSelected) {
38  // Spinner does not call the OnItemSelectedListener if the same item is selected, so do it manually now
39  getOnItemSelectedListener().onItemSelected(this, getSelectedView(), position, getSelectedItemId());
40  }
41  }
42 
43 }
NDSpinner(Context context)
Definition: NDSpinner.java:14
void setSelection(int position, boolean animate)
Definition: NDSpinner.java:24
NDSpinner(Context context, AttributeSet attrs)
Definition: NDSpinner.java:17
void setSelection(int position)
Definition: NDSpinner.java:34
NDSpinner(Context context, AttributeSet attrs, int defStyle)
Definition: NDSpinner.java:20


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Dec 14 2020 03:34:59