From 1dd78b7d9196daba20bfa2e98dbbc387900f2eaf Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Mon, 22 Mar 2021 14:51:44 -0400 Subject: [PATCH] reorganize responses --- .../adapters/NotificationsAdapter.java | 2 +- .../viewholder/NotificationViewHolder.java | 4 ++-- .../fragments/NotificationsViewerFragment.java | 7 +++---- .../repositories/FeedRepository.java | 2 +- .../repositories/responses/Media.java | 1 + .../responses/NewsInboxResponse.java | 3 +++ .../{ => feed}/EndOfFeedDemarcator.java | 2 +- .../responses/{ => feed}/EndOfFeedGroup.java | 4 +++- .../responses/{ => feed}/EndOfFeedGroupSet.java | 2 +- .../responses/{ => feed}/FeedFetchResponse.java | 4 +++- .../{ => notification}/Notification.java | 2 +- .../{ => notification}/NotificationArgs.java | 4 +--- .../{ => notification}/NotificationCounts.java | 2 +- .../{ => notification}/NotificationImage.java | 2 +- .../services/ActivityCheckerService.java | 4 +--- .../viewmodels/NotificationViewModel.java | 2 +- .../instagrabber/webservices/FeedService.java | 8 ++++---- .../instagrabber/webservices/NewsService.java | 17 +++-------------- 18 files changed, 32 insertions(+), 40 deletions(-) rename app/src/main/java/awais/instagrabber/repositories/responses/{ => feed}/EndOfFeedDemarcator.java (94%) rename app/src/main/java/awais/instagrabber/repositories/responses/{ => feed}/EndOfFeedGroup.java (92%) rename app/src/main/java/awais/instagrabber/repositories/responses/{ => feed}/EndOfFeedGroupSet.java (97%) rename app/src/main/java/awais/instagrabber/repositories/responses/{ => feed}/FeedFetchResponse.java (90%) rename app/src/main/java/awais/instagrabber/repositories/responses/{ => notification}/Notification.java (91%) rename app/src/main/java/awais/instagrabber/repositories/responses/{ => notification}/NotificationArgs.java (97%) rename app/src/main/java/awais/instagrabber/repositories/responses/{ => notification}/NotificationCounts.java (95%) rename app/src/main/java/awais/instagrabber/repositories/responses/{ => notification}/NotificationImage.java (84%) diff --git a/app/src/main/java/awais/instagrabber/adapters/NotificationsAdapter.java b/app/src/main/java/awais/instagrabber/adapters/NotificationsAdapter.java index 8a5c3a4b..80ab465b 100644 --- a/app/src/main/java/awais/instagrabber/adapters/NotificationsAdapter.java +++ b/app/src/main/java/awais/instagrabber/adapters/NotificationsAdapter.java @@ -16,7 +16,7 @@ import java.util.stream.Collectors; import awais.instagrabber.adapters.viewholder.NotificationViewHolder; import awais.instagrabber.databinding.ItemNotificationBinding; import awais.instagrabber.models.enums.NotificationType; -import awais.instagrabber.repositories.responses.Notification; +import awais.instagrabber.repositories.responses.notification.Notification; public final class NotificationsAdapter extends ListAdapter { private final OnNotificationClickListener notificationClickListener; 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 1c896770..153837e8 100644 --- a/app/src/main/java/awais/instagrabber/adapters/viewholder/NotificationViewHolder.java +++ b/app/src/main/java/awais/instagrabber/adapters/viewholder/NotificationViewHolder.java @@ -9,8 +9,8 @@ import awais.instagrabber.R; import awais.instagrabber.adapters.NotificationsAdapter.OnNotificationClickListener; import awais.instagrabber.databinding.ItemNotificationBinding; import awais.instagrabber.models.enums.NotificationType; -import awais.instagrabber.repositories.responses.Notification; -import awais.instagrabber.repositories.responses.NotificationArgs; +import awais.instagrabber.repositories.responses.notification.Notification; +import awais.instagrabber.repositories.responses.notification.NotificationArgs; public final class NotificationViewHolder extends RecyclerView.ViewHolder { private final ItemNotificationBinding binding; diff --git a/app/src/main/java/awais/instagrabber/fragments/NotificationsViewerFragment.java b/app/src/main/java/awais/instagrabber/fragments/NotificationsViewerFragment.java index cae95e09..d9b56ce7 100644 --- a/app/src/main/java/awais/instagrabber/fragments/NotificationsViewerFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/NotificationsViewerFragment.java @@ -2,7 +2,6 @@ package awais.instagrabber.fragments; import android.content.Context; import android.content.DialogInterface; -import android.os.AsyncTask; import android.os.Bundle; import android.text.SpannableString; import android.text.Spanned; @@ -37,9 +36,9 @@ import awais.instagrabber.models.enums.NotificationType; import awais.instagrabber.repositories.requests.StoryViewerOptions; import awais.instagrabber.repositories.responses.FriendshipChangeResponse; import awais.instagrabber.repositories.responses.Media; -import awais.instagrabber.repositories.responses.Notification; -import awais.instagrabber.repositories.responses.NotificationArgs; -import awais.instagrabber.repositories.responses.NotificationImage; +import awais.instagrabber.repositories.responses.notification.Notification; +import awais.instagrabber.repositories.responses.notification.NotificationArgs; +import awais.instagrabber.repositories.responses.notification.NotificationImage; import awais.instagrabber.utils.Constants; import awais.instagrabber.utils.CookieUtils; import awais.instagrabber.utils.TextUtils; diff --git a/app/src/main/java/awais/instagrabber/repositories/FeedRepository.java b/app/src/main/java/awais/instagrabber/repositories/FeedRepository.java index bb7d036c..b5273e35 100644 --- a/app/src/main/java/awais/instagrabber/repositories/FeedRepository.java +++ b/app/src/main/java/awais/instagrabber/repositories/FeedRepository.java @@ -2,7 +2,7 @@ package awais.instagrabber.repositories; import java.util.Map; -import awais.instagrabber.repositories.responses.FeedFetchResponse; +import awais.instagrabber.repositories.responses.feed.FeedFetchResponse; import retrofit2.Call; import retrofit2.http.FieldMap; import retrofit2.http.FormUrlEncoded; diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/Media.java b/app/src/main/java/awais/instagrabber/repositories/responses/Media.java index 1a149a66..c11669a8 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/Media.java +++ b/app/src/main/java/awais/instagrabber/repositories/responses/Media.java @@ -9,6 +9,7 @@ import java.util.Map; import java.util.Objects; import awais.instagrabber.models.enums.MediaItemType; +import awais.instagrabber.repositories.responses.feed.EndOfFeedDemarcator; import awais.instagrabber.utils.Utils; public class Media implements Serializable { diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/NewsInboxResponse.java b/app/src/main/java/awais/instagrabber/repositories/responses/NewsInboxResponse.java index 5dcdb487..a6339e20 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/NewsInboxResponse.java +++ b/app/src/main/java/awais/instagrabber/repositories/responses/NewsInboxResponse.java @@ -2,6 +2,9 @@ package awais.instagrabber.repositories.responses; import java.util.List; +import awais.instagrabber.repositories.responses.notification.Notification; +import awais.instagrabber.repositories.responses.notification.NotificationCounts; + public class NewsInboxResponse { private final NotificationCounts counts; private final List newStories; diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/EndOfFeedDemarcator.java b/app/src/main/java/awais/instagrabber/repositories/responses/feed/EndOfFeedDemarcator.java similarity index 94% rename from app/src/main/java/awais/instagrabber/repositories/responses/EndOfFeedDemarcator.java rename to app/src/main/java/awais/instagrabber/repositories/responses/feed/EndOfFeedDemarcator.java index 44b9936d..2408bc89 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/EndOfFeedDemarcator.java +++ b/app/src/main/java/awais/instagrabber/repositories/responses/feed/EndOfFeedDemarcator.java @@ -1,4 +1,4 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses.feed; import java.io.Serializable; import java.util.Objects; diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/EndOfFeedGroup.java b/app/src/main/java/awais/instagrabber/repositories/responses/feed/EndOfFeedGroup.java similarity index 92% rename from app/src/main/java/awais/instagrabber/repositories/responses/EndOfFeedGroup.java rename to app/src/main/java/awais/instagrabber/repositories/responses/feed/EndOfFeedGroup.java index 43384a41..e675691e 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/EndOfFeedGroup.java +++ b/app/src/main/java/awais/instagrabber/repositories/responses/feed/EndOfFeedGroup.java @@ -1,9 +1,11 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses.feed; import java.io.Serializable; import java.util.List; import java.util.Objects; +import awais.instagrabber.repositories.responses.Media; + public class EndOfFeedGroup implements Serializable { private final String id; private final String title; diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/EndOfFeedGroupSet.java b/app/src/main/java/awais/instagrabber/repositories/responses/feed/EndOfFeedGroupSet.java similarity index 97% rename from app/src/main/java/awais/instagrabber/repositories/responses/EndOfFeedGroupSet.java rename to app/src/main/java/awais/instagrabber/repositories/responses/feed/EndOfFeedGroupSet.java index 3da29e03..cfda0f39 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/EndOfFeedGroupSet.java +++ b/app/src/main/java/awais/instagrabber/repositories/responses/feed/EndOfFeedGroupSet.java @@ -1,4 +1,4 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses.feed; import java.io.Serializable; import java.util.List; diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/FeedFetchResponse.java b/app/src/main/java/awais/instagrabber/repositories/responses/feed/FeedFetchResponse.java similarity index 90% rename from app/src/main/java/awais/instagrabber/repositories/responses/FeedFetchResponse.java rename to app/src/main/java/awais/instagrabber/repositories/responses/feed/FeedFetchResponse.java index 2d91a9f7..9d8659af 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/FeedFetchResponse.java +++ b/app/src/main/java/awais/instagrabber/repositories/responses/feed/FeedFetchResponse.java @@ -1,7 +1,9 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses.feed; import java.util.List; +import awais.instagrabber.repositories.responses.Media; + public class FeedFetchResponse { private final List items; private final int numResults; diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/Notification.java b/app/src/main/java/awais/instagrabber/repositories/responses/notification/Notification.java similarity index 91% rename from app/src/main/java/awais/instagrabber/repositories/responses/Notification.java rename to app/src/main/java/awais/instagrabber/repositories/responses/notification/Notification.java index c784d52b..6da18866 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/Notification.java +++ b/app/src/main/java/awais/instagrabber/repositories/responses/notification/Notification.java @@ -1,4 +1,4 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses.notification; import awais.instagrabber.models.enums.NotificationType; diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/NotificationArgs.java b/app/src/main/java/awais/instagrabber/repositories/responses/notification/NotificationArgs.java similarity index 97% rename from app/src/main/java/awais/instagrabber/repositories/responses/NotificationArgs.java rename to app/src/main/java/awais/instagrabber/repositories/responses/notification/NotificationArgs.java index 87116896..27fde081 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/NotificationArgs.java +++ b/app/src/main/java/awais/instagrabber/repositories/responses/notification/NotificationArgs.java @@ -1,4 +1,4 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses.notification; import androidx.annotation.NonNull; @@ -7,8 +7,6 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import android.util.Log; - import awais.instagrabber.utils.Utils; public class NotificationArgs { diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/NotificationCounts.java b/app/src/main/java/awais/instagrabber/repositories/responses/notification/NotificationCounts.java similarity index 95% rename from app/src/main/java/awais/instagrabber/repositories/responses/NotificationCounts.java rename to app/src/main/java/awais/instagrabber/repositories/responses/notification/NotificationCounts.java index 38fb70f9..10074f70 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/NotificationCounts.java +++ b/app/src/main/java/awais/instagrabber/repositories/responses/notification/NotificationCounts.java @@ -1,4 +1,4 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses.notification; import androidx.annotation.NonNull; diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/NotificationImage.java b/app/src/main/java/awais/instagrabber/repositories/responses/notification/NotificationImage.java similarity index 84% rename from app/src/main/java/awais/instagrabber/repositories/responses/NotificationImage.java rename to app/src/main/java/awais/instagrabber/repositories/responses/notification/NotificationImage.java index 3ba92ce2..e3d31bc9 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/NotificationImage.java +++ b/app/src/main/java/awais/instagrabber/repositories/responses/notification/NotificationImage.java @@ -1,4 +1,4 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses.notification; public class NotificationImage { private final String id; diff --git a/app/src/main/java/awais/instagrabber/services/ActivityCheckerService.java b/app/src/main/java/awais/instagrabber/services/ActivityCheckerService.java index 5160f9aa..1845188e 100644 --- a/app/src/main/java/awais/instagrabber/services/ActivityCheckerService.java +++ b/app/src/main/java/awais/instagrabber/services/ActivityCheckerService.java @@ -18,13 +18,11 @@ import java.util.List; import awais.instagrabber.R; import awais.instagrabber.activities.MainActivity; -import awais.instagrabber.repositories.responses.NotificationCounts; +import awais.instagrabber.repositories.responses.notification.NotificationCounts; import awais.instagrabber.utils.Constants; import awais.instagrabber.webservices.NewsService; import awais.instagrabber.webservices.ServiceCallback; -import static awais.instagrabber.utils.Utils.settingsHelper; - public class ActivityCheckerService extends Service { private static final String TAG = "ActivityCheckerService"; private static final int INITIAL_DELAY_MILLIS = 200; diff --git a/app/src/main/java/awais/instagrabber/viewmodels/NotificationViewModel.java b/app/src/main/java/awais/instagrabber/viewmodels/NotificationViewModel.java index 59a8bb64..1e3e9845 100644 --- a/app/src/main/java/awais/instagrabber/viewmodels/NotificationViewModel.java +++ b/app/src/main/java/awais/instagrabber/viewmodels/NotificationViewModel.java @@ -5,7 +5,7 @@ import androidx.lifecycle.ViewModel; import java.util.List; -import awais.instagrabber.repositories.responses.Notification; +import awais.instagrabber.repositories.responses.notification.Notification; public class NotificationViewModel extends ViewModel { private MutableLiveData> list; diff --git a/app/src/main/java/awais/instagrabber/webservices/FeedService.java b/app/src/main/java/awais/instagrabber/webservices/FeedService.java index 2bd91690..3496f8b7 100644 --- a/app/src/main/java/awais/instagrabber/webservices/FeedService.java +++ b/app/src/main/java/awais/instagrabber/webservices/FeedService.java @@ -12,10 +12,10 @@ import java.util.Map; import java.util.UUID; import awais.instagrabber.repositories.FeedRepository; -import awais.instagrabber.repositories.responses.EndOfFeedDemarcator; -import awais.instagrabber.repositories.responses.EndOfFeedGroup; -import awais.instagrabber.repositories.responses.EndOfFeedGroupSet; -import awais.instagrabber.repositories.responses.FeedFetchResponse; +import awais.instagrabber.repositories.responses.feed.EndOfFeedDemarcator; +import awais.instagrabber.repositories.responses.feed.EndOfFeedGroup; +import awais.instagrabber.repositories.responses.feed.EndOfFeedGroupSet; +import awais.instagrabber.repositories.responses.feed.FeedFetchResponse; import awais.instagrabber.repositories.responses.Media; import awais.instagrabber.repositories.responses.PostsFetchResponse; import awais.instagrabber.utils.TextUtils; diff --git a/app/src/main/java/awais/instagrabber/webservices/NewsService.java b/app/src/main/java/awais/instagrabber/webservices/NewsService.java index fe54c13d..5eec9e8c 100644 --- a/app/src/main/java/awais/instagrabber/webservices/NewsService.java +++ b/app/src/main/java/awais/instagrabber/webservices/NewsService.java @@ -1,35 +1,24 @@ package awais.instagrabber.webservices; -import android.util.Log; - import androidx.annotation.NonNull; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.stream.Collectors; -import awais.instagrabber.BuildConfig; -import awais.instagrabber.models.enums.NotificationType; import awais.instagrabber.repositories.NewsRepository; import awais.instagrabber.repositories.responses.AymlResponse; import awais.instagrabber.repositories.responses.AymlUser; -import awais.instagrabber.repositories.responses.NotificationCounts; +import awais.instagrabber.repositories.responses.notification.NotificationCounts; import awais.instagrabber.repositories.responses.UserSearchResponse; import awais.instagrabber.repositories.responses.NewsInboxResponse; -import awais.instagrabber.repositories.responses.Notification; -import awais.instagrabber.repositories.responses.NotificationArgs; -import awais.instagrabber.repositories.responses.NotificationImage; +import awais.instagrabber.repositories.responses.notification.Notification; +import awais.instagrabber.repositories.responses.notification.NotificationArgs; import awais.instagrabber.repositories.responses.User; import awais.instagrabber.utils.Constants; -import awais.instagrabber.utils.Utils; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response;