diff --git a/app/src/main/java/awais/instagrabber/asyncs/FeedPostFetchService.java b/app/src/main/java/awais/instagrabber/asyncs/FeedPostFetchService.java index 4fe91772..96643339 100644 --- a/app/src/main/java/awais/instagrabber/asyncs/FeedPostFetchService.java +++ b/app/src/main/java/awais/instagrabber/asyncs/FeedPostFetchService.java @@ -39,7 +39,7 @@ public class FeedPostFetchService implements PostFetcher.PostFetchService { return; } else if (result == null) return; nextCursor = result.getNextCursor(); - hasNextPage = result.hasNextPage(); + hasNextPage = result.getHasNextPage(); final List mediaResults = result.getFeedModels(); feedModels.addAll(mediaResults); diff --git a/app/src/main/java/awais/instagrabber/asyncs/HashtagPostFetchService.java b/app/src/main/java/awais/instagrabber/asyncs/HashtagPostFetchService.java index 87b38bb7..7b26d79b 100644 --- a/app/src/main/java/awais/instagrabber/asyncs/HashtagPostFetchService.java +++ b/app/src/main/java/awais/instagrabber/asyncs/HashtagPostFetchService.java @@ -35,7 +35,7 @@ public class HashtagPostFetchService implements PostFetcher.PostFetchService { public void onSuccess(final PostsFetchResponse result) { if (result == null) return; nextMaxId = result.getNextCursor(); - moreAvailable = result.hasNextPage(); + moreAvailable = result.getHasNextPage(); if (fetchListener != null) { fetchListener.onResult(result.getFeedModels()); } diff --git a/app/src/main/java/awais/instagrabber/asyncs/LocationPostFetchService.java b/app/src/main/java/awais/instagrabber/asyncs/LocationPostFetchService.java index 31b9f90c..11f5dce3 100644 --- a/app/src/main/java/awais/instagrabber/asyncs/LocationPostFetchService.java +++ b/app/src/main/java/awais/instagrabber/asyncs/LocationPostFetchService.java @@ -35,7 +35,7 @@ public class LocationPostFetchService implements PostFetcher.PostFetchService { public void onSuccess(final PostsFetchResponse result) { if (result == null) return; nextMaxId = result.getNextCursor(); - moreAvailable = result.hasNextPage(); + moreAvailable = result.getHasNextPage(); if (fetchListener != null) { fetchListener.onResult(result.getFeedModels()); } diff --git a/app/src/main/java/awais/instagrabber/asyncs/ProfilePostFetchService.java b/app/src/main/java/awais/instagrabber/asyncs/ProfilePostFetchService.java index 2c609dcb..9bff389e 100644 --- a/app/src/main/java/awais/instagrabber/asyncs/ProfilePostFetchService.java +++ b/app/src/main/java/awais/instagrabber/asyncs/ProfilePostFetchService.java @@ -36,7 +36,7 @@ public class ProfilePostFetchService implements PostFetcher.PostFetchService { public void onSuccess(final PostsFetchResponse result) { if (result == null) return; nextMaxId = result.getNextCursor(); - moreAvailable = result.hasNextPage(); + moreAvailable = result.getHasNextPage(); if (fetchListener != null) { fetchListener.onResult(result.getFeedModels()); } diff --git a/app/src/main/java/awais/instagrabber/asyncs/SavedPostFetchService.java b/app/src/main/java/awais/instagrabber/asyncs/SavedPostFetchService.java index a84f960a..e4650a77 100644 --- a/app/src/main/java/awais/instagrabber/asyncs/SavedPostFetchService.java +++ b/app/src/main/java/awais/instagrabber/asyncs/SavedPostFetchService.java @@ -40,7 +40,7 @@ public class SavedPostFetchService implements PostFetcher.PostFetchService { public void onSuccess(final PostsFetchResponse result) { if (result == null) return; nextMaxId = result.getNextCursor(); - moreAvailable = result.hasNextPage(); + moreAvailable = result.getHasNextPage(); if (fetchListener != null) { fetchListener.onResult(result.getFeedModels()); } diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/HdProfilePicUrlInfo.kt b/app/src/main/java/awais/instagrabber/repositories/responses/HdProfilePicUrlInfo.kt index 86787880..e31a6027 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/HdProfilePicUrlInfo.kt +++ b/app/src/main/java/awais/instagrabber/repositories/responses/HdProfilePicUrlInfo.kt @@ -1,16 +1,5 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses -public class HdProfilePicUrlInfo { - private final String url; - private final int width, height; +import java.io.Serializable - public HdProfilePicUrlInfo(final String url, final int width, final int height) { - this.url = url; - this.width = width; - this.height = height; - } - - public String getUrl() { - return url; - } -} +data class HdProfilePicUrlInfo(val url: String, private val width: Int, private val height: Int) : Serializable \ No newline at end of file diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/ImageVersions2.kt b/app/src/main/java/awais/instagrabber/repositories/responses/ImageVersions2.kt index d71d8a00..6bed8a10 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/ImageVersions2.kt +++ b/app/src/main/java/awais/instagrabber/repositories/responses/ImageVersions2.kt @@ -1,30 +1,5 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses -import java.io.Serializable; -import java.util.List; -import java.util.Objects; +import java.io.Serializable -public class ImageVersions2 implements Serializable { - private final List candidates; - - public ImageVersions2(final List candidates) { - this.candidates = candidates; - } - - public List getCandidates() { - return candidates; - } - - @Override - public boolean equals(final Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - final ImageVersions2 that = (ImageVersions2) o; - return Objects.equals(candidates, that.candidates); - } - - @Override - public int hashCode() { - return Objects.hash(candidates); - } -} +data class ImageVersions2(val candidates: List) : Serializable \ No newline at end of file diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/LikersResponse.kt b/app/src/main/java/awais/instagrabber/repositories/responses/LikersResponse.kt index da750b04..8ea2aeb6 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/LikersResponse.kt +++ b/app/src/main/java/awais/instagrabber/repositories/responses/LikersResponse.kt @@ -1,27 +1,3 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses -import java.util.List; - -public class LikersResponse { - private final List users; - private final long userCount; - private final String status; - - public LikersResponse(final List users, final long userCount, final String status) { - this.users = users; - this.userCount = userCount; - this.status = status; - } - - public List getUsers() { - return users; - } - - public long getUserCount() { - return userCount; - } - - public String getStatus() { - return status; - } -} +data class LikersResponse(val users: List, val userCount: Long, val status: String) \ No newline at end of file diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/MediaCandidate.kt b/app/src/main/java/awais/instagrabber/repositories/responses/MediaCandidate.kt index 3a243497..5de5ea88 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/MediaCandidate.kt +++ b/app/src/main/java/awais/instagrabber/repositories/responses/MediaCandidate.kt @@ -1,43 +1,5 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses -import java.io.Serializable; -import java.util.Objects; +import java.io.Serializable -public class MediaCandidate implements Serializable { - private final int width; - private final int height; - private final String url; - - public MediaCandidate(final int width, final int height, final String url) { - this.width = width; - this.height = height; - this.url = url; - } - - public int getWidth() { - return width; - } - - public int getHeight() { - return height; - } - - public String getUrl() { - return url; - } - - @Override - public boolean equals(final Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - final MediaCandidate that = (MediaCandidate) o; - return width == that.width && - height == that.height && - Objects.equals(url, that.url); - } - - @Override - public int hashCode() { - return Objects.hash(width, height, url); - } -} +data class MediaCandidate(val width: Int, val height: Int, val url: String) : Serializable \ No newline at end of file diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/MediaInfoResponse.kt b/app/src/main/java/awais/instagrabber/repositories/responses/MediaInfoResponse.kt index 2112f48c..139d3c4a 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/MediaInfoResponse.kt +++ b/app/src/main/java/awais/instagrabber/repositories/responses/MediaInfoResponse.kt @@ -1,15 +1,3 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses -import java.util.List; - -public class MediaInfoResponse { - private final List items; - - public MediaInfoResponse(final List items) { - this.items = items; - } - - public List getItems() { - return items; - } -} +data class MediaInfoResponse(val items: List) \ No newline at end of file diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/NewsInboxResponse.kt b/app/src/main/java/awais/instagrabber/repositories/responses/NewsInboxResponse.kt index a6339e20..74c1417d 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/NewsInboxResponse.kt +++ b/app/src/main/java/awais/instagrabber/repositories/responses/NewsInboxResponse.kt @@ -1,32 +1,10 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses -import java.util.List; +import awais.instagrabber.repositories.responses.notification.Notification +import awais.instagrabber.repositories.responses.notification.NotificationCounts -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; - private final List oldStories; - - public NewsInboxResponse(final NotificationCounts counts, - final List newStories, - final List oldStories) { - this.counts = counts; - this.newStories = newStories; - this.oldStories = oldStories; - } - - public NotificationCounts getCounts() { - return counts; - } - - public List getNewStories() { - return newStories; - } - - public List getOldStories() { - return oldStories; - } -} +data class NewsInboxResponse( + val counts: NotificationCounts, + val newStories: List, + val oldStories: List +) \ No newline at end of file diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/Place.kt b/app/src/main/java/awais/instagrabber/repositories/responses/Place.kt index 3f10ffd4..a0004a59 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/Place.kt +++ b/app/src/main/java/awais/instagrabber/repositories/responses/Place.kt @@ -1,62 +1,12 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses -import java.util.Objects; - -public class Place { - private final Location location; +data class Place( + val location: Location, // for search - private final String title; // those are repeated within location - private final String subtitle; // address - private final String slug; // browser only; for end of address + val title: String, // those are repeated within location + val subtitle: String?, // address + // browser only; for end of address + val slug: String?, // for location info - private final String status; - - public Place(final Location location, - final String title, - final String subtitle, - final String slug, - final String status) { - this.location = location; - this.title = title; - this.subtitle = subtitle; - this.slug = slug; - this.status = status; - } - - public Location getLocation() { - return location; - } - - public String getTitle() { - return title; - } - - public String getSubtitle() { - return subtitle; - } - - public String getSlug() { - return slug; - } - - public String getStatus() { - return status; - } - - @Override - public boolean equals(final Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - final Place place = (Place) o; - return Objects.equals(location, place.location) && - Objects.equals(title, place.title) && - Objects.equals(subtitle, place.subtitle) && - Objects.equals(slug, place.slug) && - Objects.equals(status, place.status); - } - - @Override - public int hashCode() { - return Objects.hash(location, title, subtitle, slug, status); - } -} + val status: String? +) \ No newline at end of file diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/PostsFetchResponse.kt b/app/src/main/java/awais/instagrabber/repositories/responses/PostsFetchResponse.kt index c5b24016..64082fce 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/PostsFetchResponse.kt +++ b/app/src/main/java/awais/instagrabber/repositories/responses/PostsFetchResponse.kt @@ -1,27 +1,7 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses -import java.util.List; - -public class PostsFetchResponse { - private final List feedModels; - private final boolean hasNextPage; - private final String nextCursor; - - public PostsFetchResponse(final List feedModels, final boolean hasNextPage, final String nextCursor) { - this.feedModels = feedModels; - this.hasNextPage = hasNextPage; - this.nextCursor = nextCursor; - } - - public List getFeedModels() { - return feedModels; - } - - public boolean hasNextPage() { - return hasNextPage; - } - - public String getNextCursor() { - return nextCursor; - } -} +class PostsFetchResponse( + val feedModels: List, + val hasNextPage: Boolean, + val nextCursor: String? +) \ No newline at end of file diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/TagFeedResponse.kt b/app/src/main/java/awais/instagrabber/repositories/responses/TagFeedResponse.kt index f597beea..d9bfb37e 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/TagFeedResponse.kt +++ b/app/src/main/java/awais/instagrabber/repositories/responses/TagFeedResponse.kt @@ -1,43 +1,9 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses -import java.util.List; - -public class TagFeedResponse { - private final int numResults; - private final String nextMaxId; - private final boolean moreAvailable; - private final String status; - private final List items; - - public TagFeedResponse(final int numResults, - final String nextMaxId, - final boolean moreAvailable, - final String status, - final List items) { - this.numResults = numResults; - this.nextMaxId = nextMaxId; - this.moreAvailable = moreAvailable; - this.status = status; - this.items = items; - } - - public int getNumResults() { - return numResults; - } - - public String getNextMaxId() { - return nextMaxId; - } - - public boolean isMoreAvailable() { - return moreAvailable; - } - - public String getStatus() { - return status; - } - - public List getItems() { - return items; - } -} +class TagFeedResponse( + val numResults: Int, + val nextMaxId: String?, + val moreAvailable: Boolean, + val status: String, + val items: List +) \ No newline at end of file diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/UserFeedResponse.kt b/app/src/main/java/awais/instagrabber/repositories/responses/UserFeedResponse.kt index bc912bed..9a68fa4e 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/UserFeedResponse.kt +++ b/app/src/main/java/awais/instagrabber/repositories/responses/UserFeedResponse.kt @@ -1,43 +1,9 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses -import java.util.List; - -public class UserFeedResponse { - private final int numResults; - private final String nextMaxId; - private final boolean moreAvailable; - private final String status; - private final List items; - - public UserFeedResponse(final int numResults, - final String nextMaxId, - final boolean moreAvailable, - final String status, - final List items) { - this.numResults = numResults; - this.nextMaxId = nextMaxId; - this.moreAvailable = moreAvailable; - this.status = status; - this.items = items; - } - - public int getNumResults() { - return numResults; - } - - public String getNextMaxId() { - return nextMaxId; - } - - public boolean isMoreAvailable() { - return moreAvailable; - } - - public String getStatus() { - return status; - } - - public List getItems() { - return items; - } -} +class UserFeedResponse( + val numResults: Int, + val nextMaxId: String?, + val moreAvailable: Boolean, + val status: String, + val items: List +) \ No newline at end of file diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/UserProfileContextLink.kt b/app/src/main/java/awais/instagrabber/repositories/responses/UserProfileContextLink.kt index 7beb954d..ea8d1a66 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/UserProfileContextLink.kt +++ b/app/src/main/java/awais/instagrabber/repositories/responses/UserProfileContextLink.kt @@ -1,21 +1,3 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses -public class UserProfileContextLink { - private final String username; - private final int start; - private final int end; - - public UserProfileContextLink(final String username, final int start, final int end) { - this.username = username; - this.start = start; - this.end = end; - } - - public String getUsername() { - return username; - } - - public int getStart() { - return start; - } -} +class UserProfileContextLink(val username: String, val start: Int, private val end: Int) \ No newline at end of file diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/WrappedMedia.kt b/app/src/main/java/awais/instagrabber/repositories/responses/WrappedMedia.kt index 2bfb1fa1..e09a20bc 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/WrappedMedia.kt +++ b/app/src/main/java/awais/instagrabber/repositories/responses/WrappedMedia.kt @@ -1,13 +1,3 @@ -package awais.instagrabber.repositories.responses; +package awais.instagrabber.repositories.responses -public class WrappedMedia { - private final Media media; - - public WrappedMedia(final Media media) { - this.media = media; - } - - public Media getMedia() { - return media; - } -} +class WrappedMedia(val media: Media) \ No newline at end of file diff --git a/app/src/main/java/awais/instagrabber/webservices/ProfileService.java b/app/src/main/java/awais/instagrabber/webservices/ProfileService.java index 1e491906..e8f6884c 100644 --- a/app/src/main/java/awais/instagrabber/webservices/ProfileService.java +++ b/app/src/main/java/awais/instagrabber/webservices/ProfileService.java @@ -63,7 +63,7 @@ public class ProfileService { } callback.onSuccess(new PostsFetchResponse( body.getItems(), - body.isMoreAvailable(), + body.getMoreAvailable(), body.getNextMaxId() )); } @@ -204,7 +204,7 @@ public class ProfileService { } callback.onSuccess(new PostsFetchResponse( userFeedResponse.getItems(), - userFeedResponse.isMoreAvailable(), + userFeedResponse.getMoreAvailable(), userFeedResponse.getNextMaxId() )); } @@ -237,7 +237,7 @@ public class ProfileService { } callback.onSuccess(new PostsFetchResponse( userFeedResponse.getItems(), - userFeedResponse.isMoreAvailable(), + userFeedResponse.getMoreAvailable(), userFeedResponse.getNextMaxId() )); } diff --git a/app/src/main/java/awais/instagrabber/webservices/TagsService.java b/app/src/main/java/awais/instagrabber/webservices/TagsService.java index fa4f3dce..f207dcad 100644 --- a/app/src/main/java/awais/instagrabber/webservices/TagsService.java +++ b/app/src/main/java/awais/instagrabber/webservices/TagsService.java @@ -122,7 +122,7 @@ public class TagsService { } callback.onSuccess(new PostsFetchResponse( body.getItems(), - body.isMoreAvailable(), + body.getMoreAvailable(), body.getNextMaxId() )); }