mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-12-23 05:16:58 +00:00
post location optimizations
This commit is contained in:
parent
40cb975384
commit
a6c912c5d5
@ -242,7 +242,7 @@ public final class PostViewer extends BaseLanguageActivity {
|
||||
}
|
||||
|
||||
setupPostInfoBar("@"+viewerPostModel.getUsername(), viewerPostModel.getItemType(),
|
||||
viewerPostModel.getLocation());
|
||||
viewerPostModel.getLocationName(), viewerPostModel.getLocation());
|
||||
|
||||
postCaption = postModel.getPostCaption();
|
||||
viewerCaptionParent.setVisibility(View.VISIBLE);
|
||||
@ -302,7 +302,7 @@ public final class PostViewer extends BaseLanguageActivity {
|
||||
|
||||
final boolean postIdNull = postModel.getPostId() == null;
|
||||
if (!postIdNull)
|
||||
setupPostInfoBar(intent.getStringExtra(Constants.EXTRAS_USER), postModel.getItemType(), null);
|
||||
setupPostInfoBar(intent.getStringExtra(Constants.EXTRAS_USER), postModel.getItemType(), null, null);
|
||||
|
||||
isFromShare = postModel.getPosition() == -1 || postIdNull;
|
||||
|
||||
@ -586,7 +586,7 @@ public final class PostViewer extends BaseLanguageActivity {
|
||||
}
|
||||
|
||||
setupPostInfoBar("@"+viewerPostModel.getUsername(), viewerPostModel.getItemType(),
|
||||
viewerPostModel.getLocation());
|
||||
viewerPostModel.getLocationName(), viewerPostModel.getLocation());
|
||||
|
||||
if (postModel instanceof PostModel) {
|
||||
final PostModel postModel = (PostModel) this.postModel;
|
||||
@ -636,7 +636,7 @@ public final class PostViewer extends BaseLanguageActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void setupPostInfoBar(final String from, final MediaItemType mediaItemType, final JSONObject location) {
|
||||
private void setupPostInfoBar(final String from, final MediaItemType mediaItemType, final String locationName, final String location) {
|
||||
if (prevUsername == null || !prevUsername.equals(from)) {
|
||||
viewerBinding.topPanel.ivProfilePic.setImageBitmap(null);
|
||||
viewerBinding.topPanel.ivProfilePic.setImageDrawable(null);
|
||||
@ -712,8 +712,8 @@ public final class PostViewer extends BaseLanguageActivity {
|
||||
}
|
||||
else {
|
||||
viewerBinding.topPanel.location.setVisibility(View.VISIBLE);
|
||||
viewerBinding.topPanel.location.setText(location.optString("name"));
|
||||
viewerBinding.topPanel.location.setOnClickListener(v -> searchUsername(location.optString("id")+"/"+location.optString("slug")));
|
||||
viewerBinding.topPanel.location.setText(locationName);
|
||||
viewerBinding.topPanel.location.setOnClickListener(v -> searchUsername(location));
|
||||
viewerBinding.topPanel.title.setLayoutParams(new RelativeLayout.LayoutParams(
|
||||
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
|
@ -158,7 +158,10 @@ public final class FeedFetcher extends AsyncTask<Void, Void, FeedModel[]> {
|
||||
null, null, null,
|
||||
node.optLong("video_view_count", -1), -1, false, false,
|
||||
feedItem.getJSONObject("edge_media_preview_like").getLong("count"),
|
||||
feedItem.optJSONObject("location"));
|
||||
feedItem.isNull("location") ? null : feedItem.getJSONObject("location").optString("name"),
|
||||
feedItem.isNull("location") ? null :
|
||||
(feedItem.getJSONObject("location").optString("id") + "/" +
|
||||
feedItem.getJSONObject("location").optString("slug")));
|
||||
|
||||
sliderItems[j].setSliderDisplayUrl(node.getString("display_url"));
|
||||
}
|
||||
|
@ -95,7 +95,10 @@ public final class PostFetcher extends AsyncTask<Void, Void, ViewerPostModel[]>
|
||||
isVideo && media.has("video_view_count") ? media.getLong("video_view_count") : -1,
|
||||
timestamp, media.getBoolean("viewer_has_liked"), media.getBoolean("viewer_has_saved"),
|
||||
media.getJSONObject("edge_media_preview_like").getLong("count"),
|
||||
media.optJSONObject("location"));
|
||||
media.isNull("location") ? null : media.getJSONObject("location").optString("name"),
|
||||
media.isNull("location") ? null :
|
||||
(media.getJSONObject("location").optString("id") + "/" +
|
||||
media.getJSONObject("location").optString("slug")));
|
||||
|
||||
postModel.setCommentsCount(commentsCount);
|
||||
|
||||
@ -120,7 +123,10 @@ public final class PostFetcher extends AsyncTask<Void, Void, ViewerPostModel[]>
|
||||
isChildVideo && node.has("video_view_count") ? node.getLong("video_view_count") : -1,
|
||||
timestamp, media.getBoolean("viewer_has_liked"), media.getBoolean("viewer_has_saved"),
|
||||
media.getJSONObject("edge_media_preview_like").getLong("count"),
|
||||
media.optJSONObject("location"));
|
||||
media.isNull("location") ? null : media.getJSONObject("location").optString("name"),
|
||||
media.isNull("location") ? null :
|
||||
(media.getJSONObject("location").optString("id") + "/" +
|
||||
media.getJSONObject("location").optString("slug")));
|
||||
postModels[i].setSliderDisplayUrl(node.getString("display_url"));
|
||||
|
||||
Utils.checkExistence(downloadDir, customDir, true, postModels[i]);
|
||||
|
@ -87,7 +87,10 @@ public final class iPostFetcher extends AsyncTask<Void, Void, ViewerPostModel[]>
|
||||
isVideo && media.has("view_count") ? media.getLong("view_count") : -1,
|
||||
timestamp, media.optBoolean("has_liked"), media.optBoolean("has_viewer_saved"),
|
||||
media.getLong("like_count"),
|
||||
media.optJSONObject("location"));
|
||||
media.isNull("location") ? null : media.getJSONObject("location").optString("name"),
|
||||
media.isNull("location") ? null :
|
||||
(media.getJSONObject("location").optString("id") + "/" +
|
||||
media.getJSONObject("location").optString("slug")));
|
||||
|
||||
postModel.setCommentsCount(commentsCount);
|
||||
|
||||
@ -114,7 +117,10 @@ public final class iPostFetcher extends AsyncTask<Void, Void, ViewerPostModel[]>
|
||||
-1,
|
||||
timestamp, media.optBoolean("has_liked"), media.optBoolean("has_viewer_saved"),
|
||||
media.getLong("like_count"),
|
||||
media.optJSONObject("location"));
|
||||
media.isNull("location") ? null : media.getJSONObject("location").optString("name"),
|
||||
media.isNull("location") ? null :
|
||||
(media.getJSONObject("location").optString("id") + "/" +
|
||||
media.getJSONObject("location").optString("slug")));
|
||||
postModels[i].setSliderDisplayUrl(Utils.getHighQualityImage(node));
|
||||
|
||||
Utils.checkExistence(downloadDir, customDir, true, postModels[i]);
|
||||
|
@ -5,8 +5,7 @@ import org.json.JSONObject;
|
||||
import awais.instagrabber.models.enums.MediaItemType;
|
||||
|
||||
public final class ViewerPostModel extends BasePostModel {
|
||||
protected final String username;
|
||||
protected final JSONObject location;
|
||||
protected final String username, locationName, location;
|
||||
protected final long videoViews;
|
||||
protected String sliderDisplayUrl;
|
||||
protected long commentsCount, likes;
|
||||
@ -14,7 +13,7 @@ public final class ViewerPostModel extends BasePostModel {
|
||||
|
||||
public ViewerPostModel(final MediaItemType itemType, final String postId, final String displayUrl, final String shortCode,
|
||||
final String postCaption, final String username, final long videoViews, final long timestamp,
|
||||
boolean liked, boolean bookmarked, long likes, final JSONObject location) {
|
||||
boolean liked, boolean bookmarked, long likes, final String locationName, final String location) {
|
||||
this.itemType = itemType;
|
||||
this.postId = postId;
|
||||
this.displayUrl = displayUrl;
|
||||
@ -26,6 +25,7 @@ public final class ViewerPostModel extends BasePostModel {
|
||||
this.liked = liked;
|
||||
this.likes = likes;
|
||||
this.bookmarked = bookmarked;
|
||||
this.locationName = locationName;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
@ -41,7 +41,11 @@ public final class ViewerPostModel extends BasePostModel {
|
||||
return username;
|
||||
}
|
||||
|
||||
public JSONObject getLocation() {
|
||||
public String getLocationName() {
|
||||
return locationName;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/feed_text_primary_color"
|
||||
android:textSize="18sp" />
|
||||
android:textSize="15sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
|
Loading…
Reference in New Issue
Block a user