From 62ac1ecd3b6cecb12443a3f3e4cfda1b9af6ba66 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sat, 8 Oct 2022 18:01:33 +0200 Subject: [PATCH] Various UI enhancements --- sbapp/buildozer.spec | 2 +- sbapp/main.py | 32 ++++++++++++++++++++++++++------ sbapp/ui/layouts.py | 2 +- sbapp/ui/messages.py | 13 +++++++++---- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/sbapp/buildozer.spec b/sbapp/buildozer.spec index 07aaf61..12eabee 100644 --- a/sbapp/buildozer.spec +++ b/sbapp/buildozer.spec @@ -10,7 +10,7 @@ source.exclude_patterns = app_storage/*,venv/*,Makefile,./Makefil*,requirements, version.regex = __version__ = ['"](.*)['"] version.filename = %(source.dir)s/main.py -android.numeric_version = 20221008 +android.numeric_version = 20221009 requirements = python3==3.9.5,hostpython3==3.9.5,cryptography,cffi,pycparser,kivy==2.1.0,pygments,sdl2,sdl2_ttf==2.0.15,pillow,lxmf==0.1.9,netifaces,libbz2,pydenticon p4a.local_recipes = ../Others/python-for-android/pythonforandroid/recipes diff --git a/sbapp/main.py b/sbapp/main.py index 3cf2bcc..dcbe0ca 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -1,5 +1,6 @@ -__debug_build__ = False -__version__ = "0.2.1" +__debug_build__ = True +__disable_shaders__ = True +__version__ = "0.2.2" __variant__ = "beta" import sys @@ -88,13 +89,14 @@ class SidebandApp(MDApp): self.app_state = SidebandApp.STARTING self.android_service = None self.app_dir = plyer.storagepath.get_application_dir() + self.shaders_disabled = __disable_shaders__ if RNS.vendor.platformutils.get_platform() == "android": self.sideband = SidebandCore(self, is_client=True, android_app_dir=self.app_dir, verbose=__debug_build__) else: self.sideband = SidebandCore(self, is_client=False, verbose=(args.verbose or __debug_build__)) - self.update_ui_theme() + self.set_ui_theme() self.conversations_view = None self.sync_dialog = None @@ -165,16 +167,28 @@ class SidebandApp(MDApp): # General helpers # ################################################# - def update_ui_theme(self): + def set_ui_theme(self): self.theme_cls.material_style = "M3" self.theme_cls.widget_style = "android" self.theme_cls.primary_palette = "BlueGray" self.theme_cls.accent_palette = "Orange" + if self.sideband.config["dark_ui"]: self.theme_cls.theme_style = "Dark" else: self.theme_cls.theme_style = "Light" + def update_ui_theme(self): + if self.sideband.config["dark_ui"]: + self.theme_cls.theme_style = "Dark" + else: + self.theme_cls.theme_style = "Light" + + st = time.time() + RNS.log("Recursing widgets...") + for wid in self.root.ids: + RNS.log("Found: "+str(wid)+str(self.root.ids[wid])) + def set_bars_colors(self): if RNS.vendor.platformutils.get_platform() == "android": set_bars_colors( @@ -463,14 +477,18 @@ class SidebandApp(MDApp): self.messages_view = Messages(self, context_dest) self.root.ids.messages_scrollview.effect_cls = ScrollEffect - self.root.ids.messages_scrollview.scroll_y = 1 for child in self.root.ids.messages_scrollview.children: self.root.ids.messages_scrollview.remove_widget(child) + RNS.log("Removed "+str(child)) list_widget = self.messages_view.get_widget() + # RNS.log(str(list_widget.children)) + # RNS.log(str(list_widget.children[-1])) + self.root.ids.messages_scrollview.add_widget(list_widget) - self.root.ids.messages_scrollview.scroll_y = 0 + self.root.ids.messages_scrollview.scroll_y = 0.001 + self.root.ids.messages_toolbar.title = self.sideband.peer_display_name(context_dest) self.root.ids.messages_scrollview.active_conversation = context_dest self.sideband.setstate("app.active_conversation", context_dest) @@ -510,6 +528,8 @@ class SidebandApp(MDApp): context_dest = self.root.ids.messages_scrollview.active_conversation if self.sideband.send_message(msg_content, context_dest, self.outbound_mode_propagation): self.root.ids.message_text.text = "" + + self.root.ids.messages_scrollview.scroll_y = 0 self.jobs(0) else: self.messages_view.send_error_dialog = MDDialog( diff --git a/sbapp/ui/layouts.py b/sbapp/ui/layouts.py index 81c5afe..cd30dac 100644 --- a/sbapp/ui/layouts.py +++ b/sbapp/ui/layouts.py @@ -1025,7 +1025,7 @@ MDNavigationLayout: on_release: root.ids.screen_manager.app.quit_action(self) : - style: "filled" + style: "outlined" elevation: 2 padding: dp(8) radius: [dp(4), dp(4), dp(4), dp(4)] diff --git a/sbapp/ui/messages.py b/sbapp/ui/messages.py index c378e76..b9c8e04 100644 --- a/sbapp/ui/messages.py +++ b/sbapp/ui/messages.py @@ -6,8 +6,8 @@ from kivy.metrics import dp from kivy.core.clipboard import Clipboard from kivymd.uix.card import MDCard from kivymd.uix.menu import MDDropdownMenu -from kivymd.uix.behaviors import RoundedRectangularElevationBehavior, FakeRectangularElevationBehavior -# from kivymd.uix.behaviors import CommonElevationBehavior +# from kivymd.uix.behaviors import RoundedRectangularElevationBehavior, FakeRectangularElevationBehavior +from kivymd.uix.behaviors import CommonElevationBehavior from kivy.properties import StringProperty, BooleanProperty from kivy.uix.gridlayout import GridLayout from kivy.uix.boxlayout import BoxLayout @@ -22,8 +22,8 @@ else: from .helpers import ts_format, mdc from .helpers import color_received, color_delivered, color_propagated, color_failed, color_unknown, intensity_msgs_dark, intensity_msgs_light -# class ListLXMessageCard(MDCard, CommonElevationBehavior): -class ListLXMessageCard(MDCard, FakeRectangularElevationBehavior): +class ListLXMessageCard(MDCard): +# class ListLXMessageCard(MDCard, FakeRectangularElevationBehavior): text = StringProperty() heading = StringProperty() @@ -67,6 +67,11 @@ class Messages(): for w in self.widgets: m = w.m + if self.app.sideband.config["dark_ui"]: + w.line_color = (1.0, 1.0, 1.0, 0.25) + else: + w.line_color = (1.0, 1.0, 1.0, 0.5) + if m["state"] == LXMF.LXMessage.SENDING or m["state"] == LXMF.LXMessage.OUTBOUND: msg = self.app.sideband.message(m["hash"]) if msg["state"] == LXMF.LXMessage.DELIVERED: