Browse Source

edit caption (finalized)

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
312c90ad92
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 2
      app/src/main/java/awais/instagrabber/adapters/FeedAdapterV2.java
  2. 4
      app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java

2
app/src/main/java/awais/instagrabber/adapters/FeedAdapterV2.java

@ -46,7 +46,7 @@ public final class FeedAdapterV2 extends ListAdapter<FeedModel, RecyclerView.Vie
@Override
public boolean areContentsTheSame(@NonNull final FeedModel oldItem, @NonNull final FeedModel newItem) {
return oldItem.getPostId().equals(newItem.getPostId());
return oldItem.getPostId().equals(newItem.getPostId()) && oldItem.getPostCaption().equals(newItem.getPostCaption());
}
};
private final AdapterSelectionCallback adapterSelectionCallback = new AdapterSelectionCallback() {

4
app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java

@ -72,6 +72,7 @@ import awais.instagrabber.customviews.VideoPlayerCallbackAdapter;
import awais.instagrabber.customviews.VideoPlayerViewHelper;
import awais.instagrabber.customviews.drawee.AnimatedZoomableController;
import awais.instagrabber.databinding.DialogPostViewBinding;
import awais.instagrabber.fragments.main.ProfileFragment;
import awais.instagrabber.models.FeedModel;
import awais.instagrabber.models.PostChild;
import awais.instagrabber.models.ProfileModel;
@ -712,7 +713,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
}
private void setupCaption() {
if (postCaption == null) postCaption = feedModel.getPostCaption();
postCaption = feedModel.getPostCaption();
binding.date.setText(Utils.datetimeParser.format(new Date(feedModel.getTimestamp() * 1000L)));
if (!feedModel.getProfileModel().getId().equals(CookieUtils.getUserIdFromCookie(COOKIE)) && TextUtils.isEmpty(postCaption)) {
binding.caption.setVisibility(View.GONE);
@ -740,6 +741,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
public void onSuccess(final Boolean result) {
binding.editCaption.setVisibility(View.VISIBLE);
if (result) {
feedModel.setPostCaption(input.getText().toString());
binding.caption.setText(input.getText().toString());
}
else Toast.makeText(context, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();

Loading…
Cancel
Save