mirror of
https://github.com/markqvist/Sideband.git
synced 2025-05-07 17:04:58 -04:00
Mitigated performance issues related to SQLite3 randomly hanging for a second on Android
This commit is contained in:
parent
4982e37231
commit
75edbf94b9
4 changed files with 322 additions and 197 deletions
|
@ -143,7 +143,7 @@ class SidebandApp(MDApp):
|
|||
self.check_bluetooth_permissions()
|
||||
self.start_service()
|
||||
|
||||
Clock.schedule_interval(self.jobs, 1)
|
||||
Clock.schedule_interval(self.jobs, 1.5)
|
||||
|
||||
def dismiss_splash(dt):
|
||||
from android import loadingscreen
|
||||
|
@ -521,18 +521,40 @@ class SidebandApp(MDApp):
|
|||
return screen
|
||||
|
||||
def jobs(self, delta_time):
|
||||
# TODO: Remove
|
||||
js = time.time()
|
||||
actions = []
|
||||
|
||||
if self.root.ids.screen_manager.current == "messages_screen":
|
||||
# TODO: Remove
|
||||
actions.append("messages_screen")
|
||||
|
||||
self.messages_view.update()
|
||||
|
||||
if not self.root.ids.messages_scrollview.dest_known:
|
||||
# TODO: Remove
|
||||
actions.append("messages_area_detect")
|
||||
|
||||
self.message_area_detect()
|
||||
|
||||
elif self.root.ids.screen_manager.current == "conversations_screen":
|
||||
if self.sideband.getstate("app.flags.unread_conversations"):
|
||||
# TODO: Remove
|
||||
actions.append("conversations_screen")
|
||||
|
||||
if self.sideband.getstate("app.flags.unread_conversations", allow_cache=True):
|
||||
# TODO: Remove
|
||||
actions.append("unread_conversations")
|
||||
|
||||
if self.conversations_view != None:
|
||||
# TODO: Remove
|
||||
actions.append("conversations_view.update")
|
||||
|
||||
self.conversations_view.update()
|
||||
|
||||
if self.sideband.getstate("app.flags.lxmf_sync_dialog_open") and self.sync_dialog != None:
|
||||
if self.sideband.getstate("app.flags.lxmf_sync_dialog_open", allow_cache=True) and self.sync_dialog != None:
|
||||
# TODO: Remove
|
||||
actions.append("lxmf_sync_dialog_open")
|
||||
|
||||
self.sync_dialog.ids.sync_progress.value = self.sideband.get_sync_progress()*100
|
||||
self.sync_dialog.ids.sync_status.text = self.sideband.get_sync_status()
|
||||
|
||||
|
@ -543,20 +565,39 @@ class SidebandApp(MDApp):
|
|||
self.widget_hide(self.sync_dialog.stop_button, True)
|
||||
|
||||
elif self.root.ids.screen_manager.current == "announces_screen":
|
||||
if self.sideband.getstate("app.flags.new_announces"):
|
||||
# TODO: Remove
|
||||
actions.append("announces_screen")
|
||||
|
||||
if self.sideband.getstate("app.flags.new_announces", allow_cache=True):
|
||||
# TODO: Remove
|
||||
actions.append("new_announces")
|
||||
|
||||
if self.announces_view != None:
|
||||
actions.append("announces_view.update")
|
||||
self.announces_view.update()
|
||||
|
||||
if self.sideband.getstate("app.flags.new_conversations"):
|
||||
if self.sideband.getstate("app.flags.new_conversations", allow_cache=True):
|
||||
# TODO: Remove
|
||||
actions.append("new_conversations")
|
||||
|
||||
if self.conversations_view != None:
|
||||
# TODO: Remove
|
||||
actions.append("conversations_view.update")
|
||||
|
||||
self.conversations_view.update()
|
||||
|
||||
if self.sideband.getstate("wants.viewupdate.conversations", allow_cache=True):
|
||||
# TODO: Remove
|
||||
actions.append("wants.viewupdate.conversations")
|
||||
|
||||
if self.conversations_view != None:
|
||||
self.conversations_view.update()
|
||||
|
||||
if self.sideband.getstate("wants.viewupdate.conversations"):
|
||||
if self.conversations_view != None:
|
||||
self.conversations_view.update()
|
||||
|
||||
if self.sideband.getstate("lxm_uri_ingest.result"):
|
||||
info_text = self.sideband.getstate("lxm_uri_ingest.result")
|
||||
if self.sideband.getstate("lxm_uri_ingest.result", allow_cache=True):
|
||||
# TODO: Remove
|
||||
actions.append("lxm_uri_ingest.result")
|
||||
|
||||
info_text = self.sideband.getstate("lxm_uri_ingest.result", allow_cache=True)
|
||||
self.sideband.setstate("lxm_uri_ingest.result", False)
|
||||
ok_button = MDRectangleFlatButton(text="OK",font_size=dp(18))
|
||||
dialog = MDDialog(
|
||||
|
@ -571,6 +612,12 @@ class SidebandApp(MDApp):
|
|||
ok_button.bind(on_release=dl_ok)
|
||||
dialog.open()
|
||||
|
||||
# TODO: Remove Timing and Profiling
|
||||
jd = time.time()-js
|
||||
if jd > 0.25:
|
||||
RNS.log("Jobs completed in "+RNS.prettytime(jd), RNS.LOG_DEBUG)
|
||||
RNS.log(str(actions))
|
||||
|
||||
def on_start(self):
|
||||
self.last_exit_event = time.time()
|
||||
self.root.ids.screen_manager.transition.duration = 0.25
|
||||
|
@ -691,7 +738,7 @@ class SidebandApp(MDApp):
|
|||
MDApp.get_running_app().stop()
|
||||
Window.close()
|
||||
|
||||
Clock.schedule_once(final_exit, 0.65)
|
||||
Clock.schedule_once(final_exit, 0.85)
|
||||
|
||||
def announce_now_action(self, sender=None):
|
||||
self.sideband.lxmf_announce()
|
||||
|
@ -927,7 +974,6 @@ class SidebandApp(MDApp):
|
|||
def connectivity_status(self, sender):
|
||||
hs = dp(22)
|
||||
|
||||
|
||||
yes_button = MDRectangleFlatButton(text="OK",font_size=dp(18))
|
||||
dialog = MDDialog(
|
||||
title="Connectivity Status",
|
||||
|
@ -940,12 +986,16 @@ class SidebandApp(MDApp):
|
|||
def dl_yes(s):
|
||||
self.connectivity_updater.cancel()
|
||||
dialog.dismiss()
|
||||
if self.connectivity_updater != None:
|
||||
self.connectivity_updater.cancel()
|
||||
|
||||
yes_button.bind(on_release=dl_yes)
|
||||
dialog.open()
|
||||
|
||||
if self.connectivity_updater != None:
|
||||
self.connectivity_updater.cancel()
|
||||
self.connectivity_updater = Clock.schedule_interval(cs_updater, 1.0)
|
||||
|
||||
self.connectivity_updater = Clock.schedule_interval(cs_updater, 2.0)
|
||||
|
||||
def ingest_lxm_action(self, sender):
|
||||
def cb(dt):
|
||||
|
@ -1136,13 +1186,11 @@ class SidebandApp(MDApp):
|
|||
### Settings screen
|
||||
######################################
|
||||
def settings_action(self, sender=None):
|
||||
self.settings_init()
|
||||
self.root.ids.screen_manager.transition.direction = "left"
|
||||
self.root.ids.nav_drawer.set_state("closed")
|
||||
def cb(dt):
|
||||
self.root.ids.screen_manager.transition.direction = "left"
|
||||
self.settings_init()
|
||||
self.root.ids.screen_manager.current = "settings_screen"
|
||||
self.sideband.setstate("app.displaying", self.root.ids.screen_manager.current)
|
||||
Clock.schedule_once(cb, 0.2)
|
||||
self.root.ids.screen_manager.current = "settings_screen"
|
||||
self.sideband.setstate("app.displaying", self.root.ids.screen_manager.current)
|
||||
|
||||
def settings_init(self, sender=None):
|
||||
if not self.settings_ready:
|
||||
|
@ -1301,10 +1349,10 @@ class SidebandApp(MDApp):
|
|||
### Connectivity screen
|
||||
######################################
|
||||
def connectivity_action(self, sender=None):
|
||||
self.connectivity_init()
|
||||
self.root.ids.screen_manager.transition.direction = "left"
|
||||
self.root.ids.screen_manager.current = "connectivity_screen"
|
||||
self.root.ids.nav_drawer.set_state("closed")
|
||||
self.connectivity_init()
|
||||
self.root.ids.screen_manager.current = "connectivity_screen"
|
||||
self.sideband.setstate("app.displaying", self.root.ids.screen_manager.current)
|
||||
|
||||
def connectivity_init(self, sender=None):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue