@Click({R.id.btn_create_obj}) protected void createOBJ() { if (mCurrentImgPath == null) { Toast.makeText(BuildMaskActivity.this, "没有找到人脸图片", Toast.LENGTH_SHORT).show(); return; } String objDir = OBJUtils.getModelDir(); String objName = FileUtils.getMD5(mCurrentImgPath); String objPath = objDir + objName + "_obj"; File file = new File(objPath); if (!file.exists()) { OBJUtils.createObjFile(BuildMaskActivity.this, mCurrentImgPath); Toast.makeText(BuildMaskActivity.this, "Done!", Toast.LENGTH_SHORT).show(); } else { DialogUtils.showDialog(this, "该人脸OBJ文件已存在", "是否重新生成?", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { OBJUtils.createObjFile(BuildMaskActivity.this, mCurrentImgPath); } }); } }
@Click(R.id.donate) void showDonateMeDialog() { new ThemeColorMaterialDialogBuilder(this) .title(R.string.text_donate) .items("支付宝") .itemsCallback(new MaterialDialog.ListCallback() { @Override public void onSelection(MaterialDialog dialog, View itemView, int position, CharSequence text) { if (position == 0) { if (AlipayZeroSdk.hasInstalledAlipayClient(AboutActivity.this)) { AlipayZeroSdk.startAlipayClient(AboutActivity.this, "aex04370fwjf8angrv1te9e"); } else { Toast.makeText(AboutActivity.this, "未安装支付宝", Toast.LENGTH_SHORT).show(); } } } }) .show(); }
@Click(R.id.donate) void showDonateMeDialog() { new ThemeColorMaterialDialogBuilder(this) .title(R.string.donate) .items("支付宝") .itemsCallback(new MaterialDialog.ListCallback() { @Override public void onSelection(MaterialDialog dialog, View itemView, int position, CharSequence text) { if (position == 0) { if (AlipayZeroSdk.hasInstalledAlipayClient(AboutActivity.this)) { AlipayZeroSdk.startAlipayClient(AboutActivity.this, "aex04370fwjf8angrv1te9e"); } else { Toast.makeText(AboutActivity.this, "未安装支付宝", Toast.LENGTH_SHORT).show(); } } } }) .show(); }
@Click(R.id.login_btn) void login() { if (!checkIsOK()) { return; } UserService.getInstance() .login(accountTextInputLayout.getEditText().getText().toString(), passwordTextInputLayout.getEditText().getText().toString()) .doOnError(error -> { String message = error.getMessage(); if (message == null) message = getString(R.string.login_fail); Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show(); }) .subscribe(tokenCommonResponse -> { Toast.makeText(getApplicationContext(), R.string.login_success, Toast.LENGTH_SHORT).show(); finish(); }); }
/** * 检查更新 */ @Click(R.id.rl_checkUpdate) void checkUpdate() { UmengUpdateAgent.forceUpdate(getActivity()); UmengUpdateAgent.setUpdateListener(new UmengUpdateListener() { @Override public void onUpdateReturned(int updateStatus, UpdateResponse updateInfo) { switch (updateStatus) { case UpdateStatus.Yes: // has update UmengUpdateAgent.showUpdateDialog(getActivity(), updateInfo); break; case UpdateStatus.No: // has no update ToastUtil.showToast(getActivity(), "当前已是最新版本"); break; case UpdateStatus.NoneWifi: // none wifi // 注意:我已经在MainActivity中设置,更新时忽略只在WIFE下更新,所以这个状态暂时没用 ToastUtil.showToast(getActivity(), "没有wifi连接,只在wifi下更新"); break; case UpdateStatus.Timeout: // time out ToastUtil.showToast(getActivity(), "请求超时,请检查网络"); break; } } }); }
/** * 提款 */ @Click(R.id.btn_payment) void prePayment() { String payee = tv_payee.getText().toString(); String receive_bank = tv_receive_bank.getText().toString().trim(); String bankAccount = tv_bankAccount.getText().toString().trim(); String pay_amount = tv_pay_amount.getText().toString().trim(); if (TextUtils.isEmpty(payee)) { ToastUtil.showToast(this, "请输入收款单位"); } else if (TextUtils.isEmpty(receive_bank)) { ToastUtil.showToast(this, "请输入收款银行"); } else if (TextUtils.isEmpty(bankAccount)) { ToastUtil.showToast(this, "请输入银行账号"); } else if (TextUtils.isEmpty(pay_amount)) { ToastUtil.showToast(this, "请输入支付金额"); } else if (Double.valueOf(pay_amount) > generalAccount) { ToastUtil.showToast(this, "支付金额超过普通账户余额"); } else { pDialog = new SweetAlertDialog(T_PaymentActivity.this, SweetAlertDialog.PROGRESS_TYPE).setTitleText("正在提款..."); pDialog.setCancelable(false); pDialog.show(); payment(payee, receive_bank, bankAccount, pay_amount); } }
@Click(R.id.floatingMenuButton) void OnFloatButtonClick() { final AlertDialog.Builder builder2 = new AlertDialog.Builder(this.getContext()); builder2.setTitle("Main menu") .setItems(new String[] {"Paste", "Disconnect"}, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: moveCopyRemote(); break; case 1: actionListener.OnWaitStart(); ssh.setConnectDisabled(true); break; } dialog.dismiss(); } }); builder2.create().show(); }
@Click(R.id.btn_notice) void clickNotice() { String receiptDate = tv_receiptDate.getText().toString().trim(); String foreignName = tv_foreignName.getText().toString().trim(); if (TextUtils.isEmpty(receiptDate)) { ToastUtil.showToast(this, "请选择付汇日期"); } else if (TextUtils.isEmpty(receiptTypeValue)) { ToastUtil.showToast(this, "请选择付汇类型"); } else if (TextUtils.isEmpty(foreignName)) { ToastUtil.showToast(this, "请选择外商"); } else { String saleOrder = tv_saleOrder.getText().toString().trim(); String receiptBank = et_receiptBank.getText().toString().trim(); String currency = tv_currency.getText().toString().trim(); String amount = et_amount.getText().toString().trim(); String customerRemark = et_customerRemark.getText().toString().trim(); pDialog = new SweetAlertDialog(T_NewNoticeForeignExchangeActivity.this, SweetAlertDialog.PROGRESS_TYPE).setTitleText("正在创建水单通知..."); pDialog.setCancelable(false); pDialog.show(); notice(receiptDate, foreignName, receiptTypeValue, saleOrder, receiptBank, currency, amount, customerRemark); } }
@Click(R.id.fabRec) void clickRec() { if(!isInitRecorder) { isInitRecorder = true; mAudioFile = new File( Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "lecrec" + File.separator + System.nanoTime() + ".file.m4a"); mAudioRecorder.prepareRecord(MediaRecorder.AudioSource.MIC, MediaRecorder.OutputFormat.MPEG_4, MediaRecorder.AudioEncoder.AAC, mAudioFile); } if(!isRecording) { isRecording = true; startTimer(); mAudioRecorder.startRecord(); fabRec.setBackgroundTintList(ColorStateList.valueOf(getResources().getColor(R.color.colorPrimary))); fabRec.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_stop_white_24dp)); } else { isRecording = false; stopTimer(); fabRec.setVisibility(View.INVISIBLE); mAudioRecorder.stopRecord(); convertToWav(); } }
@Click(R.id.register) void login() { String email = mEmail.getText().toString(); String userName = mUserName.getText().toString(); String password = mPassword.getText().toString(); if (!validateInput(email, userName, password)) { return; } MaterialDialog dialog = new MaterialDialog.Builder(this) .progress(true, 0) .content(R.string.text_registering) .cancelable(false) .show(); UserService.getInstance().register(email, userName, password) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(response -> { dialog.dismiss(); onRegisterResponse(response.string()); } , error -> { dialog.dismiss(); mPassword.setError(NodeBB.getErrorMessage(error, RegisterActivity.this, R.string.text_register_fail)); }); }
@Click(R.id.login) void login() { String userName = mUserName.getText().toString(); String password = mPassword.getText().toString(); if (!checkNotEmpty(userName, password)) { return; } MaterialDialog dialog = new MaterialDialog.Builder(this) .progress(true, 0) .content(R.string.text_logining) .cancelable(false) .show(); UserService.getInstance().login(userName, password) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(response -> { dialog.dismiss(); Toast.makeText(getApplicationContext(), R.string.text_login_succeed, Toast.LENGTH_SHORT).show(); finish(); } , error -> { dialog.dismiss(); mPassword.setError(NodeBB.getErrorMessage(error, LoginActivity.this, R.string.text_login_fail)); }); }
@Click(R.id.icon) void lol() { mLolClickCount++; Toast.makeText(this, R.string.text_lll, Toast.LENGTH_LONG).show(); if (mLolClickCount >= 5) { crashTest(); } }
@Click(R.id.stop_all_running_scripts) void stopAllRunningScripts() { int n = AutoJs.getInstance().getScriptEngineService().stopAll(); if (n > 0) Snackbar.make(getView(), String.format(getString(R.string.text_already_stop_n_scripts), n), Snackbar.LENGTH_SHORT).show(); else Snackbar.make(getView(), R.string.text_no_running_script, Snackbar.LENGTH_SHORT).show(); }
@Click(R.id.exit) public void exitCompletely() { HoverMenuManger.hideHoverMenu(); stopService(new Intent(this, FloatyService.class)); AutoJs.getInstance().getScriptEngineService().stopAll(); finish(); }
@Click({R.id.btn_load_face}) protected void launchGallery() { Toast.makeText(BuildMaskActivity.this, "选择一张人脸图片", Toast.LENGTH_SHORT).show(); Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(galleryIntent, RESULT_LOAD_IMG); }
@Click({R.id.btn_swap_face}) protected void swapFaceAndCreateNewTexture() { if (mCurrentImgPath == null) { Toast.makeText(BuildMaskActivity.this, "没有找到人脸图片", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(BuildMaskActivity.this, "选择替换的人脸图片", Toast.LENGTH_SHORT).show(); Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(galleryIntent, RESULT_FOR_SWAP); } }
@Click({R.id.top_bar_linear_back,R.id.btn_one,R.id.btn_two,R.id.btn_three,R.id.btn_four ,R.id.btn_five,R.id.btn_six,R.id.btn_seven}) public void clickButton(View view){ switch (view.getId()){ case R.id.top_bar_linear_back: this.finish(); break; case R.id.btn_one: openActivity(RecyclerViewTestActivity.class); break; case R.id.btn_two: openActivity(RecyclerGalleryActivity.class); break; case R.id.btn_three: Intent mIntent=new Intent(this,RecyclerViewAAActivity_.class); this.startActivity(mIntent); break; case R.id.btn_four: Intent refreshIntent=new Intent(this,RecyclerRefreshActivity.class); this.startActivity(refreshIntent); break; case R.id.btn_five: Intent fiveIntent=new Intent(this,RecyclerFootActivity.class); this.startActivity(fiveIntent); break; case R.id.btn_six: Intent sixIntent=new Intent(this,ComInstanceActivity.class); this.startActivity(sixIntent); break; case R.id.btn_seven: Intent sevenIntent=new Intent(this,AdvanceComInstanceActivity.class); this.startActivity(sevenIntent); break; } }
@Click(R.id.avatar) void showUserDetail() { if (mUserService.isLoggedIn()) { //mUserService.logout(); //Toast.makeText(getActivity(), R.string.logout_success, Toast.LENGTH_SHORT).show(); startActivity(new Intent(getActivity(), UserProfileActivity_.class)); } else { LoginActivity_.intent(this).start(); } }
/** * 缓存清理 * 使用Volley会产生请求数据的缓存:这时 data/data/xxx.xxx.xxx/cach目录下会产生 volley和org.chrominum.android_webview 两个文件夹,里面是缓存数据 * 需要清理 */ @Click(R.id.rl_clear_cache) void clearCache() { try { DataCleanUtil.cleanInternalCache(getContext()); String cacheSize = DataCleanUtil.getCacheSize(getContext().getCacheDir()); tv_cache.setText(cacheSize); } catch (Exception e) { e.printStackTrace(); } }
/** * 操作电话号码:委托人 */ @Click(R.id.tv_orderDelivery_businessEnterpriseContactTelephone) void createWeituoren() { if (!TextUtils.isEmpty(businessEnterpriseContactTelephone)) { callNumber(businessEnterpriseContactTelephone); } }
/** * 货代:拨打给司机 */ @Click(R.id.tv_deliveryCarDriverTelephone) void callCarDriver() { String deliveryCarDriverTelephone = tv_deliveryCarDriverTelephone.getText().toString().trim(); if (!TextUtils.isEmpty(deliveryCarDriverTelephone)) { callNumber(deliveryCarDriverTelephone); } }
@Click(R.id.buttonDelete) void OnDeleteClick() { Intent resultIntent = new Intent(); resultIntent.putExtra("id", id); setResult(2, resultIntent); finish(); }
@Click(R.id.select_source) void selectSourceFilePath() { String initialDir = new File(mSourcePath.getText().toString()).getParent(); new FileChooserDialogBuilder(this) .title(R.string.text_source_file_path) .dir(initialDir == null ? StorageFileProvider.DEFAULT_DIRECTORY_PATH : initialDir) .justScriptFile() .singleChoice(file -> mSourcePath.setText(file.getPath())) .show(); }
@Click(R.id.buttonCancel) void OnCancelClick() { Intent resultIntent = new Intent(); resultIntent.putExtra("id", id); setResult(0, resultIntent); finish(); }
@Click(R.id.fab) void buildApk() { if (!ApkBuilderPluginHelper.checkPlugin(this)) { Toast.makeText(this, R.string.text_apk_builder_plugin_unavailable, Toast.LENGTH_SHORT).show(); return; } if (!checkInputs()) { return; } doBuildingApk(); }
/** * 确认修改 */ @Click(R.id.btn_ensure_modify) void modifyPassword() { DeviceUtil.hideSoft(this, et_ensure_new_password); originalPassword = et_original_password.getText().toString().trim(); newPassword = et_new_password.getText().toString().trim(); onBackgrounds(); }
/** * 登录 */ @Click(R.id.btn_login) void login() { DeviceUtil.hideSoft(this, et_password); if (NetUtil.isNetworkConnected(this)) { name = tv_user_name.getText().toString().trim(); pwd = et_password.getText().toString().trim(); showProgressDialog(); onBackgrounds(); } else { ToastUtil.showToast(this, "网络连接不可用,请检查网络"); } }
@Click(R.id.cleanCacheButton) void onClearCacheButtonClick() { try { Utils.cleanVideoCacheDir(this); } catch (IOException e) { Log.e(null, "Error cleaning cache", e); Toast.makeText(this, "Error cleaning cache", Toast.LENGTH_LONG).show(); } }
@Click(R.id.lock) void lockClicked() { if (lockSwitch.isChecked()) AppLockService.start(this); else AppLockService.stop(this); setAppLocked(lockSwitch.isChecked()); }
@Click(R.id.forgot_password) void forgotPassword() { WebActivity_.intent(this) .extra(WebActivity.EXTRA_URL, NodeBB.BASE_URL + "reset") .extra(Intent.EXTRA_TITLE, getString(R.string.text_reset_password)) .start(); }
@Click(R.id.select_output) void selectOutputDirPath() { String initialDir = new File(mOutputPath.getText().toString()).exists() ? mOutputPath.getText().toString() : StorageFileProvider.DEFAULT_DIRECTORY_PATH; new FileChooserDialogBuilder(this) .title(R.string.text_output_apk_path) .dir(initialDir) .chooseDir() .singleChoice(dir -> mOutputPath.setText(dir.getPath())) .show(); }
@Click(R.id.key_delete) void deleteKey() { deleteKey.onNext(null); if (index > 3) index = 3; if (index < 0) index = 0; index--; }
@Click({R.id.btn_load_obj}) protected void showMaskModel() { if (mCurrentImgPath == null) { Toast.makeText(BuildMaskActivity.this, "没有找到人脸图片", Toast.LENGTH_SHORT).show(); } else { Intent intent = new Intent(this, ShowMaskActivity.class); intent.putExtra(ShowMaskActivity.IMG_KEY, mCurrentImgPath); startActivity(intent); } }
@Click(R.id.avatar) void loginOrShowUserInfo() { UserService.getInstance() .me() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe((user -> WebActivity_.intent(this) .extra(WebActivity.EXTRA_URL, NodeBB.url("user/" + user.getUserslug())) .extra(Intent.EXTRA_TITLE, user.getUsername()) .start()), error -> LoginActivity_.intent(getActivity()).start()); }
@Click(R.id.exit) public void exitCompletely() { finish(); FloatyWindowManger.hideCircularMenu(); stopService(new Intent(this, FloatyService.class)); AutoJs.getInstance().getScriptEngineService().stopAll(); }
@Click(R.id.disposable_task_time_container) void showDisposableTaskTimePicker() { LocalTime time = TIME_FORMATTER.parseLocalTime(mDisposableTaskTime.getText().toString()); new TimePickerDialog(this, (view, hourOfDay, minute) -> mDisposableTaskTime.setText(TIME_FORMATTER.print(new LocalTime(hourOfDay, minute))), time.getHourOfDay(), time.getMinuteOfHour(), true) .show(); }
@Click(R.id.undo) void undo() { Command command = new Command(Command.CommandEnum.UNDO); mEditorDelegate.doCommand(command); }
@Click(R.id.redo) void redo() { Command command = new Command(Command.CommandEnum.REDO); mEditorDelegate.doCommand(command); }
@Click(R.id.save) void saveFile() { saveFile(false, null); }