Improve comments
This commit is contained in:
parent
dad94d753d
commit
2f3e29b037
|
@ -1263,12 +1263,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
|
||||
public void openCommentThread(Comment comment) {
|
||||
|
||||
|
||||
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
|
||||
binding.peertubeReply.setVisibility(View.GONE);
|
||||
commentViewModel.getRepliesComment(videoUuid, comment.getId()).observe(PeertubeActivity.this, apiResponse -> manageVIewCommentReply(comment, apiResponse));
|
||||
|
||||
|
||||
binding.replyThread.setVisibility(View.VISIBLE);
|
||||
TranslateAnimation animate = new TranslateAnimation(
|
||||
binding.peertubeInformationContainer.getWidth(),
|
||||
|
@ -1279,12 +1277,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
binding.peertubeInformationContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
}
|
||||
|
@ -1296,20 +1292,21 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
private void sendComment(Comment comment, int position) {
|
||||
if (isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
||||
if (comment == null) {
|
||||
String commentStr = binding.addCommentWrite.getText().toString();
|
||||
String commentStr = binding.addCommentWrite.getText() != null ? binding.addCommentWrite.getText().toString() : "";
|
||||
if (commentStr.trim().length() > 0) {
|
||||
PostActionsVM viewModelComment = new ViewModelProvider(PeertubeActivity.this).get(PostActionsVM.class);
|
||||
viewModelComment.comment(ADD_COMMENT, peertube.getId(), null, commentStr).observe(PeertubeActivity.this, apiResponse1 -> manageVIewPostActions(ADD_COMMENT, 0, apiResponse1));
|
||||
binding.addCommentWrite.setText("");
|
||||
}
|
||||
} else {
|
||||
String commentView = binding.addCommentWrite.getText().toString();
|
||||
String commentView = binding.addCommentWrite.getText() != null ? binding.addCommentWrite.getText().toString() : "";
|
||||
if (commentView.trim().length() > 0) {
|
||||
PostActionsVM viewModelComment = new ViewModelProvider(PeertubeActivity.this).get(PostActionsVM.class);
|
||||
viewModelComment.comment(REPLY, peertube.getId(), comment.getId(), commentView).observe(PeertubeActivity.this, apiResponse1 -> manageVIewPostActions(REPLY, position, apiResponse1));
|
||||
binding.addCommentWrite.setText("");
|
||||
}
|
||||
}
|
||||
closePostComment();
|
||||
} else {
|
||||
if (sepiaSearch) {
|
||||
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
||||
|
@ -1321,6 +1318,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
|
||||
private void closeCommentThread() {
|
||||
binding.peertubeInformationContainer.setVisibility(View.VISIBLE);
|
||||
hideKeyboard(this);
|
||||
TranslateAnimation animate = new TranslateAnimation(
|
||||
0,
|
||||
binding.replyThread.getWidth(),
|
||||
|
@ -1369,7 +1367,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
0,
|
||||
0,
|
||||
height,
|
||||
binding.mediaVideo.getHeight());
|
||||
0);
|
||||
animateComment.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
|
@ -1378,6 +1376,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
binding.peertubeInformationContainer.setVisibility(View.GONE);
|
||||
InputMethodManager inputMethodManager =
|
||||
(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.toggleSoftInputFromWindow(
|
||||
binding.addCommentWrite.getApplicationWindowToken(),
|
||||
InputMethodManager.SHOW_FORCED, 0);
|
||||
binding.addCommentWrite.requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1388,7 +1392,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
binding.postComment.startAnimation(animateComment);
|
||||
if (comment != null) {
|
||||
binding.addCommentWrite.setText(String.format("@%s ", comment.getAccount().getAcct()));
|
||||
binding.addCommentWrite.setSelection(binding.addCommentWrite.getText().length());
|
||||
binding.addCommentWrite.setSelection(binding.addCommentWrite.getText() != null ? binding.addCommentWrite.getText().length() : 0);
|
||||
}
|
||||
|
||||
binding.send.setOnClickListener(null);
|
||||
|
@ -1400,10 +1404,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
int height = displayMetrics.heightPixels;
|
||||
binding.peertubeInformationContainer.setVisibility(View.VISIBLE);
|
||||
hideKeyboard(this);
|
||||
TranslateAnimation animateComment = new TranslateAnimation(
|
||||
0,
|
||||
0,
|
||||
binding.mediaVideo.getHeight(),
|
||||
0,
|
||||
height);
|
||||
animateComment.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
|
|
|
@ -335,6 +335,7 @@
|
|||
android:orientation="vertical"
|
||||
android:showDividers="end">
|
||||
<ImageView
|
||||
android:layout_margin="5dp"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:id="@+id/close_post"
|
||||
android:layout_width="24dp"
|
||||
|
|
Loading…
Reference in New Issue