Java Code Examples for com.blankj.utilcode.util.ToastUtils#showShort()
The following examples show how to use
com.blankj.utilcode.util.ToastUtils#showShort() .
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: PlayerManagerActivity.java From DanDanPlayForAndroid with MIT License | 6 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == SELECT_DANMU) { if (resultCode == RESULT_OK) { BindResourceBean bindResourceBean = data.getParcelableExtra("bind_data"); if (bindResourceBean != null) { danmuPath = bindResourceBean.getDanmuPath(); episodeId = bindResourceBean.getEpisodeId(); } } if (TextUtils.isEmpty(videoPath)) { ToastUtils.showShort("解析视频地址失败"); errorTv.setVisibility(View.VISIBLE); } else { launchPlayerActivity(); } } }
Example 2
Source File: BaseActivity.java From YCAudioPlayer with Apache License 2.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { if (BaseConfig.INSTANCE.isNight()) { setTheme(getDarkTheme()); } super.onCreate(savedInstanceState); setContentView(getContentView()); ButterKnife.bind(this); //避免切换横竖屏 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); StateAppBar.setStatusBarColor(this,R.color.redTab); if (mPresenter != null){ mPresenter.subscribe(); } initView(); initListener(); if(!NetworkUtils.isConnected()){ ToastUtils.showShort("请检查网络是否连接"); } initData(); }
Example 3
Source File: LoginActivity.java From DanDanPlayForAndroid with MIT License | 6 votes |
private void login() { String userName = accountEt.getText().toString(); String password = passwordEt.getText().toString(); if (StringUtils.isEmpty(userName)) { ToastUtils.showShort("用户名不能为空"); } else if (StringUtils.isEmpty(password)) { ToastUtils.showShort("密码不能为空"); } else { LoginParam param = new LoginParam(); param.setUserName(userName); param.setPassword(password); param.setAppId(SoUtils.getInstance().getDanDanAppId()); param.setUnixTimestamp(System.currentTimeMillis() / 1000); param.buildHash(this); presenter.login(param); } }
Example 4
Source File: WebViewActivity.java From DanDanPlayForAndroid with MIT License | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: WebViewActivity.this.finish(); break; case R.id.select_url: if (!StringUtils.isEmpty(mWebView.getUrl())) { Intent intent = getIntent(); intent.putExtra("selectUrl", mWebView.getUrl()); setResult(RESULT_OK, intent); WebViewActivity.this.finish(); } else { ToastUtils.showShort("url不能为空"); } break; } return super.onOptionsItemSelected(item); }
Example 5
Source File: ResetPasswordParam.java From DanDanPlayForAndroid with MIT License | 6 votes |
public void buildHash(Context context) { if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(email) || StringUtils.isEmpty(appId) || unixTimestamp == 0){ LogUtils.e("注册信息错误"); ToastUtils.showShort("注册信息错误"); }else { String builder = this.appId + this.email + this.unixTimestamp + this.userName + SoUtils.getInstance().getDanDanAppSecret(); hash = EncryptUtils.encryptMD5ToString(builder); } }
Example 6
Source File: VideoScanFragment.java From DanDanPlayForAndroid with MIT License | 5 votes |
public void addPath(String path){ for (ScanFolderBean bean : folderList){ if (path.contains(bean.getFolder())){ ToastUtils.showShort("已在扫描范围内"); return; } } presenter.addScanFolder(path, isScanType); }
Example 7
Source File: AnimeDetailActivity.java From DanDanPlayForAndroid with MIT License | 5 votes |
@OnClick({R.id.anime_image_iv, R.id.select_episode_tv, R.id.exit_select_iv, R.id.anime_follow_iv}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.anime_image_iv: if (animeDetailBean != null) { Intent intent = new Intent(AnimeDetailActivity.this, ImagePreviewActivity.class); intent.putExtra("image_url", animeDetailBean.getBangumi().getImageUrl()); startActivity(intent); } break; case R.id.select_episode_tv: scrollableLayout.setHeadCount(1); selectEpisodeLl.setVisibility(View.VISIBLE); normalEpisodeLL.setVisibility(View.GONE); recommendAllLL.setVisibility(View.GONE); break; case R.id.exit_select_iv: scrollableLayout.setHeadCount(2); selectEpisodeLl.setVisibility(View.GONE); recommendAllLL.setVisibility(View.VISIBLE); normalEpisodeLL.setVisibility(View.VISIBLE); break; case R.id.anime_follow_iv: if (AppConfig.getInstance().isLogin()) { if (isFavorite) { presenter.followCancel(animeId); } else { presenter.followConfirm(animeId); } } else { ToastUtils.showShort(R.string.anime_detail_not_login_hint); } break; } }
Example 8
Source File: NetworkKit.java From DoraemonKit with Apache License 2.0 | 5 votes |
@Override public void onClick(Context context) { if (!DokitPluginConfig.SWITCH_DOKIT_PLUGIN) { ToastUtils.showShort(DokitUtil.getString(R.string.dk_plugin_close_tip)); return; } if (!DokitPluginConfig.SWITCH_NETWORK) { ToastUtils.showShort(DokitUtil.getString(R.string.dk_plugin_network_close_tip)); return; } startUniversalActivity(context, FragmentIndex.FRAGMENT_NETWORK_MONITOR); }
Example 9
Source File: FileOperator.java From Pixiv-Shaft with MIT License | 5 votes |
@Override public void clearAll() { if (FileUtils.delete(PathUtils.getInternalAppCachePath())) { ToastUtils.showShort("清除成功!"); } else { ToastUtils.showShort("清除失败!"); } }
Example 10
Source File: AnimeDetailActivity.java From DanDanPlayForAndroid with MIT License | 5 votes |
@Override public void afterFollow(boolean isFollow) { if (isFollow) { isFavorite = true; animeFollowIv.setImageResource(R.mipmap.ic_follow_yes); ToastUtils.showShort("关注成功"); } else { isFavorite = false; animeFollowIv.setImageResource(R.mipmap.ic_follow_no); ToastUtils.showShort("取消关注成功"); } }
Example 11
Source File: QPMRAnalysisManager.java From QPM with Apache License 2.0 | 5 votes |
@Deprecated public void analysis(final String packageName, final int pid, final String data) { if (!initialized || this.packageName == null || !this.packageName.equals(packageName)) { return; } if (pid == lastPid) { return; } QPMCallBackManager callBackManager = QPMCallBackManager.getInstance(); if (pid == -1) { ToastUtils.showShort("被测应用已打开:pid=" + pid); this.pid = pid; jmgtrAnalysisResult.otherInfo.pId = pid; callBackManager.refreshInfo(IAnalysisCallback.TYPE_REFRESH_PID, jmgtrAnalysisResult); } else if (pid != jmgtrAnalysisResult.otherInfo.pId) { ToastUtils.showShort("被测应用已重启:pid=" + pid); this.pid = pid; init(); jmgtrAnalysisResult.otherInfo.pId = pid; callBackManager.refreshInfo(IAnalysisCallback.TYPE_REFRESH_PID, jmgtrAnalysisResult); } if (jmgtrAnalysisResult.otherInfo.pId != -1) { jmgtrAnalysisResult.otherInfo.pId = pid; } }
Example 12
Source File: AnimeSeasonActivity.java From DanDanPlayForAndroid with MIT License | 4 votes |
@Override public void showError(String message) { ToastUtils.showShort(message); }
Example 13
Source File: AppActivity.java From Android-UtilCode with Apache License 2.0 | 4 votes |
@Override public void onWidgetClick(View view) { switch (view.getId()) { case R.id.btn_install_app: if (AppUtils.isInstallApp(Config.TEST_PKG)) { ToastUtils.showShort(R.string.app_install_tips); } else { AppUtils.installApp(Config.getTestApkPath(), "com.blankj.androidutilcode.provider"); } break; case R.id.btn_install_app_silent: new Thread(new Runnable() { @Override public void run() { if (AppUtils.isInstallApp(Config.TEST_PKG)) { ToastUtils.showShortSafe(R.string.app_install_tips); } else { if (AppUtils.installAppSilent(Config.getTestApkPath())) { ToastUtils.showShortSafe(R.string.install_successfully); } else { ToastUtils.showShortSafe(R.string.install_unsuccessfully); } } } }).start(); break; case R.id.btn_uninstall_app: if (AppUtils.isInstallApp(Config.TEST_PKG)) { AppUtils.uninstallApp(Config.TEST_PKG); } else { ToastUtils.showShort(R.string.app_uninstall_tips); } break; case R.id.btn_uninstall_app_silent: if (AppUtils.isInstallApp(Config.TEST_PKG)) { if (AppUtils.uninstallAppSilent(Config.TEST_PKG, false)) { ToastUtils.showShort(R.string.uninstall_successfully); } else { ToastUtils.showShort(R.string.uninstall_unsuccessfully); } } else { ToastUtils.showShort(R.string.app_uninstall_tips); } break; case R.id.btn_launch_app: AppUtils.launchApp(this.getPackageName()); break; case R.id.btn_get_app_details_settings: AppUtils.getAppDetailsSettings(); break; } }
Example 14
Source File: NodeActivity.java From V2EX with GNU General Public License v3.0 | 4 votes |
@OnClick(R.id.fb_follow) public void follow(){ ToastUtils.showShort("follow"); }
Example 15
Source File: TaskDownloadingDetailDialog.java From DanDanPlayForAndroid with MIT License | 4 votes |
@OnClick({R.id.dialog_cancel_iv, R.id.path_tv, R.id.magnet_tv, R.id.delete_tv}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.dialog_cancel_iv: TaskDownloadingDetailDialog.this.dismiss(); break; case R.id.path_tv: String path = pathTv.getText().toString(); ClipboardManager clipboardManagerPath = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE); ClipData mClipDataPath = ClipData.newPlainText("Label", path); if (clipboardManagerPath != null) { clipboardManagerPath.setPrimaryClip(mClipDataPath); ToastUtils.showShort("已复制路径:" + path); } break; case R.id.magnet_tv: String magnet = magnetTv.getText().toString(); ClipboardManager clipboardManagerMagnet = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE); ClipData mClipDataMagnet = ClipData.newPlainText("Label", magnet); if (clipboardManagerMagnet != null) { clipboardManagerMagnet.setPrimaryClip(mClipDataMagnet); ToastUtils.showShort("已复制Magnet:" + magnet); } break; case R.id.delete_tv: new CommonDialog.Builder(context) .setAutoDismiss() .showExtra() .setOkListener(dialog -> { TaskDownloadingDetailDialog.this.dismiss(); taskManageListener.deleteTask(taskStateBean.getTorrentHash(), false); }) .setExtraListener(dialog -> { TaskDownloadingDetailDialog.this.dismiss(); taskManageListener.deleteTask(taskStateBean.getTorrentHash(), true); }) .build() .show("确认删除任务?", "删除任务和文件"); break; } }
Example 16
Source File: BindZimuActivity.java From DanDanPlayForAndroid with MIT License | 4 votes |
@Override public void showError(String message) { ToastUtils.showShort(message); }
Example 17
Source File: ToastActivity.java From Android-UtilCode with Apache License 2.0 | 4 votes |
@Override public void onWidgetClick(View view) { switch (view.getId()) { case R.id.btn_toggle_location: if (isDefaultLocation) { ToastUtils.setGravity(Gravity.CENTER, 0, 0); } else { ToastUtils.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, getResources().getDimensionPixelSize(R.dimen.offset_64)); } isDefaultLocation = !isDefaultLocation; break; case R.id.btn_toggle_view: if (isDefaultView) { ToastUtils.setView(R.layout.toast_custom); } else { ToastUtils.setView(null); } isDefaultView = !isDefaultView; break; case R.id.btn_show_short_toast_safe: new Thread(new Runnable() { @Override public void run() { ToastUtils.showShortSafe(R.string.toast_short_safe); } }).start(); break; case R.id.btn_show_long_toast_safe: new Thread(new Runnable() { @Override public void run() { ToastUtils.showLongSafe(R.string.toast_long_safe); } }).start(); break; case R.id.btn_show_short_toast: ToastUtils.showShort(R.string.toast_short); break; case R.id.btn_show_long_toast: ToastUtils.showShort(R.string.toast_long); break; case R.id.btn_cancel_toast: ToastUtils.cancel(); break; } tvAboutToast.setText("is default location: " + isDefaultLocation + "\nis default view: " + isDefaultView ); }
Example 18
Source File: BookDetailActivity.java From youqu_master with Apache License 2.0 | 4 votes |
@Override public void showErrorTip(String msg) { ToastUtils.showShort(msg); }
Example 19
Source File: BindZimuPresenterImpl.java From DanDanPlayForAndroid with MIT License | 4 votes |
@Override public void matchZimu(String videoPath) { String thunderHash = HashUtils.getFileSHA1(videoPath); String shooterHash = HashUtils.getFileHash(videoPath); if (StringUtils.isEmpty(thunderHash) || StringUtils.isEmpty(shooterHash)) { ToastUtils.showShort("无匹配字幕"); return; } Map<String, String> shooterParams = new HashMap<>(); shooterParams.put("filehash", shooterHash); shooterParams.put("pathinfo", FileUtils.getFileName(videoPath)); shooterParams.put("format", "json"); shooterParams.put("lang", "Chn"); SubtitleRetrofitService service = RetroFactory.getSubtitleInstance(); getView().showLoading(); service.queryThunder(thunderHash) .onErrorReturnItem(new SubtitleBean.Thunder()) .zipWith(service.queryShooter(shooterParams).onErrorReturnItem(new ArrayList<>()), (thunder, shooters) -> SubtitleConverter.transform(thunder, shooters, videoPath)) .doOnSubscribe(new NetworkConsumer()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new CommOtherDataObserver<List<SubtitleBean>>() { @Override public void onSuccess(List<SubtitleBean> subtitleList) { getView().hideLoading(); if (subtitleList.size() > 0) { //按评分排序 Collections.sort(subtitleList, (o1, o2) -> o2.getRank() - o1.getRank()); getView().refreshZimuAdapter(subtitleList); } else { getView().showError("未找到相关字幕,请手动搜索"); } } @Override public void onError(int errorCode, String message) { getView().hideLoading(); ToastUtils.showShort(message); } }); }
Example 20
Source File: BindDanmuActivity.java From DanDanPlayForAndroid with MIT License | 4 votes |
@Override @SuppressLint("CheckResult") public void initView() { setTitle("选择网络弹幕"); bindResourceParam = getIntent().getParcelableExtra("bind_param"); String currentDanmuPath = bindResourceParam.getCurrentResourcePath(); if (!TextUtils.isEmpty(currentDanmuPath)) { currentResourcePathLl.setVisibility(View.VISIBLE); currentResourceTipsTv.setText("当前弹幕: "); currentResourcePathTv.setText(currentDanmuPath); } adapter = new BaseRvAdapter<DanmuMatchBean.MatchesBean>(new ArrayList<>()) { @NonNull @Override public AdapterItem<DanmuMatchBean.MatchesBean> onCreateItem(int viewType) { return new DanmuNetworkItem(BindDanmuActivity.this::showDownloadDialog); } }; recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); recyclerView.setNestedScrollingEnabled(false); recyclerView.setItemViewCacheSize(10); recyclerView.addItemDecoration(new ItemDecorationSpaces(0, 0, 0, 1)); recyclerView.setAdapter(adapter); if (bindResourceParam.isOutsideFile()) { if (StringUtils.isEmpty(bindResourceParam.getSearchWord())) { ToastUtils.showShort("无匹配弹幕"); return; } //非手机本地文件,无法获取MD5 String searchWord = bindResourceParam.getSearchWord(); String episode = ""; if (searchWord.trim().contains(" ")) { String[] wordAndEpisode = searchWord.split(" "); if (wordAndEpisode.length == 2 && CommonUtils.isNum(wordAndEpisode[1])) { searchWord = wordAndEpisode[0]; episode = wordAndEpisode[1]; } } presenter.searchDanmu(searchWord, episode); } else { if (StringUtils.isEmpty(bindResourceParam.getVideoPath())) { ToastUtils.showShort("无匹配弹幕"); return; } presenter.matchDanmu(bindResourceParam.getVideoPath()); } }