mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 20:57:25 +01:00
Fix post not updating in PostFragment after voting it in ViewPostDetailFragment.
This commit is contained in:
parent
83dd21450f
commit
9ad6d705e6
@ -113,7 +113,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
private String mAccessToken;
|
private String mAccessToken;
|
||||||
private String mAccountName;
|
private String mAccountName;
|
||||||
private long postFragmentId;
|
private long postFragmentId;
|
||||||
private int postListPosition = -1;
|
private int postListPosition;
|
||||||
private int orientation;
|
private int orientation;
|
||||||
private boolean mVolumeKeysNavigateComments;
|
private boolean mVolumeKeysNavigateComments;
|
||||||
private boolean isNsfwSubreddit;
|
private boolean isNsfwSubreddit;
|
||||||
@ -172,6 +172,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
EventBus.getDefault().post(new NeedForPostListFromPostFragmentEvent(postFragmentId));
|
EventBus.getDefault().post(new NeedForPostListFromPostFragmentEvent(postFragmentId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
postListPosition = getIntent().getIntExtra(EXTRA_POST_LIST_POSITION, -1);
|
||||||
isNsfwSubreddit = getIntent().getBooleanExtra(EXTRA_IS_NSFW_SUBREDDIT, false);
|
isNsfwSubreddit = getIntent().getBooleanExtra(EXTRA_IS_NSFW_SUBREDDIT, false);
|
||||||
|
|
||||||
fragmentManager = getSupportFragmentManager();
|
fragmentManager = getSupportFragmentManager();
|
||||||
@ -519,7 +520,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
bundle.putString(ViewPostDetailFragment.EXTRA_POST_ID, getIntent().getStringExtra(EXTRA_POST_ID));
|
bundle.putString(ViewPostDetailFragment.EXTRA_POST_ID, getIntent().getStringExtra(EXTRA_POST_ID));
|
||||||
} else {
|
} else {
|
||||||
bundle.putParcelable(ViewPostDetailFragment.EXTRA_POST_DATA, post);
|
bundle.putParcelable(ViewPostDetailFragment.EXTRA_POST_DATA, post);
|
||||||
bundle.putInt(ViewPostDetailFragment.EXTRA_POST_LIST_POSITION, position);
|
bundle.putInt(ViewPostDetailFragment.EXTRA_POST_LIST_POSITION, postListPosition);
|
||||||
}
|
}
|
||||||
bundle.putString(ViewPostDetailFragment.EXTRA_SINGLE_COMMENT_ID, getIntent().getStringExtra(EXTRA_SINGLE_COMMENT_ID));
|
bundle.putString(ViewPostDetailFragment.EXTRA_SINGLE_COMMENT_ID, getIntent().getStringExtra(EXTRA_SINGLE_COMMENT_ID));
|
||||||
bundle.putString(ViewPostDetailFragment.EXTRA_MESSAGE_FULLNAME, getIntent().getStringExtra(EXTRA_MESSAGE_FULLNAME));
|
bundle.putString(ViewPostDetailFragment.EXTRA_MESSAGE_FULLNAME, getIntent().getStringExtra(EXTRA_MESSAGE_FULLNAME));
|
||||||
|
@ -90,7 +90,7 @@ import ml.docilealligator.infinityforreddit.asynctasks.LoadUserData;
|
|||||||
import ml.docilealligator.infinityforreddit.bottomsheetfragments.ShareLinkBottomSheetFragment;
|
import ml.docilealligator.infinityforreddit.bottomsheetfragments.ShareLinkBottomSheetFragment;
|
||||||
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
||||||
import ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView;
|
import ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView;
|
||||||
import ml.docilealligator.infinityforreddit.events.PostUpdateEventToDetailActivity;
|
import ml.docilealligator.infinityforreddit.events.PostUpdateEventToPostDetailFragment;
|
||||||
import ml.docilealligator.infinityforreddit.fragments.PostFragment;
|
import ml.docilealligator.infinityforreddit.fragments.PostFragment;
|
||||||
import ml.docilealligator.infinityforreddit.post.Post;
|
import ml.docilealligator.infinityforreddit.post.Post;
|
||||||
import ml.docilealligator.infinityforreddit.post.PostDataSource;
|
import ml.docilealligator.infinityforreddit.post.PostDataSource;
|
||||||
@ -2393,7 +2393,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -2409,7 +2409,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
scoreTextView.setTextColor(previousScoreTextViewColor);
|
scoreTextView.setTextColor(previousScoreTextViewColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
}, post.getFullName(), newVoteType, getBindingAdapterPosition());
|
}, post.getFullName(), newVoteType, getBindingAdapterPosition());
|
||||||
}
|
}
|
||||||
@ -2489,7 +2489,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -2505,7 +2505,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
scoreTextView.setTextColor(previousScoreTextViewColor);
|
scoreTextView.setTextColor(previousScoreTextViewColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
}, post.getFullName(), newVoteType, getBindingAdapterPosition());
|
}, post.getFullName(), newVoteType, getBindingAdapterPosition());
|
||||||
}
|
}
|
||||||
@ -2534,7 +2534,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
||||||
}
|
}
|
||||||
Toast.makeText(mActivity, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show();
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -2544,7 +2544,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
||||||
}
|
}
|
||||||
Toast.makeText(mActivity, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show();
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -2558,7 +2558,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
||||||
}
|
}
|
||||||
Toast.makeText(mActivity, R.string.post_saved_success, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, R.string.post_saved_success, Toast.LENGTH_SHORT).show();
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -2568,7 +2568,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
||||||
}
|
}
|
||||||
Toast.makeText(mActivity, R.string.post_saved_failed, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, R.string.post_saved_failed, Toast.LENGTH_SHORT).show();
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -3371,7 +3371,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -3387,7 +3387,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
scoreTextView.setTextColor(previousScoreTextViewColor);
|
scoreTextView.setTextColor(previousScoreTextViewColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
}, post.getFullName(), newVoteType, getBindingAdapterPosition());
|
}, post.getFullName(), newVoteType, getBindingAdapterPosition());
|
||||||
}
|
}
|
||||||
@ -3468,7 +3468,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -3484,7 +3484,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
scoreTextView.setTextColor(previousScoreTextViewColor);
|
scoreTextView.setTextColor(previousScoreTextViewColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
}, post.getFullName(), newVoteType, getBindingAdapterPosition());
|
}, post.getFullName(), newVoteType, getBindingAdapterPosition());
|
||||||
}
|
}
|
||||||
@ -3513,7 +3513,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
||||||
}
|
}
|
||||||
Toast.makeText(mActivity, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show();
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -3523,7 +3523,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
||||||
}
|
}
|
||||||
Toast.makeText(mActivity, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show();
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -3537,7 +3537,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
||||||
}
|
}
|
||||||
Toast.makeText(mActivity, R.string.post_saved_success, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, R.string.post_saved_success, Toast.LENGTH_SHORT).show();
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -3547,7 +3547,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
||||||
}
|
}
|
||||||
Toast.makeText(mActivity, R.string.post_saved_failed, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, R.string.post_saved_failed, Toast.LENGTH_SHORT).show();
|
||||||
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
|
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@ package ml.docilealligator.infinityforreddit.events;
|
|||||||
|
|
||||||
import ml.docilealligator.infinityforreddit.post.Post;
|
import ml.docilealligator.infinityforreddit.post.Post;
|
||||||
|
|
||||||
public class PostUpdateEventToDetailActivity {
|
public class PostUpdateEventToPostDetailFragment {
|
||||||
public final Post post;
|
public final Post post;
|
||||||
|
|
||||||
public PostUpdateEventToDetailActivity(Post post) {
|
public PostUpdateEventToPostDetailFragment(Post post) {
|
||||||
this.post = post;
|
this.post = post;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -89,7 +89,7 @@ import ml.docilealligator.infinityforreddit.events.ChangeNSFWBlurEvent;
|
|||||||
import ml.docilealligator.infinityforreddit.events.ChangeNetworkStatusEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeNetworkStatusEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeSpoilerBlurEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeSpoilerBlurEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.FlairSelectedEvent;
|
import ml.docilealligator.infinityforreddit.events.FlairSelectedEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.PostUpdateEventToDetailActivity;
|
import ml.docilealligator.infinityforreddit.events.PostUpdateEventToPostDetailFragment;
|
||||||
import ml.docilealligator.infinityforreddit.events.PostUpdateEventToPostList;
|
import ml.docilealligator.infinityforreddit.events.PostUpdateEventToPostList;
|
||||||
import ml.docilealligator.infinityforreddit.message.ReadMessage;
|
import ml.docilealligator.infinityforreddit.message.ReadMessage;
|
||||||
import ml.docilealligator.infinityforreddit.post.FetchPost;
|
import ml.docilealligator.infinityforreddit.post.FetchPost;
|
||||||
@ -1682,7 +1682,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onPostUpdateEvent(PostUpdateEventToDetailActivity event) {
|
public void onPostUpdateEvent(PostUpdateEventToPostDetailFragment event) {
|
||||||
if (mPost.getId().equals(event.post.getId())) {
|
if (mPost.getId().equals(event.post.getId())) {
|
||||||
mPost.setVoteType(event.post.getVoteType());
|
mPost.setVoteType(event.post.getVoteType());
|
||||||
mPost.setSaved(event.post.isSaved());
|
mPost.setSaved(event.post.isSaved());
|
||||||
|
Loading…
Reference in New Issue
Block a user