Browse Source

downloads use shortcode, and tagged post notification

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
c2b8d8cb4f
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 3
      app/src/main/java/awais/instagrabber/adapters/viewholder/NotificationViewHolder.java
  2. 3
      app/src/main/java/awais/instagrabber/models/enums/NotificationType.java
  3. 8
      app/src/main/java/awais/instagrabber/utils/DownloadUtils.java
  4. 2
      app/src/main/res/layout/item_notification.xml
  5. 1
      app/src/main/res/values/strings.xml

3
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;

3
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<String, NotificationType> map = new HashMap<>();
private static final Map<String, NotificationType> map = new HashMap<>();
static {
for (NotificationType type : NotificationType.values()) {

8
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;

2
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" />

1
app/src/main/res/values/strings.xml

@ -225,6 +225,7 @@
<string name="comment_notif">Commented on your post:</string>
<string name="follow_notif">Started following you</string>
<string name="mention_notif">Mentioned you:</string>
<string name="tagged_notif">Tagged you in a post</string>
<string name="request_notif">Requested following you</string>
<string name="request_approve">Approve request</string>
<string name="request_reject">Reject request</string>

Loading…
Cancel
Save