From 81f6833b3c24d4ea7514cadfc6acce59a0f0c048 Mon Sep 17 00:00:00 2001 From: oakkitten Date: Tue, 24 Dec 2024 21:45:17 +0000 Subject: [PATCH] Add a preference to disable handling line changes --- .../java/com/ubergeek42/WeechatAndroid/relay/BufferList.kt | 2 ++ .../main/java/com/ubergeek42/WeechatAndroid/service/P.java | 2 ++ .../java/com/ubergeek42/WeechatAndroid/utils/Constants.java | 2 ++ app/src/main/res/values/strings.xml | 5 +++++ app/src/main/res/xml/preferences.xml | 5 +++++ 5 files changed, 16 insertions(+) diff --git a/app/src/main/java/com/ubergeek42/WeechatAndroid/relay/BufferList.kt b/app/src/main/java/com/ubergeek42/WeechatAndroid/relay/BufferList.kt index 771aeea7..6ff2c0c5 100644 --- a/app/src/main/java/com/ubergeek42/WeechatAndroid/relay/BufferList.kt +++ b/app/src/main/java/com/ubergeek42/WeechatAndroid/relay/BufferList.kt @@ -395,6 +395,8 @@ object BufferList { } add("_buffer_line_data_changed") { obj, _ -> + if (!P.handleBufferLineDataChanged) return@add + obj.forEach { entry -> val spec = LineSpec(entry) findByPointer(spec.bufferPointer)?.let { buffer -> diff --git a/app/src/main/java/com/ubergeek42/WeechatAndroid/service/P.java b/app/src/main/java/com/ubergeek42/WeechatAndroid/service/P.java index 5384156f..d3d5d423 100644 --- a/app/src/main/java/com/ubergeek42/WeechatAndroid/service/P.java +++ b/app/src/main/java/com/ubergeek42/WeechatAndroid/service/P.java @@ -247,6 +247,7 @@ public static void applyThemeAfterActivityCreation(AppCompatActivity activity) { static long pingIdleTime, pingTimeout; public static int lineIncrement; public static int searchLineIncrement; + public static boolean handleBufferLineDataChanged; static String printableHost; static boolean connectionSurelyPossibleWithCurrentPreferences; @@ -275,6 +276,7 @@ public static void applyThemeAfterActivityCreation(AppCompatActivity activity) { lineIncrement = Integer.parseInt(getString(PREF_LINE_INCREMENT, PREF_LINE_INCREMENT_D)); searchLineIncrement = Integer.parseInt(getString(PREF_SEARCH_LINE_INCREMENT, PREF_SEARCH_LINE_INCREMENT_D)); + handleBufferLineDataChanged = p.getBoolean(PREF_HANDLE_BUFFER_LINE_DATA_CHANGED, PREF_HANDLE_BUFFER_LINE_DATA_CHANGED_D); reconnect = p.getBoolean(PREF_RECONNECT, PREF_RECONNECT_D); optimizeTraffic = p.getBoolean(PREF_OPTIMIZE_TRAFFIC, PREF_OPTIMIZE_TRAFFIC_D); diff --git a/app/src/main/java/com/ubergeek42/WeechatAndroid/utils/Constants.java b/app/src/main/java/com/ubergeek42/WeechatAndroid/utils/Constants.java index b8145a25..d46b7529 100644 --- a/app/src/main/java/com/ubergeek42/WeechatAndroid/utils/Constants.java +++ b/app/src/main/java/com/ubergeek42/WeechatAndroid/utils/Constants.java @@ -63,6 +63,8 @@ public class Constants { final public static String PREF_LINE_INCREMENT_D = "300"; final static public String PREF_SEARCH_LINE_INCREMENT = "line_number_to_request_when_starting_search"; final static public String PREF_SEARCH_LINE_INCREMENT_D = "4097"; + final static public String PREF_HANDLE_BUFFER_LINE_DATA_CHANGED = "handle_buffer_line_data_changed"; + final static public Boolean PREF_HANDLE_BUFFER_LINE_DATA_CHANGED_D = true; final static public String PREF_RECONNECT = "reconnect"; final public static boolean PREF_RECONNECT_D = true; final static public String PREF_BOOT_CONNECT = "boot_connect"; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 92da247b..3c77d17d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -539,6 +539,11 @@ Also note that due to WeeChat’s limitations the app has to re-fetch all lines every times it requests more lines. + + Handle line changes + + In rare circumstances displaying line changes may lead to jerky animation + Miscellaneous diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index dd0da1c8..e598ed70 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -151,6 +151,11 @@ android:summary="@string/pref__connection__synchronization_help" android:persistent="false" android:selectable="false" /> +