List of usage examples for android.widget ArrayAdapter setDropDownViewResource
public void setDropDownViewResource(@LayoutRes int resource)
Sets the layout resource to create the drop down views.
From source file:de.uni_koblenz_landau.apow.PatientDetailEditFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.patient_detail_edit_fragment, container, false); // Create UI references. mBirthDateDialog = (DateDialogFragment) getFragmentManager().findFragmentByTag(BIRTHDATE_DIALOG_ID); if (mBirthDateDialog != null) { mBirthDateDialog.setListener(this); }//from w w w .j a v a2 s .c om mDeathDateDialog = (DateDialogFragment) getFragmentManager().findFragmentByTag(DEATHDATE_DIALOG_ID); if (mDeathDateDialog != null) { mDeathDateDialog.setListener(this); } mIdentifierView = (EditText) view.findViewById(R.id.patient_detail_edit_identifier); mNamePrefixView = (EditText) view.findViewById(R.id.patient_detail_edit_name_prefix); mGivenNameView = (EditText) view.findViewById(R.id.patient_detail_edit_name_given_name); mMiddleNameView = (EditText) view.findViewById(R.id.patient_detail_edit_name_middle_name); mFamilyNamePrefixView = (EditText) view.findViewById(R.id.patient_detail_edit_name_family_name_prefix); mFamilyNameView = (EditText) view.findViewById(R.id.patient_detail_edit_name_family_name); mFamilyName2View = (EditText) view.findViewById(R.id.patient_detail_edit_name_family_name2); mFamilyNameSuffixView = (EditText) view.findViewById(R.id.patient_detail_edit_name_family_name_suffix); mDegreeView = (EditText) view.findViewById(R.id.patient_detail_edit_name_degree); mGenderView = (Spinner) view.findViewById(R.id.patient_detail_edit_gender); mBirthdateView = (TextView) view.findViewById(R.id.patient_detail_edit_birthdate); mBirthdateEstimatedView = (CheckBox) view.findViewById(R.id.patient_detail_edit_birthdate_estimated); mAddress1View = (EditText) view.findViewById(R.id.patient_detail_edit_address_address1); mAddress2View = (EditText) view.findViewById(R.id.patient_detail_edit_address_address2); mCityVillageView = (EditText) view.findViewById(R.id.patient_detail_edit_address_cityvillage); mDistrictsView = (Spinner) view.findViewById(R.id.patient_detail_edit_address_district); mRegionsView = (Spinner) view.findViewById(R.id.patient_detail_edit_address_region); mRegionsView.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View v, int pos, long id) { Region region = (Region) parent.getItemAtPosition(pos); ArrayAdapter<District> adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item, region.getDistricts()); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mDistrictsView.setAdapter(adapter); if (parent.getTag() != null) { mDistrictsView.setSelection((int) parent.getTag()); parent.setTag(null); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); mCountryView = (EditText) view.findViewById(R.id.patient_detail_edit_address_country); mLongitudeView = (EditText) view.findViewById(R.id.patient_detail_edit_address_longitude); mLatitudeView = (EditText) view.findViewById(R.id.patient_detail_edit_address_latitude); mDeathdateView = (TextView) view.findViewById(R.id.patient_detail_edit_deathdate); mDeadLayout = (LinearLayout) view.findViewById(R.id.patient_detail_edit_dead_group); mDeadLayout = (LinearLayout) view.findViewById(R.id.patient_detail_edit_dead_group); mDeadView = (CheckBox) view.findViewById(R.id.patient_detail_edit_dead); mDeadView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { CheckBox dead = (CheckBox) v; if (dead.isChecked()) { mDeadLayout.setVisibility(View.VISIBLE); } else { mDeadLayout.setVisibility(View.GONE); } } }); // Restore UI from saved instance or load data. if (savedInstanceState != null) { mPatient = (Patient) savedInstanceState.getSerializable(ARG_PATIENT); if (mPatient != null) { mRegions = (List<Region>) savedInstanceState.getSerializable(ARG_REGIONS); ArrayAdapter<Region> adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item, mRegions); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mRegionsView.setAdapter(adapter); ArrayAdapter<District> adapter1 = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item, mRegions.get(0).getDistricts()); adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mDistrictsView.setAdapter(adapter1); String selectedRegion = savedInstanceState.getString(ARG_SELECTED_REGION); String selectedDistrict = savedInstanceState.getString(ARG_SELECTED_DISTRICT); for (int i = 0; i < adapter.getCount(); i++) { Region region = adapter.getItem(i); if (region.getRegionName().equals(selectedRegion)) { for (int j = 0; j < region.getDistricts().size(); j++) { if (region.getDistricts().get(j).getDistrictName().equals(selectedDistrict)) { mRegionsView.setTag(j); mRegionsView.setSelection(i, false); adapter1 = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item, region.getDistricts()); adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mDistrictsView.setAdapter(adapter1); mDistrictsView.setSelection(j, false); break; } } break; } } if (savedInstanceState.getBoolean(ARG_DEAD)) { mDeadLayout.setVisibility(View.VISIBLE); } else { mDeadLayout.setVisibility(View.GONE); } } } else { loadPatient(); } return view; }
From source file:gov.sfmta.sfpark.MainScreenActivity.java
@Override public void onCreate(Bundle savedInstanceState) { MYLOG("onCreate"); super.onCreate(savedInstanceState); setContentView(R.layout.main);// www .jav a 2s . co m // Set up ActionBar ActionBar ab = getSupportActionBar(); ab.setDisplayShowTitleEnabled(false); ab.setIcon(R.drawable.logo_header); ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ab.addTab(ab.newTab().setText("Price").setTabListener(new TabListener())); ab.addTab(ab.newTab().setText("Availability").setTabListener(new TabListener())); // Dropdown navigation final String[] dropdownValues = getResources().getStringArray(R.array.dropdown); ArrayAdapter<String> adapter = new ArrayAdapter<String>(ab.getThemedContext(), R.layout.sherlock_spinner_item, android.R.id.text1, dropdownValues); adapter.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item); ab.setListNavigationCallbacks(adapter, this); if (SFparkActivity.DEBUG) { debugText = (TextView) findViewById(R.id.debugText); debugText.setText("Debug String"); debugText.setVisibility(View.VISIBLE); } legendlabel = (TextView) findViewById(R.id.legendText); legendImage = (ImageView) findViewById(R.id.keyImage); // DoubleTapMapView... is a mapview that you can double-tap. :-/ mapView = new DoubleTapMapView(this); FrameLayout fl = (FrameLayout) findViewById(R.id.mapframe); fl.addView(mapView, 0, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); mapView.setBuiltInZoomControls(true); mc = mapView.getController(); // Creating and initializing Map GeoPoint p = getPoint(INITIAL_LATITUDE, INITIAL_LONGITUDE); mc.setCenter(p); mc.setZoom(14); startLocation(); showPrice = true; enablePanToMe(); reset(); }
From source file:com.zira.registration.VehicleInformationActivity.java
protected void setApapterForVehicleModel(ArrayList<ModelArray> vehicleModals) { /******************************/ if (vehicleArrayList.size() > 0) { //edit/*from ww w . ja va 2 s. c om*/ // String gettingVehicleModel=mProfileInfoModel.getVechile_model(); String gettingVehicleModel = mProfileInfoModel.getVechile_modelID(); // if(gettingVehicleModel.equals("0")) // { // gettingVehicleModel=prefs3.getString("modelid", ""); // } int i = 0; for (ModelArray vehicle : vehicleArrayList.get(gettingVehicleMakePosition).getListModalData()) { //String vehicleMode=vehicle.getVehiclemodalName(); String vehicleMode = vehicle.getVehiclemodelID(); if (gettingVehicleModel.equals(vehicleMode)) { gettingVehicleModelPosition = i; System.err.println("vehicelmodel=" + i); } i++; } } /******************************/ ArrayAdapter<ModelArray> dataAdapter = new ArrayAdapter<ModelArray>(this, R.layout.spinner_list, vehicleModals); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); vehiclemodalNameSpinner.setAdapter(dataAdapter); if (value == 1) if (vehicle_flag > 1) { gettingVehicleModelPosition = 0; vehiclemodalNameSpinner.setSelection(gettingVehicleModelPosition); String year; if (vehicleModals.size() > 0) year = vehicleModals.get(gettingVehicleModelPosition).getVehiclemodalYear(); else year = "0"; setApapterForVehicleYear(year); } else { if (vehicleModals.size() > gettingVehicleModelPosition) { vehiclemodalNameSpinner.setSelection(gettingVehicleModelPosition); String year; if (vehicleModals.size() > 0) year = vehicleModals.get(gettingVehicleModelPosition).getVehiclemodalYear(); else year = "0"; setApapterForVehicleYear(year); } } // vehiclemodalNameSpinner.setSelection(Integer.parseInt(mProfileInfoModel.getVechile_modelID())); }
From source file:de.uni_koblenz_landau.apow.LoginActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Re-attach Tasks. TaskActivityReference.getInstance().attach(LoginTask.TASK_ID, this); TaskActivityReference.getInstance().attach(SetupTask.TASK_ID, this); TaskActivityReference.getInstance().attach(NFCTagReaderTask.TASK_ID, this); TaskActivityReference.getInstance().attach(LocationWebTask.TASK_ID, this); // Create UI references. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = this.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor(this.getResources().getColor(R.color.color_primary_dark)); }// www . java 2 s . c om setContentView(R.layout.login_activity); mToolbar = (Toolbar) findViewById(R.id.toolbar); if (mToolbar != null) { setSupportActionBar(mToolbar); } mSetupLocationView = (Spinner) findViewById(R.id.login_setup_locations); mStatusView = findViewById(R.id.login_status); mStatusMessageView = (TextView) findViewById(R.id.login_status_message); mLoginFormView = findViewById(R.id.login_login); mLoginPasswordView = (EditText) findViewById(R.id.login_login_password); mLoginPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) { if (id == R.id.login || id == EditorInfo.IME_NULL) { login(textView); return true; } return false; } }); mLoginNFCText = (TextView) findViewById(R.id.login_login_nfc); mSetupFormView = findViewById(R.id.login_setup); mSetupNFCText = (TextView) findViewById(R.id.login_setup_nfc); mSetupDatabasePasswordView = (EditText) findViewById(R.id.login_setup_database_password); mSetupDatabaseConfirmView = (EditText) findViewById(R.id.login_setup_database_password_confirm); mSetupServerUsernameView = (EditText) findViewById(R.id.login_login_server_user); mSetupServerPasswordView = (EditText) findViewById(R.id.login_login_server_password); //mFirstRun = true; mFirstRun = getSharedPreferences(Constants.PREFERENCE, MODE_PRIVATE).getBoolean(ARG_FIRST_RUN, true); mNfcAdapter = NfcAdapter.getDefaultAdapter(this); // Restore UI from saved instance or load data. if (savedInstanceState != null) { mNFCTag = savedInstanceState.getString(ARG_NFC); mNFCTextDrawable = savedInstanceState.getInt(ARG_NFC_STATE); mAutoSignOffDismissed = savedInstanceState.getBoolean(ARG_AUTO_SIGN_OFF_DISMISSED); mProgress = savedInstanceState.getBoolean(ARG_PROGRESS); if (mFirstRun) { mLocations = savedInstanceState.getParcelableArrayList(ARG_LOCATIONS); if (mLocations != null) { ArrayAdapter<ListViewItem> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, mLocations); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mSetupLocationView.setAdapter(adapter); mSetupLocationView.setSelection(savedInstanceState.getInt(ARG_LOCATION_SELECTION)); } } } else { mProgress = false; mAutoSignOffDismissed = false; mNFCTag = ""; mNFCTextDrawable = R.drawable.empty; if (mFirstRun) { loadLocations(); } } mLoginNFCText.setCompoundDrawablesWithIntrinsicBounds(0, 0, mNFCTextDrawable, 0); mSetupNFCText.setCompoundDrawablesWithIntrinsicBounds(0, 0, mNFCTextDrawable, 0); if (mFirstRun) { mSetupFormView.setVisibility(View.VISIBLE); mLoginFormView.setVisibility(View.GONE); this.setTitle(R.string.login_setup_title); } else { mSetupFormView.setVisibility(View.GONE); mLoginFormView.setVisibility(View.VISIBLE); this.setTitle(R.string.login_login_title); } if (getIntent().getBooleanExtra(ARG_AUTO_LOGOUT, false) && !mAutoSignOffDismissed) { SignedOffDialog dialog = new SignedOffDialog(); dialog.show(getSupportFragmentManager(), SIGNED_OFF_DIALOG_ID); mAutoSignOffDismissed = true; } showProgress(mProgress); setNFCState(); }
From source file:nl.sogeti.android.gpstracker.actions.ShareTrack.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sharedialog); mTrackUri = getIntent().getData();// w w w .java 2s . c o m 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) { /* NOOP */ } }); 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(); } }); }
From source file:es.ugr.swad.swadroid.modules.downloads.DownloadsManager.java
/** * If there are not groups to which the user belong in the database, it makes the request *///from w w w . j a va 2 s .c o m private void loadGroupsSpinner(List<Group> currentGroups) { if (!currentGroups.isEmpty()) { //there are groups in the selected course, therefore the groups spinner should be loaded Spinner groupsSpinner = (Spinner) this.findViewById(R.id.groupSpinner); groupsSpinner.setVisibility(View.VISIBLE); ArrayList<String> spinnerNames = new ArrayList<String>(currentGroups.size() + 1); spinnerNames.add(getString(R.string.course) + "-" + Courses.getSelectedCourseShortName()); for (Group g : currentGroups) { GroupType gType = dbHelper.getGroupTypeFromGroup(g.getId()); spinnerNames .add(getString(R.string.group) + "-" + gType.getGroupTypeName() + " " + g.getGroupName()); } ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, spinnerNames); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); groupsSpinner.setAdapter(adapter); groupsSpinner.setOnItemSelectedListener(new onGroupSelectedListener()); groupsSpinner.setSelection(groupPosition); } else { this.findViewById(R.id.groupSpinner).setVisibility(View.GONE); getSupportActionBar().setSubtitle(Courses.getSelectedCourseShortName()); } }
From source file:com.cypress.cysmart.BLEServiceFragments.FindMeService.java
/** * Method to get required characteristics from service *//*from ww w.ja va 2s . c o m*/ private void getGattData() { LinearLayout ll_layout = (LinearLayout) rootView.findViewById(R.id.linkloss_layout); LinearLayout im_layout = (LinearLayout) rootView.findViewById(R.id.immalert_layout); LinearLayout tp_layout = (LinearLayout) rootView.findViewById(R.id.transmission_layout); RelativeLayout tpr_layout = (RelativeLayout) rootView.findViewById(R.id.transmission_rel_layout); for (int position = 0; position < mExtraservice.size(); position++) { HashMap<String, BluetoothGattService> item = mExtraservice.get(position); BluetoothGattService bgs = item.get("UUID"); List<BluetoothGattCharacteristic> gattCharacteristicsCurrent = bgs.getCharacteristics(); for (final BluetoothGattCharacteristic gattCharacteristic : gattCharacteristicsCurrent) { String uuidchara = gattCharacteristic.getUuid().toString(); if (uuidchara.equalsIgnoreCase(GattAttributes.ALERT_LEVEL)) { if (bgs.getUuid().toString().equalsIgnoreCase(GattAttributes.LINK_LOSS_SERVICE)) { ll_layout.setVisibility(View.VISIBLE); mSpinnerLinkLoss = (CustomSpinner) rootView.findViewById(R.id.linkloss_spinner); // Create an ArrayAdapter using the string array and a // default // spinner layout ArrayAdapter<CharSequence> adapter_linkloss = ArrayAdapter.createFromResource(getActivity(), R.array.findme_immediate_alert_array, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices // appears adapter_linkloss.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner mSpinnerLinkLoss.setAdapter(adapter_linkloss); mSpinnerLinkLoss.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (parent.getItemAtPosition(position).toString().equalsIgnoreCase("No Alert")) { byte[] convertedBytes = convertingTobyteArray(IMM_NO_ALERT); BluetoothLeService.writeCharacteristicNoresponse(gattCharacteristic, convertedBytes); Toast.makeText(getActivity(), getResources().getString(R.string.find_value_written_toast) + IMM_NO_ALERT_TEXT + getResources().getString(R.string.find_value_success_toast), Toast.LENGTH_SHORT).show(); } if (parent.getItemAtPosition(position).toString().equalsIgnoreCase("Mid Alert")) { byte[] convertedBytes = convertingTobyteArray(IMM_MID_ALERT); BluetoothLeService.writeCharacteristicNoresponse(gattCharacteristic, convertedBytes); Toast.makeText(getActivity(), getResources().getString(R.string.find_value_written_toast) + IMM_MID_ALERT_TEXT + getResources().getString(R.string.find_value_success_toast), Toast.LENGTH_SHORT).show(); } if (parent.getItemAtPosition(position).toString().equalsIgnoreCase("High Alert")) { byte[] convertedBytes = convertingTobyteArray(IMM_HIGH_ALERT); BluetoothLeService.writeCharacteristicNoresponse(gattCharacteristic, convertedBytes); Toast.makeText(getActivity(), getResources().getString(R.string.find_value_written_toast) + IMM_HIGH_ALERT_TEXT + getResources().getString(R.string.find_value_success_toast), Toast.LENGTH_SHORT).show(); } } @Override public void onNothingSelected(AdapterView<?> parent) { // TODO Auto-generated method stub } }); } if (bgs.getUuid().toString().equalsIgnoreCase(GattAttributes.IMMEDIATE_ALERT_SERVICE)) { im_layout.setVisibility(View.VISIBLE); mSpinnerImmediateAlert = (CustomSpinner) rootView.findViewById(R.id.immediate_spinner); // Create an ArrayAdapter using the string array and a // default // spinner layout ArrayAdapter<CharSequence> adapter_immediate_alert = ArrayAdapter.createFromResource( getActivity(), R.array.findme_immediate_alert_array, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices // appears adapter_immediate_alert .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner mSpinnerImmediateAlert.setAdapter(adapter_immediate_alert); mSpinnerImmediateAlert.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (parent.getItemAtPosition(position).toString().equalsIgnoreCase("No Alert")) { byte[] convertedBytes = convertingTobyteArray(IMM_NO_ALERT); BluetoothLeService.writeCharacteristicNoresponse(gattCharacteristic, convertedBytes); Toast.makeText(getActivity(), getResources().getString(R.string.find_value_written_toast) + IMM_NO_ALERT_TEXT + getResources().getString(R.string.find_value_success_toast), Toast.LENGTH_SHORT).show(); } if (parent.getItemAtPosition(position).toString().equalsIgnoreCase("Mid Alert")) { byte[] convertedBytes = convertingTobyteArray(IMM_MID_ALERT); BluetoothLeService.writeCharacteristicNoresponse(gattCharacteristic, convertedBytes); Toast.makeText(getActivity(), getResources().getString(R.string.find_value_written_toast) + IMM_MID_ALERT_TEXT + getResources().getString(R.string.find_value_success_toast), Toast.LENGTH_SHORT).show(); } if (parent.getItemAtPosition(position).toString().equalsIgnoreCase("High Alert")) { byte[] convertedBytes = convertingTobyteArray(IMM_HIGH_ALERT); BluetoothLeService.writeCharacteristicNoresponse(gattCharacteristic, convertedBytes); Toast.makeText(getActivity(), getResources().getString(R.string.find_value_written_toast) + IMM_HIGH_ALERT_TEXT + getResources().getString(R.string.find_value_success_toast), Toast.LENGTH_SHORT).show(); } } @Override public void onNothingSelected(AdapterView<?> parent) { // TODO Auto-generated method stub } }); } } if (uuidchara.equalsIgnoreCase(GattAttributes.TRANSMISSION_POWER_LEVEL)) { tp_layout.setVisibility(View.VISIBLE); tpr_layout.setVisibility(View.VISIBLE); mReadCharacteristic_tp = gattCharacteristic; mTransmissionPower = (ImageView) rootView.findViewById(R.id.findme_tx_power_img); mTransmissionPowerValue = (TextView) rootView.findViewById(R.id.findme_tx_power_txt); if (mReadCharacteristic_tp != null) { prepareBroadcastDataReadtp(mReadCharacteristic_tp); } } } } }
From source file:com.dattasmoon.pebble.plugin.EditNotificationActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_notification); mHandler = new Handler(); lvPackages = (ListView) findViewById(R.id.listPackages); spMode = (Spinner) findViewById(R.id.spMode); tvTaskerNotice = (TextView) findViewById(R.id.tvTaskerNotice); findViewById(R.id.tvAccessibilityError).setOnClickListener(new OnClickListener() { @Override//from w w w . ja v a 2s .co m public void onClick(View v) { startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS)); } }); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.mode_choices, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spMode.setAdapter(adapter); spMode.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { mMode = Constants.Mode.values()[pos]; } @Override public void onNothingSelected(AdapterView<?> parent) { mMode = Constants.Mode.OFF; if (Constants.IS_LOGGABLE) { Log.i(Constants.LOG_TAG, "Mode is: off"); } } }); }
From source file:com.money.manager.ex.search.SearchParametersFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) return null; View view = inflater.inflate(R.layout.fragment_search_parameters, container, false); // bind events ButterKnife.bind(this, view); // bind controls viewHolder = new SearchParametersViewHolder(view); initializeUiControlVariables(view);//ww w .ja v a 2 s . com // Account if (mAccountList == null) { LookAndFeelSettings settings = new AppSettings(getContext()).getLookAndFeelSettings(); AccountService accountService = new AccountService(getContext()); mAccountList = accountService.getAccountList(settings.getViewOpenAccounts(), settings.getViewFavouriteAccounts()); mAccountList.add(0, null); for (int i = 0; i <= mAccountList.size() - 1; i++) { if (mAccountList.get(i) != null) { mAccountNameList.add(mAccountList.get(i).getName()); mAccountIdList.add(mAccountList.get(i).getId()); } else { mAccountNameList.add(""); mAccountIdList.add(AdapterView.INVALID_POSITION); } } } // create adapter for spinAccount ArrayAdapter<String> adapterAccount = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item, mAccountNameList); adapterAccount.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinAccount.setAdapter(adapterAccount); //Payee viewHolder.txtSelectPayee.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), PayeeActivity.class); intent.setAction(Intent.ACTION_PICK); startActivityForResult(intent, RequestCodes.PAYEE); } }); //Category txtSelectCategory.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), CategoryListActivity.class); intent.setAction(Intent.ACTION_PICK); startActivityForResult(intent, RequestCodes.CATEGORY); } }); // Status if (mStatusItems.size() <= 0) { // add blank row mStatusItems.add(""); mStatusValues.add(SearchParameters.STRING_NULL_VALUE); mStatusItems.addAll(Arrays.asList(getResources().getStringArray(R.array.status_items))); mStatusValues.addAll(Arrays.asList(getResources().getStringArray(R.array.status_values))); } // create adapter for spinnerStatus ArrayAdapter<String> adapterStatus = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item, mStatusItems); adapterStatus.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinStatus.setAdapter(adapterStatus); // Date from // viewHolder.txtDateFrom.setOnClickListener(new OnDateButtonClickListener(getActivity(), viewHolder.txtDateFrom)); // Date to // viewHolder.txtDateTo.setOnClickListener(new OnDateButtonClickListener(getActivity(), viewHolder.txtDateTo)); // Store search criteria values into the controls. displaySearchCriteria(view); return view; }
From source file:com.amsterdam.marktbureau.makkelijkemarkt.DagvergunningFragmentKoopman.java
/** * Inflate the dagvergunning koopman fragment and initialize the view elements and its handlers * @param inflater//w ww.j a v a 2 s .c o m * @param container * @param savedInstanceState * @return */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View mainView = inflater.inflate(R.layout.dagvergunning_fragment_koopman, container, false); // bind the elements to the view ButterKnife.bind(this, mainView); // Create an onitemclick listener that will catch the clicked koopman from the autocomplete // lists (not using butterknife here because it does not support for @OnItemClick on // AutoCompleteTextView: https://github.com/JakeWharton/butterknife/pull/242 AdapterView.OnItemClickListener autoCompleteItemClickListener = new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Cursor koopman = (Cursor) parent.getAdapter().getItem(position); // select the koopman and update the fragment selectKoopman(koopman.getInt(koopman.getColumnIndex(MakkelijkeMarktProvider.Koopman.COL_ID)), KOOPMAN_SELECTION_METHOD_HANDMATIG); } }; // create the custom cursor adapter that will query for an erkenningsnummer and show an autocomplete list ErkenningsnummerAdapter searchErkenningAdapter = new ErkenningsnummerAdapter(getContext()); mErkenningsnummerEditText.setAdapter(searchErkenningAdapter); mErkenningsnummerEditText.setOnItemClickListener(autoCompleteItemClickListener); // create the custom cursor adapter that will query for a sollicitatienummer and show an autocomplete list SollicitatienummerAdapter searchSollicitatieAdapter = new SollicitatienummerAdapter(getContext()); mSollicitatienummerEditText.setAdapter(searchSollicitatieAdapter); mSollicitatienummerEditText.setOnItemClickListener(autoCompleteItemClickListener); // disable uppercasing of the button text mScanBarcodeButton.setTransformationMethod(null); mScanNfcTagButton.setTransformationMethod(null); // get the aanwezig values from a resource array with aanwezig values mAanwezigKeys = getResources().getStringArray(R.array.array_aanwezig_key); // populate the aanwezig spinner from a resource array with aanwezig titles ArrayAdapter<CharSequence> aanwezigAdapter = ArrayAdapter.createFromResource(getContext(), R.array.array_aanwezig_title, android.R.layout.simple_spinner_dropdown_item); aanwezigAdapter.setDropDownViewResource(android.R.layout.simple_list_item_activated_1); mAanwezigSpinner.setAdapter(aanwezigAdapter); return mainView; }