Prepare the new layout.

This commit is contained in:
Thomas 2020-10-14 19:11:53 +02:00
parent 24a8a0dc00
commit 2c33f7a7f8
6 changed files with 392 additions and 197 deletions

View File

@ -16,6 +16,13 @@
<item>Automatique</item> <item>Automatique</item>
</string-array> </string-array>
<plurals name="number_of_replies">
<item quantity="zero">%d réponse</item>
<item quantity="one">%d réponse</item>
<item quantity="other">%d réponses</item>
</plurals>
<string name="set_theme">Thème</string> <string name="set_theme">Thème</string>
<string name="set_theme_description">Permet de changer le thème de l\'application</string> <string name="set_theme_description">Permet de changer le thème de l\'application</string>
<string name="federation_issue">La vidéo ne peut pas être fédérée !</string> <string name="federation_issue">La vidéo ne peut pas être fédérée !</string>

View File

@ -8,6 +8,11 @@
<string name="set_theme_choice" translatable="false">set_theme_choice</string> <string name="set_theme_choice" translatable="false">set_theme_choice</string>
<plurals name="number_of_replies">
<item quantity="one">%d reply</item>
<item quantity="other">%d replies</item>
</plurals>
<string name="set_theme">Theme</string> <string name="set_theme">Theme</string>
<string name="set_theme_description">Allow to change app theme</string> <string name="set_theme_description">Allow to change app theme</string>
<string name="federation_issue">The video cannot be federated!</string> <string name="federation_issue">The video cannot be federated!</string>

View File

@ -55,6 +55,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatImageView; import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.PopupMenu; import androidx.appcompat.widget.PopupMenu;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat; import androidx.core.graphics.drawable.DrawableCompat;
@ -146,7 +147,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
private AppCompatImageView fullScreenIcon; private AppCompatImageView fullScreenIcon;
private TextView resolution; private TextView resolution;
private int mode; private int mode;
private LinearLayout write_comment_container; private ConstraintLayout write_comment_container;
private ImageView send; private ImageView send;
private TextView add_comment_read; private TextView add_comment_read;
private EditText add_comment_write; private EditText add_comment_write;

View File

