File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 66from kivy .properties import StringProperty
77from kivy .properties import ObjectProperty
88from functools import partial
9+ from utils import do_share
910
1011app = App .get_running_app ()
1112
@@ -80,8 +81,10 @@ class ScreenTalks(Screen):
8081 height: dp(54)
8182 padding: dp(9)
8283 ImBut
84+ id: but_share
8385 source: 'atlas://data/default/share'
8486 color: app.base_active_bright[:3] + [.9]
87+ on_release: do_share(self.data, "PyCon India 2018")
8588 ImBut
8689 source: 'atlas://data/default/reminder'
8790 color: app.base_active_bright[:3] + [.9]
@@ -122,6 +125,8 @@ def on_enter(self, onsuccess=False):
122125 gl = GridLayout (cols = social_len , size_hint_y = None ,
123126 padding = '2dp' , spacing = '2dp' )
124127 import webbrowser
128+ self .ids .but_share .data = "Checkout this talk " \
129+ + speaker_social ['cfp' ] + " by " + speaker ['name' ]
125130 for social_acc , social_link in items :
126131 imbt = Factory .ImBut ()
127132 imbt .source = 'atlas://data/default/' + \
Original file line number Diff line number Diff line change @@ -19,6 +19,22 @@ def pause_app():
1919 app .stop ()
2020
2121
22+ def do_share (data , title ):
23+ if platform != 'android' :
24+ return
25+ from jnius import autoclass , cast
26+ JS = autoclass ('java.lang.String' )
27+ Intent = autoclass ('android.content.Intent' )
28+ sendIntent = Intent ()
29+ sendIntent .setAction (Intent .ACTION_SEND )
30+ sendIntent .setType ("text/plain" )
31+ sendIntent .putExtra (Intent .EXTRA_TEXT , JS (data ))
32+ PythonActivity = autoclass ('org.kivy.android.PythonActivity' )
33+ currentActivity = cast ('android.app.Activity' , PythonActivity .mActivity )
34+ it = Intent .createChooser (sendIntent , cast ('java.lang.CharSequence' , JS (title )))
35+ currentActivity .startActivity (it )
36+
37+
2238def scan_qr (on_complete ):
2339 if platform != 'android' :
2440 return
You can’t perform that action at this time.
0 commit comments