List of usage examples for android.widget AdapterView getId
@IdRes @ViewDebug.CapturedViewProperty public int getId()
From source file:com.mifos.mifosxdroid.online.loanaccount.LoanAccountFragment.java
@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { switch (parent.getId()) { case R.id.sp_lproduct: productId = mLoanProducts.get(position).getId(); inflateLoanPurposeSpinner();/* w w w . j av a 2 s .co m*/ break; case R.id.sp_loan_purpose: loanPurposeId = mLoanTemplate.getLoanPurposeOptions().get(position).getId(); break; case R.id.sp_amortization: amortizationTypeId = mLoanTemplate.getAmortizationTypeOptions().get(position).getId(); break; case R.id.sp_interestcalculationperiod: interestCalculationPeriodTypeId = mLoanTemplate.getInterestCalculationPeriodTypeOptions().get(position) .getId(); break; case R.id.sp_repaymentstrategy: transactionProcessingStrategyId = mLoanTemplate.getTransactionProcessingStrategyOptions().get(position) .getId(); break; case R.id.sp_payment_periods: loanTermFrequency = mLoanTemplate.getTermFrequencyTypeOptions().get(position).getId(); if (loanTermFrequency == 2) { // Show and inflate Nth day and week spinners showHideRepaidMonthSpinners(View.VISIBLE); inflateRepaidMonthSpinners(); } else { showHideRepaidMonthSpinners(View.GONE); } break; case R.id.sp_repayment_freq_nth_day: repaymentFrequencyNthDayType = mLoanTemplate.getRepaymentFrequencyNthDayTypeOptions().get(position) .getId(); break; case R.id.sp_repayment_freq_day_of_week: repaymentFrequencyDayOfWeek = mLoanTemplate.getRepaymentFrequencyDaysOfWeekTypeOptions().get(position) .getId(); break; case R.id.sp_fund: fundId = mLoanTemplate.getFundOptions().get(position).getId(); break; case R.id.sp_loan_officer: loanOfficerId = mLoanTemplate.getLoanOfficerOptions().get(position).getId(); break; case R.id.sp_interest_type: interestTypeId = mLoanTemplate.getInterestTypeOptions().get(position).getId(); break; case R.id.sp_linking_options: if (mListAccountLinkingOptions.get(position) .equals(getResources().getString(R.string.select_linkage_account_hint))) { linkAccountId = null; } else { linkAccountId = mLoanTemplate.getAccountLinkingOptions().get(position).getId(); } } }
From source file:com.watch.customer.ui.ShopListActivity.java
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub if (R.id.shoplist == parent.getId()) { Intent mIntent = new Intent(this, ShopDetailActivity.class); mIntent.putExtra("object", shoplistdata.get(position - 1)); startActivity(mIntent);/*from w w w.java 2 s . co m*/ return; } if (R.id.area_grid == parent.getId()) { return; } selectPos[secindex] = position; secAdapter.notifyDataSetChanged(); switch (secindex) { case 0: secAdapter = new SectionAdapter(ShopListActivity.this, secArr1, position, secindex); section_list.setAdapter(secAdapter); if (position == 0) { text1.setText(R.string.shop_list_section_discount); } else { text1.setText(secArr1.get(position)); } pagerindex = 0; SearchBySec(); break; case 1: secAdapter = new SectionAdapter(ShopListActivity.this, secArr2, position, secindex); section_grid.setAdapter(secAdapter); if (position == 0) { text2.setText(R.string.shop_list_section_type); } else { text2.setText(secArr2.get(position)); } pagerindex = 0; SearchBySec(); break; case 2: secAdapter = new SectionAdapter(ShopListActivity.this, secArr3, position, secindex); section_list.setAdapter(secAdapter); text3.setText(secArr3.get(position)); if (position == 0) { text3.setText(R.string.shop_list_section_service); } else { text3.setText(secArr3.get(position)); } pagerindex = 0; SearchBySec(); break; } mPopWin.dismiss(); }
From source file:net.lp.hivawareness.v4.HIVAwarenessActivity.java
public void onNothingSelected(AdapterView<?> parent) { if (parent.getId() == R.id.spinner_gender) { if (!HIVAwarenessActivity.DEBUG) FlurryAgent.onEvent("spinner_gender"); AnalyticsUtils.getInstance().trackGAEvent("Main", "SpinnerGenderNothingSelected", this.getLocalClassName() + ".Spinner_Gender_nothing", 0); } else if (parent.getId() == R.id.spinner_region) { if (!HIVAwarenessActivity.DEBUG) FlurryAgent.onEvent("spinner_region"); AnalyticsUtils.getInstance().trackGAEvent("Main", "SpinnerRegionNothingSelected", this.getLocalClassName() + ".Spinner_Region_nothing", 0); }//from w w w . java 2 s . c om }
From source file:com.github.riotopsys.malforandroid2.fragment.AnimeDetailFragment.java
@Override public void onItemSelected(AdapterView<?> adapter, View view, int position, long id) { if (activeRecord == null) { return;/* w w w . j a v a 2s . co m*/ } BaseActivity ba = (BaseActivity) getActivity(); switch (adapter.getId()) { case R.id.anime_watched_status: AnimeWatchedStatus newStatus = AnimeWatchedStatus.values()[position]; if (activeRecord.watched_status != null && activeRecord.watched_status != newStatus) { activeRecord.watched_status = AnimeWatchedStatus.values()[position]; new AnimeDBUpdateTask(ba.getHelper(), ba.getApplicationContext(), bus).execute(activeRecord); } break; case R.id.anime_score_status: int newScore; switch (position) { case 0: newScore = position; break; default: newScore = 11 - position; } if (activeRecord.score != newScore) { activeRecord.score = newScore; new AnimeDBUpdateTask(ba.getHelper(), ba.getApplicationContext(), bus).execute(activeRecord); } break; } }
From source file:com.github.riotopsys.malforandroid2.fragment.MangaDetailFragment.java
@Override public void onItemSelected(AdapterView<?> adapter, View view, int position, long id) { if (activeRecord == null) { return;//from ww w . jav a2 s. c om } BaseActivity ba = (BaseActivity) getActivity(); switch (adapter.getId()) { case R.id.manga_read_status: MangaReadStatus newStatus = MangaReadStatus.values()[position]; if (activeRecord.read_status != null && activeRecord.read_status != newStatus) { activeRecord.read_status = MangaReadStatus.values()[position]; new MangaDBUpdateTask(ba.getHelper(), ba.getApplicationContext(), bus).execute(activeRecord); } break; case R.id.manga_score_status: int newScore; switch (position) { case 0: newScore = position; break; default: newScore = 11 - position; } if (activeRecord.score != newScore) { activeRecord.score = newScore; new MangaDBUpdateTask(ba.getHelper(), ba.getApplicationContext(), bus).execute(activeRecord); } break; } }
From source file:li.barter.fragments.BooksAroundMeFragment.java
@Override public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) { if (parent.getId() == R.id.grid_books_around_me) { if (position == mBooksAroundMeAdapter.getCount() - 1) { showAddBookOptions();//from w ww . j av a 2 s . c o m } else { final Intent booksPagerIntent = new Intent(getActivity(), SearchBookPagerActivity.class); booksPagerIntent.putExtra(Keys.BOOK_POSITION, position); startActivity(booksPagerIntent); } } }
From source file:net.lp.hivawareness.v4.HIVAwarenessActivity.java
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (parent.getId() == R.id.spinner_gender) { if (!HIVAwarenessActivity.DEBUG) FlurryAgent.onEvent("spinner_gender"); AnalyticsUtils.getInstance().trackGAEvent("Main", "SpinnerGenderItemSelected", this.getLocalClassName() + ".Spinner_Gender_" + Gender.values()[position], position); } else if (parent.getId() == R.id.spinner_region) { if (!HIVAwarenessActivity.DEBUG) FlurryAgent.onEvent("spinner_region"); AnalyticsUtils.getInstance().trackGAEvent("Main", "SpinnerRegionItemSelected", this.getLocalClassName() + ".Spinner_Region_" + Region.values()[position], position); }// w w w.ja v a 2 s . c om }
From source file:com.googlecode.CallerLookup.Main.java
@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (parent.getId() == mLookup.getId()) { if (mIgnoreItemSelection) { mIgnoreItemSelection = false; return; }/*w w w . j av a2 s . c o m*/ if (position == 0) { mURL.setText(""); mURL.setEnabled(true); mURL.setFocusableInTouchMode(true); mRegExp.setText(""); mRegExp.setEnabled(true); mRegExp.setFocusableInTouchMode(true); } else { mURL.setEnabled(false); mURL.setFocusable(false); mURL.clearFocus(); mRegExp.setEnabled(false); mRegExp.setFocusable(false); mRegExp.clearFocus(); String name = mLookup.getItemAtPosition(position).toString(); LookupEntry lookupEntry = mLookupEntries.get(name); assert (lookupEntry != null); mURL.setText(lookupEntry.mURL); mRegExp.setText(lookupEntry.mRegExp); } } }
From source file:com.hybris.mobile.app.commerce.adapter.ProductListAdapterBase.java
protected OnItemSelectedListener getProductDetailVariantSpinnerListener() { return new OnItemSelectedListener() { @Override/*from w ww.j a va2s. c o m*/ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (parent.getItemAtPosition(position) != null && mTriggerSpinnerOnChange) { Spinner spinnerToUpdate = null; switch (parent.getId()) { case R.id.product_item_variant_spinner_1: spinnerToUpdate = mCurrentSelectedViewHolder.productItemVariantSpinner2; break; case R.id.product_item_variant_spinner_2: spinnerToUpdate = mCurrentSelectedViewHolder.productItemVariantSpinner3; break; default: break; } onItemSpinnerSelected(spinnerToUpdate, parent.getItemAtPosition(position)); } // Workaround to activate the onchange listener only after having instantiated the latest spinner mNbVariantLevelsInstantiated++; if (mNbVariantLevelsInstantiated == mNbVariantLevels) { mTriggerSpinnerOnChange = true; } } @Override public void onNothingSelected(AdapterView<?> parent) { } }; }
From source file:com.kiwiteam.nomiddleman.TourPageActivity.java
/** * Adapter to select day, time and quantity of a tour * @param parent/*from w w w . j av a2 s.c om*/ * @param view * @param position * @param id */ @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { int vId = parent.getId(); switch (vId) { /* * If day is selected, search for times at current day. */ case R.id.day: String day = parent.getItemAtPosition(position).toString(); ArrayList<String> times = tour.getTourSessionsTime(day); tTime = (Spinner) findViewById(R.id.time); tAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, times); tAdapter.notifyDataSetChanged(); tTime.setOnItemSelectedListener(this); tAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); tTime.setAdapter(tAdapter); break; /* * If time is selected, search for quantities on current day and time. */ case R.id.time: String time = parent.getItemAtPosition(position).toString(); ArrayList<Integer> quantities = tour.getTourSessionAvailability(tDay.getSelectedItem().toString(), time); tQty = (Spinner) findViewById(R.id.quantity); qAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, quantities); qAdapter.notifyDataSetChanged(); qAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); tQty.setAdapter(qAdapter); break; } }