Java Code Examples for android.widget.AdapterView.OnItemSelectedListener

The following are top voted examples for showing how to use android.widget.AdapterView.OnItemSelectedListener. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: tuxguitar   File: TGBrowserView.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("unchecked")
public void refreshCollections() {
	ArrayAdapter<TGSelectableItem> arrayAdapter = new ArrayAdapter<TGSelectableItem>(findActivity(), R.layout.view_browser_spinner_item, createCollectionValues());
	arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	
	TGSelectableItem selectedItem = new TGSelectableItem(findCurrentCollection(), null);
	Integer selectedItemPosition = arrayAdapter.getPosition(selectedItem);
	
	Spinner spinner = (Spinner) this.findViewById(R.id.browser_collections);
	OnItemSelectedListener listener = spinner.getOnItemSelectedListener();
	spinner.setOnItemSelectedListener(null);
	if(!this.isSameCollection(arrayAdapter, (ArrayAdapter<TGSelectableItem>) spinner.getAdapter())) {
		spinner.setAdapter(arrayAdapter);
	}
	if( spinner.getSelectedItemPosition() != selectedItemPosition ) {
		spinner.setSelection(selectedItemPosition, false);
	}
	spinner.setOnItemSelectedListener(listener);
}
 
Example 2
Project: financisto1-holo   File: DateFilterActivity.java   Source Code and License 6 votes vote down vote up
private void createPeriodsSpinner() {
    spinnerPeriodType = (Spinner) findViewById(R.id.period);
    spinnerPeriodType.setAdapter(createSpinnerAdapter(this, periods));
    spinnerPeriodType.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            PeriodType period = periods[position];
            if (period == PeriodType.CUSTOM) {
                selectCustom();
            } else {
                selectPeriod(period);
            }
        }
        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });
}
 
Example 3
Project: TuxGuitar-1.3.1-fork   File: TGBrowserView.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("unchecked")
public void refreshCollections() {
	ArrayAdapter<TGSelectableItem> arrayAdapter = new ArrayAdapter<TGSelectableItem>(findActivity(), R.layout.view_browser_spinner_item, createCollectionValues());
	arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	
	TGSelectableItem selectedItem = new TGSelectableItem(findCurrentCollection(), null);
	Integer selectedItemPosition = arrayAdapter.getPosition(selectedItem);
	
	Spinner spinner = (Spinner) this.findViewById(R.id.browser_collections);
	OnItemSelectedListener listener = spinner.getOnItemSelectedListener();
	spinner.setOnItemSelectedListener(null);
	if(!this.isSameCollection(arrayAdapter, (ArrayAdapter<TGSelectableItem>) spinner.getAdapter())) {
		spinner.setAdapter(arrayAdapter);
	}
	if( spinner.getSelectedItemPosition() != selectedItemPosition ) {
		spinner.setSelection(selectedItemPosition, false);
	}
	spinner.setOnItemSelectedListener(listener);
}
 
Example 4
Project: flowzr-android-black   File: DateFilterActivity.java   Source Code and License 6 votes vote down vote up
private void createPeriodsSpinner() {
    spinnerPeriodType = (Spinner) findViewById(R.id.period);
    spinnerPeriodType.setAdapter(createSpinnerAdapter(this, periods));
    spinnerPeriodType.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            if (position<0) {
                position=0;
            }
            PeriodType period = periods[position];
            if (period == PeriodType.CUSTOM) {
                selectCustom();
            } else {
                selectPeriod(period);
            }

        }
        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });
}
 
Example 5
Project: flowzr-android-black   File: DateFilterFragment.java   Source Code and License 6 votes vote down vote up
private void createPeriodsSpinner() {
    spinnerPeriodType = (Spinner) getView().findViewById(R.id.period);
    spinnerPeriodType.setAdapter(createSpinnerAdapter(getContext(), periods));
    spinnerPeriodType.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (position>0) {
	PeriodType period = periods[position];
	if (period == PeriodType.CUSTOM) {
		selectCustom();
	} else {
		selectPeriod(period);
	}
}
        }
        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });
}
 
Example 6
Project: PdDroidPublisher   File: MidiConfigDialog.java   Source Code and License 6 votes vote down vote up
protected void refreshInputList() {
	OnItemSelectedListener listener = midiInSpinner.getOnItemSelectedListener();
	midiInSpinner.setOnItemSelectedListener(null);
	midiInArrayList.clear();
	midiInArrayList.add(new MidiPortAdapter());
	int position = 0;
	for (MidiDevice midiDevice : midiManager.getDeveices()) {
		for (MidiInput midiInput : midiDevice.getInputs()) {
			if (midiInput == midiManager.getInput()) {
				position = midiInArrayList.getCount();
			}
			midiInArrayList.add(new MidiPortAdapter(midiDevice, midiInput));
		}
	}
	midiInSpinner.setSelection(position);
	midiInSpinner.setOnItemSelectedListener(listener);
}
 
Example 7
Project: WikiCards   File: MainActivity.java   Source Code and License 6 votes vote down vote up
private void initCategorySpinner() {
  categoryAdapter = new CategoryListAdapter(this);
  categorySpinner = (Spinner) this.findViewById(R.id.spinner_category);
  categorySpinner.setAdapter(categoryAdapter);
  categorySpinner.setSelection(readSelectedCategory() - 1);
  categorySpinner.setOnItemSelectedListener(new OnItemSelectedListener() {

    @Override
    public void onItemSelected(AdapterView<?> parent, View view, int idx,
            long id) {
      switchSelectedCategory((int) id);
      storage = new WordsStorage(MainActivity.this, (int) id);
      langAdapter.notifyDataSetChanged();
    }

    @Override
    public void onNothingSelected(AdapterView<?> arg0) {
      // Do nothing in this case.
    }
  });
}
 
Example 8
Project: twitterwidget   File: TimeLineFragmentConfig.java   Source Code and License 6 votes vote down vote up
@Override
public void onActivityCreated(Bundle savedInstanceState) {
	super.onActivityCreated(savedInstanceState);
	applyButton.setOnClickListener(new OnClickListener() {

		@Override
		public void onClick(View v) {
			onApplyButtonClick();
		}
	});
	tweetListSpinner
			.setOnItemSelectedListener(new OnItemSelectedListener() {

				@Override
				public void onItemSelected(AdapterView<?> parent,
						View view, int position, long id) {
					onSpinnerItemSelected(position);
				}

				@Override
				public void onNothingSelected(AdapterView<?> arg0) {
				}
			});
}
 
