commit d49fcf19d87b3c082fe081eb00d822a0cc179595
parent 8d7370d897314d8542906aecc6a45cc949651f77
Author: ThomasV <thomasv@electrum.org>
Date: Fri, 3 Jul 2020 16:56:31 +0200
Merge pull request #6316 from SomberNight/202007_fix_android_back_button
android: fix back button not working (main surface loses focus)
Diffstat:
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/contrib/android/Dockerfile b/contrib/android/Dockerfile
@@ -151,6 +151,7 @@ RUN cd /opt \
&& cd buildozer \
&& git remote add sombernight https://github.com/SomberNight/buildozer \
&& git fetch --all \
+ # commit: kivy/buildozer "1.2.0" tag
&& git checkout "94cfcb8d591c11d6ad0e11f129b08c1e27a161c5^{commit}" \
&& python3 -m pip install --user -e .
@@ -160,7 +161,8 @@ RUN cd /opt \
&& cd python-for-android \
&& git remote add sombernight https://github.com/SomberNight/python-for-android \
&& git fetch --all \
- && git checkout "257cfacbdd523af0b5b6bb5b2ba64ab7a5c82d58^{commit}" \
+ # commit: from branch sombernight/electrum_20200703
+ && git checkout "0dd2ce87a8f380d20505ca5dc1e2d2357b4a08fc^{commit}" \
&& python3 -m pip install --user -e .
# build env vars
diff --git a/electrum/gui/kivy/main_window.py b/electrum/gui/kivy/main_window.py
@@ -849,6 +849,17 @@ class ElectrumWindow(App):
return
self.use_change = self.wallet.use_change
self.electrum_config.save_last_wallet(wallet)
+ self.request_focus_for_main_view()
+
+ def request_focus_for_main_view(self):
+ if platform != 'android':
+ return
+ # The main view of the activity might be not have focus
+ # in which case e.g. the OS "back" button would not work.
+ # see #6276 (specifically "method 2" and "method 3")
+ from jnius import autoclass
+ PythonActivity = autoclass('org.kivy.android.PythonActivity')
+ PythonActivity.requestFocusForMainView()
def update_status(self, *dt):
if not self.wallet: