Java Code Examples for android.widget.Spinner

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project cow, under directory /libs/ActionBarSherlock/library/src/com/actionbarsherlock/internal/widget/.

Source file: ScrollingTabContainerView.java

  19 
vote

private Spinner createSpinner(){
  final Spinner spinner=new Spinner(getContext(),null,R.attr.actionDropDownStyle);
  spinner.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.FILL_PARENT));
  spinner.setOnItemSelectedListener(this);
  return spinner;
}
 

Example 2

From project cw-advandroid, under directory /Contacts/Spinners/src/com/commonsware/android/contacts/spinners/.

Source file: ContactSpinners.java

  19 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  initListAdapters();
  Spinner spin=(Spinner)findViewById(R.id.spinner);
  spin.setOnItemSelectedListener(this);
  ArrayAdapter<String> aa=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,options);
  aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spin.setAdapter(aa);
}
 

Example 3

From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/editor/activity/.

Source file: TaskEditorActivity.java

  18 
vote

static ArrayList<Integer> reminderItemsToMinutes(ArrayList<LinearLayout> reminderItems,ArrayList<Integer> reminderValues){
  int len=reminderItems.size();
  ArrayList<Integer> reminderMinutes=new ArrayList<Integer>(len);
  for (int index=0; index < len; index++) {
    LinearLayout layout=reminderItems.get(index);
    Spinner spinner=(Spinner)layout.findViewById(R.id.reminder_value);
    int minutes=reminderValues.get(spinner.getSelectedItemPosition());
    reminderMinutes.add(minutes);
  }
  return reminderMinutes;
}
 

Example 4

From project androidannotations, under directory /AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/googlecode/androidannotations/test15/.

Source file: ItemClicksHandledActivityTest.java

  18 
vote

@Test public void handlingSpinnerItemClick(){
  Spinner spinner=(Spinner)activity.findViewById(R.id.spinner);
  long itemId=spinner.getAdapter().getItemId(TESTED_CLICKED_INDEX);
  View view=spinner.getChildAt(0);
  assertThat(activity.spinnerItemClicked).isFalse();
  spinner.performItemClick(view,TESTED_CLICKED_INDEX,itemId);
  assertThat(activity.spinnerItemClicked).isTrue();
}
 

Example 5

From project AndroidLab, under directory /samples/AndroidLdapClient/src/com/unboundid/android/ldap/client/.

Source file: SearchServer.java

  18 
vote

/** 
 * Saves the state of this activity to the provided bundle.
 * @param state  The bundle containing the state information.
 */
private void saveState(final Bundle state){
  logEnter(LOG_TAG,"saveState",state);
  state.putSerializable(BUNDLE_FIELD_INSTANCE,instance);
  final Spinner typeSpinner=(Spinner)findViewById(R.id.layout_search_server_spinner_search_type);
  searchTypePosition=typeSpinner.getSelectedItemPosition();
  state.putInt(BUNDLE_FIELD_TYPE,searchTypePosition);
  final EditText textField=(EditText)findViewById(R.id.layout_search_server_field_search_text);
  searchText=textField.getText().toString();
  state.putString(BUNDLE_FIELD_TEXT,searchText);
}
 

Example 6

From project android_7, under directory /src/org/immopoly/android/dialog/.

Source file: HighScoreDialog.java

  18 
vote

@Override protected View getLayout(){
  View layout=activity.getLayoutInflater().inflate(R.layout.highscore_webview,null);
  Spinner dropDown=(Spinner)layout.findViewById(R.id.hscore_dropdown);
  dropDown.setOnItemSelectedListener(this);
  return layout;
}
 

Example 7

From project appdriver, under directory /android/sample-aut/simplelayouts/src/com/google/android/testing/nativedriver/simplelayouts/.

Source file: SpinnersActivity.java

  18 
vote

@Override public void onCreate(Bundle savedInstance){
  super.onCreate(savedInstance);
  setContentView(R.layout.spinners);
  Spinner planetSpinner=(Spinner)findViewById(R.id.planet_spinner);
  ArrayAdapter<CharSequence> planetAdapter=ArrayAdapter.createFromResource(this,R.array.planets,android.R.layout.simple_spinner_item);
  planetAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  planetSpinner.setAdapter(planetAdapter);
  Spinner starSpinner=(Spinner)findViewById(R.id.star_spinner);
  ArrayAdapter<CharSequence> starAdapter=ArrayAdapter.createFromResource(this,R.array.stars,android.R.layout.simple_spinner_item);
  starAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  starSpinner.setAdapter(starAdapter);
}
 

Example 8

From project Book-Catalogue, under directory /src/com/eleybourn/bookcatalogue/.

Source file: Fields.java

  18 
vote

public void set(Field field,String s){
  s=field.format(s);
  Spinner v=(Spinner)field.getView();
  if (v == null)   return;
  for (int i=0; i < v.getCount(); i++) {
    if (v.getItemAtPosition(i).equals(s)) {
      v.setSelection(i);
      return;
    }
  }
}
 

Example 9

From project Catroid-maven-playground, under directory /src/main/java/at/tugraz/ist/catroid/content/bricks/.

Source file: NXTMotorStopBrick.java

  18 
vote

public View getView(Context context,int brickId,BaseAdapter adapter){
  View brickView=View.inflate(context,R.layout.brick_nxt_motor_stop,null);
  ArrayAdapter<CharSequence> motorAdapter=ArrayAdapter.createFromResource(context,R.array.nxt_stop_motor_chooser,android.R.layout.simple_spinner_item);
  motorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  Spinner motorSpinner=(Spinner)brickView.findViewById(R.id.stop_motor_spinner);
  motorSpinner.setOnItemSelectedListener(this);
  motorSpinner.setClickable(true);
  motorSpinner.setEnabled(true);
  motorSpinner.setAdapter(motorAdapter);
  motorSpinner.setSelection(motorEnum.ordinal());
  return brickView;
}
 

Example 10

From project cw-android, under directory /Selection/Spinner/src/com/commonsware/android/selection/.

Source file: SpinnerDemo.java

  18 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.main);
  selection=(TextView)findViewById(R.id.selection);
  Spinner spin=(Spinner)findViewById(R.id.spinner);
  spin.setOnItemSelectedListener(this);
  ArrayAdapter<String> aa=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,items);
  aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spin.setAdapter(aa);
}
 

Example 11

From project cw-omnibus, under directory /Contacts/Spinners/src/com/commonsware/android/contacts/spinners/.

Source file: ContactSpinners.java

  18 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  initListAdapters();
  Spinner spin=(Spinner)findViewById(R.id.spinner);
  spin.setOnItemSelectedListener(this);
  ArrayAdapter<String> aa=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,options);
  aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spin.setAdapter(aa);
}
 

Example 12

From project evodroid, under directory /src/com/sonorth/evodroid/.

Source file: EditPost.java

  18 
vote

private void evaluateSaveButtonText(){
  Spinner spinner=(Spinner)findViewById(R.id.status);
  Button saveButton=(Button)findViewById(R.id.post);
  if (spinner.getSelectedItemPosition() == 0)   saveButton.setText(getResources().getText(R.string.publish_post));
 else   saveButton.setText(getResources().getText(R.string.save));
}
 

Example 13

From project GnucashMobile, under directory /GnucashMobileTest/src/org/gnucash/android/test/ui/.

Source file: OfxExportTest.java

  18 
vote

public void testDeleteTransactionsAfterExport(){
  mSolo.clickOnActionBarItem(R.id.menu_export);
  mSolo.waitForText("Export OFX");
  Spinner spinner=mSolo.getCurrentSpinners().get(0);
  mSolo.clickOnView(spinner);
  String[] options=getActivity().getResources().getStringArray(R.array.export_destinations);
  mSolo.clickOnText(options[1]);
  mSolo.clickOnCheckBox(1);
  mSolo.clickOnButton(3);
  mSolo.waitForDialogToClose(10000);
  TransactionsDbAdapter transAdapter=new TransactionsDbAdapter(getActivity());
  assertEquals(0,transAdapter.getAllTransactionsCount());
  transAdapter.close();
}
 

Example 14

From project maven-android-plugin-samples, under directory /apidemos-android-10/application/src/main/java/com/example/android/apis/view/.

Source file: Animation2.java

  18 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.animation_2);
  mFlipper=((ViewFlipper)this.findViewById(R.id.flipper));
  mFlipper.startFlipping();
  Spinner s=(Spinner)findViewById(R.id.spinner);
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,mStrings);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  s.setAdapter(adapter);
  s.setOnItemSelectedListener(this);
}
 

Example 15

From project NotePad, under directory /NotePad/src/org/openintents/notepad/noteslist/.

Source file: NotesList.java

  18 
vote

protected void updateQuery(){
  if (debug) {
    Log.i(TAG,"Lastfilter: " + mLastFilter);
  }
  Spinner s=(Spinner)findViewById(R.id.tagselection);
  if (s.getSelectedItemPosition() == 0) {
    mSelectedTag=null;
  }
 else {
    mSelectedTag=(String)s.getSelectedItem();
  }
  Cursor cursor=mAdapter.runQueryOnBackgroundThread(mLastFilter,mSelectedTag);
  mAdapter.changeCursor(cursor);
}
 

Example 16

From project OpenAndroidWeather, under directory /OpenAndroidWeather/src/no/firestorm/ui/.

Source file: Settings.java

  18 
vote

private void setUpdateRateSpinner(){
  final Spinner spinner=(Spinner)findViewById(R.id.updateRateSpinner);
  final ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(this,R.array.Update_rates,R.layout.updaterate_spinner_view);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(adapter);
  spinner.setOnItemSelectedListener(new UpdateRateSelectedListener());
  final int updateRate=WeatherNotificationSettings.getUpdateRate(this);
  final int[] updateRateArray=getResources().getIntArray(R.array.Update_rate_values);
  final int id=Arrays.binarySearch(updateRateArray,updateRate);
  if (id >= 0)   spinner.setSelection(id);
 else   spinner.setSelection(0);
}
 

Example 17

From project packages_apps_Calendar, under directory /src/com/android/calendar/event/.

Source file: EventViewUtils.java

  18 
vote

/** 
 * Extracts reminder minutes info from UI elements.
 * @param reminderItems UI elements (layouts with spinners) that hold array indices.
 * @param reminderMinuteValues Maps array index to time in minutes.
 * @param reminderMethodValues Maps array index to alert method constant.
 * @return Array with reminder data.
 */
public static ArrayList<ReminderEntry> reminderItemsToReminders(ArrayList<LinearLayout> reminderItems,ArrayList<Integer> reminderMinuteValues,ArrayList<Integer> reminderMethodValues){
  int len=reminderItems.size();
  ArrayList<ReminderEntry> reminders=new ArrayList<ReminderEntry>(len);
  for (int index=0; index < len; index++) {
    LinearLayout layout=reminderItems.get(index);
    Spinner minuteSpinner=(Spinner)layout.findViewById(R.id.reminder_minutes_value);
    Spinner methodSpinner=(Spinner)layout.findViewById(R.id.reminder_method_value);
    int minutes=reminderMinuteValues.get(minuteSpinner.getSelectedItemPosition());
    int method=reminderMethodValues.get(methodSpinner.getSelectedItemPosition());
    reminders.add(ReminderEntry.valueOf(minutes,method));
  }
  return reminders;
}
 

Example 18

From project platform_packages_apps_calendar, under directory /src/com/android/calendar/event/.

Source file: EventViewUtils.java

  18 
vote

/** 
 * Extracts reminder minutes info from UI elements.
 * @param reminderItems UI elements (layouts with spinners) that hold array indices.
 * @param reminderMinuteValues Maps array index to time in minutes.
 * @param reminderMethodValues Maps array index to alert method constant.
 * @return Array with reminder data.
 */
public static ArrayList<ReminderEntry> reminderItemsToReminders(ArrayList<LinearLayout> reminderItems,ArrayList<Integer> reminderMinuteValues,ArrayList<Integer> reminderMethodValues){
  int len=reminderItems.size();
  ArrayList<ReminderEntry> reminders=new ArrayList<ReminderEntry>(len);
  for (int index=0; index < len; index++) {
    LinearLayout layout=reminderItems.get(index);
    Spinner minuteSpinner=(Spinner)layout.findViewById(R.id.reminder_minutes_value);
    Spinner methodSpinner=(Spinner)layout.findViewById(R.id.reminder_method_value);
    int minutes=reminderMinuteValues.get(minuteSpinner.getSelectedItemPosition());
    int method=reminderMethodValues.get(methodSpinner.getSelectedItemPosition());
    reminders.add(ReminderEntry.valueOf(minutes,method));
  }
  return reminders;
}
 

Example 19

From project platform_packages_apps_settings, under directory /src/com/android/settings/inputmethod/.

Source file: UserDictionaryAddWordFragment.java

  18 
vote

private void updateSpinner(){
  final ArrayList<LocaleRenderer> localesList=mContents.getLocalesList(getActivity());
  final Spinner localeSpinner=(Spinner)mRootView.findViewById(R.id.user_dictionary_add_locale);
  final ArrayAdapter<LocaleRenderer> adapter=new ArrayAdapter<LocaleRenderer>(getActivity(),android.R.layout.simple_spinner_item,localesList);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  localeSpinner.setAdapter(adapter);
  localeSpinner.setOnItemSelectedListener(this);
}
 

Example 20

From project android-client, under directory /xwiki-android-components/src/org/xwiki/android/components/search/.

Source file: SearchActivity.java

  17 
vote

private void loadWikiList(){
  Wikis ws=request.requestWikis();
  wikiList=new String[ws.getWikis().size()];
  for (int i=0; i < wikiList.length; i++) {
    wikiList[i]=ws.getWikis().get(i).getName();
  }
  Spinner spinner=(Spinner)findViewById(R.id.spinner_wikilist);
  ArrayAdapter adapter=new ArrayAdapter(this,android.R.layout.simple_spinner_item,wikiList);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(adapter);
  spinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> parent,    View view,    int pos,    long id){
      wikiName=parent.getItemAtPosition(pos).toString();
      loadSpaceList(wikiName);
    }
    public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
}
 

Example 21

From project Android-FFXIEQ, under directory /ffxieq/src/com/github/kanata3249/ffxieq/android/.

Source file: FFXIEQBaseActivity.java

  17 
vote

protected void updateValues(){
  for (int i=0; i < mControlAndValues.size(); i++) {
    ControlAndValue entry=mControlAndValues.get(i);
    View control;
    ControlBindableValue value;
    value=entry.getValue();
    control=findViewById(entry.getControlID());
    if (control != null) {
      if (control instanceof EditText) {
        EditText et=(EditText)control;
        et.setText(value.getValue());
      }
 else       if (control instanceof Spinner) {
        Spinner spin=(Spinner)control;
        spin.setSelection(Integer.valueOf(value.getValue()));
      }
    }
  }
}
 

Example 22

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/wifi/.

Source file: WifiApDialog.java

  17 
vote

protected void onCreate(Bundle savedInstanceState){
  mView=getLayoutInflater().inflate(R.layout.wifi_ap_dialog,null);
  Spinner mSecurity=((Spinner)mView.findViewById(R.id.security));
  setView(mView);
  setInverseBackgroundForced(true);
  Context context=getContext();
  setTitle(R.string.wifi_tether_configure_ap_text);
  mView.findViewById(R.id.type).setVisibility(View.VISIBLE);
  mSsid=(TextView)mView.findViewById(R.id.ssid);
  mPassword=(EditText)mView.findViewById(R.id.password);
  setButton(BUTTON_SUBMIT,context.getString(R.string.wifi_save),mListener);
  setButton(DialogInterface.BUTTON_NEGATIVE,context.getString(R.string.wifi_cancel),mListener);
  if (mWifiConfig != null) {
    mSsid.setText(mWifiConfig.SSID);
switch (mSecurityType) {
case AccessPoint.SECURITY_NONE:
      mSecurity.setSelection(OPEN_INDEX);
    break;
case AccessPoint.SECURITY_PSK:
  String str=mWifiConfig.preSharedKey;
mPassword.setText(str);
mSecurity.setSelection(WPA_INDEX);
break;
}
}
mSsid.addTextChangedListener(this);
mPassword.addTextChangedListener(this);
((CheckBox)mView.findViewById(R.id.show_password)).setOnClickListener(this);
mSecurity.setOnItemSelectedListener(this);
super.onCreate(savedInstanceState);
showSecurityFields();
validate();
}
 

Example 23

From project Backyard-Brains-Android-App, under directory /src/com/backyardbrains/.

Source file: BackyardBrainsConfigurationActivity.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.configuration_screen);
  final String prefsname=getResources().getString(R.string.global_prefs);
  speedPrefsKey=getResources().getString(R.string.microphone_read_speed);
  prefs=getSharedPreferences(prefsname,MODE_PRIVATE);
  CharSequence preferencesSpeed=prefs.getString(speedPrefsKey,"1");
  Log.d("Config Screen","read MicrophoneReadSpeed of " + preferencesSpeed);
  Spinner spinner=(Spinner)findViewById(R.id.read_speed_spinner);
  ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(this,R.array.speeds_array,android.R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(adapter);
  spinner.setSelection(adapter.getPosition(preferencesSpeed),true);
  spinner.setOnItemSelectedListener(new SpeedSelectedListener());
}
 

Example 24

From project Bitcoin-Wallet-for-Android, under directory /wallet/src/de/schildbach/wallet/ui/.

Source file: WalletActivity.java

  17 
vote

private Dialog createImportKeysDialog(){
  final View view=getLayoutInflater().inflate(R.layout.wallet_import_keys_dialog,null);
  final TextView messageView=(TextView)view.findViewById(R.id.wallet_import_keys_message);
  messageView.setText(getString(R.string.wallet_import_keys_dialog_message,Constants.EXTERNAL_WALLET_BACKUP_DIR));
  final Spinner fileView=(Spinner)view.findViewById(R.id.wallet_import_keys_file);
  final EditText passwordView=(EditText)view.findViewById(R.id.wallet_import_keys_password);
  final AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setInverseBackgroundForced(true);
  builder.setTitle(R.string.wallet_import_keys_dialog_title);
  builder.setView(view);
  builder.setPositiveButton(R.string.wallet_import_keys_dialog_button_import,new OnClickListener(){
    public void onClick(    final DialogInterface dialog,    final int which){
      final File file=(File)fileView.getSelectedItem();
      final String password=passwordView.getText().toString().trim();
      passwordView.setText(null);
      importPrivateKeys(file,password);
    }
  }
);
  builder.setNegativeButton(R.string.button_cancel,new OnClickListener(){
    public void onClick(    final DialogInterface dialog,    final int which){
      passwordView.setText(null);
    }
  }
);
  builder.setOnCancelListener(new OnCancelListener(){
    public void onCancel(    final DialogInterface dialog){
      passwordView.setText(null);
    }
  }
);
  return builder.create();
}
 

Example 25

From project callmeter, under directory /src/de/ub0r/android/callmeter/ui/prefs/.

Source file: HourGroupEdit.java

  17 
vote

/** 
 * Show an add/delete dialog.
 * @param nid id of entry
 */
private void showHourDialog(final long nid){
  final Builder builder=new Builder(this);
  final View v=View.inflate(this,R.layout.prefs_hourgroup_dialog,null);
  final Spinner spDays=(Spinner)v.findViewById(R.id.days);
  final Spinner spHours=(Spinner)v.findViewById(R.id.hours);
  if (nid >= 0) {
    final int[] h=this.getHour(nid);
    spDays.setSelection(h[0]);
    spHours.setSelection(h[1]);
  }
  builder.setView(v);
  builder.setTitle(R.string.add_hour);
  builder.setCancelable(true);
  builder.setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
    public void onClick(    final DialogInterface dialog,    final int id){
      HourGroupEdit.this.setHour(nid,spDays.getSelectedItemPosition(),spHours.getSelectedItemPosition());
    }
  }
);
  builder.setNegativeButton(android.R.string.cancel,null);
  builder.show();
}
 

Example 26

From project creamed_glacier_app_settings, under directory /src/com/android/settings/wifi/p2p/.

Source file: WifiP2pDialog.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  mView=getLayoutInflater().inflate(R.layout.wifi_p2p_dialog,null);
  Spinner mWpsSetup=((Spinner)mView.findViewById(R.id.wps_setup));
  setView(mView);
  setInverseBackgroundForced(true);
  Context context=getContext();
  setTitle(R.string.wifi_p2p_settings_title);
  mDeviceName=(TextView)mView.findViewById(R.id.device_name);
  mDeviceAddress=(TextView)mView.findViewById(R.id.device_address);
  setButton(BUTTON_SUBMIT,context.getString(R.string.wifi_connect),mListener);
  setButton(DialogInterface.BUTTON_NEGATIVE,context.getString(R.string.wifi_cancel),mListener);
  if (mDevice != null) {
    mDeviceName.setText(mDevice.deviceName);
    mDeviceAddress.setText(mDevice.deviceAddress);
    mWpsSetup.setSelection(mWpsSetupIndex);
  }
  mWpsSetup.setOnItemSelectedListener(this);
  super.onCreate(savedInstanceState);
}
 

Example 27

From project danbooru-gallery-android, under directory /src/tw/idv/palatis/danboorugallery/.

Source file: DanbooruGalleryPreferenceActivity.java

  17 
vote

@Override public void onClick(DialogInterface idialog,int which){
  final AlertDialog dialog=(AlertDialog)idialog;
  final EditText edit_name=(EditText)dialog.findViewById(R.id.preferences_hosts_dialog_hosts_name_input);
  final EditText edit_url=(EditText)dialog.findViewById(R.id.preferences_hosts_dialog_url_input);
  final Spinner api=(Spinner)dialog.findViewById(R.id.preferences_hosts_dialog_api);
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
    if (edit_name.getTag() == null)     newHost(edit_name.getText().toString(),edit_url.getText().toString(),api.getSelectedItem().toString());
 else     editHost((Integer)edit_name.getTag(),edit_name.getText().toString(),edit_url.getText().toString(),api.getSelectedItem().toString());
  break;
case DialogInterface.BUTTON_NEUTRAL:
Builder builder=new AlertDialog.Builder(dialog.getContext());
builder.setTitle(R.string.preferences_hosts_dialog_delete_confirm_title);
Host host=hosts.get((Integer)edit_name.getTag());
builder.setMessage(String.format(getString(R.string.preferences_hosts_dialog_delete_confirm_message),host.name,host.url));
builder.setPositiveButton(android.R.string.ok,new OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
deleteHost((Integer)edit_name.getTag());
}
}
);
builder.setNegativeButton(android.R.string.cancel,null);
builder.create().show();
break;
}
}
 

Example 28

From project eoit, under directory /EOIT/src/fr/eoit/activity/fragment/blueprint/.

Source file: RequiredDecryptorFragment.java

  17 
vote

@Override public void onLoadFinished(Cursor cursor){
  if (DbUtil.hasAtLeastOneRow(cursor)) {
    String[] from=new String[]{Item.COLUMN_NAME_NAME,"decryptorDesc"};
    int[] to=new int[]{android.R.id.text1,android.R.id.text2};
    MatrixCursor decryptorCursor=new MatrixCursor(new String[]{Item._ID,Item.COLUMN_NAME_NAME,"decryptorDesc"});
    DbUtil.addRowToMatrixCursor(decryptorCursor,0L,"None","");
    cursor.moveToFirst();
    int selectedItem=0;
    while (!cursor.isAfterLast()) {
      long itemId=cursor.getLong(cursor.getColumnIndexOrThrow(Item._ID));
      DbUtil.addRowToMatrixCursor(decryptorCursor,itemId,cursor.getString(cursor.getColumnIndexOrThrow(Item.COLUMN_NAME_NAME)),getDecryptorDescription(DecryptorUtil.getDecryptorBonuses(itemId),getActivity().getResources()));
      if (itemId == decryptorId) {
        selectedItem=cursor.getPosition() + 1;
      }
      cursor.moveToNext();
    }
    SimpleCursorAdapter adapter=new SimpleCursorAdapter(getActivity(),android.R.layout.simple_spinner_item,decryptorCursor,from,to,SimpleCursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
    Spinner spinner=(Spinner)getActivity().findViewById(R.id.DECRYPTOR_SPINNER);
    adapter.setDropDownViewResource(R.layout.decryptor_drop_down_item);
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(new SpinnerDecryptorOnItemSelectedListener());
    spinner.setSelection(selectedItem);
  }
}
 

Example 29

From project gh4a, under directory /src/com/gh4a/.

Source file: SearchActivity.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  setTheme(Gh4Application.THEME);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.search);
  ActionBar actionBar=getSupportActionBar();
  actionBar.setTitle(R.string.search);
  mListViewResults=(ListView)findViewById(R.id.list_search);
  registerForContextMenu(mListViewResults);
  final Spinner languageSpinner=(Spinner)findViewById(R.id.spinner_language);
  final EditText etSearchKey=(EditText)findViewById(R.id.et_search);
  ImageButton btnSearch=(ImageButton)findViewById(R.id.btn_search);
  if (Gh4Application.THEME == R.style.DefaultTheme) {
    btnSearch.setImageResource(R.drawable.action_search_dark);
  }
  etSearchKey.setOnEditorActionListener(new TextView.OnEditorActionListener(){
    @Override public boolean onEditorAction(    TextView v,    int actionId,    KeyEvent event){
      if (actionId == EditorInfo.IME_ACTION_SEARCH) {
        String searchKey=etSearchKey.getText().toString();
        String selectedLanguage=(String)languageSpinner.getSelectedItem();
        mProgressDialog=SearchActivity.this.showProgressDialog(SearchActivity.this.getResources().getString(R.string.loading_msg),true);
        searchRepository(searchKey,selectedLanguage);
        hideKeyboard(etSearchKey.getWindowToken());
        return true;
      }
      return false;
    }
  }
);
  btnSearch.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      String searchKey=etSearchKey.getText().toString();
      String selectedLanguage=(String)languageSpinner.getSelectedItem();
      mProgressDialog=SearchActivity.this.showProgressDialog(SearchActivity.this.getResources().getString(R.string.loading_msg),true);
      searchRepository(searchKey,selectedLanguage);
      hideKeyboard(etSearchKey.getWindowToken());
    }
  }
);
}
 

Example 30

From project liquidroid, under directory /src/liqui/droid/activity/.

Source file: Search.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.act_search);
  setUpActionBar();
  mListViewResults=(ListView)findViewById(R.id.list_search);
  registerForContextMenu(mListViewResults);
  final Spinner searchTypeSpinner=(Spinner)findViewById(R.id.spinner_search_type);
  final EditText etSearchKey=(EditText)findViewById(R.id.et_search);
  etSearchKey.setOnEditorActionListener(new TextView.OnEditorActionListener(){
    @Override public boolean onEditorAction(    TextView v,    int actionId,    KeyEvent event){
      if (actionId == EditorInfo.IME_ACTION_SEARCH) {
        mFirstTimeSearch=true;
        mPage=1;
        String searchKey=etSearchKey.getText().toString();
        if (searchTypeSpinner.getSelectedItemPosition() == 1) {
          mSearchByUser=true;
          searchUser(searchKey);
        }
 else {
          mSearchByUser=false;
        }
        hideKeyboard(etSearchKey.getWindowToken());
        return true;
      }
      return false;
    }
  }
);
}
 

Example 31

From project LoL-Chat, under directory /src/com/rei/lolchat/ui/wizard/.

Source file: AccountConfigure.java

  17 
vote

/** 
 * Store the account in the settings.
 */
private void configureAccount(){
  SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(this);
  SharedPreferences.Editor edit=settings.edit();
  edit.putString(BeemApplication.ACCOUNT_USERNAME_KEY,mAccountJID.getText().toString());
  edit.putString(BeemApplication.ACCOUNT_PASSWORD_KEY,mAccountPassword.getText().toString());
  Spinner server_spinner=(Spinner)findViewById(R.id.account_server);
  String server_long=server_spinner.getSelectedItem().toString();
  String server="chat.na.lol.riotgames.com";
  if (server_long.equals(getResources().getString(R.string.ServerEUW))) {
    server="chat.eu.lol.riotgames.com";
  }
 else   if (server_long.equals(getResources().getString(R.string.ServerEUNE))) {
    server="chat.eun1.lol.riotgames.com";
  }
  edit.putBoolean(BeemApplication.USE_AUTO_AWAY_KEY,false);
  edit.putBoolean("settings_key_xmpp_tls_use",true);
  edit.putBoolean("settings_key_specific_server",true);
  edit.putString("settings_key_xmpp_server",server);
  edit.putString("settings_key_xmpp_port","5223");
  edit.putString(BeemApplication.LEVEL_KEY,getResources().getString(R.string.StatusLevelDefault));
  edit.putString(BeemApplication.LEAVES_KEY,getResources().getString(R.string.StatusLeavesDefault));
  edit.putString(BeemApplication.WINS_KEY,getResources().getString(R.string.StatusWinsDefault));
  edit.putString(BeemApplication.MSG_KEY,getResources().getString(R.string.StatusMsgDefault));
  edit.putBoolean(BeemApplication.DEFAULT_STATUS_KEY,true);
  edit.commit();
}
 

Example 32

From project mixare, under directory /src/org/mixare/data/.

Source file: DataSource.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.datasourcedetails);
  final EditText nameField=(EditText)findViewById(R.id.name);
  final EditText urlField=(EditText)findViewById(R.id.url);
  final Spinner typeSpinner=(Spinner)findViewById(R.id.type);
  final Spinner displaySpinner=(Spinner)findViewById(R.id.displaytype);
  Bundle extras=getIntent().getExtras();
  if (extras != null) {
    if (extras.containsKey("DataSourceId")) {
      String fields[]=DataSourceStorage.getInstance().getFields(extras.getInt("DataSourceId"));
      nameField.setText(fields[0],TextView.BufferType.EDITABLE);
      urlField.setText(fields[1],TextView.BufferType.EDITABLE);
      typeSpinner.setSelection(Integer.parseInt(fields[2]) - 3);
      displaySpinner.setSelection(Integer.parseInt(fields[3]));
    }
  }
}
 

Example 33

From project MobiPerf, under directory /android/src/com/mobiperf/speedometer/.

Source file: MeasurementCreationActivity.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.setContentView(R.layout.measurement_creation_main);
  assert(this.getParent().getClass().getName().compareTo("SpeedometerApp") == 0);
  this.parent=(SpeedometerApp)this.getParent();
  Spinner spinner=(Spinner)findViewById(R.id.measurementTypeSpinner);
  spinnerValues=new ArrayAdapter<String>(this.getApplicationContext(),R.layout.spinner_layout);
  for (  String name : MeasurementTask.getMeasurementNames()) {
    spinnerValues.add(name);
  }
  spinnerValues.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(spinnerValues);
  spinner.setOnItemSelectedListener(new MeasurementTypeOnItemSelectedListener());
  spinner.requestFocus();
  Button runButton=(Button)this.findViewById(R.id.runTaskButton);
  runButton.setOnClickListener(new ButtonOnClickListener());
  this.measurementTypeUnderEdit=PingTask.TYPE;
  setupEditTextFocusChangeListener();
  this.udpDir="Up";
  final RadioButton radioUp=(RadioButton)findViewById(R.id.UDPBurstUpButton);
  final RadioButton radioDown=(RadioButton)findViewById(R.id.UDPBurstDownButton);
  radioUp.setChecked(true);
  radioUp.setOnClickListener(new RadioOnClickListener());
  radioDown.setOnClickListener(new RadioOnClickListener());
}
 

Example 34

From project mWater-Android-App, under directory /android/src/co/mwater/clientapp/ui/.

Source file: PreferenceWidget.java

  17 
vote

void onClick(){
  if (!editable)   return;
  EditText inputText=null;
  Spinner inputSpinner=null;
  if (listItems == null) {
    inputText=new EditText(getContext());
    inputText.setText(emptySummary ? "" : summary.getText());
  }
 else {
    inputSpinner=new Spinner(getContext());
    ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(getContext(),R.array.source_types,android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    inputSpinner.setAdapter(adapter);
    inputSpinner.setSelection(listValue);
  }
  final View input=inputText != null ? inputText : inputSpinner;
  new AlertDialog.Builder(getContext()).setTitle(title.getText()).setView(input).setPositiveButton("OK",new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
      Object value;
      if (input instanceof EditText)       value=((EditText)input).getText().toString();
 else {
        int pos=((Spinner)input).getSelectedItemPosition();
        if (pos == Spinner.INVALID_POSITION)         value=null;
 else         value=pos;
      }
      if (PreferenceWidget.this.onChangeListener != null)       PreferenceWidget.this.onChangeListener.onChange(value);
    }
  }
).setNegativeButton("Cancel",new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
    }
  }
).show();
}
 

Example 35

From project onebusaway-android, under directory /src/com/joulespersecond/seattlebusbot/.

Source file: TripInfoActivity.java

  17 
vote

private void initForm(){
  View view=getView();
  Spinner s=(Spinner)view.findViewById(R.id.trip_info_reminder_time);
  ArrayAdapter<?> adapter=ArrayAdapter.createFromResource(getActivity(),R.array.reminder_time,android.R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  s.setAdapter(adapter);
  final TextView stopName=(TextView)view.findViewById(R.id.stop_name);
  stopName.setText(MyTextUtils.toTitleCase(mStopName));
  final TextView routeName=(TextView)view.findViewById(R.id.route_name);
  routeName.setText(getString(R.string.trip_info_route,mRouteName));
  final TextView headsign=(TextView)view.findViewById(R.id.headsign);
  headsign.setText(MyTextUtils.toTitleCase(mHeadsign));
  final TextView departText=(TextView)view.findViewById(R.id.departure_time);
  departText.setText(getDepartureTime(getActivity(),mDepartTime));
  final TextView tripName=(TextView)view.findViewById(R.id.name);
  tripName.setText(mTripName);
  final Spinner reminder=(Spinner)view.findViewById(R.id.trip_info_reminder_time);
  reminder.setSelection(reminderToSelection(mReminderTime));
  final Button repeats=(Button)view.findViewById(R.id.trip_info_reminder_days);
  repeats.setText(getRepeatText(getActivity(),mReminderDays));
  repeats.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      showReminderDaysDialog();
    }
  }
);
}
 

Example 36

From project platform_packages_apps_VideoEditor, under directory /src/com/android/videoeditor/.

Source file: ExportOptionsDialog.java

  17 
vote

/** 
 * Create the export options dialog
 * @param context The context
 * @param positiveListener The positive listener
 * @param negativeListener The negative listener
 * @param cancelListener The cancel listener
 * @param aspectRatio The aspect ratio
 * @return The dialog
 */
public static Dialog create(Context context,final ExportOptionsListener positiveListener,DialogInterface.OnClickListener negativeListener,DialogInterface.OnCancelListener cancelListener,final int aspectRatio){
  AlertDialog.Builder builder=new AlertDialog.Builder(context);
  builder.setIcon(android.R.drawable.ic_dialog_info);
  builder.setTitle(context.getString(R.string.editor_export_movie));
  final LayoutInflater vi=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  final View myView=vi.inflate(R.layout.export_options_dialog_view,null);
  builder.setView(myView);
  prepareContent(myView,aspectRatio);
  builder.setPositiveButton(context.getString(R.string.export_dialog_export),new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      final Spinner sizeSpinner=(Spinner)myView.findViewById(R.id.export_option_size);
      final int movieHeight=indexToMovieHeight(sizeSpinner.getSelectedItemPosition(),aspectRatio);
      final Spinner qualitySpinner=(Spinner)myView.findViewById(R.id.export_option_quality);
      final int movieBitrate=indexToMovieBitrate(qualitySpinner.getSelectedItemPosition());
      positiveListener.onExportOptions(movieHeight,movieBitrate);
    }
  }
);
  builder.setNegativeButton(context.getString(android.R.string.cancel),negativeListener);
  builder.setCancelable(true);
  builder.setOnCancelListener(cancelListener);
  final AlertDialog dialog=builder.create();
  return dialog;
}
 

Example 37

From project nuxeo-android, under directory /nuxeo-android-connector/src/main/java/org/nuxeo/android/layout/widgets/.

Source file: SpinnerMultiWidgetWrapper.java

  16 
vote

@Override public View buildView(LayoutContext context,LayoutMode mode,Document doc,List<String> attributeNames,WidgetDefinition widgetDef){
  super.buildView(context,mode,doc,attributeNames,widgetDef);
  Context ctx=context.getActivity();
  LayoutParams paramsW=new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT,1f);
  if (mode == LayoutMode.VIEW) {
    textWidget=new TextView(ctx);
    textWidget.setSingleLine(false);
    textWidget.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);
    textWidget.setLines(3);
    textWidget.setMaxLines(3);
    applyBinding();
    return textWidget;
  }
 else {
    globalContainer=new LinearLayout(ctx);
    globalContainer.setOrientation(LinearLayout.VERTICAL);
    valueContainer=new LinearLayout(ctx);
    valueContainer.setOrientation(LinearLayout.VERTICAL);
    spinnerContainer=new LinearLayout(ctx);
    spinnerContainer.setOrientation(LinearLayout.HORIZONTAL);
    spinner=new Spinner(ctx);
    spinner.setAdapter(getAdapter(ctx,widgetDef.getSelectOptions().getItemLabels()));
    spinner.setLayoutParams(paramsW);
    spinnerButton=new Button(ctx);
    spinnerButton.setText("Add");
    spinnerButton.setOnClickListener(this);
    spinnerButton.setLayoutParams(paramsW);
    spinnerContainer.addView(spinner);
    spinnerContainer.addView(spinnerButton);
    globalContainer.addView(valueContainer);
    globalContainer.addView(spinnerContainer);
    applyBinding();
    return globalContainer;
  }
}
 

Example 38

From project AlarmApp-Android, under directory /src/org/alarmapp/activities/.

Source file: AlarmCreateActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.alarm_create);
  LogEx.verbose("AlarmCreateActivity");
  this.etAdress=(EditText)findViewById(R.id.etAdress);
  this.tvAdress=(TextView)findViewById(R.id.lAdresse);
  this.etAlarmText=(EditText)findViewById(R.id.etAlarmText);
  this.etAlarmTitle=(EditText)findViewById(R.id.etAlarmTitel);
  this.btCreateAlarm=(Button)findViewById(R.id.bAlarmCreate);
  this.spAlarmGroup=(Spinner)findViewById(R.id.sAlarmGroup);
  etAdress.setVisibility(etAdress.GONE);
  tvAdress.setVisibility(tvAdress.GONE);
  btCreateAlarm.setOnClickListener(alarmCreateListener);
  try {
    alarmGroups=AlarmApp.getAuthWebClient().getAlarmGroups();
    AlarmGroupsSpinnerAdapter adapter=new AlarmGroupsSpinnerAdapter(this,alarmGroups);
    spAlarmGroup.setAdapter(adapter);
    spAlarmGroup.setSelection(0);
  }
 catch (  WebException e) {
    LogEx.exception(e);
  }
}
 

Example 39

From project alljoyn_java, under directory /samples/android/properties/PropertiesClient/src/org/alljoyn/bus/samples/properties_client/.

Source file: PropertiesClient.java

  15 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  mColorSpinner=(Spinner)findViewById(R.id.color_spinner);
  ArrayAdapter<CharSequence> colorAdapter=ArrayAdapter.createFromResource(this,R.array.color_array,android.R.layout.simple_spinner_item);
  colorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mColorSpinner.setAdapter(colorAdapter);
  mColorSpinner.setOnItemSelectedListener(new ColorSelectedListener());
  mTextSizeSpinner=(Spinner)findViewById(R.id.text_size);
  ArrayAdapter<CharSequence> textSizeAdapter=ArrayAdapter.createFromResource(this,R.array.text_size_array,android.R.layout.simple_spinner_item);
  textSizeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mTextSizeSpinner.setAdapter(textSizeAdapter);
  mTextSizeSpinner.setSelection(3);
  mTextSizeSpinner.setOnItemSelectedListener(new TextSizeSelectedListener());
  mTextSizeLabel=(TextView)findViewById(R.id.text_size_label);
  mBackgroundColorLabel=(TextView)findViewById(R.id.background_color_label);
  mGetPropertiesButton=(Button)findViewById(R.id.get_properties);
  mGetPropertiesButton.setOnClickListener(new GetPropertiesListener());
  mSetPropertiesButton=(Button)findViewById(R.id.set_properties);
  mSetPropertiesButton.setOnClickListener(new SetPropertiesListener());
  mBackgroundColor="";
  mTextSize=-1;
  HandlerThread busThread=new HandlerThread("BusHandler");
  busThread.start();
  mBusHandler=new BusHandler(busThread.getLooper());
  mBusHandler.sendEmptyMessage(BusHandler.CONNECT);
  mHandler.sendEmptyMessage(MESSAGE_START_PROGRESS_DIALOG);
}
 

Example 40

From project and-bible, under directory /AndBible/src/net/bible/android/view/activity/base/.

Source file: DocumentSelectionBase.java

  15 
vote

private void initialiseView(){
  languageList=new ArrayList<Language>();
  displayedDocuments=new ArrayList<Book>();
  ArrayAdapter<Book> listArrayAdapter=new DocumentItemAdapter(this,LIST_ITEM_TYPE,displayedDocuments,isInstallStatusIconsShown);
  setListAdapter(listArrayAdapter);
  documentTypeSpinner=(Spinner)findViewById(R.id.documentTypeSpinner);
  setInitialDocumentType();
  documentTypeSpinner.setSelection(selectedDocumentFilterNo);
  documentTypeSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      selectedDocumentFilterNo=position;
      DocumentSelectionBase.this.filterDocuments();
    }
    @Override public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
{
    langSpinner=(Spinner)findViewById(R.id.languageSpinner);
    langSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
      @Override public void onItemSelected(      AdapterView<?> parent,      View view,      int position,      long id){
        selectedLanguageNo=position;
        lastSelectedLanguage=languageList.get(selectedLanguageNo);
        DocumentSelectionBase.this.filterDocuments();
      }
      @Override public void onNothingSelected(      AdapterView<?> arg0){
      }
    }
);
    langArrayAdapter=new ArrayAdapter<Language>(this,android.R.layout.simple_spinner_item,languageList);
    langArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    langSpinner.setAdapter(langArrayAdapter);
  }
}
 

