aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/res
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-02-09 14:34:49 +0100
committerChristian Schneppe <christian@pix-art.de>2019-02-09 14:34:49 +0100
commit7aa49998425b768244715b19c9779202c0145230 (patch)
tree9c26023bfe027ac232df19a8e041fdd15265e5b1 /src/main/res
parent42c3129b66fe555c37fa67b6421230199cc64968 (diff)
show web link previews in chat
fixes #113
Diffstat (limited to '')
-rw-r--r--src/main/res/layout/link_layout.xml55
-rw-r--r--src/main/res/layout/message_content.xml5
-rw-r--r--src/main/res/values/bools.xml1
-rw-r--r--src/main/res/values/strings.xml4
-rw-r--r--src/main/res/xml/preferences.xml5
5 files changed, 69 insertions, 1 deletions
diff --git a/src/main/res/layout/link_layout.xml b/src/main/res/layout/link_layout.xml
new file mode 100644
index 000000000..68e7a6cc7
--- /dev/null
+++ b/src/main/res/layout/link_layout.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/rich_link_card"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="5dp"
+ android:gravity="center"
+ android:orientation="horizontal">
+
+ <ImageView
+ android:id="@+id/rich_link_image"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
+ android:scaleType="centerCrop" />
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="2dp">
+
+ <TextView
+ android:id="@+id/rich_link_title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:padding="2dp"
+ android:textAppearance="@style/TextAppearance.Conversations.Body2"
+ tools:text="Data" />
+
+ <TextView
+ android:id="@+id/rich_link_desp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="4"
+ android:padding="2dp"
+ android:textAppearance="@style/TextAppearance.Conversations.Status"
+ tools:text="Data" />
+
+ <TextView
+ android:id="@+id/rich_link_url"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:padding="2dp"
+ android:textAppearance="@style/TextAppearance.Conversations.Body1.Secondary"
+ android:visibility="gone"
+ tools:text="Data" />
+
+ </LinearLayout>
+</LinearLayout> \ No newline at end of file
diff --git a/src/main/res/layout/message_content.xml b/src/main/res/layout/message_content.xml
index f14f310c3..be2bbf3db 100644
--- a/src/main/res/layout/message_content.xml
+++ b/src/main/res/layout/message_content.xml
@@ -28,6 +28,11 @@
android:scaleType="centerCrop"
app:riv_corner_radius="@dimen/rounded_image_border" />
+ <de.pixart.messenger.ui.widget.RichLinkView
+ android:id="@+id/richLinkView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
<de.pixart.messenger.ui.widget.CopyTextView
android:id="@+id/message_body"
android:layout_width="wrap_content"
diff --git a/src/main/res/values/bools.xml b/src/main/res/values/bools.xml
index 4807728ca..f5d0a43b6 100644
--- a/src/main/res/values/bools.xml
+++ b/src/main/res/values/bools.xml
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="prefer_xmpp_avatar">true</bool>
+ <bool name="show_links_inside">true</bool>
</resources> \ No newline at end of file
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 5742775e0..3a2eb4ea7 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -823,8 +823,10 @@
<string name="enter_your_name_instructions">Please enter your nickname which will be visible to your contacts.</string>
<string name="no_name_set_instructions">No nickname set.</string>
<string name="autojoin_groupchat">Automatically join this group chat</string>
+ <string name="pref_show_links_inside">Show previews of web links in chat</string>
+ <string name="pref_show_links_inside_summary">Show previews of web links directly inside the chat view.</string>
<string name="pref_play_gif_inside">Play GIF files in chat</string>
- <string name="pref_play_gif_inside_summary">Setting this to true plays GIF files directly inside the chat view.</string>
+ <string name="pref_play_gif_inside_summary">Play GIF files directly inside the chat view.</string>
<string name="open_with">Open with…</string>
<string name="server_info_adhoc_invite">XEP-0050: Ad-Hoc Commands: user invite</string>
<string name="choose_account">Choose account</string>
diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml
index 52a957f98..15fe0fc34 100644
--- a/src/main/res/xml/preferences.xml
+++ b/src/main/res/xml/preferences.xml
@@ -77,6 +77,11 @@
android:summary="@string/pref_play_gif_inside_summary"
android:title="@string/pref_play_gif_inside" />
<CheckBoxPreference
+ android:defaultValue="@bool/show_links_inside"
+ android:key="show_links_inside"
+ android:summary="@string/pref_show_links_inside_summary"
+ android:title="@string/pref_show_links_inside" />
+ <CheckBoxPreference
android:defaultValue="@bool/prefer_xmpp_avatar"
android:key="prefer_xmpp_avatar"
android:summary="@string/pref_prefer_xmpp_avatar_summary"