mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-12 17:57:29 +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;
|
||||
} else if (result == null) return;
|
||||
nextCursor = result.getNextCursor();
|
||||
hasNextPage = result.hasNextPage();
|
||||
hasNextPage = result.getHasNextPage();
|
||||
|
||||
final List<Media> mediaResults = result.getFeedModels();
|
||||
feedModels.addAll(mediaResults);
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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
|
@ -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<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);
|
||||
}
|
||||
}
|
||||
data class ImageVersions2(val candidates: List<MediaCandidate>) : Serializable
|
@ -1,27 +1,3 @@
|
||||
package awais.instagrabber.repositories.responses;
|
||||
package awais.instagrabber.repositories.responses
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
data class LikersResponse(val users: List<User>, val userCount: Long, val status: String)
|
@ -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
|
@ -1,15 +1,3 @@
|
||||
package awais.instagrabber.repositories.responses;
|
||||
package awais.instagrabber.repositories.responses
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MediaInfoResponse {
|
||||
private final List<Media> items;
|
||||
|
||||
public MediaInfoResponse(final List<Media> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public List<Media> getItems() {
|
||||
return items;
|
||||
}
|
||||
}
|
||||
data class MediaInfoResponse(val items: List<Media>)
|
@ -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<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;
|
||||
}
|
||||
}
|
||||
data class NewsInboxResponse(
|
||||
val counts: NotificationCounts,
|
||||
val newStories: List<Notification>,
|
||||
val oldStories: List<Notification>
|
||||
)
|
@ -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?
|
||||
)
|
@ -1,27 +1,7 @@
|
||||
package awais.instagrabber.repositories.responses;
|
||||
package awais.instagrabber.repositories.responses
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PostsFetchResponse {
|
||||
private final List<Media> feedModels;
|
||||
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;
|
||||
}
|
||||
}
|
||||
class PostsFetchResponse(
|
||||
val feedModels: List<Media>,
|
||||
val hasNextPage: Boolean,
|
||||
val nextCursor: String?
|
||||
)
|
@ -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<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;
|
||||
}
|
||||
}
|
||||
class TagFeedResponse(
|
||||
val numResults: Int,
|
||||
val nextMaxId: String?,
|
||||
val moreAvailable: Boolean,
|
||||
val status: String,
|
||||
val items: List<Media>
|
||||
)
|
@ -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<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;
|
||||
}
|
||||
}
|
||||
class UserFeedResponse(
|
||||
val numResults: Int,
|
||||
val nextMaxId: String?,
|
||||
val moreAvailable: Boolean,
|
||||
val status: String,
|
||||
val items: List<Media>
|
||||
)
|
@ -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)
|
@ -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)
|
@ -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()
|
||||
));
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ public class TagsService {
|
||||
}
|
||||
callback.onSuccess(new PostsFetchResponse(
|
||||
body.getItems(),
|
||||
body.isMoreAvailable(),
|
||||
body.getMoreAvailable(),
|
||||
body.getNextMaxId()
|
||||
));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user