mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-12 17:57:29 +00:00
fix notifications
This commit is contained in:
parent
2082c97ed6
commit
429549412a
@ -1,9 +1,9 @@
|
||||
package awais.instagrabber.repositories.responses.notification
|
||||
|
||||
class NotificationCounts(val commentLikesCount: Int,
|
||||
val userTagsCount: Int,
|
||||
val likesCount: Int,
|
||||
val commentsCount: Int,
|
||||
val relationshipsCount: Int,
|
||||
val pOYCount: Int,
|
||||
val requestsCount: Int)
|
||||
class NotificationCounts(val commentLikes: Int,
|
||||
val usertags: Int,
|
||||
val likes: Int,
|
||||
val comments: Int,
|
||||
val relationships: Int,
|
||||
val photosOfYou: Int,
|
||||
val requests: Int)
|
@ -54,10 +54,9 @@ public class ActivityCheckerService extends Service {
|
||||
public void onSuccess(final NotificationCounts result) {
|
||||
try {
|
||||
if (result == null) return;
|
||||
final String notification = getNotificationString(result);
|
||||
final List<String> notification = getNotificationString(result);
|
||||
if (notification == null) return;
|
||||
final String notificationString = getString(R.string.activity_count_prefix) + " " + notification + ".";
|
||||
showNotification(notificationString);
|
||||
showNotification(notification);
|
||||
} finally {
|
||||
handler.postDelayed(runnable, DELAY_MILLIS);
|
||||
}
|
||||
@ -88,42 +87,54 @@ public class ActivityCheckerService extends Service {
|
||||
handler.removeCallbacks(runnable);
|
||||
}
|
||||
|
||||
private String getNotificationString(final NotificationCounts result) {
|
||||
private List<String> getNotificationString(final NotificationCounts result) {
|
||||
final List<String> toReturn = new ArrayList<>(2);
|
||||
final List<String> list = new ArrayList<>();
|
||||
if (result.getRelationshipsCount() != 0) {
|
||||
list.add(getString(R.string.activity_count_relationship, result.getRelationshipsCount()));
|
||||
int count = 0;
|
||||
if (result.getRelationships() != 0) {
|
||||
list.add(getString(R.string.activity_count_relationship, result.getRelationships()));
|
||||
count += result.getRelationships();
|
||||
}
|
||||
if (result.getRequestsCount() != 0) {
|
||||
list.add(getString(R.string.activity_count_requests, result.getRequestsCount()));
|
||||
if (result.getRequests() != 0) {
|
||||
list.add(getString(R.string.activity_count_requests, result.getRequests()));
|
||||
count += result.getRequests();
|
||||
}
|
||||
if (result.getUserTagsCount() != 0) {
|
||||
list.add(getString(R.string.activity_count_usertags, result.getUserTagsCount()));
|
||||
if (result.getUsertags() != 0) {
|
||||
list.add(getString(R.string.activity_count_usertags, result.getUsertags()));
|
||||
count += result.getUsertags();
|
||||
}
|
||||
if (result.getPOYCount() != 0) {
|
||||
list.add(getString(R.string.activity_count_poy, result.getPOYCount()));
|
||||
if (result.getPhotosOfYou() != 0) {
|
||||
list.add(getString(R.string.activity_count_poy, result.getPhotosOfYou()));
|
||||
count += result.getPhotosOfYou();
|
||||
}
|
||||
if (result.getCommentsCount() != 0) {
|
||||
list.add(getString(R.string.activity_count_comments, result.getCommentsCount()));
|
||||
if (result.getComments() != 0) {
|
||||
list.add(getString(R.string.activity_count_comments, result.getComments()));
|
||||
count += result.getComments();
|
||||
}
|
||||
if (result.getCommentLikesCount() != 0) {
|
||||
list.add(getString(R.string.activity_count_commentlikes, result.getCommentLikesCount()));
|
||||
if (result.getCommentLikes() != 0) {
|
||||
list.add(getString(R.string.activity_count_commentlikes, result.getCommentLikes()));
|
||||
count += result.getCommentLikes();
|
||||
}
|
||||
if (result.getLikesCount() != 0) {
|
||||
list.add(getString(R.string.activity_count_likes, result.getLikesCount()));
|
||||
if (result.getLikes() != 0) {
|
||||
list.add(getString(R.string.activity_count_likes, result.getLikes()));
|
||||
count += result.getLikes();
|
||||
}
|
||||
if (list.isEmpty()) return null;
|
||||
return TextUtils.join(", ", list);
|
||||
toReturn.add(TextUtils.join(", ", list));
|
||||
toReturn.add(getResources().getQuantityString(R.plurals.activity_count_total, count, count));
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
private void showNotification(final String notificationString) {
|
||||
private void showNotification(final List<String> notificationString) {
|
||||
final Notification notification = new NotificationCompat.Builder(this, Constants.ACTIVITY_CHANNEL_ID)
|
||||
.setCategory(NotificationCompat.CATEGORY_STATUS)
|
||||
.setSmallIcon(R.drawable.ic_notif)
|
||||
.setAutoCancel(true)
|
||||
.setOnlyAlertOnce(true)
|
||||
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||
.setContentTitle(getString(R.string.action_notif))
|
||||
.setContentText(notificationString)
|
||||
.setContentTitle(notificationString.get(1))
|
||||
.setContentText(notificationString.get(0))
|
||||
.setStyle(new NotificationCompat.BigTextStyle().bigText(notificationString.get(0)))
|
||||
.setContentIntent(getPendingIntent())
|
||||
.build();
|
||||
notificationManager.notify(Constants.ACTIVITY_NOTIFICATION_ID, notification);
|
||||
|
@ -253,7 +253,6 @@
|
||||
<string name="action_ayml">Suggested users</string>
|
||||
<string name="select_picture">Select Picture</string>
|
||||
<string name="uploading">Uploading…</string>
|
||||
<string name="activity_count_prefix">You have:</string>
|
||||
<string name="activity_count_relationship">%d follows</string>
|
||||
<string name="activity_count_comments">%d comments</string>
|
||||
<string name="activity_count_commentlikes">%d comment likes</string>
|
||||
|
@ -237,7 +237,6 @@
|
||||
<string name="action_ayml">Usuaris suggerits</string>
|
||||
<string name="select_picture">Seleccionar imatge</string>
|
||||
<string name="uploading">S\'està pujant…</string>
|
||||
<string name="activity_count_prefix">Tens:</string>
|
||||
<string name="activity_count_relationship">%d seguidors</string>
|
||||
<string name="activity_count_comments">%d comentaris</string>
|
||||
<string name="activity_count_commentlikes">%d m\'agrades al comentari</string>
|
||||
|
@ -245,7 +245,6 @@
|
||||
<string name="action_ayml">Navrhovaní uživatelé</string>
|
||||
<string name="select_picture">Vybrat obrázek</string>
|
||||
<string name="uploading">Nahrávání…</string>
|
||||
<string name="activity_count_prefix">Máte:</string>
|
||||
<string name="activity_count_relationship">%d sleduje</string>
|
||||
<string name="activity_count_comments">%d komentářů</string>
|
||||
<string name="activity_count_commentlikes">%d lajků komentáře</string>
|
||||
|
@ -237,7 +237,6 @@
|
||||
<string name="action_ayml">Vorgeschlagene Benutzer</string>
|
||||
<string name="select_picture">Bild auswählen</string>
|
||||
<string name="uploading">Hochladen…</string>
|
||||
<string name="activity_count_prefix">Du hast:</string>
|
||||
<string name="activity_count_relationship">%d Abonnenten</string>
|
||||
<string name="activity_count_comments">%d Kommentare</string>
|
||||
<string name="activity_count_commentlikes">%d gelikte Kommentare</string>
|
||||
|
@ -237,7 +237,6 @@
|
||||
<string name="action_ayml">Προτεινόμενοι χρήστες</string>
|
||||
<string name="select_picture">Επιλογή εικόνας</string>
|
||||
<string name="uploading">Μεταφόρτωση…</string>
|
||||
<string name="activity_count_prefix">Έχετε:</string>
|
||||
<string name="activity_count_relationship">%d ακόλουθοι</string>
|
||||
<string name="activity_count_comments">%d σχόλια</string>
|
||||
<string name="activity_count_commentlikes">Το σχόλιο αρέσει σε %d</string>
|
||||
|
@ -237,7 +237,6 @@
|
||||
<string name="action_ayml">Usuarios sugeridos</string>
|
||||
<string name="select_picture">Seleccionar imagen</string>
|
||||
<string name="uploading">Subiendo…</string>
|
||||
<string name="activity_count_prefix">Tienes:</string>
|
||||
<string name="activity_count_relationship">%d sigue</string>
|
||||
<string name="activity_count_comments">%d comentarios</string>
|
||||
<string name="activity_count_commentlikes">%d me gustas en comentarios</string>
|
||||
|
@ -237,7 +237,6 @@
|
||||
<string name="action_ayml">Iradokitutako erabiltzaileak</string>
|
||||
<string name="select_picture">Hautatu irudia</string>
|
||||
<string name="uploading">Igotzen…</string>
|
||||
<string name="activity_count_prefix">Duzuna:</string>
|
||||
<string name="activity_count_relationship">%d jarraitzaile</string>
|
||||
<string name="activity_count_comments">%d iruzkin</string>
|
||||
<string name="activity_count_commentlikes">%d iruzkin-atsegite</string>
|
||||
|
@ -238,7 +238,6 @@
|
||||
<string name="action_ayml">Suggested users</string>
|
||||
<string name="select_picture">انتخاب تصویر</string>
|
||||
<string name="uploading">Uploading…</string>
|
||||
<string name="activity_count_prefix">شما باید:</string>
|
||||
<string name="activity_count_relationship">%d دنبال کننده</string>
|
||||
<string name="activity_count_comments">%d دیدگاه</string>
|
||||
<string name="activity_count_commentlikes">%d پسند دیدگاه</string>
|
||||
|
@ -237,7 +237,6 @@
|
||||
<string name="action_ayml">Utilisateurs suggérés</string>
|
||||
<string name="select_picture">Sélectionnez une image</string>
|
||||
<string name="uploading">Envoi en cours…</string>
|
||||
<string name="activity_count_prefix">Vous avez :</string>
|
||||
<string name="activity_count_relationship">%d abonné(e)s</string>
|
||||
<string name="activity_count_comments">%d commentaires</string>
|
||||
<string name="activity_count_commentlikes">%d j\'aime(s) sur le commentaire</string>
|
||||
|
@ -238,7 +238,6 @@
|
||||
<string name="action_ayml">सुझायें ऊपयोगकर्ता</string>
|
||||
<string name="select_picture">चित्र का चयन करें</string>
|
||||
<string name="uploading">अपलोड हो रहा है...</string>
|
||||
<string name="activity_count_prefix">आपके पास है:</string>
|
||||
<string name="activity_count_relationship">%d अनुगामी</string>
|
||||
<string name="activity_count_comments">%d टिप्पणियाँ</string>
|
||||
<string name="activity_count_commentlikes">%d टिप्पणीयाँ पसन्दीत</string>
|
||||
|
@ -233,7 +233,6 @@
|
||||
<string name="action_ayml">Pengguna yang disarankan</string>
|
||||
<string name="select_picture">Pilih Gambar</string>
|
||||
<string name="uploading">Mengunggah…</string>
|
||||
<string name="activity_count_prefix">Anda memiliki:</string>
|
||||
<string name="activity_count_relationship">%d mengikuti</string>
|
||||
<string name="activity_count_comments">%d komentar</string>
|
||||
<string name="activity_count_commentlikes">%d suka komentar</string>
|
||||
|
@ -237,7 +237,6 @@
|
||||
<string name="action_ayml">Utenti suggeriti</string>
|
||||
<string name="select_picture">Seleziona Immagine</string>
|
||||
<string name="uploading">Caricamento…</string>
|
||||
<string name="activity_count_prefix">Hai:</string>
|
||||
<string name="activity_count_relationship">%d seguaci</string>
|
||||
<string name="activity_count_comments">%d commenti</string>
|
||||
<string name="activity_count_commentlikes">%d mi piace al commento</string>
|
||||
|
@ -233,7 +233,6 @@
|
||||
<string name="action_ayml">おすすめのユーザー</string>
|
||||
<string name="select_picture">画像を選択</string>
|
||||
<string name="uploading">アップロード中…</string>
|
||||
<string name="activity_count_prefix">あなたのステータス:</string>
|
||||
<string name="activity_count_relationship">%d 人のフォロワー</string>
|
||||
<string name="activity_count_comments">%d コメント</string>
|
||||
<string name="activity_count_commentlikes">%d 個のコメントへのいいね!</string>
|
||||
|
@ -233,7 +233,6 @@
|
||||
<string name="action_ayml">프로필 추천</string>
|
||||
<string name="select_picture">사진 선택</string>
|
||||
<string name="uploading">업로드 중…</string>
|
||||
<string name="activity_count_prefix">You have:</string>
|
||||
<string name="activity_count_relationship">%d follows</string>
|
||||
<string name="activity_count_comments">%d comments</string>
|
||||
<string name="activity_count_commentlikes">%d comment likes</string>
|
||||
|
@ -237,7 +237,6 @@
|
||||
<string name="action_ayml">Препорачани кориснчки сметки</string>
|
||||
<string name="select_picture">Селектирај слика</string>
|
||||
<string name="uploading">Се Прикачува…</string>
|
||||
<string name="activity_count_prefix">Вие имате:</string>
|
||||
<string name="activity_count_relationship">%d следачи</string>
|
||||
<string name="activity_count_comments">%d коментари</string>
|
||||
<string name="activity_count_commentlikes">%d лајкови на коментари</string>
|
||||
|
@ -237,7 +237,6 @@
|
||||
<string name="action_ayml">Voorgestelde gebruikers</string>
|
||||
<string name="select_picture">Selecteer Afbeelding</string>
|
||||
<string name="uploading">Bezig met uploaden…</string>
|
||||
<string name="activity_count_prefix">Je hebt:</string>
|
||||
<string name="activity_count_relationship">%d volgers</string>
|
||||
<string name="activity_count_comments">%d opmerkingen</string>
|
||||
<string name="activity_count_commentlikes">%d opmerking-likes</string>
|
||||
|
@ -237,7 +237,6 @@
|
||||
<string name="action_ayml">Suggested users</string>
|
||||
<string name="select_picture">Select Picture</string>
|
||||
<string name="uploading">Uploading…</string>
|
||||
<string name="activity_count_prefix">You have:</string>
|
||||
<string name="activity_count_relationship">%d follows</string>
|
||||
<string name="activity_count_comments">%d comments</string>
|
||||
<string name="activity_count_commentlikes">%d comment likes</string>
|
||||
|
@ -245,7 +245,6 @@
|
||||
<string name="action_ayml">Proponowani użytkownicy</string>
|
||||
<string name="select_picture">Wybierz obraz</string>
|
||||
<string name="uploading">Przesyłanie…</string>
|
||||
<string name="activity_count_prefix">Masz:</string>
|
||||
<string name="activity_count_relationship">%d obserwujących</string>
|
||||
<string name="activity_count_comments">%d komentarzy</string>
|
||||
<string name="activity_count_commentlikes">%d polubionych komentarzy</string>
|
||||
|
@ -237,7 +237,6 @@
|
||||
<string name="action_ayml">Usuários sugeridos</string>
|
||||
<string name="select_picture">Selecionar imagem</string>
|
||||
<string name="uploading">Enviando…</string>
|
||||
<string name="activity_count_prefix">Você tem:</string>
|
||||
<string name="activity_count_relationship">%d seguidores</string>
|
||||
<string name="activity_count_comments">%d comentários</string>
|
||||
<string name="activity_count_commentlikes">%d comentários curtidos</string>
|
||||
|
@ -245,7 +245,6 @@
|
||||
<string name="action_ayml">Предлагаемые пользователи</string>
|
||||
<string name="select_picture">Выберите изображение</string>
|
||||
<string name="uploading">Загрузка…</string>
|
||||
<string name="activity_count_prefix">У вас есть:</string>
|
||||
<string name="activity_count_relationship">%d подписано</string>
|
||||
<string name="activity_count_comments">%d комментариев</string>
|
||||
<string name="activity_count_commentlikes">%d симпатий к комментарию</string>
|
||||
|
@ -245,7 +245,6 @@
|
||||
<string name="action_ayml">Používatelia ktorých možno poznáte</string>
|
||||
<string name="select_picture">Vybrať fotografiu</string>
|
||||
<string name="uploading">Nahráva sa…</string>
|
||||
<string name="activity_count_prefix">Máš:</string>
|
||||
<string name="activity_count_relationship">%d sledovaní</string>
|
||||
<string name="activity_count_comments">%d komentárov</string>
|
||||
<string name="activity_count_commentlikes">%d komentárov ktoré sa niekomu páčia</string>
|
||||
|
@ -237,7 +237,6 @@
|
||||
<string name="action_ayml">Suggested users</string>
|
||||
<string name="select_picture">Välj bild</string>
|
||||
<string name="uploading">Laddar upp…</string>
|
||||
<string name="activity_count_prefix">Du har:</string>
|
||||
<string name="activity_count_relationship">%d följer</string>
|
||||
<string name="activity_count_comments">%d kommentarer</string>
|
||||
<string name="activity_count_commentlikes">%d gillade kommentarer</string>
|
||||
|
@ -237,7 +237,6 @@
|
||||
<string name="action_ayml">Önerilen kullanıcılar</string>
|
||||
<string name="select_picture">Resim Seç</string>
|
||||
<string name="uploading">Yükleniyor…</string>
|
||||
<string name="activity_count_prefix">Sahip olduğun:</string>
|
||||
<string name="activity_count_relationship">%d takip</string>
|
||||
<string name="activity_count_comments">%d yorum</string>
|
||||
<string name="activity_count_commentlikes">%d yorum beğenisi</string>
|
||||
|
@ -233,7 +233,6 @@
|
||||
<string name="action_ayml">Người dùng được đề xuất</string>
|
||||
<string name="select_picture">Chọn hình ảnh</string>
|
||||
<string name="uploading">Đang tải lên…</string>
|
||||
<string name="activity_count_prefix">Bạn có:</string>
|
||||
<string name="activity_count_relationship">%d người theo dõi</string>
|
||||
<string name="activity_count_comments">%d bình luận</string>
|
||||
<string name="activity_count_commentlikes">%d lượt thích bình luận</string>
|
||||
|
@ -233,7 +233,6 @@
|
||||
<string name="action_ayml">推荐用户</string>
|
||||
<string name="select_picture">选择图片</string>
|
||||
<string name="uploading">上传中...</string>
|
||||
<string name="activity_count_prefix">您有:</string>
|
||||
<string name="activity_count_relationship">%d 位新粉丝</string>
|
||||
<string name="activity_count_comments">%d 个评论回复</string>
|
||||
<string name="activity_count_commentlikes">%d 个评论点赞</string>
|
||||
|
@ -233,7 +233,6 @@
|
||||
<string name="action_ayml">推薦用戶</string>
|
||||
<string name="select_picture">選擇圖片</string>
|
||||
<string name="uploading">上傳中…</string>
|
||||
<string name="activity_count_prefix">您有</string>
|
||||
<string name="activity_count_relationship">%d 個追蹤者</string>
|
||||
<string name="activity_count_comments">%d 個評論</string>
|
||||
<string name="activity_count_commentlikes">%d 個評論的讚</string>
|
||||
|
@ -242,7 +242,10 @@
|
||||
<string name="liability" translatable="false">This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</string>
|
||||
<string name="select_picture">Select Picture</string>
|
||||
<string name="uploading">Uploading…</string>
|
||||
<string name="activity_count_prefix">You have:</string>
|
||||
<plurals name="activity_count_total">
|
||||
<item quantity="one">You have %d notification</item>
|
||||
<item quantity="other">You have %d notifications</item>
|
||||
</plurals>
|
||||
<string name="activity_count_relationship">%d follows</string>
|
||||
<string name="activity_count_comments">%d comments</string>
|
||||
<string name="activity_count_commentlikes">%d comment likes</string>
|
||||
|
Loading…
Reference in New Issue
Block a user