com.sdsmdg.tastytoast.TastyToast Java Examples
The following examples show how to use
com.sdsmdg.tastytoast.TastyToast.
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: ProxySettingActivity.java From v9porn with MIT License | 6 votes |
private void doSettingProxy() { if (!isTestSuccess) { showMessage("未有成功测试的代理,无法设置", TastyToast.INFO); return; } presenter.exitTest(); String proxyIpAddress = etDialogProxySettingIpAddress.getIpAddressStr(); String proxyPortStr = etDialogProxySettingPort.getText().toString().trim(); if (TextUtils.isEmpty(proxyPortStr) || !TextUtils.isDigitsOnly(proxyPortStr)) { showMessage("无法设置,代理端口错误,请检查", TastyToast.INFO); return; } int proxyPort = Integer.parseInt(proxyPortStr); //设置开启代理并存储地址和端口号 presenter.setOpenHttpProxy(true); presenter.setProxyIpAddress(proxyIpAddress); presenter.setProxyPort(proxyPort); showMessage("设置成功", TastyToast.SUCCESS); onBackPressed(); }
Example #2
Source File: MainActivity.java From v9porn with MIT License | 6 votes |
@Override public void onSucceed(int requestCode, @NonNull List<String> grantedPermissions) { // 权限申请成功回调。 // 这里的requestCode就是申请时设置的requestCode。 // 和onActivityResult()的requestCode一样,用来区分多个不同的请求。 if (requestCode == permisionCode) { // TODO ... if (AndPermission.hasPermission(MainActivity.this, grantedPermissions)) { if (!file.exists()) { if (!file.mkdirs()) { showMessage("创建下载目录失败了", TastyToast.ERROR); } } } else { AndPermission.defaultSettingDialog(MainActivity.this, permisionReqCode).show(); } } }
Example #3
Source File: MainActivity.java From v9porn with MIT License | 6 votes |
@Override public void onBackPressed() { if (mCurrentFragment instanceof BaseMainFragment && ((BaseMainFragment) mCurrentFragment).onBackPressed()) { return; } showMessage("再次点击退出程序", TastyToast.INFO); long currentTime = Calendar.getInstance().getTimeInMillis(); if (currentTime - lastClickTime > MIN_CLICK_DELAY_TIME) { lastClickTime = currentTime; } else { FileDownloader.getImpl().pauseAll(); FileDownloader.getImpl().unBindService(); //没啥意义 if (!existActivityWithAnimation && !isFinishing()) { super.onBackPressed(); } finishAffinity(); new Handler().postDelayed(() -> { int pid = android.os.Process.myPid(); android.os.Process.killProcess(pid); }, 500); } }
Example #4
Source File: AboutActivity.java From v9porn with MIT License | 6 votes |
private void saveToSystemGallery(final String name, int id) { GlideApp.with(this).downloadOnly().load(id).into(new SimpleTarget<File>() { @Override public void onResourceReady(@NonNull File resource, @Nullable Transition<? super File> transition) { File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), name + ".jpg"); try { FileUtils.copyFile(resource, file); showMessage("保存图片成功了", TastyToast.SUCCESS); notifySystemGallery(file); } catch (IOException e) { e.printStackTrace(); showMessage("保存图片失败了", TastyToast.ERROR); } } }); }
Example #5
Source File: MainActivity.java From v9porn with MIT License | 6 votes |
private void showUpdateDialog(final UpdateVersion updateVersion) { QMUIDialog.MessageDialogBuilder builder = new QMUIDialog.MessageDialogBuilder(this); builder.setTitle("发现新版本--v" + updateVersion.getVersionName()); builder.setMessage(updateVersion.getUpdateMessage()); builder.addAction("立即更新", (dialog, index) -> { dialog.dismiss(); showMessage("开始下载", TastyToast.INFO); Intent intent = new Intent(MainActivity.this, UpdateDownloadService.class); intent.putExtra("updateVersion", updateVersion); startService(intent); }); builder.addAction("稍后更新", (dialog, index) -> dialog.dismiss()); builder.addAction("该版本不再提示", (dialog, index) -> { //保存版本号,用户对于此版本选择了不在提示 presenter.setIgnoreUpdateVersionCode(updateVersion.getVersionCode()); dialog.dismiss(); }); builder.show(); }
Example #6
Source File: BasePlayVideo.java From v9porn with MIT License | 6 votes |
private void favoriteVideo() { if (v9PornItem == null || v9PornItem.getVideoResultId() == 0) { showMessage("还未成功解析视频链接,不能收藏!", TastyToast.INFO); return; } VideoResult videoResult = v9PornItem.getVideoResult(); if (!presenter.isUserLogin()) { goToLogin(KeysActivityRequestResultCode.LOGIN_ACTION_FOR_GET_UID); showMessage("请先登录", TastyToast.SUCCESS); return; } // if (Integer.parseInt(videoResult.getAuthorId()) == presenter.getLoginUserId()) { // showMessage("不能收藏自己的视频", TastyToast.WARNING); // return; // } favoriteDialog.show(); presenter.favorite(String.valueOf(presenter.getLoginUserId()), videoResult.getVideoId(), videoResult.getAuthorId()); }
Example #7
Source File: BasePlayVideo.java From v9porn with MIT License | 6 votes |
private void favoriteVideo() { if (v9PornItem == null || v9PornItem.getVideoResultId() == 0) { showMessage("还未成功解析视频链接,不能收藏!", TastyToast.INFO); return; } VideoResult videoResult = v9PornItem.getVideoResult(); if (!presenter.isUserLogin()) { goToLogin(KeysActivityRequestResultCode.LOGIN_ACTION_FOR_GET_UID); showMessage("请先登录", TastyToast.SUCCESS); return; } // if (Integer.parseInt(videoResult.getAuthorId()) == presenter.getLoginUserId()) { // showMessage("不能收藏自己的视频", TastyToast.WARNING); // return; // } favoriteDialog.show(); //presenter.favorite(String.valueOf(presenter.getLoginUserId()), videoResult.getVideoId(), videoResult.getAuthorId()); presenter.favorite(presenter.getLoginUserId()+"", videoResult.getVideoId(), videoResult.getUvId()); }
Example #8
Source File: KeDouPlayActivity.java From v9porn with MIT License | 6 votes |
@Override public void onVideoRelated(KeDouRelated keDouRelated) { if (keDouRelated == null) return; String videoUrl = keDouRelated.getVideoUrl(); if (TextUtils.isEmpty(videoUrl)) { showMessage("解析视频地址失败",TastyToast.ERROR); if (keDouRelated.isOutOfWatch() && retryCount < 1) { //超出观看限制,再试一次 retryCount++; presenter.videoRelated(mKeDouModel.getContentUrl()); } } else { retryCount = 0; presenter.getRealVideoUrl(videoUrl); } List<KeDouModel> relatedList = keDouRelated.getRelatedList(); mKeDouAdapter.setNewData(relatedList); }
Example #9
Source File: SettingActivity.java From v9porn with MIT License | 6 votes |
/** * 仅仅只需将新地址保存到sp中即可,下次会自动读取 * * @param key key * @param qmuiCommonListItemView qc * @param address address */ private void saveToSpAndUpdateQMUICommonListItemView(String key, QMUICommonListItemView qmuiCommonListItemView, String address) { switch (key) { case AppPreferencesHelper.KEY_SP_PORN_91_VIDEO_ADDRESS: presenter.setPorn9VideoAddress(address); break; case AppPreferencesHelper.KEY_SP_FORUM_91_PORN_ADDRESS: presenter.setPorn9ForumAddress(address); break; case AppPreferencesHelper.KEY_SP_PIG_AV_ADDRESS: presenter.setPavAddress(address); break; case AppPreferencesHelper.KEY_SP_AXGLE_ADDRESS: presenter.setAxgleAddress(address); break; case AppPreferencesHelper.KEY_SP_KE_DOU_WO_ADDRESS: presenter.setKeDouWoAddress(address); break; default: } qmuiCommonListItemView.setDetailText(address); showMessage("设置成功", TastyToast.INFO); testBaseUrl = ""; }
Example #10
Source File: SettingActivity.java From v9porn with MIT License | 6 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.bt_setting_exit_account: showExitDialog(); break; case R.id.setting_item_player_engine_choice: showPlaybackEngineChoiceDialog((QMUICommonListItemView) v); break; case R.id.setting_item_t6y_forum_address: showMessage("暂未支持,敬请期待。", TastyToast.INFO); // showAddressSettingDialog((QMUICommonListItemView) v, ""); break; case R.id.setting_item_google_recaptcha_verify: String address = presenter.getVideo9PornAddress(); if (TextUtils.isEmpty(address)) { showMessage("请先设置9*PORN地址", TastyToast.INFO); return; } Intent intent = new Intent(this, GoogleRecaptchaVerifyActivity.class); startActivityWithAnimation(intent); break; default: } }
Example #11
Source File: MainActivity.java From v9porn with MIT License | 6 votes |
@Override public void onBackPressed() { if (mCurrentFragment instanceof BaseMainFragment && ((BaseMainFragment) mCurrentFragment).onBackPressed()) { return; } showMessage("再次点击退出程序", TastyToast.INFO); long currentTime = Calendar.getInstance().getTimeInMillis(); if (currentTime - lastClickTime > MIN_CLICK_DELAY_TIME) { lastClickTime = currentTime; } else { FileDownloader.getImpl().pauseAll(); FileDownloader.getImpl().unBindService(); //没啥意义 if (!existActivityWithAnimation && !isFinishing()) { super.onBackPressed(); } finishAffinity(); new Handler().postDelayed(() -> { int pid = android.os.Process.myPid(); android.os.Process.killProcess(pid); }, 500); } }
Example #12
Source File: ProxySettingActivity.java From v9porn with MIT License | 6 votes |
private void doSettingProxy() { if (!isTestSuccess) { showMessage("未有成功测试的代理,无法设置", TastyToast.INFO); return; } presenter.exitTest(); String proxyIpAddress = etDialogProxySettingIpAddress.getIpAddressStr(); String proxyPortStr = etDialogProxySettingPort.getText().toString().trim(); if (TextUtils.isEmpty(proxyPortStr) || !TextUtils.isDigitsOnly(proxyPortStr)) { showMessage("无法设置,代理端口错误,请检查", TastyToast.INFO); return; } int proxyPort = Integer.parseInt(proxyPortStr); //设置开启代理并存储地址和端口号 presenter.setOpenHttpProxy(true); presenter.setProxyIpAddress(proxyIpAddress); presenter.setProxyPort(proxyPort); showMessage("设置成功", TastyToast.SUCCESS); onBackPressed(); }
Example #13
Source File: MainActivity.java From v9porn with MIT License | 6 votes |
private void showUpdateDialog(final UpdateVersion updateVersion) { QMUIDialog.MessageDialogBuilder builder = new QMUIDialog.MessageDialogBuilder(this); builder.setTitle("发现新版本--v" + updateVersion.getVersionName()); builder.setMessage(updateVersion.getUpdateMessage()); builder.addAction("立即更新", (dialog, index) -> { dialog.dismiss(); showMessage("开始下载", TastyToast.INFO); Intent intent = new Intent(MainActivity.this, UpdateDownloadService.class); intent.putExtra("updateVersion", updateVersion); startService(intent); }); builder.addAction("稍后更新", (dialog, index) -> dialog.dismiss()); builder.addAction("该版本不再提示", (dialog, index) -> { //保存版本号,用户对于此版本选择了不在提示 presenter.setIgnoreUpdateVersionCode(updateVersion.getVersionCode()); dialog.dismiss(); }); builder.show(); }
Example #14
Source File: SettingActivity.java From v9porn with MIT License | 5 votes |
private boolean checkAddress(String address) { HttpUrl httpUrl = HttpUrl.parse(address); if (httpUrl == null) { showMessage("设置失败,输入地址格式不正确,(不要忘了最后面的“/”)", TastyToast.ERROR); return false; } List<String> pathSegments = httpUrl.pathSegments(); if (!"".equals(pathSegments.get(pathSegments.size() - 1))) { showMessage("设置失败,输入地址格式不正确,(不要忘了最后面的“/”)", TastyToast.ERROR); return false; } return true; }
Example #15
Source File: GoogleRecaptchaVerifyActivity.java From v9porn with MIT License | 5 votes |
@Override public void verifyRecaptchaFailure() { synchronized (lock) { lock.notifyAll(); } showMessage("验证失败了,请检查你的地址和网络后重试", TastyToast.ERROR); hideDialog(); }
Example #16
Source File: AxglePlayActivity.java From v9porn with MIT License | 5 votes |
@Override public void setData(List<AxgleVideo> axgleVideoList) { if (axgleVideoList.size() != 0) { axgleAdapter.setNewData(axgleVideoList); } else { showMessage("没找到相似的视频", TastyToast.INFO); } }
Example #17
Source File: DownloadPresenter.java From v9porn with MIT License | 5 votes |
/** * 连同文件一起删除 * * @param v9PornItem v */ private void deleteWithFile(V9PornItem v9PornItem) { File file = new File(v9PornItem.getDownLoadPath(getCustomDownloadVideoDirPath())); if (file.delete()) { v9PornItem.setDownloadId(0); dataManager.updateV9PornItem(v9PornItem); } else { ifViewAttached(new ViewAction<DownloadView>() { @Override public void run(@NonNull DownloadView view) { view.showMessage("删除文件失败", TastyToast.ERROR); } }); } }
Example #18
Source File: PictureViewerActivity.java From v9porn with MIT License | 5 votes |
private void showSavePictureDialog(final String imageUrl) { QMUIDialog.MenuDialogBuilder builder = new QMUIDialog.MenuDialogBuilder(this); builder.addItem("保存图片", (dialog, which) -> { GlideApp.with(PictureViewerActivity.this).downloadOnly().load(Uri.parse(imageUrl)).into(new SimpleTarget<File>() { @Override public void onResourceReady(@NonNull File resource, @Nullable Transition<? super File> transition) { File filePath = new File(SDCardUtils.DOWNLOAD_IMAGE_PATH); if (!filePath.exists()) { if (!filePath.mkdirs()) { showMessage("创建文件夹失败了", TastyToast.ERROR); return; } } File file = new File(filePath, UUID.randomUUID().toString() + ".jpg"); try { FileUtils.copyFile(resource, file); showMessage("保存图片成功了", TastyToast.SUCCESS); notifySystemGallery(file); } catch (IOException e) { e.printStackTrace(); showMessage("保存图片失败了", TastyToast.ERROR); } } }); dialog.dismiss(); }); builder.show(); }
Example #19
Source File: PhotoImageActivity.java From v9porn with MIT License | 5 votes |
private void showSavePictureDialog( String imageUrl) { final String saveUrl; if (imageUrl.contains("_")){ saveUrl=imgUrl.split("_")[0]; }else { saveUrl=imageUrl; } QMUIDialog.MenuDialogBuilder builder = new QMUIDialog.MenuDialogBuilder(this); builder.addItem("保存原图", (dialog, which) -> { GlideApp.with(PhotoImageActivity.this).downloadOnly().load(Uri.parse(saveUrl)).into(new SimpleTarget<File>() { @Override public void onResourceReady(@NonNull File resource, @Nullable Transition<? super File> transition) { File filePath = new File(SDCardUtils.DOWNLOAD_IMAGE_PATH); if (!filePath.exists()) { if (!filePath.mkdirs()) { showMessage("创建文件夹失败了", TastyToast.ERROR); return; } } File file = new File(filePath, UUID.randomUUID().toString() + ".jpg"); try { FileUtils.copyFile(resource, file); showMessage("保存图片成功了", TastyToast.SUCCESS); notifySystemGallery(file); } catch (IOException e) { e.printStackTrace(); showMessage("保存图片失败了", TastyToast.ERROR); } } }); dialog.dismiss(); }); builder.show(); }
Example #20
Source File: PlayPxgavActivity.java From v9porn with MIT License | 5 votes |
@Override public void playVideo(PxgavVideoParserJsonResult pxgavVideoParserJsonResult) { String url = pxgavVideoParserJsonResult.getFile(); GlideApp.with(context).load(pxgavVideoParserJsonResult.getImage()).into(videoPlayer.getPreviewImageView()); if (TextUtils.isEmpty(url)) { showMessage("播放地址无效", TastyToast.ERROR); return; } myHeaderInjector.getHashMap().put("Referer", pxgavModel.getContentUrl()); myHeaderInjector.addHeaders(url); //String proxyUrl = presenter.getVideoCacheProxyUrl(url); //视频地址已经变了,所有的视频都改成m3u8的格式了,不能缓存了,只能直接播放了 Logger.t(TAG).d("视频地址:"+url); videoPlayer.setVideoURI(Uri.parse(url)); }
Example #21
Source File: ProxySettingActivity.java From v9porn with MIT License | 5 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.bt_proxy_setting_test: if (presenter.isSetPorn91VideoAddress()) { Logger.t(TAG).d("木有设置地址呀"); showNeedSetAddressFirstDialog(); return; } isTestSuccess = false; String proxyIpAddress = etDialogProxySettingIpAddress.getIpAddressStr(); String portStr = etDialogProxySettingPort.getText().toString().trim(); if (TextUtils.isEmpty(portStr) || TextUtils.isEmpty(proxyIpAddress) || !TextUtils.isDigitsOnly(portStr)) { showMessage("端口号或IP地址不正确", TastyToast.WARNING); return; } int proxyPort = Integer.parseInt(portStr); presenter.testProxy(proxyIpAddress, proxyPort); QMUIKeyboardHelper.hideKeyboard(v); break; case R.id.bt_proxy_setting_reset: etDialogProxySettingIpAddress.setIpAddressStr(""); etDialogProxySettingPort.setText(""); View view = getCurrentFocus(); if (view instanceof AppCompatEditText || view instanceof EditText) { QMUIKeyboardHelper.showKeyboard((EditText) view, QMUIKeyboardHelper.SHOW_KEYBOARD_DELAY_TIME); } break; default: } }
Example #22
Source File: SettingActivity.java From v9porn with MIT License | 5 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.bt_setting_exit_account: showExitDialog(); break; case R.id.setting_item_player_engine_choice: showPlaybackEngineChoiceDialog((QMUICommonListItemView) v); break; case R.id.setting_item_t6y_forum_address: showMessage("暂未支持,敬请期待。", TastyToast.INFO); // showAddressSettingDialog((QMUICommonListItemView) v, ""); break; case R.id.setting_item_google_recaptcha_verify: String address = presenter.getVideo9PornAddress(); if (TextUtils.isEmpty(address)) { showMessage("请先设置9*PORN地址", TastyToast.INFO); return; } Intent intent = new Intent(this, GoogleRecaptchaVerifyActivity.class); startActivityWithAnimation(intent); break; default: } }
Example #23
Source File: MainActivity.java From v9porn with MIT License | 5 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == permisionReqCode) { if (!AndPermission.hasPermission(MainActivity.this, permission)) { showMessage("你拒绝了读写存储卡权限,这将影响下载视频等功能!", TastyToast.WARNING); } } if (mCurrentFragment != null) { mCurrentFragment.onActivityResult(requestCode, resultCode, data); } }
Example #24
Source File: UserRegisterActivity.java From v9porn with MIT License | 5 votes |
private void register(String username, String email, String passwordOne, String passwordTwo, String captcha) { if (TextUtils.isEmpty(username)) { showMessage("用户名不能为空", TastyToast.INFO); return; } //服务器根本不会验证邮箱格式,貌似只要有@符号和.就可以通过注册了,不过如果后期验证邮箱.... if (TextUtils.isEmpty(email)) { showMessage("邮箱不能为空", TastyToast.INFO); return; } if (TextUtils.isEmpty(passwordOne)) { showMessage("密码不能为空", TastyToast.INFO); return; } if (TextUtils.isEmpty(passwordTwo)) { showMessage("确认密码不能为空", TastyToast.INFO); return; } if (TextUtils.isEmpty(captcha)) { showMessage("验证码不能为空", TastyToast.INFO); return; } if (!passwordOne.equals(passwordTwo)) { showMessage("密码不一致,请检查", TastyToast.INFO); return; } QMUIKeyboardHelper.hideKeyboard(getCurrentFocus()); presenter.register(username, passwordOne, passwordTwo, email, captcha); }
Example #25
Source File: PictureViewerActivity.java From v9porn with MIT License | 5 votes |
private void showSavePictureDialog(final String imageUrl) { QMUIDialog.MenuDialogBuilder builder = new QMUIDialog.MenuDialogBuilder(this); builder.addItem("保存图片", (dialog, which) -> { GlideApp.with(PictureViewerActivity.this).downloadOnly().load(Uri.parse(imageUrl)).into(new SimpleTarget<File>() { @Override public void onResourceReady(@NonNull File resource, @Nullable Transition<? super File> transition) { File filePath = new File(SDCardUtils.DOWNLOAD_IMAGE_PATH); if (!filePath.exists()) { if (!filePath.mkdirs()) { showMessage("创建文件夹失败了", TastyToast.ERROR); return; } } File file = new File(filePath, UUID.randomUUID().toString() + ".jpg"); try { FileUtils.copyFile(resource, file); showMessage("保存图片成功了", TastyToast.SUCCESS); notifySystemGallery(file); } catch (IOException e) { e.printStackTrace(); showMessage("保存图片失败了", TastyToast.ERROR); } } }); dialog.dismiss(); }); builder.show(); }
Example #26
Source File: BaseAppCompatActivity.java From v9porn with MIT License | 5 votes |
protected void showMessage(String msg, int type) { //因为时在onDestroy 才取消的请求,初步断定又可能就是在那么微妙的一瞬间发生了 //android.view.WindowManager$BadTokenException · Unable to add window -- token android.os.BinderProxy@53d6ca9 is not valid; is your activity running? 如果activity正在销毁则可能引发 if (!isFinishing()) { TastyToast.makeText(getApplicationContext(), msg, TastyToast.LENGTH_SHORT, type).show(); } }
Example #27
Source File: GoogleRecaptchaVerifyActivity.java From v9porn with MIT License | 5 votes |
@Override public void needVerifyRecaptcha(String html) { if (loadVerifyPageDialog != null && !loadVerifyPageDialog.isShowing()) { loadVerifyPageDialog.show(); } showMessage("加载验证网页中,请稍候", TastyToast.INFO); webView.loadDataWithBaseURL(presenter.getBaseAddress(), html, "text/html", "UTF-8", null); }
Example #28
Source File: CommentFragment.java From v9porn with MIT License | 5 votes |
@Override public void replyVideoCommentSuccess(String message) { cleanVideoCommentInput(); isComment = true; etCommentVideo.setHint(R.string.comment_video_hint_tip); videoCommentAdapter.setClickPosition(-1); reFreshData(v9PornItem); showMessage(message, TastyToast.SUCCESS); }
Example #29
Source File: BasePlayVideo.java From v9porn with MIT License | 5 votes |
@Override public void errorParseVideoUrl(String errorMessage) { dismissDialog(); helper.showError(); LoadHelperUtils.setErrorText(helper.getLoadError(), R.id.tv_error_text, "解析视频地址失败了,点击重试"); showMessage(errorMessage, TastyToast.ERROR); }
Example #30
Source File: SettingActivity.java From v9porn with MIT License | 5 votes |
@Override public void testNewAddressSuccess(String message, QMUICommonListItemView qmuiCommonListItemView, String key) { isTestSuccess = true; dismissDialog(); showMessage(message, TastyToast.SUCCESS); showAddressSettingDialog(qmuiCommonListItemView, key); }