Ammar Githam
4 years ago
8 changed files with 64 additions and 232 deletions
-
6app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java
-
194app/src/main/java/awais/instagrabber/models/StoryModel.kt
-
18app/src/main/java/awais/instagrabber/models/enums/BroadcastItemType.kt
-
8app/src/main/java/awais/instagrabber/models/enums/FavoriteType.kt
-
6app/src/main/java/awais/instagrabber/models/enums/IntentModelType.kt
-
40app/src/main/java/awais/instagrabber/models/enums/NotificationType.kt
-
16app/src/main/java/awais/instagrabber/models/enums/PostItemType.kt
-
8app/src/main/java/awais/instagrabber/models/enums/SuggestionType.kt
@ -1,167 +1,29 @@ |
|||||
package awais.instagrabber.models; |
|
||||
|
|
||||
import java.io.Serializable; |
|
||||
|
|
||||
import awais.instagrabber.models.enums.MediaItemType; |
|
||||
import awais.instagrabber.models.stickers.PollModel; |
|
||||
import awais.instagrabber.models.stickers.QuestionModel; |
|
||||
import awais.instagrabber.models.stickers.QuizModel; |
|
||||
import awais.instagrabber.models.stickers.SliderModel; |
|
||||
import awais.instagrabber.models.stickers.SwipeUpModel; |
|
||||
|
|
||||
public final class StoryModel implements Serializable { |
|
||||
private final String storyMediaId; |
|
||||
private final String storyUrl; |
|
||||
private String thumbnail; |
|
||||
private final String username; |
|
||||
private final long userId; |
|
||||
private final MediaItemType itemType; |
|
||||
private final long timestamp; |
|
||||
private String videoUrl; |
|
||||
private String tappableShortCode; |
|
||||
private String tappableId; |
|
||||
private String spotify; |
|
||||
private PollModel poll; |
|
||||
private QuestionModel question; |
|
||||
private SliderModel slider; |
|
||||
private QuizModel quiz; |
|
||||
private SwipeUpModel swipeUp; |
|
||||
private String[] mentions; |
|
||||
private int position; |
|
||||
private boolean isCurrentSlide = false; |
|
||||
private final boolean canReply; |
|
||||
|
|
||||
public StoryModel(final String storyMediaId, final String storyUrl, final String thumbnail, final MediaItemType itemType, |
|
||||
final long timestamp, final String username, final long userId, final boolean canReply) { |
|
||||
this.storyMediaId = storyMediaId; |
|
||||
this.storyUrl = storyUrl; |
|
||||
this.thumbnail = thumbnail; |
|
||||
this.itemType = itemType; |
|
||||
this.timestamp = timestamp; |
|
||||
this.username = username; |
|
||||
this.userId = userId; |
|
||||
this.canReply = canReply; |
|
||||
} |
|
||||
|
|
||||
public String getStoryUrl() { |
|
||||
return storyUrl; |
|
||||
} |
|
||||
|
|
||||
public String getThumbnail() { |
|
||||
return thumbnail; |
|
||||
} |
|
||||
|
|
||||
public String getStoryMediaId() { |
|
||||
return storyMediaId; |
|
||||
} |
|
||||
|
|
||||
public MediaItemType getItemType() { |
|
||||
return itemType; |
|
||||
} |
|
||||
|
|
||||
public long getTimestamp() { |
|
||||
return timestamp; |
|
||||
} |
|
||||
|
|
||||
public String getVideoUrl() { |
|
||||
return videoUrl; |
|
||||
} |
|
||||
|
|
||||
public String getTappableShortCode() { |
|
||||
return tappableShortCode; |
|
||||
} |
|
||||
|
|
||||
public PollModel getPoll() { |
|
||||
return poll; |
|
||||
} |
|
||||
|
|
||||
public QuestionModel getQuestion() { |
|
||||
return question; |
|
||||
} |
|
||||
|
|
||||
public SliderModel getSlider() { |
|
||||
return slider; |
|
||||
} |
|
||||
|
|
||||
public QuizModel getQuiz() { |
|
||||
return quiz; |
|
||||
} |
|
||||
|
|
||||
public SwipeUpModel getSwipeUp() { return swipeUp;} |
|
||||
|
|
||||
public String[] getMentions() { |
|
||||
return mentions; |
|
||||
} |
|
||||
|
|
||||
public int getPosition() { |
|
||||
return position; |
|
||||
} |
|
||||
|
|
||||
public void setThumbnail(final String thumbnail) { |
|
||||
this.thumbnail = thumbnail; |
|
||||
} |
|
||||
|
|
||||
public void setVideoUrl(final String videoUrl) { |
|
||||
this.videoUrl = videoUrl; |
|
||||
} |
|
||||
|
|
||||
public String getSpotify() { |
|
||||
return spotify; |
|
||||
} |
|
||||
|
|
||||
public void setSpotify(final String spotify) { |
|
||||
this.spotify = spotify; |
|
||||
} |
|
||||
|
|
||||
public void setTappableShortCode(final String tappableShortCode) { |
|
||||
this.tappableShortCode = tappableShortCode; |
|
||||
} |
|
||||
|
|
||||
public void setPoll(final PollModel poll) { |
|
||||
this.poll = poll; |
|
||||
} |
|
||||
|
|
||||
public void setQuestion(final QuestionModel question) { |
|
||||
this.question = question; |
|
||||
} |
|
||||
|
|
||||
public void setSlider(final SliderModel slider) { |
|
||||
this.slider = slider; |
|
||||
} |
|
||||
|
|
||||
public void setQuiz(final QuizModel quiz) { |
|
||||
this.quiz = quiz; |
|
||||
} |
|
||||
|
|
||||
public void setMentions(final String[] mentions) { |
|
||||
this.mentions = mentions; |
|
||||
} |
|
||||
|
|
||||
public void setSwipeUp(final SwipeUpModel swipeUp) { |
|
||||
this.swipeUp = swipeUp; |
|
||||
} |
|
||||
|
|
||||
public void setPosition(final int position) { |
|
||||
this.position = position; |
|
||||
} |
|
||||
|
|
||||
public void setCurrentSlide(final boolean currentSlide) { |
|
||||
this.isCurrentSlide = currentSlide; |
|
||||
} |
|
||||
|
|
||||
public boolean isCurrentSlide() { |
|
||||
return isCurrentSlide; |
|
||||
} |
|
||||
|
|
||||
public boolean canReply() { |
|
||||
return canReply; |
|
||||
} |
|
||||
|
|
||||
public String getUsername() { |
|
||||
return username; |
|
||||
} |
|
||||
|
|
||||
public long getUserId() { |
|
||||
return userId; |
|
||||
} |
|
||||
|
package awais.instagrabber.models |
||||
|
|
||||
|
import awais.instagrabber.models.enums.MediaItemType |
||||
|
import awais.instagrabber.models.stickers.* |
||||
|
import java.io.Serializable |
||||
|
|
||||
|
data class StoryModel( |
||||
|
val storyMediaId: String?, |
||||
|
val storyUrl: String?, |
||||
|
var thumbnail: String?, |
||||
|
val itemType: MediaItemType?, |
||||
|
val timestamp: Long, |
||||
|
val username: String?, |
||||
|
val userId: Long, |
||||
|
val canReply: Boolean |
||||
|
) : Serializable { |
||||
|
var videoUrl: String? = null |
||||
|
var tappableShortCode: String? = null |
||||
|
val tappableId: String? = null |
||||
|
var spotify: String? = null |
||||
|
var poll: PollModel? = null |
||||
|
var question: QuestionModel? = null |
||||
|
var slider: SliderModel? = null |
||||
|
var quiz: QuizModel? = null |
||||
|
var swipeUp: SwipeUpModel? = null |
||||
|
var mentions: Array<String>? = null |
||||
|
var position = 0 |
||||
|
var isCurrentSlide = false |
||||
} |
} |
@ -1,8 +1,8 @@ |
|||||
package awais.instagrabber.models.enums; |
|
||||
|
package awais.instagrabber.models.enums |
||||
|
|
||||
public enum FavoriteType { |
|
||||
TOP, // used just for searching |
|
||||
|
enum class FavoriteType { |
||||
|
TOP, // used just for searching |
||||
USER, |
USER, |
||||
HASHTAG, |
HASHTAG, |
||||
LOCATION, |
LOCATION, |
||||
} |
|
||||
|
} |
@ -1,9 +1,9 @@ |
|||||
package awais.instagrabber.models.enums; |
|
||||
|
package awais.instagrabber.models.enums |
||||
|
|
||||
public enum IntentModelType { |
|
||||
|
enum class IntentModelType { |
||||
UNKNOWN, |
UNKNOWN, |
||||
USERNAME, |
USERNAME, |
||||
POST, |
POST, |
||||
HASHTAG, |
HASHTAG, |
||||
LOCATION |
|
||||
|
LOCATION, |
||||
} |
} |
@ -1,41 +1,31 @@ |
|||||
package awais.instagrabber.models.enums; |
|
||||
|
package awais.instagrabber.models.enums |
||||
|
|
||||
import java.io.Serializable; |
|
||||
import java.util.HashMap; |
|
||||
import java.util.Map; |
|
||||
|
import java.io.Serializable |
||||
|
|
||||
public enum NotificationType implements Serializable { |
|
||||
// story_type |
|
||||
|
enum class NotificationType(val itemType: Int) : Serializable { |
||||
LIKE(60), |
LIKE(60), |
||||
FOLLOW(101), |
FOLLOW(101), |
||||
COMMENT(12), // NOT TESTED |
|
||||
|
COMMENT(12), // NOT TESTED |
||||
COMMENT_MENTION(66), |
COMMENT_MENTION(66), |
||||
TAGGED(102), // NOT TESTED |
|
||||
|
TAGGED(102), // NOT TESTED |
||||
COMMENT_LIKE(13), |
COMMENT_LIKE(13), |
||||
TAGGED_COMMENT(14), |
TAGGED_COMMENT(14), |
||||
RESPONDED_STORY(213), |
RESPONDED_STORY(213), |
||||
REQUEST(75), |
REQUEST(75), |
||||
// aymf - arbitrary, misspelled as ayml but eh |
|
||||
AYML(9999); |
AYML(9999); |
||||
|
|
||||
private final int itemType; |
|
||||
private static final Map<Integer, NotificationType> map = new HashMap<>(); |
|
||||
|
companion object { |
||||
|
private val map: MutableMap<Int, NotificationType> = mutableMapOf() |
||||
|
|
||||
static { |
|
||||
for (NotificationType type : NotificationType.values()) { |
|
||||
map.put(type.itemType, type); |
|
||||
|
@JvmStatic |
||||
|
fun valueOfType(itemType: Int): NotificationType? { |
||||
|
return map[itemType] |
||||
} |
} |
||||
} |
|
||||
|
|
||||
NotificationType(final int itemType) { |
|
||||
this.itemType = itemType; |
|
||||
} |
|
||||
|
|
||||
public int getItemType() { |
|
||||
return itemType; |
|
||||
} |
|
||||
|
|
||||
public static NotificationType valueOfType(final int itemType) { |
|
||||
return map.get(itemType); |
|
||||
|
init { |
||||
|
for (type in values()) { |
||||
|
map[type.itemType] = type |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
} |
} |
@ -1,15 +1,7 @@ |
|||||
package awais.instagrabber.models.enums; |
|
||||
|
package awais.instagrabber.models.enums |
||||
|
|
||||
import java.io.Serializable; |
|
||||
|
import java.io.Serializable |
||||
|
|
||||
public enum PostItemType implements Serializable { |
|
||||
MAIN, |
|
||||
DISCOVER, |
|
||||
FEED, |
|
||||
SAVED, |
|
||||
COLLECTION, |
|
||||
LIKED, |
|
||||
TAGGED, |
|
||||
HASHTAG, |
|
||||
LOCATION |
|
||||
|
enum class PostItemType : Serializable { |
||||
|
MAIN, DISCOVER, FEED, SAVED, COLLECTION, LIKED, TAGGED, HASHTAG, LOCATION |
||||
} |
} |
@ -1,7 +1,5 @@ |
|||||
package awais.instagrabber.models.enums; |
|
||||
|
package awais.instagrabber.models.enums |
||||
|
|
||||
public enum SuggestionType { |
|
||||
TYPE_USER, |
|
||||
TYPE_HASHTAG, |
|
||||
TYPE_LOCATION |
|
||||
|
enum class SuggestionType { |
||||
|
TYPE_USER, TYPE_HASHTAG, TYPE_LOCATION |
||||
} |
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue