edit caption (finalized)

This commit is contained in:
Austin Huang 2020-12-24 11:07:31 -05:00
parent 7ee756eff3
commit 312c90ad92
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
2 changed files with 4 additions and 2 deletions

View File

@ -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() {

View File

@ -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();