mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 06:37:30 +00:00
convert stuff to kotlin
This commit is contained in:
parent
7efe8aeee5
commit
dbf0c66b41
@ -39,7 +39,7 @@ public class FeedPostFetchService implements PostFetcher.PostFetchService {
|
|||||||
return;
|
return;
|
||||||
} else if (result == null) return;
|
} else if (result == null) return;
|
||||||
nextCursor = result.getNextCursor();
|
nextCursor = result.getNextCursor();
|
||||||
hasNextPage = result.hasNextPage();
|
hasNextPage = result.getHasNextPage();
|
||||||
|
|
||||||
final List<Media> mediaResults = result.getFeedModels();
|
final List<Media> mediaResults = result.getFeedModels();
|
||||||
feedModels.addAll(mediaResults);
|
feedModels.addAll(mediaResults);
|
||||||
|
@ -35,7 +35,7 @@ public class HashtagPostFetchService implements PostFetcher.PostFetchService {
|
|||||||
public void onSuccess(final PostsFetchResponse result) {
|
public void onSuccess(final PostsFetchResponse result) {
|
||||||
if (result == null) return;
|
if (result == null) return;
|
||||||
nextMaxId = result.getNextCursor();
|
nextMaxId = result.getNextCursor();
|
||||||
moreAvailable = result.hasNextPage();
|
moreAvailable = result.getHasNextPage();
|
||||||
if (fetchListener != null) {
|
if (fetchListener != null) {
|
||||||
fetchListener.onResult(result.getFeedModels());
|
fetchListener.onResult(result.getFeedModels());
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class LocationPostFetchService implements PostFetcher.PostFetchService {
|
|||||||
public void onSuccess(final PostsFetchResponse result) {
|
public void onSuccess(final PostsFetchResponse result) {
|
||||||
if (result == null) return;
|
if (result == null) return;
|
||||||
nextMaxId = result.getNextCursor();
|
nextMaxId = result.getNextCursor();
|
||||||
moreAvailable = result.hasNextPage();
|
moreAvailable = result.getHasNextPage();
|
||||||
if (fetchListener != null) {
|
if (fetchListener != null) {
|
||||||
fetchListener.onResult(result.getFeedModels());
|
fetchListener.onResult(result.getFeedModels());
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public class ProfilePostFetchService implements PostFetcher.PostFetchService {
|
|||||||
public void onSuccess(final PostsFetchResponse result) {
|
public void onSuccess(final PostsFetchResponse result) {
|
||||||
if (result == null) return;
|
if (result == null) return;
|
||||||
nextMaxId = result.getNextCursor();
|
nextMaxId = result.getNextCursor();
|
||||||
moreAvailable = result.hasNextPage();
|
moreAvailable = result.getHasNextPage();
|
||||||
if (fetchListener != null) {
|
if (fetchListener != null) {
|
||||||
fetchListener.onResult(result.getFeedModels());
|
fetchListener.onResult(result.getFeedModels());
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class SavedPostFetchService implements PostFetcher.PostFetchService {
|
|||||||
public void onSuccess(final PostsFetchResponse result) {
|
public void onSuccess(final PostsFetchResponse result) {
|
||||||
if (result == null) return;
|
if (result == null) return;
|
||||||
nextMaxId = result.getNextCursor();
|
nextMaxId = result.getNextCursor();
|
||||||
moreAvailable = result.hasNextPage();
|
moreAvailable = result.getHasNextPage();
|
||||||
if (fetchListener != null) {
|
if (fetchListener != null) {
|
||||||
fetchListener.onResult(result.getFeedModels());
|
fetchListener.onResult(result.getFeedModels());
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,5 @@
|
|||||||
package awais.instagrabber.repositories.responses;
|
package awais.instagrabber.repositories.responses
|
||||||
|
|
||||||
public class HdProfilePicUrlInfo {
|
import java.io.Serializable
|
||||||
private final String url;
|
|
||||||
private final int width, height;
|
|
||||||
|
|
||||||
public HdProfilePicUrlInfo(final String url, final int width, final int height) {
|
data class HdProfilePicUrlInfo(val url: String, private val width: Int, private val height: Int) : Serializable
|
||||||
this.url = url;
|
|
||||||
this.width = width;
|
|
||||||
this.height = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,30 +1,5 @@
|
|||||||
package awais.instagrabber.repositories.responses;
|
package awais.instagrabber.repositories.responses
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class ImageVersions2 implements Serializable {
|
data class ImageVersions2(val candidates: List<MediaCandidate>) : Serializable
|
||||||
private final List<MediaCandidate> candidates;
|
|
||||||
|
|
||||||
public ImageVersions2(final List<MediaCandidate> candidates) {
|
|
||||||
this.candidates = candidates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MediaCandidate> 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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +1,3 @@
|
|||||||
package awais.instagrabber.repositories.responses;
|
package awais.instagrabber.repositories.responses
|
||||||
|
|
||||||
import java.util.List;
|
data class LikersResponse(val users: List<User>, val userCount: Long, val status: String)
|
||||||
|
|
||||||
public class LikersResponse {
|
|
||||||
private final List<User> users;
|
|
||||||
private final long userCount;
|
|
||||||
private final String status;
|
|
||||||
|
|
||||||
public LikersResponse(final List<User> users, final long userCount, final String status) {
|
|
||||||
this.users = users;
|
|
||||||
this.userCount = userCount;
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<User> getUsers() {
|
|
||||||
return users;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getUserCount() {
|
|
||||||
return userCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +1,5 @@
|
|||||||
package awais.instagrabber.repositories.responses;
|
package awais.instagrabber.repositories.responses
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class MediaCandidate implements Serializable {
|
data class MediaCandidate(val width: Int, val height: Int, val url: String) : 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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +1,3 @@
|
|||||||
package awais.instagrabber.repositories.responses;
|
package awais.instagrabber.repositories.responses
|
||||||
|
|
||||||
import java.util.List;
|
data class MediaInfoResponse(val items: List<Media>)
|
||||||
|
|
||||||
public class MediaInfoResponse {
|
|
||||||
private final List<Media> items;
|
|
||||||
|
|
||||||
public MediaInfoResponse(final List<Media> items) {
|
|
||||||
this.items = items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Media> getItems() {
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
data class NewsInboxResponse(
|
||||||
import awais.instagrabber.repositories.responses.notification.NotificationCounts;
|
val counts: NotificationCounts,
|
||||||
|
val newStories: List<Notification>,
|
||||||
public class NewsInboxResponse {
|
val oldStories: List<Notification>
|
||||||
private final NotificationCounts counts;
|
)
|
||||||
private final List<Notification> newStories;
|
|
||||||
private final List<Notification> oldStories;
|
|
||||||
|
|
||||||
public NewsInboxResponse(final NotificationCounts counts,
|
|
||||||
final List<Notification> newStories,
|
|
||||||
final List<Notification> oldStories) {
|
|
||||||
this.counts = counts;
|
|
||||||
this.newStories = newStories;
|
|
||||||
this.oldStories = oldStories;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationCounts getCounts() {
|
|
||||||
return counts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Notification> getNewStories() {
|
|
||||||
return newStories;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Notification> getOldStories() {
|
|
||||||
return oldStories;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,62 +1,12 @@
|
|||||||
package awais.instagrabber.repositories.responses;
|
package awais.instagrabber.repositories.responses
|
||||||
|
|
||||||
import java.util.Objects;
|
data class Place(
|
||||||
|
val location: Location,
|
||||||
public class Place {
|
|
||||||
private final Location location;
|
|
||||||
// for search
|
// for search
|
||||||
private final String title; // those are repeated within location
|
val title: String, // those are repeated within location
|
||||||
private final String subtitle; // address
|
val subtitle: String?, // address
|
||||||
private final String slug; // browser only; for end of address
|
// browser only; for end of address
|
||||||
|
val slug: String?,
|
||||||
// for location info
|
// for location info
|
||||||
private final String status;
|
val status: String?
|
||||||
|
)
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +1,7 @@
|
|||||||
package awais.instagrabber.repositories.responses;
|
package awais.instagrabber.repositories.responses
|
||||||
|
|
||||||
import java.util.List;
|
class PostsFetchResponse(
|
||||||
|
val feedModels: List<Media>,
|
||||||
public class PostsFetchResponse {
|
val hasNextPage: Boolean,
|
||||||
private final List<Media> feedModels;
|
val nextCursor: String?
|
||||||
private final boolean hasNextPage;
|
)
|
||||||
private final String nextCursor;
|
|
||||||
|
|
||||||
public PostsFetchResponse(final List<Media> feedModels, final boolean hasNextPage, final String nextCursor) {
|
|
||||||
this.feedModels = feedModels;
|
|
||||||
this.hasNextPage = hasNextPage;
|
|
||||||
this.nextCursor = nextCursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Media> getFeedModels() {
|
|
||||||
return feedModels;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasNextPage() {
|
|
||||||
return hasNextPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNextCursor() {
|
|
||||||
return nextCursor;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +1,9 @@
|
|||||||
package awais.instagrabber.repositories.responses;
|
package awais.instagrabber.repositories.responses
|
||||||
|
|
||||||
import java.util.List;
|
class TagFeedResponse(
|
||||||
|
val numResults: Int,
|
||||||
public class TagFeedResponse {
|
val nextMaxId: String?,
|
||||||
private final int numResults;
|
val moreAvailable: Boolean,
|
||||||
private final String nextMaxId;
|
val status: String,
|
||||||
private final boolean moreAvailable;
|
val items: List<Media>
|
||||||
private final String status;
|
)
|
||||||
private final List<Media> items;
|
|
||||||
|
|
||||||
public TagFeedResponse(final int numResults,
|
|
||||||
final String nextMaxId,
|
|
||||||
final boolean moreAvailable,
|
|
||||||
final String status,
|
|
||||||
final List<Media> 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<Media> getItems() {
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +1,9 @@
|
|||||||
package awais.instagrabber.repositories.responses;
|
package awais.instagrabber.repositories.responses
|
||||||
|
|
||||||
import java.util.List;
|
class UserFeedResponse(
|
||||||
|
val numResults: Int,
|
||||||
public class UserFeedResponse {
|
val nextMaxId: String?,
|
||||||
private final int numResults;
|
val moreAvailable: Boolean,
|
||||||
private final String nextMaxId;
|
val status: String,
|
||||||
private final boolean moreAvailable;
|
val items: List<Media>
|
||||||
private final String status;
|
)
|
||||||
private final List<Media> items;
|
|
||||||
|
|
||||||
public UserFeedResponse(final int numResults,
|
|
||||||
final String nextMaxId,
|
|
||||||
final boolean moreAvailable,
|
|
||||||
final String status,
|
|
||||||
final List<Media> 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<Media> getItems() {
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +1,3 @@
|
|||||||
package awais.instagrabber.repositories.responses;
|
package awais.instagrabber.repositories.responses
|
||||||
|
|
||||||
public class UserProfileContextLink {
|
class UserProfileContextLink(val username: String, val start: Int, private val end: Int)
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +1,3 @@
|
|||||||
package awais.instagrabber.repositories.responses;
|
package awais.instagrabber.repositories.responses
|
||||||
|
|
||||||
public class WrappedMedia {
|
class WrappedMedia(val media: Media)
|
||||||
private final Media media;
|
|
||||||
|
|
||||||
public WrappedMedia(final Media media) {
|
|
||||||
this.media = media;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Media getMedia() {
|
|
||||||
return media;
|
|
||||||
}
|
|
||||||
}
|
|
@ -63,7 +63,7 @@ public class ProfileService {
|
|||||||
}
|
}
|
||||||
callback.onSuccess(new PostsFetchResponse(
|
callback.onSuccess(new PostsFetchResponse(
|
||||||
body.getItems(),
|
body.getItems(),
|
||||||
body.isMoreAvailable(),
|
body.getMoreAvailable(),
|
||||||
body.getNextMaxId()
|
body.getNextMaxId()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ public class ProfileService {
|
|||||||
}
|
}
|
||||||
callback.onSuccess(new PostsFetchResponse(
|
callback.onSuccess(new PostsFetchResponse(
|
||||||
userFeedResponse.getItems(),
|
userFeedResponse.getItems(),
|
||||||
userFeedResponse.isMoreAvailable(),
|
userFeedResponse.getMoreAvailable(),
|
||||||
userFeedResponse.getNextMaxId()
|
userFeedResponse.getNextMaxId()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -237,7 +237,7 @@ public class ProfileService {
|
|||||||
}
|
}
|
||||||
callback.onSuccess(new PostsFetchResponse(
|
callback.onSuccess(new PostsFetchResponse(
|
||||||
userFeedResponse.getItems(),
|
userFeedResponse.getItems(),
|
||||||
userFeedResponse.isMoreAvailable(),
|
userFeedResponse.getMoreAvailable(),
|
||||||
userFeedResponse.getNextMaxId()
|
userFeedResponse.getNextMaxId()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ public class TagsService {
|
|||||||
}
|
}
|
||||||
callback.onSuccess(new PostsFetchResponse(
|
callback.onSuccess(new PostsFetchResponse(
|
||||||
body.getItems(),
|
body.getItems(),
|
||||||
body.isMoreAvailable(),
|
body.getMoreAvailable(),
|
||||||
body.getNextMaxId()
|
body.getNextMaxId()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user