mirror of
https://framagit.org/tom79/fedilab-tube
synced 2025-02-18 04:50:39 +01:00
improve comments
This commit is contained in:
parent
dfdda7627f
commit
a6dfd842e3
@ -38,6 +38,8 @@ import android.os.Looper;
|
|||||||
import android.support.v4.media.session.MediaSessionCompat;
|
import android.support.v4.media.session.MediaSessionCompat;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -246,7 +248,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
if (Helper.isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
if (Helper.isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
||||||
Account account = new AccountDAO(PeertubeActivity.this, db).getAccountByToken(token);
|
Account account = new AccountDAO(PeertubeActivity.this, db).getAccountByToken(token);
|
||||||
Helper.loadGiF(PeertubeActivity.this, account.getAvatar() != null ? account.getAvatar().getPath() : null, binding.myPp);
|
Helper.loadGiF(PeertubeActivity.this, account.getAvatar() != null ? account.getAvatar().getPath() : null, binding.myPp);
|
||||||
Helper.loadGiF(PeertubeActivity.this, account.getAvatar() != null ? account.getAvatar().getPath() : null, binding.myPpReply);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TorrentOptions torrentOptions = new TorrentOptions.Builder()
|
TorrentOptions torrentOptions = new TorrentOptions.Builder()
|
||||||
@ -298,7 +299,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!Helper.isLoggedIn(PeertubeActivity.this) || sepiaSearch) {
|
if (!Helper.isLoggedIn(PeertubeActivity.this) || sepiaSearch) {
|
||||||
binding.writeCommentContainerReply.setVisibility(View.GONE);
|
|
||||||
binding.writeCommentContainer.setVisibility(View.GONE);
|
binding.writeCommentContainer.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
playInMinimized = sharedpreferences.getBoolean(getString(R.string.set_video_minimize_choice), true);
|
playInMinimized = sharedpreferences.getBoolean(getString(R.string.set_video_minimize_choice), true);
|
||||||
@ -382,8 +382,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
comments = new ArrayList<>();
|
comments = new ArrayList<>();
|
||||||
|
|
||||||
binding.closeReply.setOnClickListener(v -> closeCommentThread());
|
binding.closeReply.setOnClickListener(v -> closeCommentThread());
|
||||||
|
binding.closePost.setOnClickListener(v -> closePostComment());
|
||||||
|
|
||||||
commentListAdapter = new CommentListAdapter(comments, isMyVideo || Helper.isVideoOwner(PeertubeActivity.this, peertube));
|
commentListAdapter = new CommentListAdapter(comments, isMyVideo || Helper.isVideoOwner(PeertubeActivity.this, peertube), false);
|
||||||
commentListAdapter.allCommentRemoved = PeertubeActivity.this;
|
commentListAdapter.allCommentRemoved = PeertubeActivity.this;
|
||||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
||||||
binding.peertubeComments.setLayoutManager(mLayoutManager);
|
binding.peertubeComments.setLayoutManager(mLayoutManager);
|
||||||
@ -419,6 +420,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
binding.postCommentButton.setOnClickListener(v-> openPostComment(null, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -459,7 +461,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void manageVIewCommentReply(APIResponse apiResponse) {
|
public void manageVIewCommentReply(Comment comment, APIResponse apiResponse) {
|
||||||
if (apiResponse == null || apiResponse.getError() != null || apiResponse.getCommentThreadData() == null) {
|
if (apiResponse == null || apiResponse.getError() != null || apiResponse.getCommentThreadData() == null) {
|
||||||
if (apiResponse == null || apiResponse.getError() == null)
|
if (apiResponse == null || apiResponse.getError() == null)
|
||||||
Toasty.error(PeertubeActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
Toasty.error(PeertubeActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||||
@ -469,7 +471,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
List<CommentData.CommentThreadData> commentThreadDataList = apiResponse.getCommentThreadData().getChildren();
|
List<CommentData.CommentThreadData> commentThreadDataList = apiResponse.getCommentThreadData().getChildren();
|
||||||
commentsThread = generateCommentReply(commentThreadDataList, new ArrayList<>());
|
commentsThread = generateCommentReply(commentThreadDataList, new ArrayList<>());
|
||||||
commentReplyListAdapter = new CommentListAdapter(commentsThread, Helper.isVideoOwner(PeertubeActivity.this, peertube));
|
comment.setInReplyToCommentId(null);
|
||||||
|
comment.setTotalReplies(0);
|
||||||
|
commentsThread.add(0, comment);
|
||||||
|
commentReplyListAdapter = new CommentListAdapter(commentsThread, Helper.isVideoOwner(PeertubeActivity.this, peertube), true);
|
||||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
||||||
binding.peertubeReply.setLayoutManager(mLayoutManager);
|
binding.peertubeReply.setLayoutManager(mLayoutManager);
|
||||||
binding.peertubeReply.setNestedScrollingEnabled(false);
|
binding.peertubeReply.setNestedScrollingEnabled(false);
|
||||||
@ -742,24 +747,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
|
|
||||||
if (!Helper.isLoggedIn(PeertubeActivity.this) || sepiaSearch) {
|
if (!Helper.isLoggedIn(PeertubeActivity.this) || sepiaSearch) {
|
||||||
binding.writeCommentContainer.setVisibility(View.GONE);
|
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();
|
|
||||||
if (comment.trim().length() > 0) {
|
|
||||||
PostActionsVM viewModelComment = new ViewModelProvider(PeertubeActivity.this).get(PostActionsVM.class);
|
|
||||||
viewModelComment.comment(ADD_COMMENT, peertube.getId(), null, comment).observe(PeertubeActivity.this, apiResponse1 -> manageVIewPostActions(ADD_COMMENT, 0, apiResponse1));
|
|
||||||
binding.addCommentWrite.setText("");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (sepiaSearch) {
|
|
||||||
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
|
||||||
} else {
|
|
||||||
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
binding.peertubePlaylist.setOnClickListener(v -> {
|
binding.peertubePlaylist.setOnClickListener(v -> {
|
||||||
PlaylistsVM viewModelOwnerPlaylist = new ViewModelProvider(PeertubeActivity.this).get(PlaylistsVM.class);
|
PlaylistsVM viewModelOwnerPlaylist = new ViewModelProvider(PeertubeActivity.this).get(PlaylistsVM.class);
|
||||||
@ -770,13 +758,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
|
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
|
||||||
commentViewModel.getThread(sepiaSearch ? peertubeInstance : null, videoUuid, max_id).observe(PeertubeActivity.this, this::manageVIewComment);
|
commentViewModel.getThread(sepiaSearch ? peertubeInstance : null, videoUuid, max_id).observe(PeertubeActivity.this, this::manageVIewComment);
|
||||||
if (Helper.isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
if (Helper.isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
||||||
binding.writeCommentContainerReply.setVisibility(View.VISIBLE);
|
|
||||||
binding.writeCommentContainer.setVisibility(View.VISIBLE);
|
binding.writeCommentContainer.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
binding.peertubeComments.setVisibility(View.VISIBLE);
|
binding.peertubeComments.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
binding.peertubeComments.setVisibility(View.GONE);
|
binding.peertubeComments.setVisibility(View.GONE);
|
||||||
binding.writeCommentContainerReply.setVisibility(View.GONE);
|
|
||||||
binding.writeCommentContainer.setVisibility(View.GONE);
|
binding.writeCommentContainer.setVisibility(View.GONE);
|
||||||
binding.noActionText.setText(getString(R.string.comment_no_allowed_peertube));
|
binding.noActionText.setText(getString(R.string.comment_no_allowed_peertube));
|
||||||
binding.noAction.setVisibility(View.VISIBLE);
|
binding.noAction.setVisibility(View.VISIBLE);
|
||||||
@ -1193,9 +1179,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (binding.replyThread.getVisibility() == View.VISIBLE) {
|
if(binding.postComment.getVisibility() == View.VISIBLE){
|
||||||
|
closePostComment();
|
||||||
|
} else if (binding.replyThread.getVisibility() == View.VISIBLE) {
|
||||||
closeCommentThread();
|
closeCommentThread();
|
||||||
} else {
|
} else {
|
||||||
if (playInMinimized && player != null) {
|
if (playInMinimized && player != null) {
|
||||||
enterVideoMode();
|
enterVideoMode();
|
||||||
} else {
|
} else {
|
||||||
@ -1285,24 +1273,18 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
fullScreenDialog.show();
|
fullScreenDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openCommentThread(Comment comment, int position) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void openCommentThread(Comment comment) {
|
||||||
|
|
||||||
|
|
||||||
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
|
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
|
||||||
binding.peertubeReply.setVisibility(View.GONE);
|
binding.peertubeReply.setVisibility(View.GONE);
|
||||||
commentViewModel.getRepliesComment(videoUuid, comment.getId()).observe(PeertubeActivity.this, this::manageVIewCommentReply);
|
commentViewModel.getRepliesComment(videoUuid, comment.getId()).observe(PeertubeActivity.this, apiResponse->manageVIewCommentReply(comment, apiResponse));
|
||||||
|
|
||||||
|
|
||||||
Account account = comment.getAccount();
|
|
||||||
Helper.loadGiF(PeertubeActivity.this, account.getAvatar() != null ? account.getAvatar().getPath() : null, binding.commentAccountProfile);
|
|
||||||
binding.commentAccountDisplayname.setText(account.getDisplayName());
|
|
||||||
binding.commentAccountUsername.setText(account.getAcct());
|
|
||||||
Spanned commentSpan;
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
|
||||||
commentSpan = Html.fromHtml(comment.getText(), Html.FROM_HTML_MODE_COMPACT);
|
|
||||||
else
|
|
||||||
commentSpan = Html.fromHtml(comment.getText());
|
|
||||||
binding.commentContent.setText(commentSpan);
|
|
||||||
binding.commentDate.setText(Helper.dateDiff(PeertubeActivity.this, comment.getCreatedAt()));
|
|
||||||
binding.replyThread.setVisibility(View.VISIBLE);
|
binding.replyThread.setVisibility(View.VISIBLE);
|
||||||
TranslateAnimation animate = new TranslateAnimation(
|
TranslateAnimation animate = new TranslateAnimation(
|
||||||
binding.peertubeInformationContainer.getWidth(),
|
binding.peertubeInformationContainer.getWidth(),
|
||||||
@ -1324,26 +1306,33 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
animate.setDuration(500);
|
animate.setDuration(500);
|
||||||
binding.addCommentWriteReply.setText(String.format("@%s ", comment.getAccount().getAcct()));
|
|
||||||
binding.addCommentWriteReply.setSelection(binding.addCommentWriteReply.getText().length());
|
|
||||||
binding.replyThread.startAnimation(animate);
|
binding.replyThread.startAnimation(animate);
|
||||||
binding.sendReply.setOnClickListener(null);
|
}
|
||||||
binding.sendReply.setOnClickListener(v -> {
|
|
||||||
if (isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
private void sendComment(Comment comment, int position) {
|
||||||
String commentView = binding.addCommentWriteReply.getText().toString();
|
if (isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
||||||
|
if( comment == null) {
|
||||||
|
String commentStr = 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();
|
||||||
if (commentView.trim().length() > 0) {
|
if (commentView.trim().length() > 0) {
|
||||||
PostActionsVM viewModelComment = new ViewModelProvider(PeertubeActivity.this).get(PostActionsVM.class);
|
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));
|
viewModelComment.comment(REPLY, peertube.getId(), comment.getId(), commentView).observe(PeertubeActivity.this, apiResponse1 -> manageVIewPostActions(REPLY, position, apiResponse1));
|
||||||
binding.addCommentWriteReply.setText("");
|
binding.addCommentWrite.setText("");
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (sepiaSearch) {
|
|
||||||
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
|
||||||
} else {
|
|
||||||
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
} else {
|
||||||
|
if (sepiaSearch) {
|
||||||
|
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
||||||
|
} else {
|
||||||
|
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeCommentThread() {
|
private void closeCommentThread() {
|
||||||
@ -1371,6 +1360,87 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.replyThread.startAnimation(animate);
|
binding.replyThread.startAnimation(animate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void openPostComment(Comment comment, int position) {
|
||||||
|
if( comment != null) {
|
||||||
|
binding.replyContent.setVisibility(View.VISIBLE);
|
||||||
|
Account account = comment.getAccount();
|
||||||
|
Helper.loadGiF(PeertubeActivity.this, account.getAvatar() != null ? account.getAvatar().getPath() : null, binding.commentAccountProfile);
|
||||||
|
binding.commentAccountDisplayname.setText(account.getDisplayName());
|
||||||
|
binding.commentAccountUsername.setText(account.getAcct());
|
||||||
|
Spanned commentSpan;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
|
commentSpan = Html.fromHtml(comment.getText(), Html.FROM_HTML_MODE_COMPACT);
|
||||||
|
else
|
||||||
|
commentSpan = Html.fromHtml(comment.getText());
|
||||||
|
binding.commentContent.setText(commentSpan);
|
||||||
|
binding.commentDate.setText(Helper.dateDiff(PeertubeActivity.this, comment.getCreatedAt()));
|
||||||
|
}else{
|
||||||
|
binding.replyContent.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
binding.postComment.setVisibility(View.VISIBLE);
|
||||||
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||||
|
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
|
int height = displayMetrics.heightPixels;
|
||||||
|
TranslateAnimation animateComment = new TranslateAnimation(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
height,
|
||||||
|
binding.mediaVideo.getHeight());
|
||||||
|
animateComment.setAnimationListener(new Animation.AnimationListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(Animation animation) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animation animation) {
|
||||||
|
binding.peertubeInformationContainer.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationRepeat(Animation animation) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
animateComment.setDuration(500);
|
||||||
|
binding.postComment.startAnimation(animateComment);
|
||||||
|
if( comment != null) {
|
||||||
|
binding.addCommentWrite.setText(String.format("@%s ", comment.getAccount().getAcct()));
|
||||||
|
binding.addCommentWrite.setSelection(binding.addCommentWrite.getText().length());
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.send.setOnClickListener(null);
|
||||||
|
binding.send.setOnClickListener(v-> sendComment(comment, position));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void closePostComment() {
|
||||||
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||||
|
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
|
int height = displayMetrics.heightPixels;
|
||||||
|
binding.peertubeInformationContainer.setVisibility(View.VISIBLE);
|
||||||
|
Log.v(Helper.TAG,"end: " + binding.mediaVideo.getHeight() + " - " + height);
|
||||||
|
TranslateAnimation animateComment = new TranslateAnimation(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
binding.mediaVideo.getHeight(),
|
||||||
|
height);
|
||||||
|
animateComment.setAnimationListener(new Animation.AnimationListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(Animation animation) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animation animation) {
|
||||||
|
binding.postComment.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationRepeat(Animation animation) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
animateComment.setDuration(500);
|
||||||
|
binding.postComment.startAnimation(animateComment);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"unused", "RedundantSuppression"})
|
@SuppressWarnings({"unused", "RedundantSuppression"})
|
||||||
public void manageVIewPostActions(RetrofitPeertubeAPI.ActionType statusAction, int position, APIResponse apiResponse) {
|
public void manageVIewPostActions(RetrofitPeertubeAPI.ActionType statusAction, int position, APIResponse apiResponse) {
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
@ -41,7 +42,6 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.PopupMenu;
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.lifecycle.LifecycleOwner;
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
@ -59,15 +59,14 @@ import app.fedilab.fedilabtube.client.APIResponse;
|
|||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.CommentData.Comment;
|
import app.fedilab.fedilabtube.client.data.CommentData.Comment;
|
||||||
import app.fedilab.fedilabtube.client.entities.Report;
|
import app.fedilab.fedilabtube.client.entities.Report;
|
||||||
|
import app.fedilab.fedilabtube.helper.CommentDecorationHelper;
|
||||||
import app.fedilab.fedilabtube.helper.EmojiHelper;
|
import app.fedilab.fedilabtube.helper.EmojiHelper;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
import studio.carbonylgroup.textfieldboxes.ExtendedEditText;
|
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPLY;
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPLY;
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
|
||||||
|
|
||||||
|
|
||||||
public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
@ -78,11 +77,13 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
public AllCommentRemoved allCommentRemoved;
|
public AllCommentRemoved allCommentRemoved;
|
||||||
boolean isVideoOwner;
|
boolean isVideoOwner;
|
||||||
private Context context;
|
private Context context;
|
||||||
|
private final boolean isThread;
|
||||||
|
|
||||||
public CommentListAdapter(List<Comment> comments, boolean isVideoOwner) {
|
public CommentListAdapter(List<Comment> comments, boolean isVideoOwner, boolean isThread) {
|
||||||
this.comments = comments;
|
this.comments = comments;
|
||||||
commentListAdapter = this;
|
commentListAdapter = this;
|
||||||
this.isVideoOwner = isVideoOwner;
|
this.isVideoOwner = isVideoOwner;
|
||||||
|
this.isThread = isThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -120,6 +121,19 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
return;
|
return;
|
||||||
holder.main_container.setTag(i);
|
holder.main_container.setTag(i);
|
||||||
|
|
||||||
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
);
|
||||||
|
if( comment.isReply()) {
|
||||||
|
int ident = CommentDecorationHelper.getIndentation(comment.getInReplyToCommentId(), comments);
|
||||||
|
holder.decoration.setVisibility(View.VISIBLE);
|
||||||
|
params.setMargins((int)Helper.convertDpToPixel(ident*15, context), 0, 0, 0);
|
||||||
|
}else{
|
||||||
|
holder.decoration.setVisibility(View.GONE);
|
||||||
|
params.setMargins(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
holder.main_container.setLayoutParams(params);
|
||||||
holder.more_actions.setOnClickListener(view -> {
|
holder.more_actions.setOnClickListener(view -> {
|
||||||
PopupMenu popup = new PopupMenu(context, holder.more_actions);
|
PopupMenu popup = new PopupMenu(context, holder.more_actions);
|
||||||
popup.getMenuInflater()
|
popup.getMenuInflater()
|
||||||
@ -224,9 +238,10 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
|
|
||||||
holder.comment_account_displayname.setText(comment.getAccount().getDisplayName());
|
holder.comment_account_displayname.setText(comment.getAccount().getDisplayName());
|
||||||
|
|
||||||
if (context instanceof PeertubeActivity && !comment.isReply()) {
|
|
||||||
holder.main_container.setOnClickListener(v -> ((PeertubeActivity) context).openCommentThread(comment, i));
|
if (context instanceof PeertubeActivity && !isThread) {
|
||||||
holder.comment_content.setOnClickListener(v -> ((PeertubeActivity) context).openCommentThread(comment, i));
|
holder.main_container.setOnClickListener(v -> ((PeertubeActivity) context).openCommentThread(comment));
|
||||||
|
holder.comment_content.setOnClickListener(v -> ((PeertubeActivity) context).openCommentThread(comment));
|
||||||
}
|
}
|
||||||
if (comment.getTotalReplies() > 0) {
|
if (comment.getTotalReplies() > 0) {
|
||||||
holder.number_of_replies.setVisibility(View.VISIBLE);
|
holder.number_of_replies.setVisibility(View.VISIBLE);
|
||||||
@ -269,33 +284,13 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
} else {
|
} else {
|
||||||
holder.replyButton.setVisibility(View.GONE);
|
holder.replyButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
if (comment.isReply() && comment.isReplyViewOpen()) {
|
if( i == 0 && isThread) {
|
||||||
holder.write_comment_container_reply.setVisibility(View.VISIBLE);
|
holder.post_reply_button.setVisibility(View.VISIBLE);
|
||||||
} else {
|
}else {
|
||||||
holder.write_comment_container_reply.setVisibility(View.GONE);
|
holder.post_reply_button.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
if (holder.add_comment_write_reply.getText() == null || holder.add_comment_write_reply.getText().toString().trim().length() == 0) {
|
holder.post_reply_button.setOnClickListener(v -> ((PeertubeActivity) context).openPostComment(comment, i));
|
||||||
holder.add_comment_write_reply.setText(String.format("@%s ", comment.getAccount().getAcct()));
|
holder.replyButton.setOnClickListener(v -> ((PeertubeActivity) context).openPostComment(comment, i));
|
||||||
holder.add_comment_write_reply.setSelection(holder.add_comment_write_reply.getText().length());
|
|
||||||
}
|
|
||||||
holder.replyButton.setOnClickListener(v -> {
|
|
||||||
comment.setReplyViewOpen(!comment.isReplyViewOpen());
|
|
||||||
notifyItemChanged(i);
|
|
||||||
});
|
|
||||||
|
|
||||||
holder.send_reply.setOnClickListener(null);
|
|
||||||
holder.send_reply.setOnClickListener(v -> {
|
|
||||||
if (isLoggedIn(context)) {
|
|
||||||
String commentView = holder.add_comment_write_reply.getText().toString();
|
|
||||||
if (commentView.trim().length() > 0) {
|
|
||||||
PostActionsVM viewModelComment = new ViewModelProvider((ViewModelStoreOwner) context).get(PostActionsVM.class);
|
|
||||||
viewModelComment.comment(REPLY, comment.getVideoId(), comment.getId(), commentView).observe((LifecycleOwner) context, apiResponse1 -> manageVIewPostActions(REPLY, (int) holder.main_container.getTag(), apiResponse1));
|
|
||||||
holder.add_comment_write_reply.setText("");
|
|
||||||
comment.setReplyViewOpen(false);
|
|
||||||
notifyItemChanged(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void manageVIewPostActions(RetrofitPeertubeAPI.ActionType statusAction, int i, APIResponse apiResponse) {
|
public void manageVIewPostActions(RetrofitPeertubeAPI.ActionType statusAction, int i, APIResponse apiResponse) {
|
||||||
@ -361,13 +356,12 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
TextView comment_content;
|
TextView comment_content;
|
||||||
TextView comment_account_username;
|
TextView comment_account_username;
|
||||||
TextView comment_account_displayname;
|
TextView comment_account_displayname;
|
||||||
ImageView comment_account_profile, send_reply;
|
ImageView comment_account_profile;
|
||||||
TextView comment_date, replyButton;
|
TextView comment_date, replyButton;
|
||||||
LinearLayout main_container;
|
LinearLayout main_container;
|
||||||
TextView more_actions, number_of_replies;
|
TextView more_actions, number_of_replies;
|
||||||
ExtendedEditText add_comment_write_reply;
|
Button post_reply_button;
|
||||||
ConstraintLayout write_comment_container_reply;
|
View decoration;
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("SetJavaScriptEnabled")
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
ViewHolder(View itemView) {
|
ViewHolder(View itemView) {
|
||||||
@ -380,10 +374,9 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
main_container = itemView.findViewById(R.id.main_container);
|
main_container = itemView.findViewById(R.id.main_container);
|
||||||
more_actions = itemView.findViewById(R.id.more_actions);
|
more_actions = itemView.findViewById(R.id.more_actions);
|
||||||
number_of_replies = itemView.findViewById(R.id.number_of_replies);
|
number_of_replies = itemView.findViewById(R.id.number_of_replies);
|
||||||
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);
|
replyButton = itemView.findViewById(R.id.replyButton);
|
||||||
write_comment_container_reply = itemView.findViewById(R.id.write_comment_container_reply);
|
decoration = itemView.findViewById(R.id.decoration);
|
||||||
|
post_reply_button = itemView.findViewById(R.id.post_reply_button);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package app.fedilab.fedilabtube.helper;
|
||||||
|
/* Copyright 2020 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.client.data.CommentData;
|
||||||
|
|
||||||
|
public class CommentDecorationHelper {
|
||||||
|
|
||||||
|
public static int getIndentation(String replyToCommentId, List<CommentData.Comment> comments){
|
||||||
|
return numberOfIndentation(0, replyToCommentId, comments);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int numberOfIndentation(int currentIdentation, String replyToCommentId, List<CommentData.Comment> comments) {
|
||||||
|
|
||||||
|
String targetedComment = null;
|
||||||
|
for(CommentData.Comment comment: comments) {
|
||||||
|
if( replyToCommentId.compareTo(comment.getId()) == 0) {
|
||||||
|
targetedComment = comment.getInReplyToCommentId();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( targetedComment != null) {
|
||||||
|
currentIdentation++;
|
||||||
|
return numberOfIndentation(currentIdentation, targetedComment, comments);
|
||||||
|
}else{
|
||||||
|
return Math.min(currentIdentation, 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -244,80 +244,13 @@
|
|||||||
android:textColor="?attr/colorAccent"
|
android:textColor="?attr/colorAccent"
|
||||||
android:layout_marginTop="2dp" />
|
android:layout_marginTop="2dp" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<Button
|
||||||
android:id="@+id/write_comment_container"
|
android:layout_gravity="center"
|
||||||
android:layout_margin="10dp"
|
style="@style/Widget.AppCompat.Button.Borderless.Colored"
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/post_comment_button"
|
||||||
android:layout_height="wrap_content">
|
android:layout_width="wrap_content"
|
||||||
<View
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/separator_top"
|
android:text="@string/add_public_comment"/>
|
||||||
android:layout_margin="5dp"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/write_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1px"
|
|
||||||
android:background="@android:color/darker_gray"/>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/separator_top"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/separator_bottom"
|
|
||||||
android:id="@+id/write_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/my_pp"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:layout_marginEnd="5dp"
|
|
||||||
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"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/my_pp"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/send"
|
|
||||||
app:labelText="@string/add_public_comment"
|
|
||||||
app:secondaryColor="?attr/colorAccent"
|
|
||||||
app:primaryColor="?attr/colorAccent"
|
|
||||||
>
|
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
|
||||||
android:id="@+id/add_comment_write"
|
|
||||||
app:alwaysShowHint="false"
|
|
||||||
app:useDenseSpacing="false"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
/>
|
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
|
||||||
<ImageView
|
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
android:id="@+id/send"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:contentDescription="@string/send_comment"
|
|
||||||
android:src="@drawable/ic_baseline_send_24" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/separator_bottom"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/write_container"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1px"
|
|
||||||
android:background="@android:color/darker_gray"/>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/peertube_comments"
|
android:id="@+id/peertube_comments"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -370,7 +303,47 @@
|
|||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:contentDescription="@string/close"
|
android:contentDescription="@string/close"
|
||||||
android:src="@drawable/ic_close_black_48dp"/>
|
android:src="@drawable/ic_close_black_48dp"/>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
android:id="@+id/peertube_reply"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:background="?android:colorBackground"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
android:id="@+id/post_comment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
|
android:id="@+id/post_main_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:divider="?android:dividerHorizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:showDividers="end">
|
||||||
|
<ImageView
|
||||||
|
android:layout_gravity="end|center_vertical"
|
||||||
|
android:id="@+id/close_post"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:contentDescription="@string/close"
|
||||||
|
android:src="@drawable/ic_close_black_48dp"/>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/reply_content"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<ImageView
|
<ImageView
|
||||||
@ -429,69 +402,72 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@+id/comment_account_profile" />
|
app:layout_constraintTop_toBottomOf="@+id/comment_account_profile" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/write_comment_container_reply"
|
android:id="@+id/write_comment_container"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<View
|
<View
|
||||||
android:id="@+id/separator_top_reply"
|
android:id="@+id/separator_top"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/write_container_reply"
|
app:layout_constraintBottom_toTopOf="@+id/write_container"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1px"
|
android:layout_height="1px"
|
||||||
android:background="@android:color/darker_gray"/>
|
android:background="@android:color/darker_gray"/>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
app:layout_constraintTop_toBottomOf="@+id/separator_top_reply"
|
app:layout_constraintTop_toBottomOf="@+id/separator_top"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/separator_bottom_reply"
|
app:layout_constraintBottom_toTopOf="@+id/separator_bottom"
|
||||||
android:id="@+id/write_container_reply"
|
android:id="@+id/write_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/my_pp_reply"
|
android:id="@+id/my_pp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:contentDescription="@string/profile_picture" />
|
android:contentDescription="@string/profile_picture" />
|
||||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
||||||
android:id="@+id/text_field_boxes_reply"
|
android:id="@+id/text_field_boxes"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/my_pp_reply"
|
app:layout_constraintStart_toEndOf="@+id/my_pp"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/send_reply"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:labelText="@string/add_public_reply"
|
app:labelText="@string/add_public_reply"
|
||||||
app:secondaryColor="?attr/colorAccent"
|
app:secondaryColor="?attr/colorAccent"
|
||||||
app:primaryColor="?attr/colorAccent"
|
app:primaryColor="?attr/colorAccent"
|
||||||
>
|
>
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
||||||
android:id="@+id/add_comment_write_reply"
|
android:id="@+id/add_comment_write"
|
||||||
app:alwaysShowHint="false"
|
app:alwaysShowHint="false"
|
||||||
app:useDenseSpacing="false"
|
app:useDenseSpacing="false"
|
||||||
android:textSize="14sp"
|
android:gravity="top"
|
||||||
android:layout_width="wrap_content"
|
android:inputType="textMultiLine"
|
||||||
android:layout_height="wrap_content"
|
android:minLines="4"
|
||||||
|
android:maxLines="8"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
/>
|
/>
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
||||||
<ImageView
|
<Button
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintTop_toBottomOf="@+id/text_field_boxes"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:id="@+id/send_reply"
|
style="@style/Widget.AppCompat.Button.Borderless.Colored"
|
||||||
|
android:id="@+id/send"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:contentDescription="@string/send_comment"
|
android:text="@string/send_comment"/>
|
||||||
android:src="@drawable/ic_baseline_send_24"
|
|
||||||
/>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/separator_bottom_reply"
|
android:id="@+id/separator_bottom"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/write_container_reply"
|
app:layout_constraintTop_toBottomOf="@+id/write_container"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
@ -499,12 +475,6 @@
|
|||||||
android:layout_height="1px"
|
android:layout_height="1px"
|
||||||
android:background="@android:color/darker_gray"/>
|
android:background="@android:color/darker_gray"/>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
android:id="@+id/peertube_reply"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
@ -28,14 +28,23 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
<View
|
||||||
|
android:id="@+id/decoration"
|
||||||
|
android:layout_width="2dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:background="?attr/colorAccent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/comment_account_profile"
|
android:id="@+id/comment_account_profile"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
android:contentDescription="@string/profile_picture"
|
android:contentDescription="@string/profile_picture"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="@id/decoration"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -51,13 +60,14 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/comment_account_username"
|
android:id="@+id/comment_account_username"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:layout_marginStart="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/more_actions"
|
||||||
app:layout_constraintStart_toEndOf="@+id/comment_account_profile"
|
app:layout_constraintStart_toEndOf="@+id/comment_account_profile"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/comment_account_displayname" />
|
app:layout_constraintTop_toBottomOf="@+id/comment_account_displayname" />
|
||||||
|
|
||||||
@ -71,7 +81,7 @@
|
|||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toStartOf="@id/more_actions"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -91,14 +101,14 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:textIsSelectable="true"
|
android:textIsSelectable="true"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toStartOf="@id/more_actions"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="@id/comment_account_profile"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/comment_account_profile" />
|
app:layout_constraintTop_toBottomOf="@+id/comment_account_profile" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/number_of_replies"
|
android:id="@+id/number_of_replies"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/comment_content"
|
app:layout_constraintTop_toBottomOf="@+id/comment_content"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="@id/decoration"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="?attr/colorAccent"/>
|
android:textColor="?attr/colorAccent"/>
|
||||||
@ -106,7 +116,7 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
app:layout_constraintTop_toBottomOf="@+id/comment_content"
|
app:layout_constraintTop_toBottomOf="@+id/comment_content"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="@id/comment_account_profile"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:id="@+id/replyButton"
|
android:id="@+id/replyButton"
|
||||||
@ -115,73 +125,18 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<Button
|
||||||
app:layout_constraintTop_toBottomOf="@+id/replyButton"
|
style="@style/Widget.AppCompat.Button.Borderless.Colored"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:id="@+id/post_reply_button"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
android:id="@+id/write_comment_container_reply"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:gravity="center"
|
||||||
<View
|
android:visibility="gone"
|
||||||
android:id="@+id/separator_top_reply"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="5dp"
|
android:text="@string/add_public_reply"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:textColor="?attr/colorAccent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/write_container_reply"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintTop_toBottomOf="@+id/comment_content" />
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1px"
|
|
||||||
android:background="@android:color/darker_gray"/>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/separator_top_reply"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/separator_bottom_reply"
|
|
||||||
android:id="@+id/write_container_reply"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
<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_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/send_reply"
|
|
||||||
app:labelText="@string/add_public_reply"
|
|
||||||
app:secondaryColor="?attr/colorAccent"
|
|
||||||
app:primaryColor="?attr/colorAccent"
|
|
||||||
>
|
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
|
||||||
android:id="@+id/add_comment_write_reply"
|
|
||||||
app:alwaysShowHint="false"
|
|
||||||
app:useDenseSpacing="false"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
/>
|
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
|
||||||
<ImageView
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
android:id="@+id/send_reply"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:contentDescription="@string/send_comment"
|
|
||||||
android:src="@drawable/ic_baseline_send_24"
|
|
||||||
/>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/separator_bottom_reply"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/write_container_reply"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1px"
|
|
||||||
android:background="@android:color/darker_gray"/>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user