mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-14 04:07:12 +01:00
Show more context when loading a single comment
This commit makes it so that when loading a single comment (e.g. from the inbox) it also shows the parent comment. Closes #47
This commit is contained in:
parent
5c39fddbc6
commit
2af6c5a742
@ -227,6 +227,7 @@ public class LinkResolverActivity extends AppCompatActivity {
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_SINGLE_COMMENT_ID, comment.getId());
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_SINGLE_COMMENT_PARENT_ID, comment.getParentId());
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@ -246,6 +247,7 @@ public class LinkResolverActivity extends AppCompatActivity {
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_SINGLE_COMMENT_ID, comment.getId());
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_SINGLE_COMMENT_PARENT_ID, comment.getParentId());
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
@ -95,6 +95,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
||||
public static final String EXTRA_POST_ID = "EPI";
|
||||
public static final String EXTRA_POST_LIST_POSITION = "EPLP";
|
||||
public static final String EXTRA_SINGLE_COMMENT_ID = "ESCI";
|
||||
public static final String EXTRA_SINGLE_COMMENT_PARENT_ID = "ESCPI";
|
||||
public static final String EXTRA_CONTEXT_NUMBER = "ECN";
|
||||
public static final String EXTRA_MESSAGE_FULLNAME = "ENI";
|
||||
public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN";
|
||||
@ -870,6 +871,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
||||
bundle.putParcelable(ViewPostDetailFragment.EXTRA_POST_DATA, post);
|
||||
bundle.putInt(ViewPostDetailFragment.EXTRA_POST_LIST_POSITION, position);
|
||||
bundle.putInt(ViewPostDetailFragment.EXTRA_SINGLE_COMMENT_ID, getIntent().getIntExtra(EXTRA_SINGLE_COMMENT_ID, 0));
|
||||
bundle.putInt(ViewPostDetailFragment.EXTRA_SINGLE_COMMENT_PARENT_ID, getIntent().getIntExtra(EXTRA_SINGLE_COMMENT_PARENT_ID, 0));
|
||||
bundle.putString(ViewPostDetailFragment.EXTRA_CONTEXT_NUMBER, getIntent().getStringExtra(EXTRA_CONTEXT_NUMBER));
|
||||
bundle.putString(ViewPostDetailFragment.EXTRA_MESSAGE_FULLNAME, getIntent().getStringExtra(EXTRA_MESSAGE_FULLNAME));
|
||||
} else {
|
||||
@ -891,6 +893,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
||||
bundle.putInt(ViewPostDetailFragment.EXTRA_POST_LIST_POSITION, postListPosition);
|
||||
}
|
||||
bundle.putInt(ViewPostDetailFragment.EXTRA_SINGLE_COMMENT_ID, getIntent().getIntExtra(EXTRA_SINGLE_COMMENT_ID, 0));
|
||||
bundle.putInt(ViewPostDetailFragment.EXTRA_SINGLE_COMMENT_PARENT_ID, getIntent().getIntExtra(EXTRA_SINGLE_COMMENT_PARENT_ID, 0));
|
||||
bundle.putString(ViewPostDetailFragment.EXTRA_CONTEXT_NUMBER, getIntent().getStringExtra(EXTRA_CONTEXT_NUMBER));
|
||||
bundle.putString(ViewPostDetailFragment.EXTRA_MESSAGE_FULLNAME, getIntent().getStringExtra(EXTRA_MESSAGE_FULLNAME));
|
||||
}
|
||||
|
@ -472,6 +472,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
||||
Intent intent = new Intent(mActivity, ViewPostDetailActivity.class);
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, comment.getPostId());
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_SINGLE_COMMENT_ID, comment.getId());
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_SINGLE_COMMENT_PARENT_ID, comment.getParentId());
|
||||
mActivity.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
@ -182,6 +182,9 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<CommentInteract
|
||||
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, message.getComment().getPostId());
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_SINGLE_COMMENT_ID, message.getComment().getId());
|
||||
if(message.getComment().getDepth() > 0) {
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_SINGLE_COMMENT_PARENT_ID, message.getComment().getParentId());
|
||||
}
|
||||
mActivity.startActivity(intent);
|
||||
} else if (mMessageType == FetchMessage.MESSAGE_TYPE_PRIVATE_MESSAGE) {
|
||||
Intent intent = new Intent(mActivity, ViewPrivateMessagesActivity.class);
|
||||
|
@ -129,6 +129,8 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
||||
public static final String EXTRA_POST_DATA = "EPD";
|
||||
public static final String EXTRA_POST_ID = "EPI";
|
||||
public static final String EXTRA_SINGLE_COMMENT_ID = "ESCI";
|
||||
|
||||
public static final String EXTRA_SINGLE_COMMENT_PARENT_ID = "ESCPID";
|
||||
public static final String EXTRA_CONTEXT_NUMBER = "ECN";
|
||||
public static final String EXTRA_MESSAGE_FULLNAME = "EMF";
|
||||
public static final String EXTRA_POST_LIST_POSITION = "EPLP";
|
||||
@ -229,6 +231,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
||||
private String mAccountQualifiedName;
|
||||
private int postListPosition = -1;
|
||||
private Integer mSingleCommentId;
|
||||
private Integer mSingleCommentParentId;
|
||||
private String mContextNumber;
|
||||
private boolean showToast = false;
|
||||
private boolean mIsSmoothScrolling = false;
|
||||
@ -547,6 +550,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
||||
};
|
||||
|
||||
mSingleCommentId = getArguments().getInt(EXTRA_SINGLE_COMMENT_ID, 0);
|
||||
mSingleCommentParentId = getArguments().getInt(EXTRA_SINGLE_COMMENT_PARENT_ID, 0);
|
||||
mContextNumber = getArguments().getString(EXTRA_CONTEXT_NUMBER, "8");
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
@ -606,8 +610,8 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
||||
mExoCreator, post -> EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)));
|
||||
mCommentsAdapter = new CommentsRecyclerViewAdapter(activity,
|
||||
this, mCustomThemeWrapper, mExecutor, mRetrofit.getRetrofit(),
|
||||
mAccessToken, mAccountName, mPost, mLocale, mSingleCommentId,
|
||||
isSingleCommentThreadMode, mSharedPreferences,
|
||||
mAccessToken, mAccountName, mPost, mLocale, mSingleCommentId
|
||||
, isSingleCommentThreadMode, mSharedPreferences,
|
||||
new CommentsRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
|
||||
@Override
|
||||
public void retryFetchingComments() {
|
||||
@ -626,7 +630,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
||||
public SortType.Type getSortType() {
|
||||
return sortType;
|
||||
}
|
||||
});
|
||||
} );
|
||||
if (mCommentsRecyclerView != null) {
|
||||
mRecyclerView.setAdapter(mPostAdapter);
|
||||
mCommentsRecyclerView.setAdapter(mCommentsAdapter);
|
||||
@ -1245,7 +1249,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
||||
mPostDetailsSharedPreferences, mExoCreator,
|
||||
post1 -> EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)));
|
||||
mSwipeRefreshLayout.setRefreshing(false);
|
||||
FetchComment.fetchComments(mExecutor, new Handler(), mRetrofit.getRetrofit(), mAccessToken, post.getId(), mSingleCommentId == 0 ? null : mSingleCommentId, sortType, mExpandChildren, 1, new FetchComment.FetchCommentListener() {
|
||||
FetchComment.fetchComments(mExecutor, new Handler(), mRetrofit.getRetrofit(), mAccessToken, post.getId(), mSingleCommentId == 0 ? null : mSingleCommentParentId == 0 ? mSingleCommentId : mSingleCommentParentId, sortType, mExpandChildren, 1, new FetchComment.FetchCommentListener() {
|
||||
@Override
|
||||
public void onFetchCommentSuccess(ArrayList<Comment> expandedComments, Integer parentId, ArrayList<Integer> children) {
|
||||
pages_loaded++;
|
||||
@ -1666,6 +1670,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
||||
public void changeToNormalThreadMode() {
|
||||
isSingleCommentThreadMode = false;
|
||||
mSingleCommentId = null;
|
||||
mSingleCommentParentId = null;
|
||||
mRespectSubredditRecommendedSortType = mSharedPreferences.getBoolean(SharedPreferencesUtils.RESPECT_SUBREDDIT_RECOMMENDED_COMMENT_SORT_TYPE, false);
|
||||
refresh(false, true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user