mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-24 23:57:30 +00:00
geotag time
This commit is contained in:
parent
be48af600e
commit
e71faf3f20
@ -19,6 +19,7 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@ -250,7 +251,7 @@ public final class PostViewer extends BaseLanguageActivity {
|
||||
|
||||
final boolean postIdNull = postModel.getPostId() == null;
|
||||
if (!postIdNull)
|
||||
setupPostInfoBar(intent.getStringExtra(Constants.EXTRAS_USER), postModel.getItemType());
|
||||
setupPostInfoBar(intent.getStringExtra(Constants.EXTRAS_USER), postModel.getItemType(), null);
|
||||
|
||||
isFromShare = postModel.getPosition() == -1 || postIdNull;
|
||||
|
||||
@ -403,7 +404,7 @@ public final class PostViewer extends BaseLanguageActivity {
|
||||
postModel.setBookmark(viewerPostModel.getBookmark());
|
||||
}
|
||||
|
||||
setupPostInfoBar(viewerPostModel.getUsername(), viewerPostModel.getItemType());
|
||||
setupPostInfoBar(viewerPostModel.getUsername(), viewerPostModel.getItemType(), viewerPostModel.getLocation());
|
||||
|
||||
postCaption = postModel.getPostCaption();
|
||||
viewerCaptionParent.setVisibility(View.VISIBLE);
|
||||
@ -575,6 +576,10 @@ public final class PostViewer extends BaseLanguageActivity {
|
||||
|
||||
private void refreshPost() {
|
||||
postShortCode = postModel.getShortCode();
|
||||
if (containerLayoutParams.weight != 3.3f) {
|
||||
containerLayoutParams.weight = (viewerBinding.mediaList.getVisibility() == View.VISIBLE) ? 1.35f : 1.9f;
|
||||
viewerBinding.container.setLayoutParams(containerLayoutParams);
|
||||
}
|
||||
if (viewerBinding.mediaList.getVisibility() == View.VISIBLE) {
|
||||
ViewerPostModel item = mediaAdapter.getItemAt(lastSlidePos);
|
||||
if (item != null) {
|
||||
@ -604,7 +609,7 @@ public final class PostViewer extends BaseLanguageActivity {
|
||||
viewerBinding.bottomPanel.viewerCaption.setText(postCaption);
|
||||
}
|
||||
|
||||
setupPostInfoBar(viewerPostModel.getUsername(), viewerPostModel.getItemType());
|
||||
setupPostInfoBar(viewerPostModel.getUsername(), viewerPostModel.getItemType(), viewerPostModel.getLocation());
|
||||
|
||||
if (postModel instanceof PostModel) {
|
||||
final PostModel postModel = (PostModel) this.postModel;
|
||||
@ -654,7 +659,7 @@ public final class PostViewer extends BaseLanguageActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void setupPostInfoBar(final String from, final MediaItemType mediaItemType) {
|
||||
private void setupPostInfoBar(final String from, final MediaItemType mediaItemType, final String location) {
|
||||
if (prevUsername == null || !prevUsername.equals(from)) {
|
||||
viewerBinding.topPanel.ivProfilePic.setImageBitmap(null);
|
||||
viewerBinding.topPanel.ivProfilePic.setImageDrawable(null);
|
||||
@ -707,6 +712,20 @@ public final class PostViewer extends BaseLanguageActivity {
|
||||
spannableString.setSpan(new CommentMentionClickSpan(), titleLen - from.length() - 1, titleLen - 1, 0);
|
||||
viewerBinding.topPanel.title.setText(spannableString);
|
||||
}
|
||||
|
||||
if (location == null) {
|
||||
viewerBinding.topPanel.location.setVisibility(View.GONE);
|
||||
viewerBinding.topPanel.title.setLayoutParams(new RelativeLayout.LayoutParams(
|
||||
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT
|
||||
));
|
||||
}
|
||||
else {
|
||||
viewerBinding.topPanel.location.setVisibility(View.VISIBLE);
|
||||
viewerBinding.topPanel.location.setText(location);
|
||||
viewerBinding.topPanel.title.setLayoutParams(new RelativeLayout.LayoutParams(
|
||||
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleFullscreen() {
|
||||
@ -755,13 +774,13 @@ public final class PostViewer extends BaseLanguageActivity {
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
if (ok == true && action == "likes") {
|
||||
postModel.setLike(!postModel.getLike());
|
||||
viewerPostModel.setManualLike(!postModel.getLike());
|
||||
postModel.setLike(!viewerPostModel.getLike());
|
||||
viewerPostModel.setManualLike(!viewerPostModel.getLike());
|
||||
refreshPost();
|
||||
}
|
||||
else if (ok == true && action == "save") {
|
||||
viewerPostModel.setBookmark(!postModel.getBookmark());
|
||||
postModel.setBookmark(!postModel.getBookmark());
|
||||
viewerPostModel.setBookmark(!viewerPostModel.getBookmark());
|
||||
postModel.setBookmark(!viewerPostModel.getBookmark());
|
||||
refreshPost();
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +155,8 @@ public final class FeedFetcher extends AsyncTask<Void, Void, FeedModel[]> {
|
||||
isChildVideo ? node.getString("video_url") : Utils.getHighQualityImage(node),
|
||||
null, null, null,
|
||||
node.optLong("video_view_count", -1), -1, false, false,
|
||||
feedItem.getJSONObject("edge_media_preview_like").getLong("count"));
|
||||
feedItem.getJSONObject("edge_media_preview_like").getLong("count"),
|
||||
feedItem.getJSONObject("location") == null ? null : feedItem.getJSONObject("location").optString("name"));
|
||||
|
||||
sliderItems[j].setSliderDisplayUrl(node.getString("display_url"));
|
||||
}
|
||||
|
@ -89,7 +89,8 @@ public final class PostFetcher extends AsyncTask<Void, Void, ViewerPostModel[]>
|
||||
username,
|
||||
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.getJSONObject("edge_media_preview_like").getLong("count"),
|
||||
media.optJSONObject("location") == null ? null : media.getJSONObject("location").optString("name"));
|
||||
|
||||
postModel.setCommentsCount(commentsCount);
|
||||
postModel.setCommentsEndCursor(endCursor);
|
||||
@ -114,7 +115,8 @@ public final class PostFetcher extends AsyncTask<Void, Void, ViewerPostModel[]>
|
||||
username,
|
||||
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.getJSONObject("edge_media_preview_like").getLong("count"),
|
||||
media.optJSONObject("location") == null ? null : media.getJSONObject("location").optString("name"));
|
||||
postModels[i].setSliderDisplayUrl(node.getString("display_url"));
|
||||
|
||||
Utils.checkExistence(downloadDir, customDir, username, true, i, postModels[i]);
|
||||
|
@ -3,7 +3,7 @@ package awais.instagrabber.models;
|
||||
import awais.instagrabber.models.enums.MediaItemType;
|
||||
|
||||
public final class ViewerPostModel extends BasePostModel {
|
||||
protected final String username;
|
||||
protected final String username, location;
|
||||
protected final long videoViews;
|
||||
protected String sliderDisplayUrl, commentsEndCursor;
|
||||
protected long commentsCount, likes;
|
||||
@ -11,7 +11,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) {
|
||||
boolean liked, boolean bookmarked, long likes, final String location) {
|
||||
this.itemType = itemType;
|
||||
this.postId = postId;
|
||||
this.displayUrl = displayUrl;
|
||||
@ -23,6 +23,7 @@ public final class ViewerPostModel extends BasePostModel {
|
||||
this.liked = liked;
|
||||
this.likes = likes;
|
||||
this.bookmarked = bookmarked;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public long getCommentsCount() {
|
||||
@ -37,6 +38,10 @@ public final class ViewerPostModel extends BasePostModel {
|
||||
return username;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public String getCommentsEndCursor() {
|
||||
return commentsEndCursor;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -13,19 +14,40 @@
|
||||
android:adjustViewBounds="true"
|
||||
android:background="?selectableItemBackgroundBorderless" />
|
||||
|
||||
<awais.instagrabber.customviews.RamboTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
<RelativeLayout
|
||||
android:id="@+id/infoContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:animateLayoutChanges="true"
|
||||
android:background="@null"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="2"
|
||||
android:paddingStart="4dp"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingEnd="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingRight="4dp">
|
||||
|
||||
<awais.instagrabber.customviews.RamboTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/feed_text_primary_color"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
<awais.instagrabber.customviews.RamboTextView
|
||||
android:id="@+id/location"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/title"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/feed_text_primary_color"
|
||||
android:textSize="18sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/viewStoryPost"
|
||||
android:layout_width="40dp"
|
||||
|
@ -1,6 +1,7 @@
|
||||
* You can now write comments, and reply/like/delete comments through the menu (by clicking the comment)
|
||||
* Liked comments are shown with a pink background
|
||||
* You can now share posts in the post viewer
|
||||
* You can now see the geotag name of a post
|
||||
* Search field is now empty if you're viewing your own profile while logged in
|
||||
* Post like counts are now displayed (The button texts are slightly reduced to accomodate @world_record_egg) (logged in only)
|
||||
* Mute buttons are changed to display the current status (i.e. muted icon when muted, sound icon when not muted)
|
||||
|
Loading…
Reference in New Issue
Block a user