mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2024-12-16 15:48:13 +08:00
Launch Toasts on UI thread. (#868)
Launch Toasts on UI thread. Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/868 Reviewed-by: M M Arif <mmarif@noreply.codeberg.org> Co-Authored-By: opyale <opyale@noreply.codeberg.org> Co-Committed-By: opyale <opyale@noreply.codeberg.org>
This commit is contained in:
parent
4b140f3195
commit
a384128c8f
@ -106,23 +106,23 @@ public class FileDiffActivity extends BaseActivity {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 401:
|
case 401:
|
||||||
AlertDialogs.authorizationTokenRevokedDialog(ctx,
|
runOnUiThread(() -> AlertDialogs.authorizationTokenRevokedDialog(ctx,
|
||||||
getString(R.string.alertDialogTokenRevokedTitle),
|
getString(R.string.alertDialogTokenRevokedTitle),
|
||||||
getString(R.string.alertDialogTokenRevokedMessage),
|
getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
getString(R.string.alertDialogTokenRevokedCopyPositiveButton)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 403:
|
case 403:
|
||||||
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
runOnUiThread(() -> Toasty.error(ctx, ctx.getString(R.string.authorizeError)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 404:
|
case 404:
|
||||||
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
runOnUiThread(() -> Toasty.warning(ctx, ctx.getString(R.string.apiNotFound)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
runOnUiThread(() -> Toasty.error(ctx, getString(R.string.labelGeneralError)));
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch(IOException ignored) {}
|
} catch(IOException ignored) {}
|
||||||
|
@ -240,23 +240,23 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
switch(response.code()) {
|
switch(response.code()) {
|
||||||
|
|
||||||
case 401:
|
case 401:
|
||||||
AlertDialogs.authorizationTokenRevokedDialog(ctx,
|
runOnUiThread(() -> AlertDialogs.authorizationTokenRevokedDialog(ctx,
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 403:
|
case 403:
|
||||||
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
runOnUiThread(() -> Toasty.error(ctx, ctx.getString(R.string.authorizeError)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 404:
|
case 404:
|
||||||
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
runOnUiThread(() -> Toasty.warning(ctx, ctx.getString(R.string.apiNotFound)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
runOnUiThread(() -> Toasty.error(ctx, getString(R.string.labelGeneralError)));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user