Mercurial > libervia-desktop-kivy
diff cagou/core/platform_/android.py @ 403:b0af45a92055
android: do not restore previously selected widget if an intent contains a widget to create.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 12 Feb 2020 20:02:58 +0100 |
parents | 788e05d1e2bf |
children | c466678c57b2 |
line wrap: on
line diff
--- a/cagou/core/platform_/android.py Wed Feb 12 20:02:58 2020 +0100 +++ b/cagou/core/platform_/android.py Wed Feb 12 20:02:58 2020 +0100 @@ -90,6 +90,7 @@ activity.bind(on_new_intent=self.on_new_intent) self.cache.append((self.on_new_intent, mActivity.getIntent())) self.last_selected_wid = None + self.restore_selected_wid = True host.addListener('profilePlugged', self.onProfilePlugged) host.addListener('selected', self.onSelectedWidget) local_dir = Path(host.getConfig('', 'local_dir')).resolve() @@ -174,7 +175,7 @@ def privateDataGetCb(self, data_s, profile): data = data_format.deserialise(data_s, type_check=None) - if data is not None: + if data is not None and self.restore_selected_wid: log.debug(f"restoring previous widget {data}") try: name = data['name'] @@ -368,6 +369,11 @@ except KeyError as e: log.warning(f"incomplete action {action}: {e}") else: + # we don't want stored selected widget to be displayed after this + # one + log.debug("cancelling restoration of previous widget") + self.restore_selected_wid = False + # and now we open the widget linked to the intent current_profile = next(iter(G.host.profiles)) Clock.schedule_once( lambda *args: G.host.doAction(