es.dmoral.toasty.Toasty Java Examples
The following examples show how to use
es.dmoral.toasty.Toasty.
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: FileExplorerFragment.java From rcloneExplorer with MIT License | 6 votes |
@Override protected void onPostExecute(Boolean result) { super.onPostExecute(result); if (!isRunning) { return; } if (result) { Toasty.success(context, getString(R.string.make_directory_success), Toast.LENGTH_SHORT, true).show(); } else { Toasty.error(context, getString(R.string.error_mkdir), Toast.LENGTH_SHORT, true).show(); } if (!pathWhenTaskStarted.equals(directoryObject.getCurrentPath())) { directoryObject.removePathFromCache(pathWhenTaskStarted); return; } swipeRefreshLayout.setRefreshing(false); if (fetchDirectoryTask != null) { fetchDirectoryTask.cancel(true); } fetchDirectoryTask = new FetchDirectoryContent(true).execute(); }
Example #2
Source File: WebViewActivity.java From UGank with GNU General Public License v3.0 | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_share: AndroidUtil.share(this, mWebViewPresenter.getGankUrl()); break; case R.id.menu_copy_link: if (AndroidUtil.copyText(this, mWebViewPresenter.getGankUrl())) { Toasty.success(this, "链接复制成功").show(); } break; case R.id.menu_open_with: AndroidUtil.openWithBrowser(this, mWebViewPresenter.getGankUrl()); break; } return super.onOptionsItemSelected(item); }
Example #3
Source File: PostDetailListAdapter.java From Focus with GNU General Public License v3.0 | 6 votes |
private void openLink(FeedItem feedItem) { String url = feedItem.getUrl(); Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); if (pattern.matcher(url).matches()){ Toasty.info(context,"该文章没有外链哦").show(); }else { /*if (url.startsWith("/")){//相对地址 Feed feed = LitePal.find(Feed.class,feedItem.getFeedId()); String origin = feed.getLink(); if (!origin.endsWith("/")){ origin = origin + "/"; } url = origin + url; }*/ WebViewUtil.openLink(url, context); } }
Example #4
Source File: PostDetailActivity.java From Focus with GNU General Public License v3.0 | 6 votes |
private void openLink(FeedItem feedItem) { String url = currentFeedItem.getUrl(); Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); if (pattern.matcher(url).matches()) { Toasty.info(this, "该文章没有外链哦").show(); } else { /*if (url.startsWith("/")){//相对地址 Feed feed = LitePal.find(Feed.class,currentFeedItem.getFeedId()); String origin = feed.getLink(); if (!origin.endsWith("/")){ origin = origin + "/"; } url = origin + url; }*/ WebViewUtil.openLink(url, PostDetailActivity.this); } }
Example #5
Source File: ShareFragment.java From rcloneExplorer with MIT License | 6 votes |
@Override protected void onPostExecute(Boolean result) { super.onPostExecute(result); if (!isRunning) { return; } if (result) { Toasty.success(context, getString(R.string.make_directory_success), Toast.LENGTH_SHORT, true).show(); } else { Toasty.error(context, getString(R.string.error_mkdir), Toast.LENGTH_SHORT, true).show(); } if (!pathWhenTaskStarted.equals(directoryObject.getCurrentPath())) { directoryObject.removePathFromCache(pathWhenTaskStarted); return; } swipeRefreshLayout.setRefreshing(false); if (null != fetchDirectoryTask) { fetchDirectoryTask.cancel(true); } fetchDirectoryTask = new FetchDirectoryContent().execute(); }
Example #6
Source File: RemoteDestinationDialog.java From rcloneExplorer with MIT License | 6 votes |
@Override protected void onPostExecute(List<FileItem> fileItems) { super.onPostExecute(fileItems); if (fileItems == null) { Toasty.error(context, getString(R.string.error_getting_dir_content), Toast.LENGTH_SHORT, true).show(); fileItems = new ArrayList<>(); } directoryObject.setContent(fileItems); sortDirectory(); if (recyclerViewAdapter != null) { recyclerViewAdapter.newData(directoryObject.getDirectoryContent()); } if (null != swipeRefreshLayout) { swipeRefreshLayout.setRefreshing(false); } }
Example #7
Source File: MainActivity.java From WebviewProject with MIT License | 6 votes |
private void checkInternet(){ IntentFilter intentFilter=new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"); broadcastReceiver=new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (WebviewInits.isNetworkAvailable(getBaseContext())){ Toasty.success(context,getString(R.string.baglanti_basarili), Toast.LENGTH_LONG).show(); return; } else{ Toasty.error(context,getString(R.string.baglanti_basarisiz),Toast.LENGTH_LONG).show(); } } }; registerReceiver(broadcastReceiver,intentFilter); }
Example #8
Source File: TicketSaveActivity.java From faveo-helpdesk-android-app with Open Software License 3.0 | 6 votes |
protected void onPostExecute(String result) { if (progressDialog.isShowing()) progressDialog.dismiss(); if (result == null) { Toasty.error(TicketSaveActivity.this, getString(R.string.something_went_wrong), Toast.LENGTH_LONG).show(); return; } if (result.contains("Edited successfully")) { Toasty.success(TicketSaveActivity.this, getString(R.string.update_success), Toast.LENGTH_LONG).show(); finish(); Intent intent=new Intent(TicketSaveActivity.this, MainActivity.class); startActivity(intent); } else Toasty.error(TicketSaveActivity.this, getString(R.string.failed_to_update_ticket), Toast.LENGTH_LONG).show(); }
Example #9
Source File: RegisterActivity.java From Hify with MIT License | 6 votes |
private void askPermission() { Dexter.withActivity(this) .withPermissions( Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.READ_EXTERNAL_STORAGE ) .withListener(new MultiplePermissionsListener() { @Override public void onPermissionsChecked(MultiplePermissionsReport report) { if (report.isAnyPermissionPermanentlyDenied()) { Toasty.info(RegisterActivity.this, "You have denied some permissions permanently, if the app force close try granting permission from settings.", Toasty.LENGTH_LONG, true).show(); } } @Override public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) { token.continuePermissionRequest(); } }) .check(); }
Example #10
Source File: LoginActivity.java From Hify with MIT License | 6 votes |
private void askPermission() { Dexter.withActivity(this) .withPermissions( Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.READ_EXTERNAL_STORAGE ) .withListener(new MultiplePermissionsListener() { @Override public void onPermissionsChecked(MultiplePermissionsReport report) { if (report.isAnyPermissionPermanentlyDenied()) { Toasty.info(LoginActivity.this, "You have denied some permissions permanently, if the app force close try granting permission from settings.", Toasty.LENGTH_LONG, true).show(); } } @Override public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) { token.continuePermissionRequest(); } }) .check(); }
Example #11
Source File: ImagePreviewSave.java From Hify with MIT License | 6 votes |
public void onReceive(Context ctxt, Intent intent) { long referenceId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1); list.remove(referenceId); if (list.isEmpty()) { NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( ImagePreviewSave.this, "other_channel"); android.app.Notification notification; notification = mBuilder .setAutoCancel(true) .setContentTitle("Hify") .setColorized(true) .setColor(Color.parseColor("#2591FC")) .setSmallIcon(R.drawable.ic_file_download_accent_24dp) .setContentText("Image saved at Downloads/Hify/" + sender_name) .build(); notificationManager.notify(0, notification); Toasty.success(ctxt, "Image saved at Downloads/Hify/" + sender_name, Toasty.LENGTH_LONG,true).show(); } }
Example #12
Source File: SearchListAdapter.java From UGank with GNU General Public License v3.0 | 6 votes |
@Override public void onClick(View v, int position, CommonHolder4RecyclerView holder) { if (mData == null || mData.get(position) == null) { Toasty.error(mContext, "数据异常").show(); return; } Intent intent = new Intent(); if ("福利".equals(mData.get(position).type)) { intent.setClass(mContext, BigimgActivity.class); intent.putExtra(BigimgActivity.MEIZI_TITLE, mData.get(position).desc); intent.putExtra(BigimgActivity.MEIZI_URL, mData.get(position).url); } else { intent.setClass(mContext, WebViewActivity.class); intent.putExtra(WebViewActivity.GANK_TITLE, mData.get(position).desc); intent.putExtra(WebViewActivity.GANK_URL, mData.get(position).url); Favorite favorite = new Favorite(); favorite.setAuthor(mData.get(position).who); favorite.setData(mData.get(position).publishedAt); favorite.setTitle(mData.get(position).desc); favorite.setType(mData.get(position).type); favorite.setUrl(mData.get(position).url); favorite.setGankID(mData.get(position).ganhuo_id); intent.putExtra(WebViewActivity.FAVORITE_DATA, favorite); } mContext.startActivity(intent); }
Example #13
Source File: Downloader.java From OpenHub with GNU General Public License v3.0 | 5 votes |
public void start(String url, String fileName) { try{ if(StringUtils.isBlank(url) || StringUtils.isBlank(fileName)){ Toasty.error(mContext, mContext.getString(R.string.download_empty_tip)).show(); return; } this.url = url; this.fileName = fileName; if(!AppUtils.checkDownloadServiceEnabled(mContext)){ Toasty.warning(mContext, mContext.getString(R.string.enable_download_service_tip), Toast.LENGTH_LONG).show(); AppUtils.showDownloadServiceSetting(mContext); return ; } if(BaseActivity.getCurActivity() == null){ Toasty.error(mContext, mContext.getString(R.string.download_failed), Toast.LENGTH_SHORT).show(); return; } new RxPermissions(BaseActivity.getCurActivity()) .request(Manifest.permission.WRITE_EXTERNAL_STORAGE) .subscribe(granted -> { if (granted) { start(); } else { Toasty.error(mContext, mContext.getString(R.string.permission_storage_denied), Toast.LENGTH_LONG).show(); } }); }catch (Exception e){ Toasty.error(mContext, e.getMessage()).show(); } }
Example #14
Source File: IndividualProduct.java From MagicPrint-ECommerce-App-Android with MIT License | 5 votes |
@Override public void afterTextChanged(Editable s) { //none if (Integer.parseInt(quantityProductPage.getText().toString()) >= 500) { Toasty.error(IndividualProduct.this, "Product Count Must be less than 500", Toast.LENGTH_LONG).show(); } }
Example #15
Source File: IndividualProduct.java From MagicPrint-ECommerce-App-Android with MIT License | 5 votes |
public void increment(View view) { if (quantity < 500) { quantity++; quantityProductPage.setText(String.valueOf(quantity)); } else { Toasty.error(IndividualProduct.this, "Product Count Must be less than 500", Toast.LENGTH_LONG).show(); } }
Example #16
Source File: OPMLReadHelper_backup.java From Focus with GNU General Public License v3.0 | 5 votes |
private void saveFeedToFeedFolder(final List<FeedFolder> feedFolders){ //显示feedFolderList 弹窗 for (int i = 0;i < feedFolders.size();i++){ //首先检查这个feedFolder名称是否存在。 FeedFolder feedFolder = feedFolders.get(i); List<FeedFolder> temp = LitePal.where("name = ?",feedFolder.getName()).find(FeedFolder.class); if (temp.size()<1){ if (feedFolder.getName() == null || feedFolder.getName().equals("")){ feedFolder.setName("导入的未命名文件夹"); } //新建一个feedFolder feedFolder.save(); }else {//存在这个名称 feedFolder.setId(temp.get(0).getId());//使用是数据库的对象 } //将导入的feed全部保存 for (Feed feed:feedFolder.getFeedList()) { feed.setFeedFolderId(feedFolder.getId()); ALog.d(feed.getUrl()); feed.save(); } new Handler().postDelayed(new Runnable() { @Override public void run() { EventBus.getDefault().post(new EventMessage(EventMessage.IMPORT_OPML_FEED)); } },500); } Toasty.success(activity,"导入成功!").show(); }
Example #17
Source File: WebViewActivity.java From Focus with GNU General Public License v3.0 | 5 votes |
/** * 打开浏览器 * * @param targetUrl 外部浏览器打开的地址 */ private void openBrowser(String targetUrl) { if (TextUtils.isEmpty(targetUrl) || targetUrl.startsWith("file://")) { Toasty.info(this, targetUrl + " 该链接无法使用浏览器打开。", Toast.LENGTH_SHORT).show(); return; } Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); Uri mUri = Uri.parse(targetUrl); intent.setData(mUri); startActivity(intent); }
Example #18
Source File: PermissionPageUtils.java From ToDoList with Apache License 2.0 | 5 votes |
private void goSonyMainager(){ try { Intent intent = new Intent(packageName); ComponentName comp = new ComponentName("com.sonymobile.cta", "com.sonymobile.cta.SomcCTAMainActivity"); intent.setComponent(comp); mContext.startActivity(intent); } catch (Exception e) { Toasty.error(mContext,"跳转失败", Toast.LENGTH_SHORT).show(); e.printStackTrace(); goIntentSetting(); } }
Example #19
Source File: UserDataActivity.java From ToDoList with Apache License 2.0 | 5 votes |
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); switch (requestCode) { //调用系统相机申请拍照权限回调 case CAMERA_PERMISSIONS_REQUEST_CODE: { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (hasSdcard()) { imageUri = Uri.fromFile(fileUri); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) imageUri = FileProvider.getUriForFile(UserDataActivity.this, "com.example.fileprovider", fileUri);//通过FileProvider创建一个content类型的Uri PhotoUtils.takePicture(this, imageUri, CODE_CAMERA_REQUEST); } else { Toasty.info(this, "设备没有SD卡", Toast.LENGTH_SHORT, true).show(); } } else { Toasty.info(this, "请允许打开相机", Toast.LENGTH_SHORT, true).show(); } break; } //调用系统相册申请Sdcard权限回调 case STORAGE_PERMISSIONS_REQUEST_CODE: if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { PhotoUtils.openPic(this, CODE_GALLERY_REQUEST); } else { Toasty.info(this, "请允许操作SD卡", Toast.LENGTH_SHORT, true).show(); } break; default: } }
Example #20
Source File: LoginActivity.java From OpenHub with GNU General Public License v3.0 | 5 votes |
@Override public void onGetTokenError(String errorMsg) { loginBn.doResult(false); new Handler().postDelayed(new Runnable() { @Override public void run() { loginBn.reset(); loginBn.setEnabled(true); } }, 1000); Toasty.error(getApplicationContext(), errorMsg).show(); }
Example #21
Source File: LocalConfig.java From rcloneExplorer with MIT License | 5 votes |
private void setUpRemote() { String name = remoteName.getText().toString(); if (name.trim().isEmpty()) { remoteNameInputLayout.setErrorEnabled(true); remoteNameInputLayout.setError(getString(R.string.remote_name_cannot_be_empty)); return; } else { remoteNameInputLayout.setErrorEnabled(false); } ArrayList<String> options = new ArrayList<>(); options.add(name); options.add("local"); Process process = rclone.configCreate(options); try { process.waitFor(); } catch (InterruptedException e) { e.printStackTrace(); } if (process.exitValue() != 0) { Toasty.error(context, getString(R.string.error_creating_remote), Toast.LENGTH_SHORT, true).show(); } else { Toasty.success(context, getString(R.string.remote_creation_success), Toast.LENGTH_SHORT, true).show(); } if (getActivity() != null) { getActivity().finish(); } }
Example #22
Source File: PcloudConfig.java From rcloneExplorer with MIT License | 5 votes |
@Override protected void onPostExecute(Boolean success) { super.onPostExecute(success); if (!success) { Toasty.error(context, getString(R.string.error_creating_remote), Toast.LENGTH_SHORT, true).show(); } else { Toasty.success(context, getString(R.string.remote_creation_success), Toast.LENGTH_SHORT, true).show(); } Intent intent = new Intent(context, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); }
Example #23
Source File: FileExplorerFragment.java From rcloneExplorer with MIT License | 5 votes |
@Override protected void onPostExecute(String s) { super.onPostExecute(s); if (loadingDialog != null) { if (loadingDialog.isStateSaved()) { loadingDialog.dismissAllowingStateLoss(); } else { loadingDialog.dismiss(); } } if (s == null) { Toasty.error(context, getString(R.string.error_generating_link), Toast.LENGTH_SHORT, true).show(); return; } LinkDialog linkDialog = new LinkDialog() .isDarkTheme(isDarkTheme) .setLinkUrl(s); if (getFragmentManager() != null) { linkDialog.show(getChildFragmentManager(), "link dialog"); } ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clipData = ClipData.newPlainText("Copied link", s); if (clipboardManager == null) { return; } clipboardManager.setPrimaryClip(clipData); Toasty.info(context, getString(R.string.link_copied_to_clipboard), Toast.LENGTH_SHORT, true).show(); }
Example #24
Source File: WebViewActivity.java From Focus with GNU General Public License v3.0 | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { case R.id.refresh: if (mAgentWeb != null) { mAgentWeb.getUrlLoader().reload(); // 刷新 } return true; case R.id.copy: if (mAgentWeb != null) { ClipboardManager mClipboardManager = (ClipboardManager) this.getSystemService(Context.CLIPBOARD_SERVICE); mClipboardManager.setPrimaryClip(ClipData.newPlainText(null, this.url)); Toasty.success(this,"复制成功").show(); } return true; case R.id.default_browser: if (mAgentWeb != null) { openBrowser(mAgentWeb.getWebCreator().getWebView().getUrl()); } return true; case R.id.default_clean: toCleanWebCache(); default: return false; } }
Example #25
Source File: PermissionPageUtils.java From ToDoList with Apache License 2.0 | 5 votes |
private void goLGMainager(){ try { Intent intent = new Intent(packageName); ComponentName comp = new ComponentName("com.android.settings", "com.android.settings.Settings$AccessLockSummaryActivity"); intent.setComponent(comp); mContext.startActivity(intent); } catch (Exception e) { Toasty.error(mContext,"跳转失败", Toast.LENGTH_SHORT).show(); e.printStackTrace(); goIntentSetting(); } }
Example #26
Source File: Downloader.java From OpenHub with GNU General Public License v3.0 | 5 votes |
private void checkStatus() { //cause SQLiteException at 乐视 LE X820 Android 6.0.1,level 23 try{ DownloadManager.Query query = new DownloadManager.Query(); query.setFilterById(downloadId); Cursor c = downloadManager.query(query); if (c.moveToFirst()) { int status = c.getInt(c.getColumnIndex(DownloadManager.COLUMN_STATUS)); switch (status) { case DownloadManager.STATUS_PAUSED: break; case DownloadManager.STATUS_PENDING: break; case DownloadManager.STATUS_RUNNING: break; case DownloadManager.STATUS_SUCCESSFUL: String tip = mContext.getString(R.string.download_complete) .concat("\n").concat(getFilePath()); Toasty.success(mContext, tip).show(); unregister(); break; case DownloadManager.STATUS_FAILED: Toasty.error(mContext, mContext.getString(R.string.download_failed)).show(); unregister(); break; } } c.close(); }catch (SQLiteException e){ Logger.d(e); unregister(); } }
Example #27
Source File: UpdateAvailable.java From Hify with MIT License | 5 votes |
public void onReceive(Context ctxt, Intent intent) { long referenceId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1); list.remove(referenceId); if (list.isEmpty()) { NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); PendingIntent pendingIntent = PendingIntent.getActivity(ctxt, 0, intent, 0); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( UpdateAvailable.this, "other_channel"); android.app.Notification notification; notification = mBuilder .setAutoCancel(true) .setContentTitle("Hify_v" + version+".apk") .setColorized(true) .setContentIntent(pendingIntent) .setColor(Color.parseColor("#2591FC")) .setSmallIcon(R.mipmap.ic_launcher) .setContentText("Download success") .build(); notificationManager.notify(0, notification); Toasty.success(ctxt, "File downloaded and saved at Downloads/Hify Updates", Toasty.LENGTH_LONG,true).show(); } }
Example #28
Source File: MainActivity.java From Hify with MIT License | 5 votes |
public void logout() { performUploadTask(); final ProgressDialog mDialog = new ProgressDialog(this); mDialog.setIndeterminate(true); mDialog.setMessage("Logging you out..."); mDialog.setCancelable(false); mDialog.setCanceledOnTouchOutside(false); mDialog.show(); SharedPreferences pref = getApplicationContext().getSharedPreferences(Config.SHARED_PREF, MODE_PRIVATE); Map<String, Object> tokenRemove = new HashMap<>(); tokenRemove.put("token_ids", FieldValue.arrayRemove(pref.getString("regId",""))); firestore.collection("Users").document(userId).update(tokenRemove).addOnSuccessListener(new OnSuccessListener<Void>() { @Override public void onSuccess(Void aVoid) { userHelper.deleteContact(1); mAuth.signOut(); LoginActivity.startActivityy(MainActivity.this); mDialog.dismiss(); finish(); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Toasty.error(MainActivity.this, "Error logging out", Toasty.LENGTH_SHORT,true).show(); mDialog.dismiss(); Log.e("Logout Error", e.getMessage()); } }); }
Example #29
Source File: SinglePostView.java From Hify with MIT License | 5 votes |
private void getPosts(final String post_id) { mFirestore.collection("Posts") .document(post_id) .get() .addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() { @Override public void onSuccess(DocumentSnapshot documentSnapshot) { if(!documentSnapshot.exists()){ Toasty.error(SinglePostView.this, "The post does not exist.", Toasty.LENGTH_SHORT, true).show(); }else{ Post post = new Post(documentSnapshot.getString("userId"),documentSnapshot.getString("name"),documentSnapshot.getString("timestamp"),documentSnapshot.getString("likes"),documentSnapshot.getString("favourites"),documentSnapshot.getString("description"),documentSnapshot.getString("color"),documentSnapshot.getString("username"),documentSnapshot.getString("userimage"),Integer.parseInt(String.valueOf(documentSnapshot.get("image_count"))),documentSnapshot.getString("image_url_0"),documentSnapshot.getString("image_url_1"),documentSnapshot.getString("image_url_2"),documentSnapshot.getString("image_url_3"),documentSnapshot.getString("image_url_4"),documentSnapshot.getString("image_url_5"),documentSnapshot.getString("image_url_6")).withId(post_id); mPostsList.add(post); mAdapter.notifyDataSetChanged(); pbar.setVisibility(View.GONE); } } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { e.printStackTrace(); Toasty.error(SinglePostView.this, "Some error occured opening the post", Toasty.LENGTH_SHORT,true).show(); finish(); } }); }
Example #30
Source File: UpdateToastMediaScannerCompletionListener.java From MusicPlayer with GNU General Public License v3.0 | 5 votes |
@Override public void onScanCompleted(final String path, final Uri uri) { Activity activity = activityWeakReference.get(); if (activity != null) { activity.runOnUiThread(() -> { if (uri == null) { failed++; } else { scanned++; } String text = " " + String.format(scannedFiles, scanned, toBeScanned.length) + (failed > 0 ? " " + String.format(couldNotScanFiles, failed) : ""); Toasty.normal(activity,text).show(); }); } }