@ -215,6 +215,13 @@ 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( comment.getTotalReplies() > 0) {
holder.number_of_replies.setVisibility(View.VISIBLE);
holder.number_of_replies.setText(context.getResources().getQuantityString(R.plurals.number_of_replies, comment.getTotalReplies(), comment.getTotalReplies()));
} else {
holder.number_of_replies.setVisibility(View.GONE);
}
if (comment.getAccount() != null) { if (comment.getAccount() != null) {
Spannable wordtoSpan; Spannable wordtoSpan;
Pattern hashAcct; Pattern hashAcct;
@ -298,7 +305,7 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
ImageView comment_account_profile; ImageView comment_account_profile;
TextView comment_date; TextView comment_date;
LinearLayout main_container; LinearLayout main_container;
TextView more_actions; TextView more_actions, number_of_replies;
@SuppressLint("SetJavaScriptEnabled") @SuppressLint("SetJavaScriptEnabled")
ViewHolder(View itemView) { ViewHolder(View itemView) {
@ -310,6 +317,7 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
comment_date = itemView.findViewById(R.id.comment_date); comment_date = itemView.findViewById(R.id.comment_date);
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);
} }

View File

@ -76,14 +76,21 @@
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>
<androidx.core.widget.NestedScrollView <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/peertube_information_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="2"
android:layout_marginStart="@dimen/video_comment_margin" android:layout_marginStart="@dimen/video_comment_margin"
android:layout_marginEnd="@dimen/video_comment_margin" android:layout_marginEnd="@dimen/video_comment_margin"
android:layout_weight="2"> >
<androidx.core.widget.NestedScrollView
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:id="@+id/peertube_information_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -210,56 +217,41 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" /> android:layout_marginTop="10dp" />
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/write_comment_container" android:id="@+id/write_comment_container"
android:layout_margin="10dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:layout_gravity="center_vertical" <androidx.constraintlayout.widget.ConstraintLayout
android:layout_marginTop="10dp" app:layout_constraintTop_toTopOf="parent"
android:baselineAligned="false" app:layout_constraintStart_toStartOf="parent"
android:orientation="horizontal" app:layout_constraintBottom_toTopOf="@+id/separator"
android:visibility="gone"> android:id="@+id/write_container"
android:layout_width="match_parent"
<LinearLayout android:layout_height="wrap_content">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView <ImageView
android:id="@+id/my_pp" android:id="@+id/my_pp"
android:layout_width="40dp" app:layout_constraintTop_toTopOf="parent"
android:layout_height="40dp" app:layout_constraintStart_toStartOf="parent"
android:contentDescription="@string/profile_picture" />
<ImageView
android:id="@+id/send"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_marginTop="5dp" android:contentDescription="@string/profile_picture" />
android:contentDescription="@string/send_comment"
android:src="@drawable/ic_baseline_send_24"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView <TextView
android:id="@+id/add_comment_read" android:id="@+id/add_comment_read"
android:layout_width="match_parent" android:gravity="center"
android:layout_height="wrap_content" android:text="@string/add_public_comment"
android:text="@string/add_public_comment" /> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@+id/my_pp"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<EditText <EditText
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@+id/my_pp"
app:layout_constraintEnd_toStartOf="@+id/send"
android:id="@+id/add_comment_write" android:id="@+id/add_comment_write"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
@ -270,10 +262,30 @@
android:overScrollMode="always" android:overScrollMode="always"
android:scrollbarStyle="insideInset" android:scrollbarStyle="insideInset"
android:scrollbars="vertical" android:scrollbars="vertical"
android:visibility="gone"
/>
<ImageView
app:layout_constraintTop_toTopOf="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"
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout> <View
android:id="@+id/separator"
android:layout_margin="5dp"
app:layout_constraintTop_toBottomOf="@+id/write_container"
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.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/peertube_comments" android:id="@+id/peertube_comments"
@ -298,6 +310,161 @@
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<androidx.core.widget.NestedScrollView
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/reply_thread"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/main_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="?android:dividerHorizontal"
android:orientation="vertical"
android:showDividers="end">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/comment_account_profile"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="5dp"
android:contentDescription="@string/profile_picture"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/comment_account_displayname"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:singleLine="true"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/comment_date"
app:layout_constraintStart_toEndOf="@+id/comment_account_profile"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/comment_account_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginStart="5dp"
android:ellipsize="end"
android:singleLine="true"
android:textSize="12sp"
app:layout_constraintStart_toEndOf="@+id/comment_account_profile"
app:layout_constraintTop_toBottomOf="@+id/comment_account_displayname" />
<TextView
android:id="@+id/comment_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginStart="2dp"
android:layout_weight="0"
android:gravity="end"
android:maxLines="1"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/comment_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/comment_account_profile" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/write_comment_container_reply"
android:layout_margin="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toTopOf="@+id/separator_reply"
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" />
<TextView
android:id="@+id/add_comment_read_reply"
android:gravity="center"
android:text="@string/add_public_comment"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@+id/my_pp_reply"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<EditText
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@+id/my_pp_reply"
app:layout_constraintEnd_toStartOf="@+id/send_reply"
android:id="@+id/add_comment_write_reply"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="@string/add_public_comment"
android:importantForAutofill="no"
android:inputType="textMultiLine"
android:maxLines="4"
android:overScrollMode="always"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
android:visibility="gone"
/>
<ImageView
app:layout_constraintTop_toTopOf="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"
android:visibility="gone" />
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:id="@+id/separator_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.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.constraintlayout.widget.ConstraintLayout>
<!-- View where the video will be shown when video goes fullscreen --> <!-- View where the video will be shown when video goes fullscreen -->
<RelativeLayout <RelativeLayout
android:id="@+id/videoLayout" android:id="@+id/videoLayout"

View File

@ -93,6 +93,13 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/comment_account_profile" /> app:layout_constraintTop_toBottomOf="@+id/comment_account_profile" />
<TextView
android:id="@+id/number_of_replies"
app:layout_constraintTop_toBottomOf="@+id/comment_content"
app:layout_constraintStart_toStartOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/colorAccent"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout> </LinearLayout>