Java Code Examples for android.view.View#getId()
The following examples show how to use
android.view.View#getId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SlideInMenuPage.java From Paginize with MIT License | 6 votes |
@Override public void onClick(View v) { switch (v.getId()) { case MENU_ITEM_ID: hide(true); if (mListener != null) { Pair<Integer, String> pair = (Pair<Integer, String>)v.getTag(); mListener.onMenuItemClicked(pair.first, pair.second); } break; default: hide(true); } }
Example 2
Source File: LoginActivity.java From elemeimitate with Apache License 2.0 | 6 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.bt_login: initLogin(); break; case R.id.bt_register: Intent intent = new Intent(LoginActivity.this,RegisterActivity.class); startActivity(intent); break; case R.id.mimedetail_back: LoginActivity.this.finish(); break; default: break; } }
Example 3
Source File: CustomVideoView.java From FimiX8-RE with MIT License | 6 votes |
public void onClick(View view) { if (view.getId() == R.id.play_video_textureview) { if (this.mTopBarLl.getVisibility() == 0) { this.mTopBarLl.setVisibility(8); this.mBottomPlayRl.setVisibility(8); return; } this.mTopBarLl.setVisibility(0); this.mBottomPlayRl.setVisibility(0); } else if (view.getId() == R.id.play_btn) { if (this.playerState == 2) { seekAndResume(this.mPlaySb.getProgress()); } else if (this.playerState == 0) { load(); } else { pause(); } } else if (view.getId() == R.id.media_back_btn && this.listener != null) { this.listener.onClickBackBtn(); } }
Example 4
Source File: DashboardAddFragment.java From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License | 6 votes |
@OnClick({R.id.close_dialog_button, R.id.cancel_dashboard_add, R.id.save_dashboard}) @SuppressWarnings("unused") public void onButtonClicked(View view) { if (view.getId() == R.id.save_dashboard) { boolean isEmptyName = isEmpty(mDashboardName.getText().toString().trim()); String message = isEmptyName ? getString(R.string.enter_valid_name) : ""; mTextInputLayout.setError(message); if (!isEmptyName) { Dashboard newDashboard = Dashboard .createDashboard(mDashboardName.getText().toString()); newDashboard.save(); if (isDhisServiceBound()) { getDhisService().syncDashboards(SyncStrategy.DOWNLOAD_ONLY_NEW); EventBusProvider.post(new UiEvent(UiEvent.UiEventType.SYNC_DASHBOARDS)); } dismiss(); } } else { dismiss(); } }
Example 5
Source File: ToolsActivity.java From VMLibrary with Apache License 2.0 | 6 votes |
@OnClick({ R.id.btn_key_hashes, R.id.btn_md5_signature, R.id.btn_base64, R.id.tools_random_btn }) public void onClick(View view) { switch (view.getId()) { case R.id.btn_key_hashes: getKeyHashes(); break; case R.id.btn_md5_signature: md5Encryption(); break; case R.id.btn_base64: base64Encryption(); break; case R.id.tools_random_btn: random(); break; } }
Example 6
Source File: CurrencyUnitSettingActivity.java From Upchain-wallet with GNU Affero General Public License v3.0 | 6 votes |
@OnClick({R.id.rl_cny, R.id.rl_usd, R.id.rl_btn}) public void onClick(View view) { switch (view.getId()) { case R.id.rl_cny: currencyUnit = 0; ivCNY.setVisibility(View.VISIBLE); ivUSD.setVisibility(View.GONE); break; case R.id.rl_usd: currencyUnit = 1; ivCNY.setVisibility(View.GONE); ivUSD.setVisibility(View.VISIBLE); break; case R.id.rl_btn:// 保存 SharedPreferenceRepository.instance(this.mContext).setCurrencyUnit(currencyUnit); finish(); break; } }
Example 7
Source File: UseActivity.java From UltimateAndroid with Apache License 2.0 | 6 votes |
@Override public void onClick(View v) { int id = v.getId(); switch (id) { case R.id.toggle_ani: mToggleSb.toggle(); break; case R.id.toggle_not_ani: mToggleSb.toggle(false); break; case R.id.checked_ani: mCheckedSb.slideToChecked(!mCheckedSb.isChecked()); break; case R.id.checked_not_ani: mCheckedSb.setChecked(!mCheckedSb.isChecked()); break; default: break; } }
Example 8
Source File: OrderActivity.java From Android-Developer-Fundamentals-Version-2 with GNU General Public License v3.0 | 6 votes |
public void onRadioButtonClicked(View view) { boolean checked = ((RadioButton) view).isChecked(); switch (view.getId()){ case R.id.sameDay: if (checked){ displayToast(getString(R.string.same_day_messenger_service)); } break; case R.id.nextday: if (checked){ displayToast(getString(R.string.next_day_ground_delivery)); } break; case R.id.pickup: if (checked){ displayToast(getString(R.string.pick_up)); } break; default: break; } }
Example 9
Source File: MoviesDetailsFavFragment.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 6 votes |
@Optional @Override public void onClick(View v) { switch (v.getId()){ case R.id.imageView: launchTrailer(); break; case R.id.playicon: launchTrailer(); break; case R.id.backButton: getActivity().onBackPressed(); break; case R.id.shareButton: Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, currentMovieTrailer); startActivity(Intent.createChooser(sharingIntent, "Share via")); break; } }
Example 10
Source File: MeFragment.java From weixin with Apache License 2.0 | 5 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.cgt_ll_me_userInfo: AppToast.getToast().show("用户信息"); L.i(LOGTAG, "用户信息"); break; case R.id.cgt_ib_me_qrCode: AppToast.getToast().show("二维码"); L.i(LOGTAG, "二维码"); break; case R.id.cgt_ll_me_photo: AppToast.getToast().show(R.string.text_me_photo); L.i(LOGTAG, "相册"); break; case R.id.cgt_ll_me_collect: AppToast.getToast().show(R.string.text_me_collect); L.i(LOGTAG, "收藏"); break; case R.id.cgt_ll_me_wallet: AppToast.getToast().show(R.string.text_me_wallet); L.i(LOGTAG, "钱包"); break; case R.id.cgt_ll_me_set: AppToast.getToast().show(R.string.text_me_set); L.i(LOGTAG, "设置"); break; default: break; } }
Example 11
Source File: FragmentMatrixInput.java From ncalc with GNU General Public License v3.0 | 5 votes |
@Override public void onClick(View view) { int id = view.getId(); switch (id) { case R.id.btn_create_a: showDialogCreateMatrix(true); break; case R.id.btn_create_b: showDialogCreateMatrix(false); break; case R.id.btn_submit: prepareAndCalculate(); break; } }
Example 12
Source File: WelcomeBackEmailLinkPrompt.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
@Override public void onClick(View view) { final int id = view.getId(); if (id == R.id.button_sign_in) { startEmailLinkFlow(); } }
Example 13
Source File: ImageCropActivity.java From NIM_Android_UIKit with MIT License | 5 votes |
@Override public void onClick(View v) { int id = v.getId(); if (id == R.id.btn_back) { setResult(RESULT_CANCELED); finish(); } else if (id == R.id.btn_ok) { boolean ret = mCropImageView.saveBitmapToFile(imagePicker.getCropCacheFolder(this), mOutputX, mOutputY, mIsSaveRectangle); if (!ret) { Toast.makeText(this, "裁剪失败,换一张试试", Toast.LENGTH_LONG).show(); } } }
Example 14
Source File: CountFragment.java From AccountBook with GNU General Public License v3.0 | 5 votes |
@OnClick({R.id.ibt_left, R.id.ibt_right}) public void onClick(View view) { switch (view.getId()) { case R.id.ibt_left: // 请求上月数据 mStartDate = DateUtils.getDateNxtMonth(mStartDate, DateUtils.FORMAT_MAIN_TAB, -1); mEndDate = DateUtils.getDateNxtMonth(mStartDate, DateUtils.FORMAT_MAIN_TAB, 1); onRefresh(); break; case R.id.ibt_right:// 请求下月数据 mStartDate = mEndDate; mEndDate = DateUtils.getDateNxtMonth(mStartDate, DateUtils.FORMAT_MAIN_TAB, 1); onRefresh(); break; } }
Example 15
Source File: TimeLocationActivity.java From LocationProvider with Apache License 2.0 | 5 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.bt_location: String time = etTime.getText().toString(); if (TextUtils.isEmpty(time)) { Toast.makeText(getApplicationContext(), "请输入时间", Toast.LENGTH_SHORT).show(); } else { HooweLocationProvider.getInstance().getLocationByTime(TimeUtils.string2Millis(time), new OnLocationUpdatedListener() { @Override public void onReceiveLocation(HooweLocation location) { LocationUtils.displayLocation(location,tvMessage); } @Override public void onReceiveLocation(List<HooweLocation> LocationList) { } @Override public void onLocationTrackerExist() { } @Override public void onLocationTrackerNotRun() { } }); } break; } }
Example 16
Source File: HomeAdapter.java From candybar with Apache License 2.0 | 5 votes |
@Override public void onClick(View view) { int id = view.getId(); if (id == R.id.container) { if (CandyBarApplication.getConfiguration().getOtherApps() != null) { OtherAppsFragment.showOtherAppsDialog(((AppCompatActivity) mContext).getSupportFragmentManager()); return; } String link = mContext.getResources().getString(R.string.google_play_dev); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(link)); intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); mContext.startActivity(intent); } }
Example 17
Source File: CountActivity.java From accountBook with Apache License 2.0 | 5 votes |
/** * 点击底部Text 动态修改ViewPager的内容 */ @Override public void onClick(View v) { switch (v.getId()) { case R.id.item_detail: vp.setCurrentItem(0, true); break; case R.id.item_category_report: vp.setCurrentItem(1, true); break; } }
Example 18
Source File: SettingsFragment.java From MaoWanAndoidClient with Apache License 2.0 | 5 votes |
@Override public void onClick(View view) { switch (view.getId()){ case R.id.tv_quit_login: //退出登录 NormalAlertDialog.getInstance().showAlertDialog(getActivity(), getString(R.string.login_out_text), getString(R.string.login_out_positive_text), getString(R.string.login_out_negative_text), (dialog, which) -> { mPresenter.getSingOut(); }, (dialog, which) -> dialog.dismiss()); break; } }
Example 19
Source File: MainActivity.java From journaldev with MIT License | 5 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.txtSignIn: hideSoftKeyBoard(); showSignInForm(); break; case R.id.txtRegister: hideSoftKeyBoard(); showRegisterForm(); break; } }
Example 20
Source File: MainActivity.java From Android-CountDownTimer with Apache License 2.0 | 4 votes |
@Override public void onClick(View v) { switch (v.getId()){ case R.id.btn_start: switch (timerStatus){ case CountDownTimerUtil.PREPARE: startTimer(); timerStatus = CountDownTimerUtil.START; btnStart.setText("PAUSE"); break; case CountDownTimerUtil.START: timer.cancel(); timerStatus = CountDownTimerUtil.PASUSE; btnStart.setText("RESUME"); break; case CountDownTimerUtil.PASUSE: startTimer(); timerStatus = CountDownTimerUtil.START; btnStart.setText("PAUSE"); break; } break; case R.id.btn_stop: if(timer!=null){ timer.cancel(); initTimerStatus(); mHandler.sendEmptyMessage(1); } break; case R.id.btn_start2: switch (countDownTimerService.getTimerStatus()){ case CountDownTimerUtil.PREPARE: countDownTimerService.startCountDown(); btnServiceStart.setText("PAUSE"); break; case CountDownTimerUtil.START: countDownTimerService.pauseCountDown(); btnServiceStart.setText("RESUME"); break; case CountDownTimerUtil.PASUSE: countDownTimerService.startCountDown(); btnServiceStart.setText("PAUSE"); break; } break; case R.id.btn_stop2: btnServiceStart.setText("START"); countDownTimerService.stopCountDown(); break; } }