comparison cagou/kv/share_widget.kv @ 322:e2b51663d8b8

core, android: new share widget + added Cagou to "share" menu: - new intent filter to add Cagou to share menu for all media types - minimum Kivy version is now 1.11.0 - new "Share" widget to display data to share via SàT and select the target - new core.platform_ module (the suffix "_" avoid trouble with standard "platform" module), for platform specific code. - Android intent are now checked on startup and "on_new_intent" events - if a android.intent.action.SEND action is received (i.e. some data is shared), the "Share" widget is shown - new Cagou.share method to share data using "Share" widget - new Cagou.getAncestorWidget method to easily retrieve an instance of a specific class in a widget's ancestors - ContactList's Avatar and ContactItem widgets have been moved to core.common
author Goffi <goffi@goffi.org>
date Fri, 06 Dec 2019 13:23:03 +0100
parents
children 38fd457b2158
comparison
equal deleted inserted replaced
321:a6eb154ba266 322:e2b51663d8b8
1 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client
2 # Copyright (C) 2016-2019 Jérôme Poisson (goffi@goffi.org)
3
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU Affero General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU Affero General Public License for more details.
13
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 #:import _ sat.core.i18n._
18 #:import C cagou.core.constants.Const
19
20
21 <ShareWidget>:
22 preview_box: preview_box
23 layout: layout
24 orientation: 'vertical'
25 Label:
26 size_hint: 1, None
27 text_size: self.size
28 halign: 'center'
29 text: _("share")
30 height: self.font_size + dp(5)
31 bold: True
32 font_size: '35sp'
33 BoxLayout:
34 id: preview_box
35 size_hint: 1, None
36 height: self.minimum_height
37 orientation: 'vertical'
38 text: str(root.data)
39 Label:
40 size_hint: 1, None
41 text_size: self.size
42 halign: 'center'
43 text: _("with")
44 height: self.font_size + dp(5)
45 bold: True
46 font_size: '25sp'
47 ScrollView:
48 StackLayout:
49 id: layout
50 size_hint: 1, None
51 height: self.minimum_height
52 spacing: 0
53 Button:
54 size_hint: 1, None
55 height: C.BTN_HEIGHT
56 text: _("cancel")
57 on_press: app.host.closeUI()
58
59
60 <TextPreview>:
61 size_hint: 1, None
62 height: min(data.height, dp(100))
63 ScrollView
64 Label:
65 id: data
66 size_hint: 1, None
67 text: root.text
68 text_size: self.width, None
69 size: self.texture_size
70 font_size: sp(20)
71 padding_x: dp(10)
72 padding_y: dp(5)
73 halign: 'center'
74 canvas.before:
75 Color:
76 rgba: 0.95, 0.95, 0.95, 1
77 Rectangle:
78 pos: self.pos
79 size: self.size
80
81 <ImagePreview>:
82 reduce_layout: reduce_layout
83 reduce_checkbox: reduce_checkbox
84 size_hint: 1, None
85 height: dp(120)
86 orientation: "vertical"
87 Image:
88 source: root.path
89 BoxLayout
90 id: reduce_layout
91 size_hint: 1, None
92 padding_y: None
93 opacity: 0
94 height: 0
95 Widget:
96 CheckBox:
97 id: reduce_checkbox
98 size_hint: None, 1
99 width: dp(20)
100 active: True
101 Label:
102 size_hint: None, None
103 text: _("reduce image size")
104 text_size: None, None
105 size: self.texture_size
106 padding_x: dp(10)
107 font_size: sp(15)
108 Widget:
109
110 <GenericPreview>:
111 size_hint: 1, None
112 height: dp(100)
113 Widget:
114 SymbolLabel:
115 symbol: "doc"
116 text: root.path
117 Widget:
118