diff cagou/plugins/plugin_wid_chat.kv @ 425:13884aac1220

chat: show images in attachments: - if an image is received from somebody in roster, it is automatically displayed (we display only for people in roster to avoid IP address leak) - encrypted files are decrypted and stored in cache before being displayed - GIFs image are shown as attachment because they are badly handle in Kivy (images frequencies is not handled correctly, and memory consumption explode). Instead, a click on it will open the GIF in the appropriate software of the platform. - a click on an attachment image will open it in the gallery
author Goffi <goffi@goffi.org>
date Wed, 26 Feb 2020 16:47:39 +0100
parents 3e2333a11f61
children d3a6ae859556
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_chat.kv	Wed Feb 26 16:43:48 2020 +0100
+++ b/cagou/plugins/plugin_wid_chat.kv	Wed Feb 26 16:47:39 2020 +0100
@@ -27,9 +27,12 @@
 # Chat
 
 
-<AttachmentItem>:
+<BaseAttachmentItem>:
     size_hint: None, None
     size: self.minimum_width, dp(50)
+
+
+<AttachmentItem>:
     canvas.before:
         Color:
             rgb: app.c_prim_dark
@@ -54,6 +57,16 @@
         on_press: root.on_press()
 
 
+<AttachmentImageItem>:
+    size: self.minimum_width, self.minimum_height
+    image: image
+    orientation: "vertical"
+    SizedImage:
+        id: image
+        source: root.data.get('url', root.data.get('path'))
+        anim_delay: -1
+
+
 <AttachmentsLayout>:
     attachments: self
     size_hint: 1, None