List of usage examples for android.widget AdapterView getTag
@ViewDebug.ExportedProperty
public Object getTag()
From source file:org.droid2droid.test.TestDroid2DroidListFragment.java
@Override public void onItemSelected(AdapterView<?> parent, View view, int itemPosition, long id) { final int position = (Integer) parent.getTag(); Droid2DroidContext context = mRemoteAndroids.get(position); context.mUri = mItems.get(itemPosition); }
From source file:com.quectel.presentationtest.PresentationTest.java
/** * Called when a display mode has been unselected. */// www. j a v a 2 s .com @Override public void onNothingSelected(AdapterView<?> parent) { final Display display = (Display) parent.getTag(); setPresentationDisplayMode(display, 0); }
From source file:com.quectel.presentationtest.PresentationTest.java
/** * Called when a display mode has been selected. */// w ww. j ava 2 s .c o m @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { final Display display = (Display) parent.getTag(); final Display.Mode[] modes = display.getSupportedModes(); setPresentationDisplayMode(display, position >= 1 && position <= modes.length ? modes[position - 1].getModeId() : 0); }
From source file:com.z299studio.pb.EditFragment.java
@Override public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { if (parent.getId() == R.id.category) { mPosition = pos;// www . jav a2s .com } else { EntryHolder eh = (EntryHolder) parent.getTag(); int type = pos + 1; eh.mEntryItem.mType = type; eh.mValueField.setInputType(INPUT_TYPES[type]); if (type == AccountManager.EntryType.PASSWORD || type == AccountManager.EntryType.PIN) { eh.mAutoPwd.setVisibility(View.VISIBLE); } else { eh.mAutoPwd.setVisibility(View.INVISIBLE); } } }
From source file:ch.teamuit.android.soundplusplus.LibraryPagerAdapter.java
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { int type = (Integer) parent.getTag(); if (type == MediaUtils.TYPE_FILE) { mFilesAdapter.onViewClicked(view); } else {/*from ww w . j ava 2 s . c om*/ Intent intent = id == -1 ? createHeaderIntent(view) : mCurrentAdapter.createData(view); mActivity.onItemClicked(intent); } }
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); }// www . j a v a 2 s . c o m 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:com.inmobi.ultrapush.AnalyzeActivity.java
@Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { // get the tag, which is the value we are going to use String selectedItemTag = ((TextView) v).getTag().toString(); // if tag() is "0" then do not update anything (it is a title) if (selectedItemTag.equals("0")) { return;//from w w w . j av a 2 s. com } // get the text and set it as the button text String selectedItemText = ((TextView) v).getText().toString(); int buttonId = Integer.parseInt((parent.getTag().toString())); Button buttonView = (Button) findViewById(buttonId); buttonView.setText(selectedItemText); boolean b_need_restart_audio; SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences.Editor editor = sharedPref.edit(); // dismiss the pop up switch (buttonId) { case R.id.button_sample_rate: popupMenuSampleRate.dismiss(); sampleRate = Integer.parseInt(selectedItemTag); b_need_restart_audio = true; editor.putInt("button_sample_rate", sampleRate); break; case R.id.button_fftlen: popupMenuFFTLen.dismiss(); fftLen = Integer.parseInt(selectedItemTag); b_need_restart_audio = true; editor.putInt("button_fftlen", fftLen); break; case R.id.button_average: popupMenuAverage.dismiss(); nFFTAverage = Integer.parseInt(selectedItemTag); if (graphView != null) { graphView.setTimeMultiplier(nFFTAverage); } b_need_restart_audio = false; editor.putInt("button_average", nFFTAverage); break; default: Log.w(TAG, "onItemClick(): no this button"); b_need_restart_audio = false; } editor.commit(); if (b_need_restart_audio) { reRecur(); } }
From source file:com.xandy.calendar.EventInfoFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mReminderChangeListener = new OnItemSelectedListener() { @Override//from w w w .jav a 2s . c o m public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Integer prevValue = (Integer) parent.getTag(); if (prevValue == null || prevValue != position) { parent.setTag(position); mUserModifiedReminders = true; } } @Override public void onNothingSelected(AdapterView<?> parent) { // do nothing } }; if (savedInstanceState != null) { mIsDialog = savedInstanceState.getBoolean(BUNDLE_KEY_IS_DIALOG, false); mWindowStyle = savedInstanceState.getInt(BUNDLE_KEY_WINDOW_STYLE, DIALOG_WINDOW_STYLE); } if (mIsDialog) { applyDialogParams(); } final Activity activity = getActivity(); mContext = activity; mColorPickerDialog = (EventColorPickerDialog) getActivity().getSupportFragmentManager() .findFragmentByTag(COLOR_PICKER_DIALOG_TAG); if (mColorPickerDialog != null) { mColorPickerDialog.setOnColorSelectedListener(this); } }
From source file:com.android.calendar.EventInfoFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mReminderChangeListener = new OnItemSelectedListener() { @Override/*from www. j a v a 2 s . c o m*/ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Integer prevValue = (Integer) parent.getTag(); if (prevValue == null || prevValue != position) { parent.setTag(position); mUserModifiedReminders = true; } } @Override public void onNothingSelected(AdapterView<?> parent) { // do nothing } }; if (savedInstanceState != null) { mIsDialog = savedInstanceState.getBoolean(BUNDLE_KEY_IS_DIALOG, false); mWindowStyle = savedInstanceState.getInt(BUNDLE_KEY_WINDOW_STYLE, DIALOG_WINDOW_STYLE); } if (mIsDialog) { applyDialogParams(); } final FragmentActivity activity = getActivity(); mContext = activity; mColorPickerDialog = (EventColorPickerDialog) activity.getSupportFragmentManager() .findFragmentByTag(COLOR_PICKER_DIALOG_TAG); if (mColorPickerDialog != null) { mColorPickerDialog.setOnColorSelectedListener(this); } }