From 40811e9f73a4d31b80dc348fe79c9917f0725e51 Mon Sep 17 00:00:00 2001 From: M M Arif Date: Thu, 5 May 2022 18:45:04 +0500 Subject: [PATCH] Improve string by adding plurals --- .../java/org/mian/gitnex/adapters/UserAccountsAdapter.java | 3 ++- app/src/main/res/values/strings.xml | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/mian/gitnex/adapters/UserAccountsAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/UserAccountsAdapter.java index 0dfcafa9..cec56acc 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/UserAccountsAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/UserAccountsAdapter.java @@ -163,7 +163,8 @@ public class UserAccountsAdapter extends RecyclerView.Adapter 0) { - new Handler().postDelayed(() -> Toasty.info(context, context.getString(R.string.youHaveNewNotifications, String.valueOf(notificationCount.getNew()))), 5000); + String toastMsg = context.getResources().getQuantityString(R.plurals.youHaveNewNotifications, Math.toIntExact(notificationCount.getNew()), Math.toIntExact(notificationCount.getNew())); + new Handler().postDelayed(() -> Toasty.info(context, toastMsg), 5000); } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 50bddcc7..c404cd97 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -653,7 +653,10 @@ Notifications This is the main notification channel of GitNex. - %s (%s) - You have %s notification(s). + + You have %s new notification. + You have %s new notifications. + Read Unread