Example 9
Project: YiBo   File: AddAccountActivity.java   Source Code and License 6 votes vote down vote up
private void bindEvent() {
	Button btnBack = (Button) this.findViewById(R.id.btnBack);
	btnBack.setOnClickListener(new GoBackClickListener(R.anim.slide_in_right));

	spServiceProvider.setAdapter(new ServiceProviderSpinnerAdapter(this));
	OnItemSelectedListener spItemListener = new AddAccountSpItemSelectedListener(this);
	spServiceProvider.setOnItemSelectedListener(spItemListener);
	
	
	spConfigApp.setAdapter(new ConfigAppSpinnerAdapter(this));
	OnItemSelectedListener configAppItemSelectedListener = null;
	configAppItemSelectedListener = new AddAccountConfigAppItemSelectedListener(this);
	spConfigApp.setOnItemSelectedListener(configAppItemSelectedListener);
	
	TextWatcher editTextWatcher = new AddAccountTextWatcher(this);
	etUsername.addTextChangedListener(editTextWatcher);
	etPassword.addTextChangedListener(editTextWatcher);
	etRestProxy.addTextChangedListener(editTextWatcher);
	etSearchProxy.addTextChangedListener(editTextWatcher);

	AddAccountAuthorizeClickListener authorizeClickListener = null;
	authorizeClickListener = new AddAccountAuthorizeClickListener(this);
	btnAuthorize.setOnClickListener(authorizeClickListener);

}
 
Example 10
Project: encdroidMC   File: ConfigSyncActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_config_sync);
	

	
	volumeName = (EditText) findViewById(R.id.volumeName);
	//volumeName.setFocusable(false);
	
	volumePath = (EditText) findViewById(R.id.volumePath);
	//volumePath.setFocusable(false);
	
	password = (EditText) findViewById(R.id.volumePassword);
	password.setTransformationMethod(PasswordTransformationMethod.getInstance());
	password.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); 
	
	onlyWifiCheckBox = ((CheckBox) findViewById(R.id.onlyWifi));
	removeAfterCheckBox = ((CheckBox) findViewById(R.id.removeAfter));
	localFolder = ((EditText) findViewById(R.id.localFolder));
	syncID = ((EditText) findViewById(R.id.syncID));
	syncID.setFocusable(false);
	
	
	spin1=(Spinner) findViewById(R.id.selectedRule);
	ArrayAdapter<String> adapter=new ArrayAdapter<String>(ConfigSyncActivity.this, android.R.layout.simple_spinner_item, rules);
	adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	spin1.setAdapter(adapter);
	spin1.setOnTouchListener(this);
	spin1.setOnItemSelectedListener((OnItemSelectedListener) this);
	
	refresh(null);

	
}
 
Example 11
Project: lr_dialer   File: AbstractAQuery.java   Source Code and License 5 votes vote down vote up
/**
 * Register a callback method for when an item is selected.
 *
 * @param listener The item selected listener.
 * @return self
 */
public T itemSelected(OnItemSelectedListener listener)
{
	if (view instanceof AdapterView)
	{
		AdapterView<?> alv = (AdapterView<?>) view;
		alv.setOnItemSelectedListener(listener);
	}
	return self();
}
 
Example 12
Project: ExoPlayerDemo   File: AbstractAQuery.java   Source Code and License 5 votes vote down vote up
/**
 * Register a callback method for when an item is selected. 
 *
 * @param listener The item selected listener.
 * @return self
 */
public T itemSelected(OnItemSelectedListener listener){
	
	if(view instanceof AdapterView){		
		AdapterView<?> alv = (AdapterView<?>) view;
		alv.setOnItemSelectedListener(listener);		
	}
	
	return self();
	
}
 
Example 13
Project: DroidShows   File: DroidShows.java   Source Code and License 5 votes vote down vote up
@SuppressLint("NewApi")
private void arrangeActionBar(Menu menu) {
	menu.findItem(TOGGLE_ARCHIVE_MENU_ITEM).setVisible(false);
	menu.findItem(LOG_MODE_ITEM).setVisible(false);
	menu.findItem(SEARCH_MENU_ITEM).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
	spinner = new Spinner(this);
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
		spinner.setPopupBackgroundResource(R.drawable.menu_dropdown_panel);
	spinner.setAdapter(new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1,
		new String[] {
			getString(R.string.layout_app_name),
			getString(R.string.archive),
			getString(R.string.menu_log),
		}));
	spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
		public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
			logMode = position == 2;
			showArchive = (position == 2 ? showArchive : position);
			if (logMode)
				clearFilter(null);
			getSeries();
		}
		public void onNothingSelected(AdapterView<?> arg0) {
		}
	});
	ActionBar actionBar = getActionBar();
	actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);
	actionBar.setCustomView(spinner);
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
		actionBar.setIcon(R.drawable.actionbar);
}
 
Example 14
Project: Fabric-Example-App-Android   File: MoPubAdAdapterTest.java   Source Code and License 5 votes vote down vote up
@Test
public void setOnItemSelectedListener_withAdPosition_shouldNotCallListener() {
    subject.setOnItemSelectedListener(mockListView, mockOnItemSelectedListener);

    ArgumentCaptor<OnItemSelectedListener> listenerCaptor =
            ArgumentCaptor.forClass(OnItemSelectedListener.class);
    verify(mockListView).setOnItemSelectedListener(listenerCaptor.capture());

    OnItemSelectedListener listener = listenerCaptor.getValue();
    listener.onItemSelected(mockListView, mockItemView, AD_POSITION, 0);

    verify(mockOnItemSelectedListener, never()).onItemSelected(
            any(AdapterView.class), any(View.class), anyInt(), anyInt());
}
 
Example 15
Project: Fabric-Example-App-Android   File: MoPubAdAdapterTest.java   Source Code and License 5 votes vote down vote up
@Test
public void setOnItemSelectedListener_withNonAdPosition_shouldCallListener() {
    subject.setOnItemSelectedListener(mockListView, mockOnItemSelectedListener);

    ArgumentCaptor<OnItemSelectedListener> listenerCaptor =
            ArgumentCaptor.forClass(OnItemSelectedListener.class);
    verify(mockListView).setOnItemSelectedListener(listenerCaptor.capture());

    OnItemSelectedListener listener = listenerCaptor.getValue();
    listener.onItemSelected(mockListView, mockItemView, AD_POSITION + 1, 0);

    verify(mockOnItemSelectedListener).onItemSelected(
            mockListView, mockItemView, AD_POSITION, 0);
}
 