Example 41

From project android-donations-lib, under directory /org_donations/src/org/donations/.

Source file: DonationsActivity.java

  15 
vote

/** 
 * Called when the activity is first created.
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.donations__activity);
  if (DonationsUtils.getResourceBoolean(this,"donations__flattr_enabled")) {
    ViewStub flattrViewStub=(ViewStub)findViewById(R.id.donations__flattr_stub);
    flattrViewStub.inflate();
    buildFlattrView();
  }
  mGoogleEnabled=DonationsUtils.getResourceBoolean(this,"donations__google_enabled");
  if (mGoogleEnabled) {
    ViewStub googleViewStub=(ViewStub)findViewById(R.id.donations__google_stub);
    googleViewStub.inflate();
    CATALOG=DonationsUtils.getResourceStringArray(this,"donations__google_catalog");
    mGoogleSpinner=(Spinner)findViewById(R.id.donations__google_android_market_spinner);
    ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(this,R.array.donations__google_android_market_promt_array,android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mGoogleSpinner.setAdapter(adapter);
    mHandler=new Handler();
    mDonatePurchaseObserver=new DonatePurchaseObserver(mHandler);
    mBillingService=new BillingService();
    mBillingService.setContext(this);
  }
  if (DonationsUtils.getResourceBoolean(this,"donations__paypal_enabled")) {
    ViewStub paypalViewStub=(ViewStub)findViewById(R.id.donations__paypal_stub);
    paypalViewStub.inflate();
  }
}
 

Example 42

From project android-joedayz, under directory /Proyectos/Socrates/src/org/upc/socrates/nota/.

Source file: BusqCursosActivity.java

  15 
vote

/** 
 * Called when the activity is first created. 
 */
@SuppressWarnings("rawtypes") @Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  theme.onActivityCreateSetTheme(this);
  setContentView(R.layout.busq_cursos);
  modalidadSpinner=(Spinner)findViewById(R.id.modalidadSpinner);
  ArrayAdapter adapter=ArrayAdapter.createFromResource(this,R.array.modalidades,android.R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  modalidadSpinner.setAdapter(adapter);
  cicloSpinner=(Spinner)findViewById(R.id.cicloSpinner);
  adapter=ArrayAdapter.createFromResource(this,R.array.ciclos,android.R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  cicloSpinner.setAdapter(adapter);
  siguienteButton=(Button)findViewById(R.id.siguienteButton);
  siguienteButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View view){
      Intent intent=new Intent(BusqCursosActivity.this,CursosListActivity.class);
      startActivity(intent);
    }
  }
);
}
 

Example 43

From project android-rackspacecloud, under directory /src/com/rackspacecloud/android/.

Source file: AddAccountActivity.java

  15 
vote

private void loadProviderSpinner(){
  authServer="https://auth.api.rackspacecloud.com/v2.0";
  providerSpinner=(Spinner)findViewById(R.id.provider_spinner);
  ArrayAdapter<String> imageAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,PROVIDERS);
  imageAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  providerSpinner.setAdapter(imageAdapter);
  providerSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> parent,    View view,    int pos,    long id){
      if (pos == 0) {
        authServer=Preferences.COUNTRY_US_AUTH_SERVER_V2;
        customServer.setEnabled(false);
      }
 else       if (pos == 1) {
        authServer=Preferences.COUNTRY_UK_AUTH_SERVER_V2;
        customServer.setEnabled(false);
      }
 else {
        customServer.setEnabled(true);
      }
    }
    public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
}
 

Example 44

From project android-xbmcremote-sandbox, under directory /src/org/xbmc/android/account/authenticator/.

Source file: AuthenticatorActivity.java

  15 
vote

/** 
 * {@inheritDoc}
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  requestWindowFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.activity_addaccount);
  getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,android.R.drawable.ic_dialog_info);
  mFlipper=(ViewFlipper)findViewById(R.id.addaccount_flipper);
  mButtonNext=(Button)findViewById(R.id.addaccount_next_button);
  mButtonPrev=(Button)findViewById(R.id.addaccount_prev_button);
  mZeroconfDiscoverButton=(ImageButton)findViewById(R.id.addaccount_zeroconf_scan_button);
  mZeroconfProgressBar=(ProgressBar)findViewById(R.id.addaccount_zeroconf_progressbar);
  mZeroconfSpinner=(Spinner)findViewById(R.id.addaccount_zeroconf_spinner);
  mZeroconfSpinnerText=(TextView)findViewById(R.id.addaccount_zeroconf_spinnertext);
  mMessage=(TextView)findViewById(R.id.addaccount_credentials_text);
  mUsernameEdit=(EditText)findViewById(R.id.username_edit);
  mPasswordEdit=(EditText)findViewById(R.id.password_edit);
  mUsernameEdit.setText(mUsername);
  mFinishedText=(TextView)findViewById(R.id.addaccount_finished_text);
  mAccountManager=AccountManager.get(this);
  mReceiver=new DetachableResultReceiver(new Handler());
  mReceiver.setReceiver(this);
  discoverHosts(null);
}
 

Example 45

From project AndroidBillingLibrary, under directory /DungeonsRedux/src/net/robotmedia/billing/example/.

Source file: Dungeons.java

  15 
vote

private void setupWidgets(){
  mBuyButton=(Button)findViewById(R.id.buy_button);
  mBuyButton.setEnabled(false);
  mBuyButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      if (mSelectedItem.managed != Managed.SUBSCRIPTION) {
        BillingController.requestPurchase(Dungeons.this,mSelectedItem.sku,true,null);
      }
 else {
        BillingController.requestSubscription(Dungeons.this,mSelectedItem.sku,true,null);
      }
    }
  }
);
  mSelectItemSpinner=(Spinner)findViewById(R.id.item_choices);
  mCatalogAdapter=new CatalogAdapter(this,CatalogEntry.CATALOG);
  mSelectItemSpinner.setAdapter(mCatalogAdapter);
  mSelectItemSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      mSelectedItem=CatalogEntry.CATALOG[position];
    }
    public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
  mOwnedItemsTable=(ListView)findViewById(R.id.owned_items);
}
 

Example 46

From project Android_1, under directory /LeftNavBarExample/LeftNavBarLibrary/src/com/example/google/tv/leftnavbar/.

Source file: SpinnerDisplay.java

  15 
vote

private void createView(ViewGroup parent,TypedArray attributes){
  mView=(Spinner)LayoutInflater.from(mContext).inflate(R.layout.leftnav_bar_spinner,parent,false);
  mView.setOnItemSelectedListener(new Spinner.OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      if (mListener != null) {
        mListener.onNavigationItemSelected(position,id);
      }
      refreshSelectedItem();
    }
    public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
}
 

Example 47

From project Android_NFC_FelicaEdit, under directory /src/jp/co/yumemi/rd/felicaedit/.

Source file: EditBlock.java

  15 
vote

/** 
 * ???????????????????????????????????
 */
@Override protected void onPrepareDialog(int id,Dialog dialog,Bundle args){
  super.onPrepareDialog(id,dialog,args);
  sp1=(Spinner)dialog.findViewById(R.id.sp1);
  sp2=(Spinner)dialog.findViewById(R.id.sp2);
  byte data=args.getByte(BYTE_DATA);
  sp1.setSelection((int)((data >>> 4) & 0x0F));
  sp2.setSelection((int)(data & 0x0F));
}
 

Example 48

From project androvoip, under directory /src/org/androvoip/ui/.

Source file: Settings.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.settings);
  Intent intent=getIntent();
  mAccount=(Account)intent.getSerializableExtra("account");
  if (mAccount == null) {
    finish();
  }
  ((Button)findViewById(R.id.save)).setOnClickListener(this);
  ((Button)findViewById(R.id.cancel)).setOnClickListener(this);
  ArrayAdapter<String> spinnerArrayAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,mProtocols);
  spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  ((Spinner)findViewById(R.id.protocol_spinner)).setAdapter(spinnerArrayAdapter);
  for (int i=0; i < mProtocols.length; i++) {
    if (mProtocols[i].equals(mAccount.getProtocol().toString())) {
      ((Spinner)findViewById(R.id.protocol_spinner)).setSelection(i);
      break;
    }
  }
  setField(R.id.host_text,mAccount.getHost());
  setField(R.id.username_text,mAccount.getUserName());
  setField(R.id.password_text,mAccount.getPassword());
  bindService(new Intent().setClassName("org.androvoip","org.androvoip.iax2.IAX2Service"),this,BIND_AUTO_CREATE);
}
 

Example 49

From project Anki-Android, under directory /src/com/ichi2/anki/.

Source file: StudyOptions.java

  15 
vote

private AlertDialog createDialog(){
  View contentView=getLayoutInflater().inflate(R.layout.studyoptions_more_dialog_contents,null);
  mSpinnerNewCardOrder=(Spinner)contentView.findViewById(R.id.studyoptions_new_card_order);
  mSpinnerNewCardSchedule=(Spinner)contentView.findViewById(R.id.studyoptions_new_card_schedule);
  mSpinnerRevCardOrder=(Spinner)contentView.findViewById(R.id.studyoptions_rev_card_order);
  mSpinnerFailCardOption=(Spinner)contentView.findViewById(R.id.studyoptions_fail_card_option);
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setTitle(R.string.studyoptions_more_dialog_title);
  builder.setPositiveButton(R.string.studyoptions_more_save,mDialogSaveListener);
  builder.setView(contentView);
  return builder.create();
}
 

Example 50

From project AnySoftKeyboard, under directory /src/com/anysoftkeyboard/ui/settings/.

Source file: UserDictionaryEditorActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.user_dictionary_editor);
  mLangs=(Spinner)findViewById(R.id.user_dictionay_langs);
  mLangs.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> arg0,    View arg1,    int arg2,    long arg3){
      mSelectedLocale=arg0.getItemAtPosition(arg2).toString();
      fillWordsList();
    }
    public void onNothingSelected(    AdapterView<?> arg0){
      Log.d(TAG,"No locale selected");
      mSelectedLocale=null;
    }
  }
);
  findViewById(R.id.add_user_word).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      showAddOrEditDialog(null);
    }
  }
);
  findViewById(R.id.backup_words).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      new BackupUserWordsAsyncTask(UserDictionaryEditorActivity.this).execute();
    }
  }
);
  findViewById(R.id.restore_words).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      new RestoreUserWordsAsyncTask(UserDictionaryEditorActivity.this).execute();
    }
  }
);
  TextView emptyView=(TextView)findViewById(R.id.empty_user_dictionary);
  ListView listView=getListView();
  listView.setFastScrollEnabled(true);
  listView.setEmptyView(emptyView);
}
 

Example 51

From project apg, under directory /src/org/thialfihar/android/apg/ui/widget/.

