From c2b8d8cb4fe4e3d171af6bebdaa89492242029f6 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Fri, 6 Nov 2020 18:09:29 -0500 Subject: [PATCH] downloads use shortcode, and tagged post notification --- .../adapters/viewholder/NotificationViewHolder.java | 3 +++ .../awais/instagrabber/models/enums/NotificationType.java | 3 ++- .../main/java/awais/instagrabber/utils/DownloadUtils.java | 8 ++++---- app/src/main/res/layout/item_notification.xml | 2 +- app/src/main/res/values/strings.xml | 1 + 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/adapters/viewholder/NotificationViewHolder.java b/app/src/main/java/awais/instagrabber/adapters/viewholder/NotificationViewHolder.java index fbd527c0..ac1ef257 100644 --- a/app/src/main/java/awais/instagrabber/adapters/viewholder/NotificationViewHolder.java +++ b/app/src/main/java/awais/instagrabber/adapters/viewholder/NotificationViewHolder.java @@ -42,6 +42,9 @@ public final class NotificationViewHolder extends RecyclerView.ViewHolder { text = R.string.mention_notif; subtext = model.getText(); break; + case TAGGED: + text = R.string.tagged_notif; + break; case FOLLOW: text = R.string.follow_notif; break; diff --git a/app/src/main/java/awais/instagrabber/models/enums/NotificationType.java b/app/src/main/java/awais/instagrabber/models/enums/NotificationType.java index 99b420be..acdadfbd 100755 --- a/app/src/main/java/awais/instagrabber/models/enums/NotificationType.java +++ b/app/src/main/java/awais/instagrabber/models/enums/NotificationType.java @@ -9,10 +9,11 @@ public enum NotificationType implements Serializable { FOLLOW("GraphFollowAggregatedStory"), COMMENT("GraphCommentMediaStory"), MENTION("GraphMentionStory"), + TAGGED("GraphUserTaggedStory"), REQUEST("REQUEST"); private final String itemType; - private static Map map = new HashMap<>(); + private static final Map map = new HashMap<>(); static { for (NotificationType type : NotificationType.values()) { diff --git a/app/src/main/java/awais/instagrabber/utils/DownloadUtils.java b/app/src/main/java/awais/instagrabber/utils/DownloadUtils.java index 97919a65..9a8241f9 100644 --- a/app/src/main/java/awais/instagrabber/utils/DownloadUtils.java +++ b/app/src/main/java/awais/instagrabber/utils/DownloadUtils.java @@ -185,7 +185,7 @@ public final class DownloadUtils { case MEDIA_TYPE_IMAGE: case MEDIA_TYPE_VIDEO: { final String url = feedModel.getDisplayUrl(); - final File file = getDownloadSaveFile(downloadDir, feedModel.getPostId(), url); + final File file = getDownloadSaveFile(downloadDir, feedModel.getShortCode(), url); checkList.add(file.exists()); break; } @@ -194,7 +194,7 @@ public final class DownloadUtils { for (int i = 0; i < sliderItems.size(); i++) { final PostChild child = sliderItems.get(i); final String url = child.getDisplayUrl(); - final File file = getDownloadChildSaveFile(downloadDir, feedModel.getPostId(), i + 1, url); + final File file = getDownloadChildSaveFile(downloadDir, feedModel.getShortCode(), i + 1, url); checkList.add(file.exists()); } break; @@ -275,7 +275,7 @@ public final class DownloadUtils { case MEDIA_TYPE_IMAGE: case MEDIA_TYPE_VIDEO: { final String url = feedModel.getDisplayUrl(); - final File file = getDownloadSaveFile(downloadDir, feedModel.getPostId(), url); + final File file = getDownloadSaveFile(downloadDir, feedModel.getShortCode(), url); map.put(url, file.getAbsolutePath()); break; } @@ -287,7 +287,7 @@ public final class DownloadUtils { } final PostChild child = sliderItems.get(i); final String url = child.getDisplayUrl(); - final File file = getDownloadChildSaveFile(downloadDir, feedModel.getPostId(), i + 1, url); + final File file = getDownloadChildSaveFile(downloadDir, feedModel.getShortCode(), i + 1, url); map.put(url, file.getAbsolutePath()); } break; diff --git a/app/src/main/res/layout/item_notification.xml b/app/src/main/res/layout/item_notification.xml index 9b2e4b11..a3dee112 100644 --- a/app/src/main/res/layout/item_notification.xml +++ b/app/src/main/res/layout/item_notification.xml @@ -111,7 +111,7 @@ android:textAppearance="@style/TextAppearance.AppCompat.Caption" android:textStyle="italic" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toStartOf="@id/preview_barrier" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/ivProfilePic" app:layout_constraintTop_toBottomOf="@id/tvSubComment" tools:text="some long long long long long date" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c3a4f2b9..c3327ebd 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -225,6 +225,7 @@ Commented on your post: Started following you Mentioned you: + Tagged you in a post Requested following you Approve request Reject request