Example 16
Project: palette   File: ViewHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Register a callback method for when an item is selected.
 *
 * @param listener The item selected listener.
 * @return self
 */
public ViewHelper itemSelected(OnItemSelectedListener listener) {

    if (mView instanceof AdapterView) {
        AdapterView<?> alv = (AdapterView<?>) mView;
        alv.setOnItemSelectedListener(listener);
    }

    return this;

}
 
Example 17
Project: SyncFrameworkAndroid   File: SpinnerHelper.java   Source Code and License 5 votes vote down vote up
public SpinnerHelper(Spinner spinner, int loaderID, ResourceCursorAdapter adapter, @LayoutRes int dropDownLayout, OnItemSelectedListener onSelected) {
    Spinner = spinner;
    mLoaderID = loaderID;
    Spinner.setOnItemSelectedListener(onSelected);
    Spinner.setAdapter(adapter);
    adapter.setDropDownViewResource(dropDownLayout);

}
 
Example 18
Project: CardUI   File: GridActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        // Intialize and set the Action Bar to Holo Blue
        ActionBar actionBar = getActionBar();
        actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#33b5e5" )));
        
        GridView grid = (GridView) findViewById(R.id.myGrid);
         rowItems = new ArrayList<RowItem>();
         
        String[] titles = {"Movie1","Movie2","Movie3","Movie4","Movie5","Movie6","Movie7","Movie8"};
        String[] descriptions = {"First Movie","Second movie","Third Movie","Fourth Movie","Fifth Movie",
                        "Sixth Movie","Seventh Movie","Eighth Movie"};
        //Populate the List
        for (int i = 0; i < titles.length; i++) {
            RowItem item = new RowItem(images[i], titles[i], descriptions[i]);
            rowItems.add(item);
        }

        // Set the adapter on the ListView
        LazyAdapter adapter = new LazyAdapter(getApplicationContext(), R.layout.grid_row, rowItems);
        grid.setAdapter(adapter);
        
        grid.setOnItemSelectedListener(new OnItemSelectedListener() {

                        @Override
                        public void onItemSelected(AdapterView<?> arg0, View arg1,
                                        int arg2, long arg3) {
                                // TODO Auto-generated method stub
                                
                        }

                        
                });
}
 
Example 19
Project: Wabbit-Messenger---android-client   File: ItemManaged.java   Source Code and License 5 votes vote down vote up
void setOnItemSelectedListener(OnItemSelectedListener l) {
    if (mInstallingManager) {
        return;
    }

    mOnItemSelectedListener = l;
}
 
Example 20
Project: Wabbit-Messenger---android-client   File: ItemManager.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
    if (mScrollState != OnScrollListener.SCROLL_STATE_IDLE) {
        mScrollState = OnScrollListener.SCROLL_STATE_IDLE;
        postUpdateItems();
    }

    final OnItemSelectedListener l = mManaged.getOnItemSelectedListener();
    if (l != null) {
        l.onItemSelected(adapterView, view, position, id);
    }
}
 
Example 21
Project: Wabbit-Messenger---android-client   File: ItemManager.java   Source Code and License 5 votes vote down vote up
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
    final OnItemSelectedListener l = mManaged.getOnItemSelectedListener();
    if (l != null) {
        l.onNothingSelected(adapterView);
    }
}
 
Example 22
Project: EasyQuranMemorizer   File: MyMediaPlayer.java   Source Code and License 5 votes vote down vote up
private void initializeReciterSpinner()

	{

		ReciterDataManger manager = new ReciterDataManger(
				getApplicationContext());
		downloadedReciterList = manager.getDownloadedReciterList(surah);

		// setting reciter spinner list
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
				android.R.layout.simple_spinner_item, downloadedReciterList);
		dataAdapter
				.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		reciterSpinner.setAdapter(dataAdapter);
		reciterSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> parent, View view,
					int position, long id) {

				selectedAuthorName = downloadedReciterList.get(position);
				// if (selectedAuthorName != CONSTANT.AUDIO_NOT_FOUND) {
				// resetVerse();
				// play();
				// }
				resetVerse();
				play();
			}

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

			}

		});

	}
 
Example 23
Project: NeXT_pyp   File: AbstractAQuery.java   Source Code and License 5 votes vote down vote up
/**
 * Register a callback method for when an item is selected. 
 *
 * @param listener The item selected listener.
 * @return self
 */
public T itemSelected(OnItemSelectedListener listener){
	
	if(view instanceof AdapterView){		
		AdapterView<?> alv = (AdapterView<?>) view;
		alv.setOnItemSelectedListener(listener);		
	}
	
	return self();
	
}
 
Example 24
Project: NeXT_pyp   File: AbstractAQuery.java   Source Code and License 5 votes vote down vote up
/**
 * Register a callback method for when an item is selected.
 * 
 * @param listener
 *            The item selected listener.
 * @return self
 */
public T itemSelected(OnItemSelectedListener listener) {

	if (view instanceof AdapterView) {
		AdapterView<?> alv = (AdapterView<?>) view;
		alv.setOnItemSelectedListener(listener);
	}

	return self();

}
 
Example 25
Project: NeXT_pyp   File: AbstractAQuery.java   Source Code and License 5 votes vote down vote up
/**
 * Register a callback method for when an item is selected.
 * 
 * @param listener
 *            The item selected listener.
 * @return self
 */
public T itemSelected(OnItemSelectedListener listener) {

	if (view instanceof AdapterView) {
		AdapterView<?> alv = (AdapterView<?>) view;
		alv.setOnItemSelectedListener(listener);
	}

	return self();

}
 
Example 26
Project: Android-Project-Manager   File: SpinnerUtil.java   Source Code and License 5 votes vote down vote up
public static ArrayAdapter<CharSequence> setCustomSpinnerAdapter (final Context context, final Fragment fragment, 
		final FragmentManager fragmentManager, String spinnerFileName, Spinner spinner, boolean sort) {
	FileOperations fO = new FileOperations(context);
	
	String spinnerItems = fO.readFile(spinnerFileName);
	ArrayList<String> spinnerItemsArray = fO.convertToStringList(spinnerItems);
	if(sort)
		Collections.sort(spinnerItemsArray.subList(0, spinnerItemsArray.size()));
	spinnerItemsArray.add("Custom...");
	
	//Set the adapter for the status spinner 
	final ArrayAdapter<CharSequence> spinnerAdapter = new ArrayAdapter<CharSequence>(context, android.R.layout.simple_spinner_item);
	spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	spinnerAdapter.addAll(spinnerItemsArray);
	spinner.setAdapter(spinnerAdapter);
	
	spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
		@Override
		public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
			if( "Custom...".equals((String) spinnerAdapter.getItem(position))) {
				DialogFragment customStatusDialog = new CustomStatus();
				customStatusDialog.setTargetFragment(fragment, 0);
				customStatusDialog.show(fragmentManager, "Custom Status Dialog");
			}
		}
		@Override
		public void onNothingSelected(AdapterView<?> arg0) { }
	});
	
	return spinnerAdapter;
}
 
