From 4826434cca6f0625640a1b80e49714597dcfceb4 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Sat, 7 Nov 2020 11:55:44 -0500 Subject: [PATCH] add post date, fix detail hiding, and semver --- app/build.gradle | 4 ++-- .../fragments/PostViewV2Fragment.java | 10 ++++++++++ app/src/main/res/layout/dialog_post_view.xml | 16 +++++++++++++--- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 26ef9d1c..b4f2367b 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,13 +5,13 @@ android { compileSdkVersion 29 defaultConfig { - applicationId 'me.austinhuang.instagrabbr' + applicationId 'me.austinhuang.instagrabber' minSdkVersion 21 targetSdkVersion 29 versionCode 52 - versionName '19.0' + versionName '19.0.0' multiDexEnabled true diff --git a/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java b/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java index 1cc4c2a5..83cb6eef 100644 --- a/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java @@ -56,6 +56,7 @@ import com.google.android.material.snackbar.BaseTransientBottomBar; import com.google.android.material.snackbar.Snackbar; import java.io.Serializable; +import java.util.Date; import awais.instagrabber.R; import awais.instagrabber.activities.MainActivity; @@ -666,7 +667,10 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment { private void setupCaption() { final CharSequence postCaption = feedModel.getPostCaption(); + binding.date.setText(Utils.datetimeParser.format(new Date(feedModel.getTimestamp() * 1000L))); if (TextUtils.isEmpty(postCaption)) { + binding.caption.setVisibility(View.GONE); + binding.captionToggle.setVisibility(View.GONE); return; } binding.caption.addOnHashtagListener(autoLinkItem -> { @@ -1062,6 +1066,8 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment { detailsVisible = false; binding.profilePic.setVisibility(View.GONE); binding.title.setVisibility(View.GONE); + binding.isVerified.setVisibility(View.GONE); + binding.righttitle.setVisibility(View.GONE); binding.topBg.setVisibility(View.GONE); if (!TextUtils.isEmpty(binding.subtitle.getText())) { binding.subtitle.setVisibility(View.GONE); @@ -1070,6 +1076,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment { binding.bottomBg.setVisibility(View.GONE); binding.likesCount.setVisibility(View.GONE); binding.commentsCount.setVisibility(View.GONE); + binding.date.setVisibility(View.GONE); binding.comment.setVisibility(View.GONE); binding.captionToggle.setVisibility(View.GONE); binding.playerControlsToggle.setVisibility(View.GONE); @@ -1086,6 +1093,8 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment { } binding.profilePic.setVisibility(View.VISIBLE); binding.title.setVisibility(View.VISIBLE); + binding.isVerified.setVisibility(feedModel.getProfileModel().isVerified() ? View.VISIBLE : View.GONE); + binding.righttitle.setVisibility(View.VISIBLE); binding.topBg.setVisibility(View.VISIBLE); if (!TextUtils.isEmpty(binding.subtitle.getText())) { binding.subtitle.setVisibility(View.VISIBLE); @@ -1094,6 +1103,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment { binding.bottomBg.setVisibility(View.VISIBLE); binding.likesCount.setVisibility(View.VISIBLE); binding.commentsCount.setVisibility(View.VISIBLE); + binding.date.setVisibility(View.VISIBLE); binding.captionToggle.setVisibility(View.VISIBLE); binding.comment.setVisibility(View.VISIBLE); if (video) { diff --git a/app/src/main/res/layout/dialog_post_view.xml b/app/src/main/res/layout/dialog_post_view.xml index e39e6b4f..b0a4227c 100644 --- a/app/src/main/res/layout/dialog_post_view.xml +++ b/app/src/main/res/layout/dialog_post_view.xml @@ -211,7 +211,7 @@ android:layout_height="wrap_content" android:padding="8dp" android:textColor="@color/white" - app:layout_constraintBottom_toBottomOf="@id/buttons_barrier" + app:layout_constraintBottom_toTopOf="@id/date" app:layout_constraintEnd_toStartOf="@id/comments_count" app:layout_constraintHorizontal_bias="0" app:layout_constraintStart_toStartOf="parent" @@ -225,7 +225,7 @@ android:layout_height="wrap_content" android:padding="8dp" android:textColor="@color/white" - app:layout_constraintBottom_toBottomOf="@id/buttons_barrier" + app:layout_constraintBottom_toTopOf="@id/date" app:layout_constraintEnd_toStartOf="@id/views_count" app:layout_constraintHorizontal_bias="0" app:layout_constraintStart_toEndOf="@id/likes_count" @@ -239,13 +239,23 @@ android:layout_height="wrap_content" android:padding="8dp" android:textColor="@color/white" - app:layout_constraintBottom_toBottomOf="@id/buttons_barrier" + app:layout_constraintBottom_toTopOf="@id/date" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/comments_count" app:layout_constraintTop_toTopOf="@id/bottom_bg_barrier" tools:text="9999999999 views" tools:visibility="visible" /> + +