Some improvements

This commit is contained in:
Thomas 2020-10-15 18:37:50 +02:00
parent d93c74a449
commit 43fd2945cc
4 changed files with 17 additions and 20 deletions

View File

@ -1,5 +1,5 @@
- Custom default instance depending of the country
- New comment feature
- See replies to comments
- Reply to comment
- Reply to comments
- Reply to replies
- Fix some issues when posting

View File

@ -341,13 +341,13 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
}
List<CommentData.CommentThreadData> commentThreadDataList = apiResponse.getCommentThreadData().getChildren();
commentsThread = generateCommentReply(commentThreadDataList, new ArrayList<>());
commentReplyListAdapter = new CommentListAdapter(commentsThread, Helper.isVideoOwner(PeertubeActivity.this, peertube));
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
binding.peertubeReply.setLayoutManager(mLayoutManager);
binding.peertubeReply.setNestedScrollingEnabled(false);
binding.peertubeReply.setAdapter(commentReplyListAdapter);
binding.peertubeReply.setVisibility(View.VISIBLE);
if (commentsThread.size() > 0) {
commentReplyListAdapter = new CommentListAdapter(commentsThread, Helper.isVideoOwner(PeertubeActivity.this, peertube));
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
binding.peertubeReply.setLayoutManager(mLayoutManager);
binding.peertubeReply.setNestedScrollingEnabled(false);
binding.peertubeReply.setAdapter(commentReplyListAdapter);
binding.peertubeReply.setVisibility(View.VISIBLE);
commentReplyListAdapter.notifyItemRangeInserted(0, commentsThread.size());
}
}
@ -508,7 +508,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
binding.writeCommentContainer.setVisibility(View.GONE);
binding.writeCommentContainerReply.setVisibility(View.GONE);
}
binding.send.setOnClickListener(v -> {
if (isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
String comment = binding.addCommentWrite.getText().toString();
@ -860,7 +859,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
@Override
public void onBackPressed() {
if( binding.writeCommentContainerReply.getVisibility() == View.VISIBLE) {
if( binding.replyThread.getVisibility() == View.VISIBLE) {
closeCommentThread();
}else {
if (playInMinimized && player != null) {
@ -1009,6 +1008,8 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
public void onAnimationRepeat(Animation animation) {}
});
animate.setDuration(500);
binding.addCommentWriteReply.setText(String.format("@%s ", comment.getAccount().getAcct()));
binding.addCommentWriteReply.setSelection(binding.addCommentWriteReply.getText().length());
binding.replyThread.startAnimation(animate);
binding.sendReply.setOnClickListener(null);
binding.sendReply.setOnClickListener(v -> {

View File

@ -263,6 +263,10 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
}else{
holder.write_comment_container_reply.setVisibility(View.GONE);
}
if( holder.add_comment_write_reply.getText() == null || holder.add_comment_write_reply.getText().toString().trim().length() == 0) {
holder.add_comment_write_reply.setText(String.format("@%s ", comment.getAccount().getAcct()));
holder.add_comment_write_reply.setSelection(holder.add_comment_write_reply.getText().length());
}
holder.replyButton.setOnClickListener(v->{
comment.setReplyViewOpen(!comment.isReplyViewOpen());
notifyItemChanged(i);
@ -346,7 +350,7 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
TextView comment_content;
TextView comment_account_username;
TextView comment_account_displayname;
ImageView comment_account_profile, my_pp_reply, send_reply;
ImageView comment_account_profile, send_reply;
TextView comment_date, replyButton;
LinearLayout main_container;
TextView more_actions, number_of_replies;
@ -365,7 +369,6 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
main_container = itemView.findViewById(R.id.main_container);
more_actions = itemView.findViewById(R.id.more_actions);
number_of_replies = itemView.findViewById(R.id.number_of_replies);
my_pp_reply = itemView.findViewById(R.id.my_pp_reply);
add_comment_write_reply = itemView.findViewById(R.id.add_comment_write_reply);
send_reply = itemView.findViewById(R.id.send_reply);
replyButton = itemView.findViewById(R.id.replyButton);

View File

@ -141,19 +141,12 @@
android:id="@+id/write_container_reply"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/my_pp_reply"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_width="30dp"
android:layout_height="30dp"
android:contentDescription="@string/profile_picture" />
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
android:id="@+id/text_field_boxes_reply"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@+id/my_pp_reply"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/send_reply"
app:labelText="@string/add_public_reply"
app:secondaryColor="?attr/colorAccent"