Example 27
Project: CardUI   File: GridActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        // Intialize and set the Action Bar to Holo Blue
        ActionBar actionBar = getActionBar();
        actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#33b5e5" )));
        
        GridView grid = (GridView) findViewById(R.id.myGrid);
         rowItems = new ArrayList<RowItem>();
         
        String[] titles = {"Movie1","Movie2","Movie3","Movie4","Movie5","Movie6","Movie7","Movie8"};
        String[] descriptions = {"First Movie","Second movie","Third Movie","Fourth Movie","Fifth Movie",
                        "Sixth Movie","Seventh Movie","Eighth Movie"};
        //Populate the List
        for (int i = 0; i < titles.length; i++) {
            RowItem item = new RowItem(images[i], titles[i], descriptions[i]);
            rowItems.add(item);
        }

        // Set the adapter on the ListView
        LazyAdapter adapter = new LazyAdapter(getApplicationContext(), R.layout.grid_row, rowItems);
        grid.setAdapter(adapter);
        
        grid.setOnItemSelectedListener(new OnItemSelectedListener() {

                        @Override
                        public void onItemSelected(AdapterView<?> arg0, View arg1,
                                        int arg2, long arg3) {
                                // TODO Auto-generated method stub
                                
                        }

                        
                });
}
 
Example 28
Project: jukefox   File: SearchActivity.java   Source Code and License 5 votes vote down vote up
private void registerSpinner(int selectedPos) {
		searchInSelectionSpinner = (Spinner)findViewById(R.id.searchInSelectionSpinner);
		searchInSelectionSpinner.setSelection(selectedPos); // title
		searchInSelectionSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> parent, View view,
					int pos, long id) {
				search();
			}

			@Override
			public void onNothingSelected(AdapterView<?> arg0) {
				// TODO: nothing to do (?)
			}
		});
//		searchInArtists = (RadioButton) findViewById(R.id.searchInArtists);
//		searchInAlbums = (RadioButton) findViewById(R.id.searchInAlbums);
//		searchInFamousArtists = (RadioButton) findViewById(R.id.searchInSimilarArtists);
//		searchInTitles = (RadioButton) findViewById(R.id.searchInTitles);
//		RadioGroup radioGroup = (RadioGroup) findViewById(R.id.searchCriterion);
//		radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
//
//			@Override
//			public void onCheckedChanged(RadioGroup group, int checkedId) {
//				search();
//			}
//		});
	}
 
Example 29
Project: triples   File: StatisticsSelectorView.java   Source Code and License 5 votes vote down vote up
private void initSpinner() {
  mSpinner = (Spinner) findViewById(R.id.period_spinner);

  ArrayAdapter<CharSequence> adapter =
      new ArrayAdapter<CharSequence>(getContext(), android.R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  initPeriodsMap();
  for (String key : PERIODS.keySet()) {
    adapter.add(key);
  }
  mSpinner.setAdapter(adapter);

  mSpinner.setOnItemSelectedListener(
      new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
          String string = (String) parent.getItemAtPosition(pos);
          mCurrentPeriod = PERIODS.get(string);
          if (mOnPeriodChangeListener != null) {
            mOnPeriodChangeListener.onPeriodChange(mCurrentPeriod);
          }
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {}
      });
  mCurrentPeriod = PERIODS.get(mSpinner.getSelectedItem().toString());
}
 
Example 30
Project: gundog-engine   File: OnlineGameLayout.java   Source Code and License 5 votes vote down vote up
private Spinner generateSpinner(Context context, OnItemSelectedListener listener, int description, int[] choices) {
	String[] mStrings = new String[choices.length];
	Resources resources = context.getResources();
	for (int i = 0; i < mStrings.length; i++) {
		mStrings[i] = resources.getString(description) + ": " + resources.getString(choices[i]).toUpperCase();
	}

	Spinner speedSpinner = new Spinner(context);
	ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item, mStrings);
	adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	speedSpinner.setAdapter(adapter);
	speedSpinner.setOnItemSelectedListener(listener);
	return speedSpinner;
}
 
Example 31
Project: gundog-engine   File: NewGameLayout.java   Source Code and License 5 votes vote down vote up
private Spinner generateSpinner(Context context, OnItemSelectedListener listener, int description, int[] choices) {
	String[] mStrings = new String[choices.length];
	Resources resources = context.getResources();
	for (int i = 0; i < mStrings.length; i++) {
		mStrings[i] = resources.getString(description) + ": " + resources.getString(choices[i]).toUpperCase();
	}

	Spinner speedSpinner = new Spinner(context);
	ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item, mStrings);
	adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	speedSpinner.setAdapter(adapter);
	speedSpinner.setOnItemSelectedListener(listener);
	return speedSpinner;
}
 
Example 32
Project: gundog-engine   File: CampaignLevelLayout.java   Source Code and License 5 votes vote down vote up
private Spinner generateSpinner(Context context, OnItemSelectedListener listener, int description, int[] choices) {
	String[] mStrings = new String[choices.length];
	Resources resources = context.getResources();
	for (int i = 0; i < mStrings.length; i++) {
		mStrings[i] = resources.getString(description) + ": " + resources.getString(choices[i]).toUpperCase();
	}

	Spinner speedSpinner = new Spinner(context);
	ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item, mStrings);
	adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	speedSpinner.setAdapter(adapter);
	speedSpinner.setOnItemSelectedListener(listener);
	return speedSpinner;
}
 
Example 33
Project: BeeFramework_Android   File: AbstractAQuery.java   Source Code and License 5 votes vote down vote up
/**
 * Register a callback method for when an item is selected. 
 *
 * @param listener The item selected listener.
 * @return self
 */