Source file: KeyEditor.java

  15 
vote

@Override protected void onFinishInflate(){
  setDrawingCacheEnabled(true);
  setAlwaysDrawnWithCacheEnabled(true);
  mAlgorithm=(TextView)findViewById(R.id.algorithm);
  mKeyId=(TextView)findViewById(R.id.keyId);
  mCreationDate=(TextView)findViewById(R.id.creation);
  mExpiryDateButton=(Button)findViewById(R.id.expiry);
  mUsage=(Spinner)findViewById(R.id.usage);
  Choice choices[]={new Choice(Id.choice.usage.sign_only,getResources().getString(R.string.choice_signOnly)),new Choice(Id.choice.usage.encrypt_only,getResources().getString(R.string.choice_encryptOnly)),new Choice(Id.choice.usage.sign_and_encrypt,getResources().getString(R.string.choice_signAndEncrypt))};
  ArrayAdapter<Choice> adapter=new ArrayAdapter<Choice>(getContext(),android.R.layout.simple_spinner_item,choices);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mUsage.setAdapter(adapter);
  mDeleteButton=(ImageButton)findViewById(R.id.delete);
  mDeleteButton.setOnClickListener(this);
  setExpiryDate(null);
  mExpiryDateButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      GregorianCalendar date=mExpiryDate;
      if (date == null) {
        date=new GregorianCalendar();
      }
      DatePickerDialog dialog=new DatePickerDialog(getContext(),mExpiryDateSetListener,date.get(Calendar.YEAR),date.get(Calendar.MONTH),date.get(Calendar.DAY_OF_MONTH));
      dialog.setCancelable(true);
      dialog.setButton(Dialog.BUTTON_NEGATIVE,getContext().getString(R.string.btn_noDate),new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int which){
          setExpiryDate(null);
        }
      }
);
      dialog.show();
    }
  }
);
  super.onFinishInflate();
}
 

Example 52

From project BibleQuote-for-Android, under directory /src/com/BibleQuote/activity/.

Source file: SearchActivity.java

  15 
vote

private void SpinnerInit(){
  books=new ArrayList<ItemList>();
  try {
    books=myLibararian.getCurrentModuleBooksList();
  }
 catch (  OpenModuleException e) {
    ExceptionHelper.onOpenModuleException(e,this,TAG);
  }
catch (  BooksDefinitionException e) {
    ExceptionHelper.onBooksDefinitionException(e,this,TAG);
  }
catch (  BookDefinitionException e) {
    ExceptionHelper.onBookDefinitionException(e,this,TAG);
  }
  SimpleAdapter AA=new SimpleAdapter(this,books,android.R.layout.simple_spinner_item,new String[]{ItemList.Name},new int[]{android.R.id.text1});
  AA.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  SimpleAdapter.ViewBinder viewBinder=new SimpleAdapter.ViewBinder(){
    public boolean setViewValue(    View view,    Object data,    String textRepresentation){
      TextView textView=(TextView)view;
      textView.setText(textRepresentation);
      return true;
    }
  }
;
  AA.setViewBinder(viewBinder);
  s1=(Spinner)findViewById(R.id.FromBookCB);
  s1.setAdapter(AA);
  s1.setOnItemSelectedListener(onClick_FromBook);
  s2=(Spinner)findViewById(R.id.ToBookCB);
  s2.setAdapter(AA);
  s2.setOnItemSelectedListener(onClick_ToBook);
  restoreSelectedPosition();
}
 

Example 53

From project BombusLime, under directory /src/org/bombusim/lime/activity/.

Source file: PresenceActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  rJid=getIntent().getStringExtra("RJID");
  to=getIntent().getStringExtra("JID");
  setContentView(R.layout.presence);
  presenceDirect=(View)findViewById(R.id.presenceDirect);
  editPresenceTo=(EditText)findViewById(R.id.presenceToJid);
  editPriority=(EditText)findViewById(R.id.priority);
  editMessage=(EditText)findViewById(R.id.presenceMessage);
  spStatus=(Spinner)findViewById(R.id.presenceStatus);
  buttonRecent=(Button)findViewById(R.id.recentPresences);
  mOkCancel=(OkCancelBar)findViewById(R.id.okCancel);
  if (to != null) {
    presenceDirect.setVisibility(View.VISIBLE);
    editPresenceTo.setText(to);
  }
  mOkCancel.setOnButtonActionListener(new OkCancelBar.OnButtonActionListener(){
    @Override public void onPositive(){
      doSetStatus();
      finish();
    }
    @Override public void onNegative(){
      finish();
    }
  }
);
  spStatus.setAdapter(new StatusSpinnerAdapter(this));
  sb=new XmppServiceBinding(this);
  if (savedInstanceState != null) {
    setStatus(savedInstanceState.getInt("status"));
    setMessage(savedInstanceState.getString("message"));
    setPriority(savedInstanceState.getInt("priority"));
  }
 else {
    PresenceStorage ps=new PresenceStorage(this);
    setMessage(ps.getMessage());
    setPriority(ps.getPriority());
    setStatus(ps.getStatus());
  }
}
 

Example 54

From project CineShowTime-Android, under directory /Libraries/CineShowTime/src/com/binomed/showtime/android/screen/search/.

Source file: CineShowTimeSearchFragment.java

  15 
vote

/** 
 * init the view of activity
 * @param mainView
 */
private void initViews(View mainView){
  gpsImgView=(ImageView)mainView.findViewById(R.id.searchImgGps);
  searchButton=(Button)mainView.findViewById(R.id.searchBtnSearch);
  fieldCityName=(AutoCompleteTextWithSpeech)mainView.findViewById(R.id.searchCityName);
  lblMovieName=(TextView)mainView.findViewById(R.id.searchTxtMovieName);
  fieldMovieName=(AutoCompleteTextWithSpeech)mainView.findViewById(R.id.searchMovieName);
  lblDay=(TextView)mainView.findViewById(R.id.searchTxtSpinner);
  spinnerChooseDay=(Spinner)mainView.findViewById(R.id.searchSpinner);
  localisationCallBack=CineShowTimeLayoutUtils.manageLocationManagement(fragmentInteraction.getMainContext(),tracker,gpsImgView,fieldCityName,model);
}
 

Example 55

From project connectbot, under directory /src/sk/vx/connectbot/.

Source file: ColorsActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.act_colors);
  this.setTitle(String.format("%s: %s",getResources().getText(R.string.app_name),getResources().getText(R.string.title_colors)));
  mColorScheme=HostDatabase.DEFAULT_COLOR_SCHEME;
  hostdb=new HostDatabase(this);
  mColorList=Arrays.asList(hostdb.getColorsForScheme(mColorScheme));
  mDefaultColors=hostdb.getDefaultColorsForScheme(mColorScheme);
  mColorGrid=(GridView)findViewById(R.id.color_grid);
  mColorGrid.setAdapter(new ColorsAdapter(true));
  mColorGrid.setOnItemClickListener(this);
  mColorGrid.setSelection(0);
  mFgSpinner=(Spinner)findViewById(R.id.fg);
  mFgSpinner.setAdapter(new ColorsAdapter(false));
  mFgSpinner.setSelection(mDefaultColors[0]);
  mFgSpinner.setOnItemSelectedListener(this);
  mBgSpinner=(Spinner)findViewById(R.id.bg);
  mBgSpinner.setAdapter(new ColorsAdapter(false));
  mBgSpinner.setSelection(mDefaultColors[1]);
  mBgSpinner.setOnItemSelectedListener(this);
}
 

Example 56

From project convertcsv, under directory /ConvertCSV/src/org/openintents/convertcsv/common/.

Source file: ConvertCsvBaseActivity.java

  15 
vote

public String getFormat(){
  int id=mSpinner.getSelectedItemPosition();
  if (id != Spinner.INVALID_POSITION) {
    return mFormatValues[id];
  }
  return DEFAULT_FORMAT;
}
 

Example 57

From project Cura, under directory /src/com/cura/syslog/.

Source file: SysLogActivity.java

  15 
vote

public void initSpinners(){
  position=(Spinner)findViewById(R.id.HeadTailSpinner);
  ArrayAdapter<String> adapter1=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,menu1);
  adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  position.setAdapter(adapter1);
  logFile=(Spinner)findViewById(R.id.LogFileSpinner);
  ArrayAdapter<String> adapter2=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,menu2);
  adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  logFile.setAdapter(adapter2);
}
 

Example 58

From project daily-money, under directory /dailymoney/src/com/bottleworks/dailymoney/ui/.

Source file: BookEditorActivity.java

  15 
vote

private void doOk(){
  if (Spinner.INVALID_POSITION == positionEditor.getSelectedItemPosition()) {
    GUIs.shortToast(this,i18n.string(R.string.cmsg_field_empty,i18n.string(R.string.label_symbol_position)));
    return;
  }
  String name=nameEditor.getText().toString().trim();
  if ("".equals(name)) {
    nameEditor.requestFocus();
    GUIs.alert(this,i18n.string(R.string.cmsg_field_empty,i18n.string(R.string.clabel_name)));
    return;
  }
  SymbolPosition pos=SymbolPosition.getAvailable()[positionEditor.getSelectedItemPosition()];
  workingBook.setName(name);
  workingBook.setSymbol(symbolEditor.getText().toString().trim());
  workingBook.setNote(noteEditor.getText().toString().trim());
  workingBook.setSymbolPosition(pos);
  IMasterDataProvider idp=getContexts().getMasterDataProvider();
  if (modeCreate) {
    idp.newBook(workingBook);
    GUIs.shortToast(this,i18n.string(R.string.msg_book_created,name));
  }
 else {
    idp.updateBook(book.getId(),workingBook);
    GUIs.shortToast(this,i18n.string(R.string.msg_book_updated,name));
    setResult(RESULT_OK);
    finish();
  }
  setResult(RESULT_OK);
  finish();
}
 

Example 59

From project droidtv, under directory /src/com/chrulri/droidtv/.

Source file: ChannelsActivity.java

  15 
vote

private void onCreateImpl(){
  setContentView(R.layout.channels);
  mSpinner=(Spinner)findViewById(R.id.spinner);
  mSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      loadChannels((String)parent.getSelectedItem());
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
      loadChannels(null);
    }
  }
);
  mListView=(ListView)findViewById(R.id.listView);
  mListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      watchChannel((int)id);
    }
  }
);
  loadChannelLists();
  setChannelList(null);
  if (mSpinner.getAdapter().getCount() == 0) {
    PreferenceUtils.openSettings(this);
  }
}
 

Example 60

From project fauxclock, under directory /src/com/teamkang/fauxclock/factories/.

Source file: GpuFactory.java

  15 
vote

