Compare Pastes
Differences between the pastes
#123339 (30.06.2019 02:51)
and
#176922 (27.04.2021 23:14).
1 | # -*- coding: UTF-8 -*- | |
2 | #!/usr/bin/env python3 | |
3 | ||
4 | import kivy | |
5 | from kivy.app import App | |
6 | from kivy.lang import Builder | |
7 | from kivy.utils import platform | |
8 | from kivy.uix.widget import Widget | |
9 | from kivy.clock import Clock | |
10 | from pyjnius.jnius import autoclass | |
11 | from android.runnable import run_on_ui_thread | |
12 | ||
13 | WevbApp = autoclass('android.webkit.WebView') | |
14 | WebViewClient = autoclass('android.webkit.WebViewClient') | |
15 | activity = autoclass('org.renpy.android.PythonActivity').mActivity | |
16 | ||
17 | class Wv(Widget): | |
18 | def __init__(self, **kwargs): | |
19 | super(Wv, self).__init__(**kwargs) | |
20 | Clock.schedule_once(self.create_webview, 0) | |
21 | ||
22 | @run_on_ui_thread | |
23 | def create_webview(self, *args): | |
24 | webview = WevbApp(activity) | |
25 | webview.getSettings().setJavaScriptEnabled(True) | |
26 | wvc = WebViewClient(); | |
27 | webview.setWebViewClient(wvc); | |
28 | activity.setContentView(webview) | |
29 | webview.loadUrl('https://pix.calculate.social') | |
30 | ||
31 | class ServiceApp(App): | |
32 | def build(self): | |
33 | return Wv() | |
34 | ||
35 | if __name__ == '__main__': |