public T itemSelected(OnItemSelectedListener listener){
	
	if(view instanceof AdapterView){		
		AdapterView<?> alv = (AdapterView<?>) view;
		alv.setOnItemSelectedListener(listener);		
	}
	
	return self();
	
}
 
Example 34
Project: q-mail   File: AccountSetupIncoming.java   Source Code and License 4 votes vote down vote up
/**
 * This is invoked only when the user makes changes to a widget, not when
 * widgets are changed programmatically.  (The logic is simpler when you know
 * that this is the last thing called after an input change.)
 */
private void validateFields() {
    AuthType authType = getSelectedAuthType();
    boolean isAuthTypeExternal = (AuthType.EXTERNAL == authType);

    ConnectionSecurity connectionSecurity = getSelectedSecurity();
    boolean hasConnectionSecurity = (connectionSecurity != ConnectionSecurity.NONE);

    if (isAuthTypeExternal && !hasConnectionSecurity) {

        // Notify user of an invalid combination of AuthType.EXTERNAL & ConnectionSecurity.NONE
        String toastText = getString(R.string.account_setup_incoming_invalid_setting_combo_notice,
                getString(R.string.account_setup_incoming_auth_type_label),
                AuthType.EXTERNAL.toString(),
                getString(R.string.account_setup_incoming_security_label),
                ConnectionSecurity.NONE.toString());
        Toast.makeText(this, toastText, Toast.LENGTH_LONG).show();

        // Reset the views back to their previous settings without recursing through here again
        OnItemSelectedListener onItemSelectedListener = mAuthTypeView.getOnItemSelectedListener();
        mAuthTypeView.setOnItemSelectedListener(null);
        mAuthTypeView.setSelection(mCurrentAuthTypeViewPosition, false);
        mAuthTypeView.setOnItemSelectedListener(onItemSelectedListener);
        updateViewFromAuthType();

        onItemSelectedListener = mSecurityTypeView.getOnItemSelectedListener();
        mSecurityTypeView.setOnItemSelectedListener(null);
        mSecurityTypeView.setSelection(mCurrentSecurityTypeViewPosition, false);
        mSecurityTypeView.setOnItemSelectedListener(onItemSelectedListener);
        updateAuthPlainTextFromSecurityType(getSelectedSecurity());

        mPortView.removeTextChangedListener(validationTextWatcher);
        mPortView.setText(mCurrentPortViewSetting);
        mPortView.addTextChangedListener(validationTextWatcher);

        authType = getSelectedAuthType();
        isAuthTypeExternal = (AuthType.EXTERNAL == authType);

        connectionSecurity = getSelectedSecurity();
        hasConnectionSecurity = (connectionSecurity != ConnectionSecurity.NONE);
    } else {
        mCurrentAuthTypeViewPosition = mAuthTypeView.getSelectedItemPosition();
        mCurrentSecurityTypeViewPosition = mSecurityTypeView.getSelectedItemPosition();
        mCurrentPortViewSetting = mPortView.getText().toString();
    }

    boolean hasValidCertificateAlias = mClientCertificateSpinner.getAlias() != null;
    boolean hasValidUserName = Utility.requiredFieldValid(mUsernameView);

    boolean hasValidPasswordSettings = hasValidUserName
            && !isAuthTypeExternal
            && Utility.requiredFieldValid(mPasswordView);

    boolean hasValidExternalAuthSettings = hasValidUserName
            && isAuthTypeExternal
            && hasConnectionSecurity
            && hasValidCertificateAlias;

    mNextButton.setEnabled(Utility.domainFieldValid(mServerView)
            && Utility.requiredFieldValid(mPortView)
            && (hasValidPasswordSettings || hasValidExternalAuthSettings));
    Utility.setCompoundDrawablesAlpha(mNextButton, mNextButton.isEnabled() ? 255 : 128);
}
 
Example 35
Project: q-mail   File: AccountSetupOutgoing.java   Source Code and License 4 votes vote down vote up
/**
 * This is invoked only when the user makes changes to a widget, not when
 * widgets are changed programmatically.  (The logic is simpler when you know
 * that this is the last thing called after an input change.)
 */
private void validateFields() {
    AuthType authType = getSelectedAuthType();
    boolean isAuthTypeExternal = (AuthType.EXTERNAL == authType);

    ConnectionSecurity connectionSecurity = getSelectedSecurity();
    boolean hasConnectionSecurity = (connectionSecurity != ConnectionSecurity.NONE);

    if (isAuthTypeExternal && !hasConnectionSecurity) {

        // Notify user of an invalid combination of AuthType.EXTERNAL & ConnectionSecurity.NONE
        String toastText = getString(R.string.account_setup_outgoing_invalid_setting_combo_notice,
                getString(R.string.account_setup_incoming_auth_type_label),
                AuthType.EXTERNAL.toString(),
                getString(R.string.account_setup_incoming_security_label),
                ConnectionSecurity.NONE.toString());
        Toast.makeText(this, toastText, Toast.LENGTH_LONG).show();

        // Reset the views back to their previous settings without recursing through here again
        OnItemSelectedListener onItemSelectedListener = mAuthTypeView.getOnItemSelectedListener();
        mAuthTypeView.setOnItemSelectedListener(null);
        mAuthTypeView.setSelection(mCurrentAuthTypeViewPosition, false);
        mAuthTypeView.setOnItemSelectedListener(onItemSelectedListener);
        updateViewFromAuthType();

        onItemSelectedListener = mSecurityTypeView.getOnItemSelectedListener();
        mSecurityTypeView.setOnItemSelectedListener(null);
        mSecurityTypeView.setSelection(mCurrentSecurityTypeViewPosition, false);
        mSecurityTypeView.setOnItemSelectedListener(onItemSelectedListener);
        updateAuthPlainTextFromSecurityType(getSelectedSecurity());

        mPortView.removeTextChangedListener(validationTextWatcher);
        mPortView.setText(mCurrentPortViewSetting);
        mPortView.addTextChangedListener(validationTextWatcher);

        authType = getSelectedAuthType();
        isAuthTypeExternal = (AuthType.EXTERNAL == authType);

        connectionSecurity = getSelectedSecurity();
        hasConnectionSecurity = (connectionSecurity != ConnectionSecurity.NONE);
    } else {
        mCurrentAuthTypeViewPosition = mAuthTypeView.getSelectedItemPosition();
        mCurrentSecurityTypeViewPosition = mSecurityTypeView.getSelectedItemPosition();
        mCurrentPortViewSetting = mPortView.getText().toString();
    }

    boolean hasValidCertificateAlias = mClientCertificateSpinner.getAlias() != null;
    boolean hasValidUserName = Utility.requiredFieldValid(mUsernameView);

    boolean hasValidPasswordSettings = hasValidUserName
            && !isAuthTypeExternal
            && Utility.requiredFieldValid(mPasswordView);

    boolean hasValidExternalAuthSettings = hasValidUserName
            && isAuthTypeExternal
            && hasConnectionSecurity
            && hasValidCertificateAlias;

    mNextButton
            .setEnabled(Utility.domainFieldValid(mServerView)
                    && Utility.requiredFieldValid(mPortView)
                    && (!mRequireLoginView.isChecked()
                            || hasValidPasswordSettings || hasValidExternalAuthSettings));
    Utility.setCompoundDrawablesAlpha(mNextButton, mNextButton.isEnabled() ? 255 : 128);
}
 
Example 36
Project: GitHub   File: GridPickerView.java   Source Code and License 4 votes vote down vote up
public void setOnItemSelectedListener(OnItemSelectedListener onItemSelectedListener) {
	this.onItemSelectedListener = onItemSelectedListener;
}
 
Example 37
Project: GitHub   File: GridPickerAdapter.java   Source Code and License 4 votes vote down vote up
public void setOnItemSelectedListener(OnItemSelectedListener onItemSelectedListener) {
	this.onItemSelectedListener = onItemSelectedListener;
}
 
Example 38
Project: GitHub   File: GridPickerView.java   Source Code and License 4 votes vote down vote up
public void setOnItemSelectedListener(OnItemSelectedListener onItemSelectedListener) {
	this.onItemSelectedListener = onItemSelectedListener;
}
 
Example 39
Project: GitHub   File: GridPickerAdapter.java   Source Code and License 4 votes vote down vote up
public void setOnItemSelectedListener(OnItemSelectedListener onItemSelectedListener) {
	this.onItemSelectedListener = onItemSelectedListener;
}
 
Example 40
Project: APIJSON-Android-RxJava   File: GridPickerView.java   Source Code and License 4 votes vote down vote up
public void setOnItemSelectedListener(OnItemSelectedListener onItemSelectedListener) {
	this.onItemSelectedListener = onItemSelectedListener;
}
 
Example 41
Project: APIJSON-Android-RxJava   File: GridPickerAdapter.java   Source Code and License 4 votes vote down vote up
public void setOnItemSelectedListener(OnItemSelectedListener onItemSelectedListener) {
	this.onItemSelectedListener = onItemSelectedListener;
}
 
Example 42
Project: letv   File: LetvGallery.java   Source Code and License 4 votes vote down vote up
public void addSelectedListener(OnItemSelectedListener itemSelectedListener) {
    this.listeners.add(itemSelectedListener);
}
 
Example 43
Project: letv   File: LetvGallery.java   Source Code and License 4 votes vote down vote up
public void removeSelectedListener(OnItemSelectedListener itemSelectedListener) {
    this.listeners.remove(itemSelectedListener);
}
 
Example 44
Project: buildAPKsSamples   File: SpinnerActivity.java   Source Code and License 4 votes vote down vote up
/**
 * Initializes the application and the activity.
 * 1) Sets the view
 * 2) Reads the spinner's backing data from the string resources file
 * 3) Instantiates a callback listener for handling selection from the
 *    spinner
 * Notice that this method includes code that can be uncommented to force
 * tests to fail.
 *
 * This method overrides the default onCreate() method for an Activity.
 *
 * @see android.app.Activity#onCreate(android.os.Bundle)
 */
@Override
public void onCreate(Bundle savedInstanceState) {

    /**
     * derived classes that use onCreate() overrides must always call the super constructor
     */
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    Spinner spinner = (Spinner) findViewById(R.id.Spinner01);

    /*
     * Create a backing mLocalAdapter for the Spinner from a list of the
     * planets. The list is defined by XML in the strings.xml file.
     */

    this.mAdapter = ArrayAdapter.createFromResource(this, R.array.Planets,
            android.R.layout.simple_spinner_dropdown_item);

    /*
     * Attach the mLocalAdapter to the spinner.
     */

    spinner.setAdapter(this.mAdapter);

    /*
     * Create a listener that is triggered when Android detects the
     * user has selected an item in the Spinner.
     */

    OnItemSelectedListener spinnerListener = new myOnItemSelectedListener(this,this.mAdapter);

    /*
     * Attach the listener to the Spinner.
     */

    spinner.setOnItemSelectedListener(spinnerListener);


    /*
     * To demonstrate a failure in the preConditions test,
     * uncomment the following line.
     * The test will fail because the selection listener for the
     * Spinner is not set.
     */
     // spinner.setOnItemSelectedListener(null);

}
 
Example 45
Project: AndroidViewHelper   File: AdapterViewWrapper.java   Source Code and License 4 votes vote down vote up
/**
* @see AdapterView#setOnItemSelectedListener(OnItemSelectedListener)
*/
 public W setOnItemSelectedListener(OnItemSelectedListener listener) {
     mView.setOnItemSelectedListener(listener);
     return (W) this;
 }
 
Example 46
Project: boohee_v5.6   File: HorizontalListView.java   Source Code and License 4 votes vote down vote up
public void setOnItemSelectedListener(OnItemSelectedListener listener) {
    this.mOnItemSelected = listener;
}
 
Example 47
Project: boohee_v5.6   File: HorizontalListViewPosition.java   Source Code and License 4 votes vote down vote up
public void setOnItemSelectedListener(OnItemSelectedListener listener) {
    this.mOnItemSelected = listener;
}
 
Example 48
Project: boohee_v5.6   File: AlertDialog.java   Source Code and License 4 votes vote down vote up
public Builder setOnItemSelectedListener(OnItemSelectedListener listener) {
    this.P.mOnItemSelectedListener = listener;
    return this;
}
 
Example 49
Project: boohee_v5.6   File: ToolbarWidgetWrapper.java   Source Code and License 4 votes vote down vote up
public void setDropdownParams(SpinnerAdapter adapter, OnItemSelectedListener listener) {
    ensureSpinner();
    this.mSpinner.setAdapter(adapter);
    this.mSpinner.setOnItemSelectedListener(listener);
}
 
Example 50
Project: boohee_v5.6   File: ListPopupWindow.java   Source Code and License 4 votes vote down vote up
public void setOnItemSelectedListener(OnItemSelectedListener selectedListener) {
    this.mItemSelectedListener = selectedListener;
}
 
Example 51
Project: APIJSON   File: GridPickerView.java   Source Code and License 4 votes vote down vote up
public void setOnItemSelectedListener(OnItemSelectedListener onItemSelectedListener) {
	this.onItemSelectedListener = onItemSelectedListener;
}
 
Example 52
Project: APIJSON   File: GridPickerAdapter.java   Source Code and License 4 votes vote down vote up
public void setOnItemSelectedListener(OnItemSelectedListener onItemSelectedListener) {
	this.onItemSelectedListener = onItemSelectedListener;
}
 
Example 53
Project: K9-MailClient   File: AccountSetupIncoming.java   Source Code and License 4 votes vote down vote up
/**
 * This is invoked only when the user makes changes to a widget, not when
 * widgets are changed programmatically.  (The logic is simpler when you know
 * that this is the last thing called after an input change.)
 */
private void validateFields() {
    AuthType authType = getSelectedAuthType();
    boolean isAuthTypeExternal = (AuthType.EXTERNAL == authType);

    ConnectionSecurity connectionSecurity = getSelectedSecurity();
    boolean hasConnectionSecurity = (connectionSecurity != ConnectionSecurity.NONE);

    if (isAuthTypeExternal && !hasConnectionSecurity) {

        // Notify user of an invalid combination of AuthType.EXTERNAL & ConnectionSecurity.NONE
        String toastText = getString(R.string.account_setup_incoming_invalid_setting_combo_notice,
                getString(R.string.account_setup_incoming_auth_type_label),
                AuthType.EXTERNAL.toString(),
                getString(R.string.account_setup_incoming_security_label),
                ConnectionSecurity.NONE.toString());
        Toast.makeText(this, toastText, Toast.LENGTH_LONG).show();

        // Reset the views back to their previous settings without recursing through here again
        OnItemSelectedListener onItemSelectedListener = mAuthTypeView.getOnItemSelectedListener();
        mAuthTypeView.setOnItemSelectedListener(null);
        mAuthTypeView.setSelection(mCurrentAuthTypeViewPosition, false);
        mAuthTypeView.setOnItemSelectedListener(onItemSelectedListener);
        updateViewFromAuthType();

        onItemSelectedListener = mSecurityTypeView.getOnItemSelectedListener();
        mSecurityTypeView.setOnItemSelectedListener(null);
        mSecurityTypeView.setSelection(mCurrentSecurityTypeViewPosition, false);
        mSecurityTypeView.setOnItemSelectedListener(onItemSelectedListener);
        updateAuthPlainTextFromSecurityType(getSelectedSecurity());

        mPortView.removeTextChangedListener(validationTextWatcher);
        mPortView.setText(mCurrentPortViewSetting);
        mPortView.addTextChangedListener(validationTextWatcher);

        authType = getSelectedAuthType();
        isAuthTypeExternal = (AuthType.EXTERNAL == authType);

        connectionSecurity = getSelectedSecurity();
        hasConnectionSecurity = (connectionSecurity != ConnectionSecurity.NONE);
    } else {
        mCurrentAuthTypeViewPosition = mAuthTypeView.getSelectedItemPosition();
        mCurrentSecurityTypeViewPosition = mSecurityTypeView.getSelectedItemPosition();
        mCurrentPortViewSetting = mPortView.getText().toString();
    }

    boolean hasValidCertificateAlias = mClientCertificateSpinner.getAlias() != null;
    boolean hasValidUserName = Utility.requiredFieldValid(mUsernameView);

    boolean hasValidPasswordSettings = hasValidUserName
            && !isAuthTypeExternal
            && Utility.requiredFieldValid(mPasswordView);

    boolean hasValidExternalAuthSettings = hasValidUserName
            && isAuthTypeExternal
            && hasConnectionSecurity
            && hasValidCertificateAlias;

    mNextButton.setEnabled(Utility.domainFieldValid(mServerView)
            && Utility.requiredFieldValid(mPortView)
            && (hasValidPasswordSettings || hasValidExternalAuthSettings));
    Utility.setCompoundDrawablesAlpha(mNextButton, mNextButton.isEnabled() ? 255 : 128);
}
 
Example 54
Project: K9-MailClient   File: AccountSetupOutgoing.java   Source Code and License 4 votes vote down vote up
/**
 * This is invoked only when the user makes changes to a widget, not when
 * widgets are changed programmatically.  (The logic is simpler when you know
 * that this is the last thing called after an input change.)
 */
private void validateFields() {
    AuthType authType = getSelectedAuthType();
    boolean isAuthTypeExternal = (AuthType.EXTERNAL == authType);

    ConnectionSecurity connectionSecurity = getSelectedSecurity();
    boolean hasConnectionSecurity = (connectionSecurity != ConnectionSecurity.NONE);

    if (isAuthTypeExternal && !hasConnectionSecurity) {

        // Notify user of an invalid combination of AuthType.EXTERNAL & ConnectionSecurity.NONE
        String toastText = getString(R.string.account_setup_outgoing_invalid_setting_combo_notice,
                getString(R.string.account_setup_incoming_auth_type_label),
                AuthType.EXTERNAL.toString(),
                getString(R.string.account_setup_incoming_security_label),
                ConnectionSecurity.NONE.toString());
        Toast.makeText(this, toastText, Toast.LENGTH_LONG).show();

        // Reset the views back to their previous settings without recursing through here again
        OnItemSelectedListener onItemSelectedListener = mAuthTypeView.getOnItemSelectedListener();
        mAuthTypeView.setOnItemSelectedListener(null);
        mAuthTypeView.setSelection(mCurrentAuthTypeViewPosition, false);
        mAuthTypeView.setOnItemSelectedListener(onItemSelectedListener);
        updateViewFromAuthType();

        onItemSelectedListener = mSecurityTypeView.getOnItemSelectedListener();
        mSecurityTypeView.setOnItemSelectedListener(null);
        mSecurityTypeView.setSelection(mCurrentSecurityTypeViewPosition, false);
        mSecurityTypeView.setOnItemSelectedListener(onItemSelectedListener);
        updateAuthPlainTextFromSecurityType(getSelectedSecurity());

        mPortView.removeTextChangedListener(validationTextWatcher);
        mPortView.setText(mCurrentPortViewSetting);
        mPortView.addTextChangedListener(validationTextWatcher);

        authType = getSelectedAuthType();
        isAuthTypeExternal = (AuthType.EXTERNAL == authType);

        connectionSecurity = getSelectedSecurity();
        hasConnectionSecurity = (connectionSecurity != ConnectionSecurity.NONE);
    } else {
        mCurrentAuthTypeViewPosition = mAuthTypeView.getSelectedItemPosition();
        mCurrentSecurityTypeViewPosition = mSecurityTypeView.getSelectedItemPosition();
        mCurrentPortViewSetting = mPortView.getText().toString();
    }

    boolean hasValidCertificateAlias = mClientCertificateSpinner.getAlias() != null;
    boolean hasValidUserName = Utility.requiredFieldValid(mUsernameView);

    boolean hasValidPasswordSettings = hasValidUserName
            && !isAuthTypeExternal
            && Utility.requiredFieldValid(mPasswordView);

    boolean hasValidExternalAuthSettings = hasValidUserName
            && isAuthTypeExternal
            && hasConnectionSecurity
            && hasValidCertificateAlias;

    mNextButton
            .setEnabled(Utility.domainFieldValid(mServerView)
                    && Utility.requiredFieldValid(mPortView)
                    && (!mRequireLoginView.isChecked()
                            || hasValidPasswordSettings || hasValidExternalAuthSettings));
    Utility.setCompoundDrawablesAlpha(mNextButton, mNextButton.isEnabled() ? 255 : 128);
}
 
