use of fr.free.nrw.commons.CommonsApplication in project apps-android-commons by commons-app.
the class ContributionsActivity method setUploadCount.
private void setUploadCount() {
UploadCountClient uploadCountClient = new UploadCountClient();
CommonsApplication application = CommonsApplication.getInstance();
ListenableFuture<Integer> future = uploadCountClient.getUploadCount(application.getCurrentAccount().name);
Futures.addCallback(future, new FutureCallback<Integer>() {
@Override
public void onSuccess(Integer uploadCount) {
getSupportActionBar().setSubtitle(getResources().getQuantityString(R.plurals.contributions_subtitle, uploadCount, uploadCount));
}
@Override
public void onFailure(@NonNull Throwable t) {
Timber.e(t, "Fetching upload count failed");
}
}, ExecutorUtils.uiExecutor());
}
use of fr.free.nrw.commons.CommonsApplication in project apps-android-commons by commons-app.
the class MoreBottomSheetFragment method onLogoutClicked.
@OnClick(R.id.more_logout)
public void onLogoutClicked() {
new AlertDialog.Builder(getActivity()).setMessage(R.string.logout_verification).setCancelable(false).setPositiveButton(R.string.yes, (dialog, which) -> {
BaseLogoutListener logoutListener = new BaseLogoutListener();
CommonsApplication app = (CommonsApplication) getContext().getApplicationContext();
app.clearApplicationData(getContext(), logoutListener);
}).setNegativeButton(R.string.no, (dialog, which) -> dialog.cancel()).show();
}
Aggregations