public void createGpuView(){
  LayoutInflater inf=LayoutInflater.from(mContext);
  me=inf.inflate(R.layout.gpu_control,null);
  gpuLayout=(RelativeLayout)me.findViewById(R.id.gpuControl);
  gpuGovSpinner=(Spinner)me.findViewById(R.id.gpu_gov_spinner);
  gpuIOFracSeek=(SeekBar)me.findViewById(R.id.seekbar_gpu_io_frac);
  gpuIOFracValue=(TextView)me.findViewById(R.id.gpu_io_frac_value);
  if (PhoneManager.supportsGpu()) {
    gpu=new GpuController(mContext);
    ArrayAdapter<String> gpuGovSpinnerAdapter=new ArrayAdapter<String>(mContext,android.R.layout.simple_spinner_item,gpu.govs);
    gpuGovSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    gpuGovSpinner.setAdapter(gpuGovSpinnerAdapter);
    gpuGovSpinner.setSelection(gpuGovSpinnerAdapter.getPosition(gpu.getCurrentActiveGov()));
    gpuGovSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
      public void onItemSelected(      AdapterView<?> parent,      View view,      int position,      long id){
        String selectedGov=(String)parent.getSelectedItem();
        gpu.setGpuGoverner(selectedGov);
      }
      public void onNothingSelected(      AdapterView<?> parent){
      }
    }
);
    gpuIOFracSeek.setMax(100);
    gpuIOFracSeek.setProgress(gpu.getGpuIOFraction());
    gpuIOFracSeek.setOnSeekBarChangeListener(this);
    gpuIOFracValue.setText(gpu.getGpuIOFraction() + "");
  }
 else {
    gpuLayout.setVisibility(View.GONE);
    gpuGovSpinner.setVisibility(View.GONE);
    gpuIOFracSeek.setVisibility(View.GONE);
    gpuIOFracValue.setVisibility(View.GONE);
  }
  tabTitle=(TextView)me.findViewById(R.id.tab_title);
  tabTitle.setText("GPU Control");
}
 

Example 61

From project Gaggle, under directory /src/com/geeksville/gaggle/.

Source file: WaypointDialog.java

  15 
vote

/** 
 * Read text fields to generate a latitude
 * @param groupId
 * @param isLatitude
 * @return
 */
private double readPosition(int groupId,boolean isLatitude) throws NumberFormatException {
  ViewGroup group=(ViewGroup)layout.findViewById(groupId);
  double degs=((NumberEdit)group.findViewById(R.id.degree)).getDouble();
  double mins=((NumberEdit)group.findViewById(R.id.minute)).getDouble();
  double secs=((NumberEdit)group.findViewById(R.id.second)).getDouble();
  boolean isPositive="NE".contains(((Spinner)group.findViewById(R.id.hemisphere)).getSelectedItem().toString());
  return LocationUtils.DMSToDegrees(degs,mins,secs,isPositive);
}
 

Example 62

From project Gibberbot, under directory /src/info/guardianproject/otr/app/im/app/.

Source file: AddContactActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mApp=ImApp.getApplication(this);
  mHandler=new SimpleAlertHandler(this);
  resolveIntent(getIntent());
  setContentView(R.layout.add_contact_activity);
  BrandingResources brandingRes=mApp.getBrandingResource(mProviderId);
  setTitle(brandingRes.getString(BrandingResourceIDs.STRING_ADD_CONTACT_TITLE));
  TextView label=(TextView)findViewById(R.id.input_contact_label);
  label.setText(brandingRes.getString(BrandingResourceIDs.STRING_LABEL_INPUT_CONTACT));
  mAddressList=(MultiAutoCompleteTextView)findViewById(R.id.email);
  mAddressList.setAdapter(new EmailAddressAdapter(this));
  mAddressList.setTokenizer(new Rfc822Tokenizer());
  mAddressList.addTextChangedListener(mTextWatcher);
  mListSpinner=(Spinner)findViewById(R.id.choose_list);
  Cursor c=queryContactLists();
  int initSelection=searchInitListPos(c,getIntent().getStringExtra(ImServiceConstants.EXTRA_INTENT_LIST_NAME));
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,android.R.layout.simple_spinner_item,c,new String[]{Imps.ContactList.NAME},new int[]{android.R.id.text1});
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mListSpinner.setAdapter(adapter);
  mListSpinner.setSelection(initSelection);
  mInviteButton=(Button)findViewById(R.id.invite);
  mInviteButton.setText(brandingRes.getString(BrandingResourceIDs.STRING_BUTTON_ADD_CONTACT));
  mInviteButton.setOnClickListener(mButtonHandler);
  mInviteButton.setEnabled(false);
}
 

Example 63

From project GSM-Signal-Tracking-, under directory /gpstracker/src/nl/sogeti/android/gpstracker/actions/.

Source file: ShareTrack.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.sharedialog);
  mTrackUri=getIntent().getData();
  calculator=new StatisticsCalulator(this,new UnitsI18n(this,null));
  mFileNameView=(EditText)findViewById(R.id.fileNameField);
  mTweetView=(EditText)findViewById(R.id.tweetField);
  mShareTypeSpinner=(Spinner)findViewById(R.id.shareTypeSpinner);
  ArrayAdapter<CharSequence> shareTypeAdapter=ArrayAdapter.createFromResource(this,R.array.sharetype_choices,android.R.layout.simple_spinner_item);
  shareTypeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mShareTypeSpinner.setAdapter(shareTypeAdapter);
  mShareTargetSpinner=(Spinner)findViewById(R.id.shareTargetSpinner);
  mShareTypeSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> arg0,    View arg1,    int position,    long arg3){
      adjustTargetToType(position);
    }
    public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
  int lastType=PreferenceManager.getDefaultSharedPreferences(this).getInt(Constants.EXPORT_TYPE,EXPORT_TYPE_KMZ);
  mShareTypeSpinner.setSelection(lastType);
  adjustTargetToType(lastType);
  mFileNameView.setText(queryForTrackName());
  Button okay=(Button)findViewById(R.id.okayshare_button);
  okay.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      share();
    }
  }
);
  Button cancel=(Button)findViewById(R.id.cancelshare_button);
  cancel.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      ShareTrack.this.finish();
    }
  }
);
}
 

Example 64

From project jamendo-android, under directory /src/com/teleca/jamendo/activity/.

Source file: AlbumActivity.java

  15 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.album);
  mBetterRes=getResources().getString(R.string.better_res);
  mAlbum=(Album)getIntent().getSerializableExtra("album");
  mReviewAlbumListView=(ListView)findViewById(R.id.AlbumListView);
  mAlbumTrackListView=(ListView)findViewById(R.id.AlbumTrackListView);
  mLanguageSpinner=(Spinner)findViewById(R.id.LanguageSpinner);
  mReviewAdapter=new ReviewAdapter(this);
  mReviewAdapter.setListView(mReviewAlbumListView);
  mReviewAlbumListView.setAdapter(mReviewAdapter);
  loadReviews();
  loadTracks();
  setupTabs();
  int selectedReviewId=getIntent().getIntExtra("selectedReviewId",-1);
  if (selectedReviewId != -1) {
    selectReview(selectedReviewId);
  }
  mGestureOverlayView=(GestureOverlayView)findViewById(R.id.gestures);
  mGestureOverlayView.addOnGesturePerformedListener(JamendoApplication.getInstance().getPlayerGestureHandler());
}
 

Example 65

From project Jota-Text-Editor, under directory /src/jp/sblo/pandora/jota/.

Source file: FileSelectorActivity.java

  15 
vote

private void selectItemOfSpinner(Spinner spinner,String s){
  SpinnerAdapter adapter=spinner.getAdapter();
  int max=adapter.getCount();
  for (int i=0; i < max; i++) {
    String item=(String)adapter.getItem(i);
    if (s.equals(item)) {
      spinner.setSelection(i);
      break;
    }
  }
  return;
}
 

Example 66

From project k-9, under directory /src/com/fsck/k9/activity/setup/.

Source file: AccountSetupOptions.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.account_setup_options);
  mCheckFrequencyView=(Spinner)findViewById(R.id.account_check_frequency);
  mDisplayCountView=(Spinner)findViewById(R.id.account_display_count);
  mNotifyView=(CheckBox)findViewById(R.id.account_notify);
  mNotifySyncView=(CheckBox)findViewById(R.id.account_notify_sync);
  mPushEnable=(CheckBox)findViewById(R.id.account_enable_push);
  findViewById(R.id.next).setOnClickListener(this);
  SpinnerOption checkFrequencies[]={new SpinnerOption(-1,getString(R.string.account_setup_options_mail_check_frequency_never)),new SpinnerOption(1,getString(R.string.account_setup_options_mail_check_frequency_1min)),new SpinnerOption(5,getString(R.string.account_setup_options_mail_check_frequency_5min)),new SpinnerOption(10,getString(R.string.account_setup_options_mail_check_frequency_10min)),new SpinnerOption(15,getString(R.string.account_setup_options_mail_check_frequency_15min)),new SpinnerOption(30,getString(R.string.account_setup_options_mail_check_frequency_30min)),new SpinnerOption(60,getString(R.string.account_setup_options_mail_check_frequency_1hour)),new SpinnerOption(120,getString(R.string.account_setup_options_mail_check_frequency_2hour)),new SpinnerOption(180,getString(R.string.account_setup_options_mail_check_frequency_3hour)),new SpinnerOption(360,getString(R.string.account_setup_options_mail_check_frequency_6hour)),new SpinnerOption(720,getString(R.string.account_setup_options_mail_check_frequency_12hour)),new SpinnerOption(1440,getString(R.string.account_setup_options_mail_check_frequency_24hour))};
  ArrayAdapter<SpinnerOption> checkFrequenciesAdapter=new ArrayAdapter<SpinnerOption>(this,android.R.layout.simple_spinner_item,checkFrequencies);
  checkFrequenciesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mCheckFrequencyView.setAdapter(checkFrequenciesAdapter);
  SpinnerOption displayCounts[]={new SpinnerOption(10,getString(R.string.account_setup_options_mail_display_count_10)),new SpinnerOption(25,getString(R.string.account_setup_options_mail_display_count_25)),new SpinnerOption(50,getString(R.string.account_setup_options_mail_display_count_50)),new SpinnerOption(100,getString(R.string.account_setup_options_mail_display_count_100)),new SpinnerOption(250,getString(R.string.account_setup_options_mail_display_count_250)),new SpinnerOption(500,getString(R.string.account_setup_options_mail_display_count_500)),new SpinnerOption(1000,getString(R.string.account_setup_options_mail_display_count_1000))};
  ArrayAdapter<SpinnerOption> displayCountsAdapter=new ArrayAdapter<SpinnerOption>(this,android.R.layout.simple_spinner_item,displayCounts);
  displayCountsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mDisplayCountView.setAdapter(displayCountsAdapter);
  String accountUuid=getIntent().getStringExtra(EXTRA_ACCOUNT);
  mAccount=Preferences.getPreferences(this).getAccount(accountUuid);
  mNotifyView.setChecked(mAccount.isNotifyNewMail());
  mNotifySyncView.setChecked(mAccount.isShowOngoing());
  SpinnerOption.setSpinnerOptionValue(mCheckFrequencyView,mAccount.getAutomaticCheckIntervalMinutes());
  SpinnerOption.setSpinnerOptionValue(mDisplayCountView,mAccount.getDisplayCount());
  boolean isPushCapable=false;
  try {
    Store store=mAccount.getRemoteStore();
    isPushCapable=store.isPushCapable();
  }
 catch (  Exception e) {
    Log.e(K9.LOG_TAG,"Could not get remote store",e);
  }
  if (!isPushCapable) {
    mPushEnable.setVisibility(View.GONE);
  }
 else {
    mPushEnable.setChecked(true);
  }
}
 

