kivy: share button
This commit is contained in:
parent
6ccb1dd207
commit
5120c24a0b
|
@ -16,6 +16,7 @@ from kivy.uix.label import Label
|
||||||
|
|
||||||
from kivy.lang import Builder
|
from kivy.lang import Builder
|
||||||
from kivy.factory import Factory
|
from kivy.factory import Factory
|
||||||
|
from kivy.utils import platform
|
||||||
|
|
||||||
from electrum.util import profiler, parse_URI, format_time
|
from electrum.util import profiler, parse_URI, format_time
|
||||||
from electrum import bitcoin
|
from electrum import bitcoin
|
||||||
|
@ -293,25 +294,24 @@ class ReceiveScreen(CScreen):
|
||||||
qr = self.screen.ids.qr
|
qr = self.screen.ids.qr
|
||||||
qr.set_data(uri)
|
qr.set_data(uri)
|
||||||
|
|
||||||
def do_copy(self):
|
def do_share(self):
|
||||||
from kivy.utils import platform
|
if platform != 'android':
|
||||||
|
|
||||||
uri = self.get_URI()
|
|
||||||
|
|
||||||
if platform == 'android':
|
|
||||||
from jnius import autoclass, cast
|
|
||||||
JS = autoclass('java.lang.String')
|
|
||||||
Intent = autoclass('android.content.Intent')
|
|
||||||
sendIntent = Intent()
|
|
||||||
sendIntent.setAction(Intent.ACTION_SEND)
|
|
||||||
sendIntent.setType("text/plain")
|
|
||||||
sendIntent.putExtra(Intent.EXTRA_TEXT, JS(uri))
|
|
||||||
PythonActivity = autoclass('org.renpy.android.PythonActivity')
|
|
||||||
currentActivity = cast('android.app.Activity', PythonActivity.mActivity)
|
|
||||||
it = Intent.createChooser(sendIntent, cast('java.lang.CharSequence', JS("Share Bitcoin Request")))
|
|
||||||
currentActivity.startActivity(it)
|
|
||||||
return
|
return
|
||||||
|
uri = self.get_URI()
|
||||||
|
from jnius import autoclass, cast
|
||||||
|
JS = autoclass('java.lang.String')
|
||||||
|
Intent = autoclass('android.content.Intent')
|
||||||
|
sendIntent = Intent()
|
||||||
|
sendIntent.setAction(Intent.ACTION_SEND)
|
||||||
|
sendIntent.setType("text/plain")
|
||||||
|
sendIntent.putExtra(Intent.EXTRA_TEXT, JS(uri))
|
||||||
|
PythonActivity = autoclass('org.renpy.android.PythonActivity')
|
||||||
|
currentActivity = cast('android.app.Activity', PythonActivity.mActivity)
|
||||||
|
it = Intent.createChooser(sendIntent, cast('java.lang.CharSequence', JS("Share Bitcoin Request")))
|
||||||
|
currentActivity.startActivity(it)
|
||||||
|
|
||||||
|
def do_copy(self):
|
||||||
|
uri = self.get_URI()
|
||||||
self.app._clipboard.copy(uri)
|
self.app._clipboard.copy(uri)
|
||||||
self.app.show_info(_('Request copied to clipboard'))
|
self.app.show_info(_('Request copied to clipboard'))
|
||||||
|
|
||||||
|
|
|
@ -89,15 +89,23 @@ ReceiveScreen:
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
on_release: s.parent.do_copy()
|
on_release: s.parent.do_copy()
|
||||||
|
Button:
|
||||||
|
text: _('Share')
|
||||||
|
size_hint: 1, None
|
||||||
|
height: '48dp'
|
||||||
|
on_release: s.parent.do_share()
|
||||||
Button:
|
Button:
|
||||||
text: _('Save')
|
text: _('Save')
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
on_release: s.parent.do_save()
|
on_release: s.parent.do_save()
|
||||||
|
BoxLayout:
|
||||||
|
size_hint: 1, None
|
||||||
|
height: '48dp'
|
||||||
|
Widget:
|
||||||
|
size_hint: 1, 1
|
||||||
Button:
|
Button:
|
||||||
text: _('New')
|
text: _('New')
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
on_release: s.parent.do_new()
|
on_release: s.parent.do_new()
|
||||||
#Widget:
|
|
||||||
# size_hint: 1, 0.3
|
|
||||||
|
|
Loading…
Reference in New Issue