mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 05:09:53 +01:00
This commit adds badges to the forum list that indicate unread posts.
It does so by extending the compound view `TextAvatarView` and provides convienient setters that take care of the required UI changes. The new badge can also be used to indicate a problem with the forum. Closes #408
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
|
||||
<padding
|
||||
android:left="@dimen/unread_bubble_padding_horizontal"
|
||||
android:right="@dimen/unread_bubble_padding_horizontal"/>
|
||||
android:right="@dimen/unread_bubble_padding_horizontal"
|
||||
android:bottom="1px"/>
|
||||
|
||||
<solid
|
||||
android:color="@color/briar_primary"/>
|
||||
|
||||
21
briar-android/res/drawable/bubble_problem.xml
Normal file
21
briar-android/res/drawable/bubble_problem.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners
|
||||
android:radius="@dimen/unread_bubble_size"/>
|
||||
|
||||
<padding
|
||||
android:left="@dimen/unread_bubble_padding_horizontal"
|
||||
android:right="@dimen/unread_bubble_padding_horizontal"/>
|
||||
|
||||
<solid
|
||||
android:color="@color/briar_gold"/>
|
||||
|
||||
<stroke
|
||||
android:color="@color/briar_primary"
|
||||
android:width="@dimen/avatar_border_width"/>
|
||||
|
||||
</shape>
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
<org.briarproject.android.util.TextAvatarView
|
||||
android:id="@+id/avatarView"
|
||||
android:layout_width="@dimen/avatar_forum_size"
|
||||
android:layout_height="@dimen/avatar_forum_size"
|
||||
android:layout_width="@dimen/listitem_picture_frame_size"
|
||||
android:layout_height="@dimen/listitem_picture_frame_size"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
||||
|
||||
@@ -1,68 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
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:layout_marginLeft="@dimen/listitem_horizontal_margin"
|
||||
android:layout_marginStart="@dimen/listitem_horizontal_margin"
|
||||
android:paddingTop="@dimen/listitem_horizontal_margin"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
|
||||
<org.briarproject.android.util.TextAvatarView
|
||||
android:id="@+id/avatarView"
|
||||
android:layout_height="@dimen/avatar_forum_size"
|
||||
android:layout_width="@dimen/avatar_forum_size"
|
||||
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
||||
android:layout_width="@dimen/listitem_picture_frame_size"
|
||||
android:layout_height="@dimen/listitem_picture_frame_size"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
/>
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="@dimen/listitem_horizontal_margin"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/forumNameView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="@dimen/listitem_horizontal_margin"
|
||||
android:layout_toEndOf="@+id/avatarView"
|
||||
android:layout_toRightOf="@+id/avatarView"
|
||||
android:maxLines="2"
|
||||
android:textColor="@color/briar_text_primary"
|
||||
android:textSize="@dimen/text_size_medium"
|
||||
tools:text="This is a name of a forum"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toRightOf="@+id/avatarView"
|
||||
android:layout_toEndOf="@+id/avatarView"/>
|
||||
tools:text="This is a name of a forum"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/unreadView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/margin_medium"
|
||||
android:layout_below="@+id/forumNameView"
|
||||
android:layout_toEndOf="@+id/avatarView"
|
||||
android:layout_toRightOf="@+id/avatarView"
|
||||
android:paddingBottom="@dimen/listitem_horizontal_margin"
|
||||
android:paddingTop="@dimen/margin_medium"
|
||||
android:textColor="@color/briar_text_secondary"
|
||||
android:textSize="@dimen/text_size_small"
|
||||
android:text="@string/no_unread_posts"
|
||||
android:layout_below="@+id/forumNameView"
|
||||
android:layout_toRightOf="@+id/avatarView"
|
||||
android:layout_toEndOf="@+id/avatarView"/>
|
||||
tools:text="1337 posts"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dateView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@+id/forumNameView"
|
||||
android:paddingTop="@dimen/margin_medium"
|
||||
android:paddingBottom="@dimen/listitem_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
||||
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
||||
android:paddingBottom="@dimen/listitem_horizontal_margin"
|
||||
android:paddingTop="@dimen/margin_medium"
|
||||
android:textColor="@color/briar_text_secondary"
|
||||
android:textSize="@dimen/text_size_small"
|
||||
tools:text="Dec 24"/>
|
||||
|
||||
<View style="@style/Divider.ForumList"
|
||||
android:layout_below="@+id/unreadView"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"/>
|
||||
<View
|
||||
style="@style/Divider.ForumList"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/unreadView"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
<merge
|
||||
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">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:showIn="@layout/list_item_forum">
|
||||
|
||||
<de.hdodenhof.circleimageview.CircleImageView
|
||||
android:id="@+id/avatarBackground"
|
||||
style="@style/BriarAvatar"
|
||||
android:layout_width="@dimen/avatar_forum_size"
|
||||
android:layout_height="@dimen/avatar_forum_size"
|
||||
android:layout_gravity="center"
|
||||
android:layout_gravity="bottom|left"
|
||||
android:src="@android:color/transparent"
|
||||
app:civ_fill_color="@color/briar_button_positive"/>
|
||||
|
||||
@@ -18,13 +19,28 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginRight="@dimen/listitem_picture_frame_offset"
|
||||
android:layout_marginTop="@dimen/listitem_picture_frame_offset"
|
||||
android:maxLength="1"
|
||||
android:shadowColor="@color/forum_avatar_shadow"
|
||||
android:shadowDx="0"
|
||||
android:shadowDy="1.5"
|
||||
android:shadowRadius="1.5"
|
||||
android:textColor="@color/briar_text_primary_inverse"
|
||||
android:textSize="30sp"
|
||||
android:textSize="@dimen/avatar_text_size"
|
||||
tools:text="T"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/unreadCountView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/unread_bubble_size"
|
||||
android:layout_gravity="right|top"
|
||||
android:background="@drawable/bubble"
|
||||
android:gravity="center"
|
||||
android:minWidth="@dimen/unread_bubble_size"
|
||||
android:textColor="@color/briar_text_primary_inverse"
|
||||
android:textSize="@dimen/unread_bubble_text_size"
|
||||
android:textStyle="bold"
|
||||
tools:text="12"/>
|
||||
|
||||
</merge>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<color name="briar_text_primary">@color/briar_primary</color>
|
||||
<color name="briar_text_primary_inverse">#ffffff</color>
|
||||
<color name="briar_text_secondary">#333333</color>
|
||||
<color name="briar_text_tertiary">#333333</color>
|
||||
<color name="briar_text_tertiary">#FF78909C</color>
|
||||
<color name="briar_button_positive">#06b9ff</color>
|
||||
<color name="briar_button_negative">#ff0000</color>
|
||||
|
||||
|
||||
@@ -27,11 +27,13 @@
|
||||
<dimen name="listitem_height_contact_selector">68dp</dimen>
|
||||
<dimen name="listitem_picture_size">48dp</dimen>
|
||||
<dimen name="listitem_picture_size_small">23dp</dimen>
|
||||
<dimen name="listitem_picture_frame_size">50dp</dimen>
|
||||
<dimen name="listitem_picture_frame_size">53dp</dimen>
|
||||
<dimen name="listitem_picture_frame_offset">2dp</dimen>
|
||||
<dimen name="listitem_selectable_picture_size">40dp</dimen>
|
||||
<dimen name="dropdown_picture_size">32dp</dimen>
|
||||
<dimen name="avatar_forum_size">48dp</dimen>
|
||||
<dimen name="avatar_border_width">2dp</dimen>
|
||||
<dimen name="avatar_text_size">30sp</dimen>
|
||||
|
||||
<dimen name="unread_bubble_text_size">12sp</dimen>
|
||||
<dimen name="unread_bubble_border_width">2dp</dimen>
|
||||
|
||||
@@ -81,12 +81,15 @@
|
||||
<string name="forum_leave">Leave Forum</string>
|
||||
<string name="forum_left_toast">Left Forum</string>
|
||||
<string name="forum_sharing_status">Sharing Status</string>
|
||||
<string name="no_forum_posts">No posts</string>
|
||||
<string name="no_unread_posts">no unread posts</string>
|
||||
<string name="forum_no_posts">No posts</string>
|
||||
<plurals name="unread_posts">
|
||||
<item quantity="one">%d unread post</item>
|
||||
<item quantity="other">%d unread posts</item>
|
||||
</plurals>
|
||||
<plurals name="forum_posts">
|
||||
<item quantity="one">%d post</item>
|
||||
<item quantity="other">%d posts</item>
|
||||
</plurals>
|
||||
<string name="create_forum_title">New Forum</string>
|
||||
<string name="choose_forum_name">Choose a name for your forum:</string>
|
||||
<string name="create_forum_button">Create Forum</string>
|
||||
|
||||
Reference in New Issue
Block a user