private void displayShareInfo(final Share share) { String message = context .getResources() .getString( R.string.share_info, share.getUsername(), (share.getDescription() != null) ? share.getDescription() : "", share.getUrl(), share.getCreated(), share.getLastVisited(), share.getExpires(), share.getVisitCount()); Util.info(context, share.getName(), message); }
private void deleteShare(final Share share) { Util.confirmDialog( context, R.string.common_delete, share.getName(), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { new LoadingTask<Void>(context, false) { @Override protected Void doInBackground() throws Throwable { MusicService musicService = MusicServiceFactory.getMusicService(context); musicService.deleteShare(share.getId(), context, null); return null; } @Override protected void done(Void result) { adapter.remove(share); adapter.notifyDataSetChanged(); Util.toast( context, context.getResources().getString(R.string.share_deleted, share.getName())); } @Override protected void error(Throwable error) { String msg; if (error instanceof OfflineException || error instanceof ServerTooOldException) { msg = getErrorMessage(error); } else { msg = context .getResources() .getString(R.string.share_deleted_error, share.getName()) + " " + getErrorMessage(error); } Util.toast(context, msg, false); } }.execute(); } }); }