Skip to content

Commit c1a6d62

Browse files
committed
Update
1 parent 00fabdf commit c1a6d62

3 files changed

Lines changed: 32 additions & 17 deletions

File tree

app/src/main/java/com/omarea/krscript/config/PageConfigReader.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,7 @@ class PageConfigReader {
11251125
}
11261126
tomlGet(table, "mime")?.let { option.mime = it.lowercase(getDefault()) }
11271127
tomlGet(table, "path-home", "home-path", "pathhome")?.let { option.pathHome = it.trim() }
1128+
tomlGet(table, "multiple")?.let { option.multiple = tomlTruthy(it, "multiple") }
11281129
tomlGet(table, "box", "visible", "check")?.let { option.checkedSh = it }
11291130
tomlGet(table, "silent", "hidden")?.let { option.silent = it.isEmpty() || tomlTruthy(it, "silent", "hidden") }
11301131
tomlGet(table, "link", "href")?.let { option.link = it }

app/src/main/java/com/tool/tree/ActivityFileSelector.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.os.Environment
66
import android.view.Menu
77
import android.view.MenuItem
88
import android.view.View
9+
import android.widget.TextView
910
import androidx.activity.addCallback
1011
import androidx.appcompat.app.AppCompatActivity
1112
import androidx.appcompat.widget.Toolbar
@@ -80,6 +81,20 @@ class ActivityFileSelector : AppCompatActivity() {
8081
}
8182

8283
invalidateOptionsMenu()
84+
85+
// Cho phép tiêu đề toolbar xuống dòng (tối đa 2 dòng) thay vì bị cắt hiện dấu "..."
86+
// Toolbar tự tạo TextView tiêu đề khi layout, nên phải chờ tới lúc đó mới chỉnh được.
87+
toolbar.post {
88+
for (i in 0 until toolbar.childCount) {
89+
val child = toolbar.getChildAt(i)
90+
if (child is TextView && child.text?.toString() == toolbar.title?.toString()) {
91+
child.isSingleLine = false
92+
child.maxLines = 2
93+
child.ellipsize = null
94+
break
95+
}
96+
}
97+
}
8398
}
8499

85100
override fun onCreateOptionsMenu(menu: Menu?): Boolean {

app/src/main/res/layout/activity_file_selector.xml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,36 @@
1919
android:layout_height="match_parent"
2020
android:orientation="vertical">
2121

22-
<!-- Hàng "Chọn tất cả" cố định ở đầu trang, chỉ hiện khi đang ở chế độ chọn nhiều (multiple) -->
23-
<LinearLayout
22+
<!-- Hàng "Chọn tất cả" cố định ở đầu trang, chỉ hiện khi đang ở chế độ chọn nhiều (multiple).
23+
Dùng đúng 1 CheckBox (layoutDirection rtl) để chữ dính sát ô vuông, và padding 6dp
24+
giống hệt list_item_file/list_item_dir để ô vuông thẳng hàng với checkbox bên dưới. -->
25+
<RelativeLayout
2426
android:id="@+id/select_all_block"
25-
android:orientation="horizontal"
26-
android:gravity="center_vertical"
2727
android:visibility="gone"
2828
android:clickable="true"
2929
android:focusable="true"
30-
android:paddingStart="16dp"
31-
android:paddingEnd="16dp"
32-
android:paddingTop="10dp"
33-
android:paddingBottom="10dp"
30+
android:paddingStart="6dp"
31+
android:paddingEnd="6dp"
32+
android:paddingTop="6dp"
33+
android:paddingBottom="6dp"
3434
android:layout_width="match_parent"
3535
android:layout_height="wrap_content">
3636

37-
<TextView
38-
android:id="@+id/select_all_label"
37+
<CheckBox
38+
android:id="@+id/select_all"
3939
android:text="@string/select_all"
40+
android:layoutDirection="rtl"
4041
android:textColor="?android:attr/textColorPrimary"
4142
android:textSize="14dp"
42-
android:layout_width="0dp"
43-
android:layout_weight="1"
44-
android:layout_height="wrap_content" />
45-
46-
<CheckBox
47-
android:id="@+id/select_all"
43+
android:minWidth="0dp"
44+
android:minHeight="0dp"
4845
android:clickable="true"
4946
android:focusable="true"
47+
android:layout_alignParentEnd="true"
48+
android:layout_centerVertical="true"
5049
android:layout_width="wrap_content"
5150
android:layout_height="wrap_content" />
52-
</LinearLayout>
51+
</RelativeLayout>
5352

5453
<ListView
5554
android:id="@+id/file_selector_list"

0 commit comments

Comments
 (0)