Allow predictive text on Android by default, add option to block predictive text. Fixes #55.

This commit is contained in:
Mark Qvist 2024-09-23 00:03:13 +02:00
parent c2dcc55d6e
commit 919cd6a449
4 changed files with 32 additions and 13 deletions

View File

@ -2751,6 +2751,10 @@ class SidebandApp(MDApp):
self.sideband.save_configuration()
self.sideband._reticulum_log_debug(self.sideband.config["debug"])
def save_block_predictive_text(sender=None, event=None):
self.sideband.config["block_predictive_text"] = self.settings_screen.ids.settings_block_predictive_text.active
self.sideband.save_configuration()
def save_print_command(sender=None, event=None):
if not sender.focus:
in_cmd = self.settings_screen.ids.settings_print_command.text
@ -2917,6 +2921,9 @@ class SidebandApp(MDApp):
self.settings_screen.ids.settings_debug.active = self.sideband.config["debug"]
self.settings_screen.ids.settings_debug.bind(active=save_debug)
self.settings_screen.ids.settings_block_predictive_text.active = self.sideband.config["block_predictive_text"]
self.settings_screen.ids.settings_block_predictive_text.bind(active=save_block_predictive_text)
self.settings_screen.ids.settings_lang_default.active = False
self.settings_screen.ids.settings_lang_chinese.active = False
self.settings_screen.ids.settings_lang_japanese.active = False

View File

@ -531,6 +531,8 @@ class SidebandCore():
self.config["input_language"] = None
if not "allow_predictive_text" in self.config:
self.config["allow_predictive_text"] = False
if not "block_predictive_text" in self.config:
self.config["block_predictive_text"] = False
if not "connect_transport" in self.config:
self.config["connect_transport"] = False

View File

@ -1822,20 +1822,20 @@ MDScreen:
pos_hint: {"center_y": 0.3}
active: False
# MDBoxLayout:
# orientation: "horizontal"
# size_hint_y: None
# padding: [0,0,dp(24),dp(0)]
# height: dp(48)
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
# MDLabel:
# text: "Allow Predictive Text"
# font_style: "H6"
MDLabel:
text: "Block Predictive Text"
font_style: "H6"
# MDSwitch:
# id: settings_allow_predictive_text
# pos_hint: {"center_y": 0.3}
# active: False
MDSwitch:
id: settings_block_predictive_text
pos_hint: {"center_y": 0.3}
active: False
# MDBoxLayout:
# orientation: "vertical"
@ -1844,7 +1844,7 @@ MDScreen:
# padding: [0, dp(24), 0, dp(24)]
# MDRectangleFlatIconButton:
# id: hardware_rnode_button
# id: input_language_button
# icon: "translate"
# text: "Input Languages"
# padding: [dp(0), dp(14), dp(0), dp(14)]

View File

@ -194,6 +194,15 @@ class Messages():
self.details_dialog.open()
def update(self, limit=8):
if self.app.sideband.config["block_predictive_text"]:
if self.ids.message_text.input_type != "null":
self.ids.message_text.input_type = "null"
self.ids.message_text.keyboard_suggestions = False
else:
if self.ids.message_text.input_type != "text":
self.ids.message_text.input_type = "text"
self.ids.message_text.keyboard_suggestions = False
for new_message in self.app.sideband.list_messages(self.context_dest, after=self.latest_message_timestamp,limit=limit):
self.new_messages.append(new_message)
@ -1229,6 +1238,7 @@ MDScreen:
MDTextField:
id: message_text
input_type: "text"
keyboard_suggestions: True
multiline: True
hint_text: "Write message"