diff --git a/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java b/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java
index d7ca2d65..2a434f9d 100644
--- a/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java
+++ b/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java
@@ -420,6 +420,10 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
bundle.putString("postUserId", feedModel.getProfileModel().getId());
navController.navigate(R.id.action_global_commentsViewerFragment, bundle);
});
+ binding.comment.setOnLongClickListener(v -> {
+ Utils.displayToastAboveView(context, v, getString(R.string.comment));
+ return true;
+ });
}
private void setupDownload() {
@@ -430,6 +434,10 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
}
requestPermissions(DownloadUtils.PERMS, STORAGE_PERM_REQUEST_CODE);
});
+ binding.download.setOnLongClickListener(v -> {
+ Utils.displayToastAboveView(context, v, getString(R.string.action_download));
+ return true;
+ });
}
private void setupLike() {
@@ -496,6 +504,10 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
mediaService.unlike(feedModel.getPostId(), userId, csrfToken, likeCallback);
}
});
+ binding.like.setOnLongClickListener(v -> {
+ Utils.displayToastAboveView(context, v, getString(R.string.like_without_count));
+ return true;
+ });
}
private void setLikedResources(final boolean liked) {
@@ -513,7 +525,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
}
binding.like.setIconResource(iconResource);
binding.like.setIconTintResource(tintResource);
- binding.like.setText(textResId);
+ // binding.like.setText(textResId);
}
private void setupSave() {
@@ -570,6 +582,10 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
mediaService.unsave(feedModel.getPostId(), userId, csrfToken, saveCallback);
}
});
+ binding.save.setOnLongClickListener(v -> {
+ Utils.displayToastAboveView(context, v, getString(R.string.save));
+ return true;
+ });
}
private void setSavedResources(final boolean saved) {
@@ -587,7 +603,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
}
binding.save.setIconResource(iconResource);
binding.save.setIconTintResource(tintResource);
- binding.save.setText(textResId);
+ // binding.save.setText(textResId);
}
private void setupProfilePic() {
@@ -705,6 +721,10 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
default:
}
});
+ binding.captionToggle.setOnLongClickListener(v -> {
+ Utils.displayToastAboveView(context, v, getString(R.string.caption));
+ return true;
+ });
if (sharedProfilePicElement == null || sharedMainPostElement == null) {
binding.getRoot().getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
@@ -724,8 +744,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
final int likesCount = (int) feedModel.getLikesCount();
final String likesString = getResources().getQuantityString(R.plurals.likes_count, likesCount, likesCount);
binding.likesCount.setText(likesString);
- }
- catch (IllegalStateException e) {}
+ } catch (IllegalStateException e) {}
}
private void setupPostTypeLayout() {
diff --git a/app/src/main/java/awais/instagrabber/utils/Utils.java b/app/src/main/java/awais/instagrabber/utils/Utils.java
index 2fb1b008..ee6c06a5 100755
--- a/app/src/main/java/awais/instagrabber/utils/Utils.java
+++ b/app/src/main/java/awais/instagrabber/utils/Utils.java
@@ -11,6 +11,8 @@ import android.net.Uri;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Pair;
+import android.view.Gravity;
+import android.view.View;
import android.webkit.MimeTypeMap;
import android.widget.Toast;
@@ -178,4 +180,14 @@ public final class Utils {
emailIntent.putExtra(Intent.EXTRA_TEXT, "");
context.startActivity(emailIntent);
}
+
+ public static void displayToastAboveView(@NonNull final Context context,
+ @NonNull final View view,
+ @NonNull final String text) {
+ final Toast toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
+ toast.setGravity(Gravity.TOP | Gravity.START,
+ view.getLeft(),
+ view.getTop() - view.getHeight() - 4);
+ toast.show();
+ }
}
diff --git a/app/src/main/res/layout/dialog_post_view.xml b/app/src/main/res/layout/dialog_post_view.xml
index 2c945499..4920eb67 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_toTopOf="@id/caption_toggle"
+ app:layout_constraintBottom_toBottomOf="@id/buttons_barrier"
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_toTopOf="@id/caption_toggle"
+ app:layout_constraintBottom_toBottomOf="@id/buttons_barrier"
app:layout_constraintEnd_toStartOf="@id/views_count"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toEndOf="@id/likes_count"
@@ -239,131 +239,149 @@
android:layout_height="wrap_content"
android:padding="8dp"
android:textColor="@color/white"
- app:layout_constraintBottom_toTopOf="@id/caption_toggle"
+ app:layout_constraintBottom_toBottomOf="@id/buttons_barrier"
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" />
+
+
+
+
+
+
+
+
+
+