Commit f83b9244 authored by Torsten Grote's avatar Torsten Grote

Clean up threaded discussion screen

Adds RTL support
Fixing cropping bug

Closes #964
parent 81292967
package org.briarproject.briar.android.threaded;
import android.support.annotation.NonNull;
import android.support.annotation.UiThread;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
......@@ -36,8 +37,9 @@ public class ThreadItemAdapter<I extends ThreadItem>
this.layoutManager = layoutManager;
}
@NonNull
@Override
public BaseThreadItemViewHolder<I> onCreateViewHolder(
public BaseThreadItemViewHolder<I> onCreateViewHolder(@NonNull
ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.list_item_thread, parent, false);
......@@ -45,7 +47,8 @@ public class ThreadItemAdapter<I extends ThreadItem>
}
@Override
public void onBindViewHolder(BaseThreadItemViewHolder<I> ui, int position) {
public void onBindViewHolder(@NonNull BaseThreadItemViewHolder<I> ui,
int position) {
I item = items.get(position);
ui.bind(item, listener);
}
......
......@@ -3,9 +3,9 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/window_background"/>
<solid android:color="@color/thread_item_background"/>
<stroke
android:width="2dp"
android:width="@dimen/forum_nested_line_width"
android:color="@color/thread_indicator"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
<android.support.constraint.ConstraintLayout
android:id="@+id/layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="vertical">
android:layout_height="wrap_content">
<com.vanniktech.emoji.EmojiTextView
android:id="@+id/text"
......@@ -17,20 +15,24 @@
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_medium"
android:textStyle="italic"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/groups_member_joined"/>
<org.briarproject.briar.android.view.AuthorView
android:id="@+id/author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/text"
android:layout_alignStart="@+id/text"
android:layout_below="@+id/text"
android:layout_margin="@dimen/margin_medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text"
app:persona="commenter"/>
<View
android:id="@+id/divider"
style="@style/Divider.ThreadItem"
android:layout_below="@+id/author"
android:layout_marginTop="@dimen/margin_medium"/>
android:layout_marginTop="@dimen/margin_medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/author"/>
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:background="@drawable/list_item_thread_background"
android:orientation="horizontal">
<RelativeLayout
<android.support.constraint.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@drawable/list_item_thread_background">
<View
android:id="@+id/nested_line_1"
style="@style/DiscussionLevelIndicator"
android:layout_width="@dimen/forum_nested_line_width"
android:layout_height="match_parent"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible"/>
<View
android:id="@+id/nested_line_2"
style="@style/DiscussionLevelIndicator"
android:layout_width="@dimen/forum_nested_line_width"
android:layout_height="match_parent"
android:layout_toRightOf="@id/nested_line_1"
android:visibility="gone"/>
app:layout_constraintStart_toEndOf="@id/nested_line_1"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible"/>
<View
android:id="@+id/nested_line_3"
style="@style/DiscussionLevelIndicator"
android:layout_width="@dimen/forum_nested_line_width"
android:layout_height="match_parent"
android:layout_toRightOf="@id/nested_line_2"
android:visibility="gone"/>
app:layout_constraintStart_toEndOf="@id/nested_line_2"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible"/>
<View
android:id="@+id/nested_line_4"
style="@style/DiscussionLevelIndicator"
android:layout_width="@dimen/forum_nested_line_width"
android:layout_height="match_parent"
android:layout_toRightOf="@id/nested_line_3"
android:visibility="gone"/>
app:layout_constraintStart_toEndOf="@id/nested_line_3"
app:layout_constraintTop_toTopOf="parent"/>
<View
android:id="@+id/nested_line_5"
style="@style/DiscussionLevelIndicator"
android:layout_width="@dimen/forum_nested_line_width"
android:layout_height="match_parent"
android:layout_toRightOf="@id/nested_line_4"
android:visibility="gone"/>
app:layout_constraintStart_toEndOf="@id/nested_line_4"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible"/>
<TextView
android:id="@+id/nested_line_text"
android:layout_width="@dimen/forum_nested_indicator"
android:layout_height="@dimen/forum_nested_indicator"
android:layout_centerInParent="true"
android:background="@drawable/level_indicator_circle"
android:gravity="center"
android:textSize="@dimen/text_size_small"
android:visibility="gone"/>
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="42"
tools:visibility="visible"/>
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
<RelativeLayout
<android.support.constraint.ConstraintLayout
android:id="@+id/layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
android:layout_weight="1"
android:background="@drawable/list_item_thread_background">
<View
android:id="@+id/divider"
style="@style/Divider.ThreadItem"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<com.vanniktech.emoji.EmojiTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="@dimen/margin_medium"
android:textColor="?android:attr/textColorPrimary"
android:textIsSelectable="true"
android:textSize="@dimen/text_size_medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider"
tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."/>
<org.briarproject.briar.android.view.AuthorView
android:id="@+id/author"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/text"
android:layout_below="@id/text"
android:layout_marginLeft="@dimen/margin_medium"
android:layout_toLeftOf="@+id/btn_reply"
android:layout_marginBottom="@dimen/margin_medium"
android:layout_marginEnd="@dimen/margin_medium"
android:layout_marginStart="@dimen/margin_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/btn_reply"
app:layout_constraintStart_toStartOf="@id/text"
app:layout_constraintTop_toBottomOf="@id/text"
app:persona="commenter"/>
<TextView
......@@ -96,19 +108,14 @@
style="@style/BriarButtonFlat.Positive.Tiny"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/author"
android:layout_alignParentRight="true"
android:layout_below="@+id/text"
android:layout_marginRight="@dimen/margin_medium"
android:layout_marginEnd="@dimen/margin_medium"
android:layout_marginStart="@dimen/margin_medium"
android:text="@string/btn_reply"
android:textSize="@dimen/text_size_tiny"/>
<View
style="@style/Divider.ThreadItem"
android:layout_alignLeft="@id/text"
android:layout_below="@+id/author"
android:layout_marginTop="@dimen/margin_medium"/>
android:textSize="@dimen/text_size_tiny"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text"/>
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
</LinearLayout>
......@@ -52,8 +52,8 @@
<dimen name="message_bubble_margin_non_tail">30dp</dimen>
<dimen name="message_bubble_stroke">1px</dimen>
<dimen name="forum_nested_line_width">2dp</dimen>
<dimen name="forum_nested_indicator">24dp</dimen>
<dimen name="forum_nested_line_width">1dp</dimen>
<dimen name="forum_nested_indicator">25dp</dimen>
<dimen name="blogs_avatar_normal_size">30dp</dimen>
<dimen name="blogs_avatar_icon_size">15dp</dimen>
......
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<resources
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<style name="BriarToolbar" parent="Widget.AppCompat.Toolbar">
<item name="android:background">?colorPrimary</item>
......@@ -79,7 +81,7 @@
<style name="Divider.ThreadItem" parent="Divider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:layout_height">@dimen/forum_nested_line_width</item>
</style>
<style name="BriarAvatar">
......@@ -108,8 +110,12 @@
</style>
<style name="DiscussionLevelIndicator">
<item name="android:layout_marginLeft">4dp</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_width">@dimen/forum_nested_line_width</item>
<item name="android:layout_marginLeft">5dp</item>
<item name="android:layout_marginStart" tools:targetApi="jelly_bean_mr1">5dp</item>
<item name="android:background">@color/thread_indicator</item>
<item name="android:visibility">gone</item>
</style>
<style name="BriarCard" parent="CardView">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment