diff cagou/plugins/plugin_wid_chat.kv @ 276:a0835f0212d8

chat: multi-lines input: - text input is now multi-lines and grows with the text (up to a max) - on touch devices (i.e. on Android), an icon is added to the right to send the message, allowing to use virtual enter key for multi-lines messages
author Goffi <goffi@goffi.org>
date Wed, 20 Mar 2019 09:29:44 +0100
parents 7d5297984191
children 444ba439530f
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_chat.kv	Wed Mar 20 09:29:44 2019 +0100
+++ b/cagou/plugins/plugin_wid_chat.kv	Wed Mar 20 09:29:44 2019 +0100
@@ -113,13 +113,15 @@
             id: messages_widget
     MessageInputBox:
         size_hint: 1, None
-        height: dp(40)
+        height: self.minimum_height
         spacing: dp(10)
         padding: [app.MARGIN_LEFT, 0, app.MARGIN_RIGHT, dp(10)]
         message_input: message_input
         MessageInputWidget:
             id: message_input
-            size_hint: 1, 1
+            size_hint: 1, None
+            height: min(self.minimum_height, dp(250))
+            multiline: True
             hint_text: _(u"Enter your message here")
             on_text_validate: root.onSend(args[0])
         SymbolButton
@@ -131,6 +133,16 @@
             font_size: dp(25)
             on_release: TransferMenu(callback=root.onTransferOK).show(self)
 
+
+<SendButton>:
+    # SendButton is only shown on touch devices
+    symbol: "forward"
+    size_hint: None, 1
+    width: dp(30)
+    font_size: dp(25)
+    on_release: self.message_input_box.send_text()
+
+
 <EncryptionMainButton>:
     size_hint: None, 1
     width: dp(30)