Example 67

From project MIT-Mobile-for-Android, under directory /src/edu/mit/mitmobile2/libraries/.

Source file: AppointmentActivity.java

  15 
vote

private boolean formValidates(){
  Spinner[] spinners=new Spinner[]{mTopicSpinner,mStatusSpinner};
  for (int i=0; i < spinners.length; i++) {
    if (spinners[i].getSelectedItemPosition() < 1) {
      return false;
    }
  }
  EditText[] editTexts=new EditText[]{mResearchTopic,mResearchInfo,mDepartment};
  for (int i=0; i < editTexts.length; i++) {
    if (editTexts[i].getText().toString().trim().length() == 0) {
      return false;
    }
  }
  return true;
}
 

Example 68

From project multi-translator, under directory /src/com/robtheis/translator/.

Source file: MultiTranslatorActivity.java

  15 
vote

/** 
 * Set up the Spinners for selecting source/target languages from drop-down lists 
 */
public void initSpinners(){
  sourceSpinner=(Spinner)findViewById(R.id.spinner1);
  ArrayAdapter<String> sourceAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,languages);
  sourceAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  sourceSpinner.setAdapter(sourceAdapter);
  sourceSpinner.setOnItemSelectedListener(new SourceLanguageOnItemSelectedListener());
  targetSpinner=(Spinner)findViewById(R.id.spinner2);
  ArrayAdapter<String> targetAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,languages);
  targetAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  targetSpinner.setAdapter(targetAdapter);
  targetSpinner.setOnItemSelectedListener(new TargetLanguageOnItemSelectedListener());
  String sourceLanguage=sharedPreferences.getString(PreferencesActivity.KEY_SOURCE_LANGUAGE_PREFERENCE,PreferencesActivity.DEFAULT_SOURCE_LANGUAGE);
  String targetLanguage=sharedPreferences.getString(PreferencesActivity.KEY_TARGET_LANGUAGE_PREFERENCE,PreferencesActivity.DEFAULT_TARGET_LANGUAGE);
  sourceSpinner.setSelection(sourceAdapter.getPosition(sourceLanguage));
  targetSpinner.setSelection(targetAdapter.getPosition(targetLanguage));
}
 

Example 69

From project OpenComm, under directory /sipvoip/src/org/hsc/sip/ua/config/ui/.

Source file: UserProfile.java

  15 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  this.setContentView(R.layout.user_profile);
  background_image_view=(ImageView)findViewById(R.id.background_image);
  if (background_image_view != null) {
    background_image_view.setImageResource(R.drawable.options_backend);
  }
  m_UserName=(EditText)findViewById(R.id.txt_user_name);
  m_Password=(EditText)findViewById(R.id.txt_usr_password);
  m_LocalPort=(EditText)findViewById(R.id.txt_local_port);
  m_LocalIP=(EditText)findViewById(R.id.txt_user_profile_local_ip);
  Intent intent=this.getIntent();
  m_UserName.setText(intent.getStringExtra("UserName"));
  m_Password.setText(intent.getStringExtra("Password"));
  m_LocalPort.setText(Short.toString(intent.getShortExtra("LocalPort",(short)5060)));
  m_LocalIP.setText(intent.getStringExtra("LocalIP"));
  m_Transport=(Spinner)findViewById(R.id.txt_transport);
  String data[]=new String[]{"UDP","TCP","Both"};
  ArrayAdapter<String> TransportAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,data);
  TransportAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  m_Transport.setAdapter(TransportAdapter);
}
 

Example 70

From project OpenComm_andr, under directory /sipvoip/src/org/hsc/sip/ua/config/ui/.

Source file: UserProfile.java

  15 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  this.setContentView(R.layout.user_profile);
  background_image_view=(ImageView)findViewById(R.id.background_image);
  if (background_image_view != null) {
    background_image_view.setImageResource(R.drawable.options_backend);
  }
  m_UserName=(EditText)findViewById(R.id.txt_user_name);
  m_Password=(EditText)findViewById(R.id.txt_usr_password);
  m_LocalPort=(EditText)findViewById(R.id.txt_local_port);
  m_LocalIP=(EditText)findViewById(R.id.txt_user_profile_local_ip);
  Intent intent=this.getIntent();
  m_UserName.setText(intent.getStringExtra("UserName"));
  m_Password.setText(intent.getStringExtra("Password"));
  m_LocalPort.setText(Short.toString(intent.getShortExtra("LocalPort",(short)5060)));
  m_LocalIP.setText(intent.getStringExtra("LocalIP"));
  m_Transport=(Spinner)findViewById(R.id.txt_transport);
  String data[]=new String[]{"UDP","TCP","Both"};
  ArrayAdapter<String> TransportAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,data);
  TransportAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  m_Transport.setAdapter(TransportAdapter);
}
 

Example 71

From project platform_packages_apps_browser, under directory /src/com/android/browser/.

Source file: AutologinBar.java

  15 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  mAutoLoginAccount=(Spinner)findViewById(R.id.autologin_account);
  mAutoLoginLogin=(Button)findViewById(R.id.autologin_login);
  mAutoLoginLogin.setOnClickListener(this);
  mAutoLoginProgress=(ProgressBar)findViewById(R.id.autologin_progress);
  mAutoLoginError=(TextView)findViewById(R.id.autologin_error);
  mAutoLoginCancel=findViewById(R.id.autologin_close);
  mAutoLoginCancel.setOnClickListener(this);
}
 

Example 72

From project platform_packages_apps_contacts, under directory /src/com/android/contacts/editor/.

Source file: LabeledEditorView.java

  15 
vote

/** 
 * {@inheritDoc} 
 */
@Override protected void onFinishInflate(){
  mLabel=(Spinner)findViewById(R.id.spinner);
  mLabel.setId(View.NO_ID);
  mLabel.setOnItemSelectedListener(mSpinnerListener);
  mDelete=(ImageView)findViewById(R.id.delete_button);
  mDeleteContainer=findViewById(R.id.delete_button_container);
  mDeleteContainer.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      new Handler().post(new Runnable(){
        @Override public void run(){
          if (!mIsAttachedToWindow) {
            return;
          }
          if (mListener != null) {
            mListener.onDeleteRequested(LabeledEditorView.this);
          }
        }
      }
);
    }
  }
);
}
 

Example 73

From project platform_packages_apps_im, under directory /src/com/android/im/app/.

Source file: AddContactActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mApp=ImApp.getApplication(this);
  mHandler=new SimpleAlertHandler(this);
  resolveIntent(getIntent());
  setContentView(R.layout.add_contact_activity);
  BrandingResources brandingRes=mApp.getBrandingResource(mProviderId);
  setTitle(brandingRes.getString(BrandingResourceIDs.STRING_ADD_CONTACT_TITLE));
  TextView label=(TextView)findViewById(R.id.input_contact_label);
  label.setText(brandingRes.getString(BrandingResourceIDs.STRING_LABEL_INPUT_CONTACT));
  mAddressList=(MultiAutoCompleteTextView)findViewById(R.id.email);
  mAddressList.setAdapter(new EmailAddressAdapter(this));
  mAddressList.setTokenizer(new Rfc822Tokenizer());
  mAddressList.addTextChangedListener(mTextWatcher);
  mListSpinner=(Spinner)findViewById(R.id.choose_list);
  Cursor c=queryContactLists();
  int initSelection=searchInitListPos(c,getIntent().getStringExtra(ImServiceConstants.EXTRA_INTENT_LIST_NAME));
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,android.R.layout.simple_spinner_item,c,new String[]{Imps.ContactList.NAME},new int[]{android.R.id.text1});
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mListSpinner.setAdapter(adapter);
  mListSpinner.setSelection(initSelection);
  mInviteButton=(Button)findViewById(R.id.invite);
  mInviteButton.setText(brandingRes.getString(BrandingResourceIDs.STRING_BUTTON_ADD_CONTACT));
  mInviteButton.setOnClickListener(mButtonHandler);
  mInviteButton.setEnabled(false);
}
 

Example 74

From project Project_source, under directory /HansungFinalProjectAppandServerSource/2012.05.23app/APP06_Dialog/src/com/dialog/.

Source file: simpletest.java

  15 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.simpletest);
  time=(Spinner)findViewById(R.id.spintime);
  time.setOnItemSelectedListener(this);
  weather=(Spinner)findViewById(R.id.spinweather);
  weather.setOnItemSelectedListener(this);
  emotion=(Spinner)findViewById(R.id.spinemotion);
  emotion.setOnItemSelectedListener(this);
}
 

Example 75

From project QuasselDroid, under directory /src/com/iskrembilen/quasseldroid/gui/fragments/.

Source file: JoinChannelDialog.java

  15 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View root=inflater.inflate(R.layout.dialog_join_channel,container,false);
  networkSpinner=(Spinner)root.findViewById(R.id.dialog_join_channel_network_spinner);
  channelNameField=(EditText)root.findViewById(R.id.dialog_join_channel_channel_name_field);
  OnClickListener buttonListener=new OnClickListener(){
    @Override public void onClick(    View v){
      if (v.getId() == R.id.dialog_join_channel_cancel_button) {
        getDialog().dismiss();
      }
 else       if (v.getId() == R.id.dialog_join_channel_join_button && !channelNameField.getText().toString().equals("")) {
        String channelName=channelNameField.getText().toString().trim();
        String networkSelected=(String)networkSpinner.getSelectedItem();
        BusProvider.getInstance().post(new JoinChannelEvent(networkSelected,channelName));
        dismiss();
      }
    }
  }
;
  root.findViewById(R.id.dialog_join_channel_join_button).setOnClickListener(buttonListener);
  root.findViewById(R.id.dialog_join_channel_cancel_button).setOnClickListener(buttonListener);
  return root;
}