Debug: autoscroll editor

This commit is contained in:
M66B 2023-05-14 09:15:18 +02:00
parent 32909d157b
commit 7a8f1a9642
4 changed files with 35 additions and 7 deletions

View File

@ -278,6 +278,7 @@ public class FragmentCompose extends FragmentBase {
private ContentResolver resolver;
private AdapterAttachment adapter;
private boolean autoscroll_editor;
private int compose_color;
private String compose_font;
private boolean compose_monospaced;
@ -344,6 +345,7 @@ public class FragmentCompose extends FragmentBase {
final Context context = getContext();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
autoscroll_editor = prefs.getBoolean("autoscroll_editor", false);
compose_color = prefs.getInt("compose_color", Color.TRANSPARENT);
compose_font = prefs.getString("compose_font", "");
compose_monospaced = prefs.getBoolean("compose_monospaced", false);
@ -701,6 +703,8 @@ public class FragmentCompose extends FragmentBase {
}
}
// Autoscroll was fixed by Android 14 beta 2
if (autoscroll_editor) {
if (count - before > 1)
inserted = true;
else if (count - before == 1) {
@ -708,6 +712,7 @@ public class FragmentCompose extends FragmentBase {
inserted = Character.isWhitespace(c);
}
}
}
@Override
public void afterTextChanged(Editable text) {

View File

@ -204,6 +204,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private TextView tvThreadRange;
private SeekBar sbThreadRange;
private ImageButton ibSqliteCache;
private SwitchCompat swAutoScroll;
private SwitchCompat swUndoManager;
private SwitchCompat swBrowserZoom;
private SwitchCompat swFakeDark;
@ -284,7 +285,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"test1", "test2", "test3", "test4", "test5",
"emergency_file", "work_manager", // "external_storage",
"sqlite_integrity_check", "wal", "sqlite_checkpoints", "sqlite_analyze", "sqlite_auto_vacuum", "sqlite_sync_extra", "sqlite_cache",
"chunk_size", "thread_range", "undo_manager",
"chunk_size", "thread_range",
"autoscroll_editor", "undo_manager",
"browser_zoom", "fake_dark",
"show_recent",
"use_modseq", "preamble", "uid_command", "perform_expunge", "uid_expunge",
@ -445,6 +447,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
sbChunkSize = view.findViewById(R.id.sbChunkSize);
tvThreadRange = view.findViewById(R.id.tvThreadRange);
sbThreadRange = view.findViewById(R.id.sbThreadRange);
swAutoScroll = view.findViewById(R.id.swAutoScroll);
swUndoManager = view.findViewById(R.id.swUndoManager);
swBrowserZoom = view.findViewById(R.id.swBrowserZoom);
swFakeDark = view.findViewById(R.id.swFakeDark);
@ -1542,6 +1545,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swAutoScroll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("autoscroll_editor", checked).apply();
}
});
swUndoManager.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -2448,6 +2458,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
tvThreadRange.setText(getString(R.string.title_advanced_thread_range, range));
sbThreadRange.setProgress(thread_range);
swAutoScroll.setChecked(prefs.getBoolean("autoscroll_editor", false));
swUndoManager.setChecked(prefs.getBoolean("undo_manager", false));
swBrowserZoom.setChecked(prefs.getBoolean("browser_zoom", false));
swFakeDark.setChecked(prefs.getBoolean("fake_dark", false));

View File

@ -1610,6 +1610,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvThreadRange" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoScroll"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_auto_scroll"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/sbThreadRange"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swUndoManager"
android:layout_width="0dp"
@ -1618,7 +1629,7 @@
android:text="@string/title_advanced_undo_manager"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/sbThreadRange"
app:layout_constraintTop_toBottomOf="@id/swAutoScroll"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View File

@ -850,6 +850,7 @@
<string name="title_advanced_sqlite_cache" translatable="false">sqlite cache: %1$s %% - %2$s</string>
<string name="title_advanced_chunk_size" translatable="false">Chunk size: %1$d</string>
<string name="title_advanced_thread_range" translatable="false">Thread range: %1$d days</string>
<string name="title_advanced_auto_scroll" translatable="false">Auto scroll editor</string>
<string name="title_advanced_undo_manager" translatable="false">Use Android\'s undo manager</string>
<string name="title_advanced_browser_zoom" translatable="false">Use browser zoom</string>
<string name="title_advanced_fake_dark" translatable="false">Fake dark</string>