diff --git a/app/src/main/java/com/orgzly/android/prefs/AppPreferences.java b/app/src/main/java/com/orgzly/android/prefs/AppPreferences.java
index 6270f7b89..b5e13383b 100644
--- a/app/src/main/java/com/orgzly/android/prefs/AppPreferences.java
+++ b/app/src/main/java/com/orgzly/android/prefs/AppPreferences.java
@@ -423,6 +423,17 @@ public static void isReverseNoteClickAction(Context context, boolean value) {
getDefaultSharedPreferences(context).edit().putBoolean(key, value).apply();
}
+ public static boolean isRemoveNoteIndent(Context context) {
+ return getDefaultSharedPreferences(context).getBoolean(
+ context.getResources().getString(R.string.pref_key_is_remove_indent),
+ context.getResources().getBoolean(R.bool.pref_default_is_remove_indent));
+ }
+
+ public static void isRemoveNoteIndent(Context context, boolean value) {
+ String key = context.getResources().getString(R.string.pref_key_is_remove_indent);
+ getDefaultSharedPreferences(context).edit().putBoolean(key, value).apply();
+ }
+
/*
* Schedule new note.
*/
diff --git a/app/src/main/java/com/orgzly/android/ui/notes/NoteItemViewBinder.kt b/app/src/main/java/com/orgzly/android/ui/notes/NoteItemViewBinder.kt
index dbea4a280..bcee517f6 100644
--- a/app/src/main/java/com/orgzly/android/ui/notes/NoteItemViewBinder.kt
+++ b/app/src/main/java/com/orgzly/android/ui/notes/NoteItemViewBinder.kt
@@ -103,7 +103,14 @@ class NoteItemViewBinder(private val context: Context, private val inBook: Boole
}
private fun setupTitle(holder: NoteItemViewHolder, noteView: NoteView) {
- holder.binding.itemHeadTitle.setText(generateTitle(noteView))
+ val level = if (inBook) noteView.note.position.level else 0
+
+ if (AppPreferences.isRemoveNoteIndent(context)) {
+ holder.binding.itemHeadTitle.setText("--".repeat(level)+" "+generateTitle(noteView))
+ }
+ else {
+ holder.binding.itemHeadTitle.setText(generateTitle(noteView))
+ }
}
fun generateTitle(noteView: NoteView): CharSequence {
@@ -244,28 +251,33 @@ class NoteItemViewBinder(private val context: Context, private val inBook: Boole
val container = holder.binding.itemHeadIndentContainer
val level = if (inBook) note.position.level - 1 else 0
+ var titleIndentLevel = level
+
+ if (AppPreferences.isRemoveNoteIndent(context)) {
+ titleIndentLevel = 0
+ }
when {
- container.childCount < level -> { // More levels needed
+ container.childCount < titleIndentLevel -> { // More levels needed
// Make all existing levels visible
for (i in 1..container.childCount) {
container.getChildAt(i - 1).visibility = View.VISIBLE
}
// Inflate the rest
- for (i in container.childCount + 1..level) {
+ for (i in container.childCount + 1..titleIndentLevel) {
View.inflate(container.context, R.layout.indent, container)
}
}
- level < container.childCount -> { // Too many levels
+ titleIndentLevel< container.childCount -> { // Too many levels
// Make required levels visible
- for (i in 1..level) {
+ for (i in 1..titleIndentLevel) {
container.getChildAt(i - 1).visibility = View.VISIBLE
}
// Hide the rest
- for (i in level + 1..container.childCount) {
+ for (i in titleIndentLevel + 1..container.childCount) {
container.getChildAt(i - 1).visibility = View.GONE
}
}
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index e8c9fac44..e9b18efd5 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -282,6 +282,8 @@
为笔记内容和笔记本序言使用等宽字体
反转笔记点击动作
点击选择笔记,长按打开笔记
+ 移除笔记缩进
+ 移除笔记缩进以节省屏幕空间
外观 & 感觉
笔记列表
新建笔记
diff --git a/app/src/main/res/values/prefs_keys.xml b/app/src/main/res/values/prefs_keys.xml
index 1d37573dc..4bbc0a3ae 100644
--- a/app/src/main/res/values/prefs_keys.xml
+++ b/app/src/main/res/values/prefs_keys.xml
@@ -25,6 +25,9 @@
pref_key_is_reverse_click_action
false
+ pref_key_is_remove_indent
+ false
+
pref_key_is_notes_content_displayed_in_list
true
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 735b29910..b0fc8932c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -328,6 +328,8 @@
Use monospaced font for note\'s content and notebook\'s preface
Swap note click and long-click actions
Click to select note, long-click to open
+ Remove note indent
+ Remove note indent to save screen space
Look & Feel
List of notes
New note
diff --git a/app/src/main/res/xml/prefs_screen_look_and_feel.xml b/app/src/main/res/xml/prefs_screen_look_and_feel.xml
index e5c77d551..2675e7c07 100644
--- a/app/src/main/res/xml/prefs_screen_look_and_feel.xml
+++ b/app/src/main/res/xml/prefs_screen_look_and_feel.xml
@@ -11,6 +11,12 @@
android:summary="@string/reversed_note_click_action_summary"
android:defaultValue="@bool/pref_default_is_reverse_click_action"/>
+
+