-
Notifications
You must be signed in to change notification settings - Fork 28
/
item_post.xml
115 lines (97 loc) · 4.89 KB
/
item_post.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context="cl.monsoon.s1next.view.adapter.delegate.PostAdapterDelegate">
<data>
<import type="cl.monsoon.s1next.widget.CustomMovementMethod" />
<import type="android.text.method.LinkMovementMethod" />
<variable
name="postViewModel"
type="cl.monsoon.s1next.viewmodel.PostViewModel" />
<variable
name="eventBus"
type="cl.monsoon.s1next.widget.EventBus" />
<variable
name="downloadPreferencesManager"
type="cl.monsoon.s1next.data.pref.DownloadPreferencesManager" />
<variable
name="drawableRequestBuilder"
type="com.bumptech.glide.DrawableRequestBuilder<String>" />
</data>
<android.support.v7.widget.CardView
style="?attr/cardViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/card_view_vertical_margin"
android:layout_marginEnd="@dimen/card_view_horizontal_margin"
android:layout_marginLeft="@dimen/card_view_horizontal_margin"
android:layout_marginRight="@dimen/card_view_horizontal_margin"
android:layout_marginStart="@dimen/card_view_horizontal_margin"
android:layout_marginTop="@dimen/card_view_vertical_margin">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/item_padding">
<cl.monsoon.s1next.widget.BezelImageView
android:id="@+id/avatar"
android:layout_width="@dimen/avatar_size"
android:layout_height="@dimen/avatar_size"
android:layout_marginEnd="@dimen/item_padding"
android:layout_marginRight="@dimen/item_padding"
android:contentDescription="@string/avatar_content_desc"
app:avatarDrawableRequestBuilder="@{drawableRequestBuilder}"
app:downloadPreferencesManager="@{downloadPreferencesManager}"
app:maskDrawable="@drawable/rounded_mask"
app:authorId="@{postViewModel.post.authorId}" />
<TextView
android:id="@+id/author_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/avatar"
android:layout_toRightOf="@id/avatar"
android:includeFontPadding="false"
android:singleLine="true"
android:text="@{postViewModel.post.authorName}"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textIsSelectable="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/author_name"
android:layout_alignStart="@id/author_name"
android:layout_below="@id/author_name"
android:layout_marginTop="@dimen/subtitle_margin_top"
android:includeFontPadding="false"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:relativeDateTime="@{postViewModel.post.datetime}" />
<!-- enable `textIsSelectable` in order to add click effect -->
<!-- see https://code.google.com/p/android/issues/detail?id=13895 -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:includeFontPadding="false"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:eventBus="@{eventBus}"
app:increaseClickingArea="@{@dimen/minimum_touch_target_size}"
app:movementMethod="@{LinkMovementMethod.instance}"
app:post="@{postViewModel.post}" />
<!-- layout_marginTop = 72dp (two line height with avatar) - 16dp (RelativeLayout's top padding) -->
<!-- use custom movement method to provides selection and click -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/single_line_height_with_avatar"
android:lineSpacingMultiplier="@dimen/line_spacing_multiplier"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textIsSelectable="true"
app:movementMethod="@{CustomMovementMethod.instance}"
app:reply="@{postViewModel.post.reply}" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</layout>