Example 55
Project: motolog   File: NewRem.java   Source Code and License 4 votes vote down vote up
public void setMaintElemSpinner(int pos) {

		maintElemArrayList.add(0, "...");

		maintElemAdapter = new ArrayAdapter<String>(getApplicationContext(),
				R.layout.generalspinner, maintElemArrayList);
		maintElemAdapter
				.setDropDownViewResource(R.layout.generalspinnerdropdown);

		maintElemSpinner = (Spinner) findViewById(R.id.maintelemspinner);
		maintElemSpinner.setAdapter(maintElemAdapter);

		maintElemSpinner
				.setOnItemSelectedListener(new OnItemSelectedListener() {
					@Override
					public void onItemSelected(AdapterView<?> parent, View view,
							int position, long id) {
						String select = maintElemSpinner.getItemAtPosition(position).toString() ;
						if(select.equals("Other") && notonloadmaintelemspinner) {
							
							elemDialog = new NewElementDialog();
							Bundle b = new Bundle();
								FragmentManager fm = getSupportFragmentManager();
								b.putString("newelementdialog", ELEMVAL);
								b.putString("callingActivity", tag);
								elemDialog.setArguments(b);
								elemDialog.show(fm, tag);
						} else {
							notonloadmaintelemspinner=true;
							setTextHeader();
						}
					}

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

					}

				});
		if (pos >-1 ) {
			maintElemSpinner.setSelection(pos);
		}

	}
 
Example 56
Project: AndroidAPS   File: SpinnerHelper.java   Source Code and License 4 votes vote down vote up
public void setOnItemSelectedListener(OnItemSelectedListener listener) {
    proxiedItemSelectedListener = listener;
    setTouchListener();
    spinner.setOnItemSelectedListener(listener == null ? null : this);
}
 
Example 57
Project: Trebuchet   File: PinnedHeaderListView.java   Source Code and License 4 votes vote down vote up
@Override
public void setOnItemSelectedListener(OnItemSelectedListener listener) {
    mOnItemSelectedListener = listener;
    super.setOnItemSelectedListener(this);
}
 
Example 58
Project: FMTech   File: FormSpinner.java   Source Code and License 4 votes vote down vote up
public void setOnItemSelectedListener(AdapterView.OnItemSelectedListener paramOnItemSelectedListener)
{
  this.mOnItemSelectedListener = paramOnItemSelectedListener;
}
 
Example 59
Project: ODK-Liberia   File: SpinnerWidget.java   Source Code and License 4 votes vote down vote up
public SpinnerWidget(Context context, FormEntryPrompt prompt) {
     super(context, prompt);

     // SurveyCTO-added support for dynamic select content (from .csv files)
     XPathFuncExpr xPathFuncExpr = ExternalDataUtil.getSearchXPathExpression(prompt.getAppearanceHint());
     if (xPathFuncExpr != null) {
         mItems = ExternalDataUtil.populateExternalChoices(prompt, xPathFuncExpr);
     } else {
         mItems = prompt.getSelectChoices();
     }

     spinner = new Spinner(context);
     choices = new String[mItems.size()+1];
     for (int i = 0; i < mItems.size(); i++) {
         choices[i] = prompt.getSelectChoiceText(mItems.get(i));
     }
     choices[mItems.size()] = getContext().getString(R.string.select_one);

     // The spinner requires a custom adapter. It is defined below
     SpinnerAdapter adapter =
         new SpinnerAdapter(getContext(), android.R.layout.simple_spinner_item, choices,
                 TypedValue.COMPLEX_UNIT_DIP, mQuestionFontsize);

     spinner.setAdapter(adapter);
     spinner.setPrompt(prompt.getQuestionText());
     spinner.setEnabled(!prompt.isReadOnly());
     spinner.setFocusable(!prompt.isReadOnly());

     // Fill in previous answer
     String s = null;
     if (prompt.getAnswerValue() != null) {
         s = ((Selection) prompt.getAnswerValue().getValue()).getValue();
     }

     spinner.setSelection(mItems.size());
     if (s != null) {
         for (int i = 0; i < mItems.size(); ++i) {
             String sMatch = mItems.get(i).getValue();
             if (sMatch.equals(s)) {
                 spinner.setSelection(i);
             }
         }
     }

     spinner.setOnItemSelectedListener(new OnItemSelectedListener() {

@Override
public void onItemSelected(AdapterView<?> parent, View view,
		int position, long id) {
	if ( position == mItems.size() ) {
		Collect.getInstance().getActivityLogger().logInstanceAction(this, "onCheckedChanged.clearValue", 
   			"", mPrompt.getIndex());
	} else {
		Collect.getInstance().getActivityLogger().logInstanceAction(this, "onCheckedChanged", 
    			mItems.get(position).getValue(), mPrompt.getIndex());
	}
}

@Override
public void onNothingSelected(AdapterView<?> arg0) {
	
}});
     
     addView(spinner);

 }
 
Example 60
Project: Android-ZBLibrary   File: GridPickerView.java   Source Code and License 4 votes vote down vote up
public void setOnItemSelectedListener(OnItemSelectedListener onItemSelectedListener) {
	this.onItemSelectedListener = onItemSelectedListener;
}