Skip to content

Commit 917b331

Browse files
committed
Update
1 parent 4f95077 commit 917b331

5 files changed

Lines changed: 50 additions & 18 deletions

File tree

.github/addon/patch_rom/default.prop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ title_boot_patch2="If there are two boots, only patch vendor_boot, for older And
4949
title_boot_patch3="Add fake locked bootloader"
5050
title_boot_patch4="Selinux"
5151
text_del_file="Manually find folders and files to delete"
52-
title_boot_patch3_desc="To avoid bootloops after patching, make sure to patch the item containing „enforceVersionPolicy”"
52+
title_boot_patch3_desc="MTK devices with patched bootloaders or vendor_boot may freeze."
5353
action_title="App testing"
5454
action_desc="Run apps without rebooting"
5555
action_warn="Some apps are linked, so both must be force-stopped [Aod, App Vault]"

.github/addon/patch_rom/language.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ title_boot_patch2="Nếu như có hai boot chỉ cần vá vendor_boot, đối v
5454
title_boot_patch3="Thêm fake lock bootloader"
5555
title_boot_patch4="Selinux"
5656
text_del_file="Tự tìm thư mục, và tệp để xoá bỏ"
57-
title_boot_patch3_desc="Nếu muốn không bị treo sau khi hãy vá mục chữ „enforceVersionPolicy” để tránh bị treo thiết bị"
57+
title_boot_patch3_desc="Các thiết bị MTK boot, vendor_boot thể bị treo"
5858
action_title="Thử nghiệm ứng dụng"
5959
action_desc="Chạy ứng dụng mà không cần khởi động lại"
6060
action_warn="Một số ứng dụng liên kết với nhau vì vậy phải buộc dừng cả hai, ví dụ: Aod, App vault"
@@ -144,7 +144,7 @@ title_boot_patch2="Ha két rendszerindító lemezkép (boot image) is rendelkez
144144
title_boot_patch3="Hozzáadva egy ál-bootloader-zár"
145145
title_boot_patch4="Selinux"
146146
text_del_file="Keresse meg a törlendő mappákat és fájlokat"
147-
title_boot_patch3_desc="A patchelés utáni bootloop elkerülése érdekében patchelje az „enforceVersionPolicy” elemet"
147+
title_boot_patch3_desc="A javított rendszerbetöltővel vagy vendor_boot fájllal rendelkező MTK eszközök lefagyhatnak."
148148
action_title="Futtassa az alkalmazást újraindítás nélkül"
149149
action_warn="Egyes alkalmazások összekapcsolódnak, ezért mindkettőt le kell állítani – ilyen például az AOD és az App Vault"
150150
param1_title="Szerkesztett fájl"

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

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import java.util.Locale.getDefault
1919
import androidx.core.graphics.toColorInt
2020
// Thư viện phân tích TOML (cần thêm vào build.gradle, ví dụ: implementation("org.tomlj:tomlj:1.1.1"))
2121
import org.tomlj.Toml
22+
import org.tomlj.TomlArray
2223
import org.tomlj.TomlTable
2324

2425
/**
@@ -900,11 +901,11 @@ class PageConfigReader {
900901
// Các mục nằm "bên trong" một group (con của nó) khai báo bằng đường dẫn lồng:
901902
// [[group.action]], [[group.page]], [[group.text]] ...
902903
//
903-
// Giới hạn cần biết: TOML không lưu được thứ tự XEN KẼ giữa các bảng KHÁC TÊN
904-
// (vd 1 action rồi tới 1 page rồi lại 1 action nữa) - mỗi tên gom thành 1 danh sách
905-
// riêng. Mặc định các loại được sắp theo thứ tự: group, text, switch, picker, action,
906-
// page, editor, resource; nếu cần chỉ định thứ tự chính xác, thêm field `order = <số>`
907-
// (số nhỏ hơn hiện trước) vào từng mục.
904+
// Thứ tự hiển thị: LUÔN theo đúng vị trí xuất hiện trong file (trên trước, dưới sau),
905+
// bất kể loại mục là gì (group, action, page, text ...) - kể cả khi các loại XEN KẼ
906+
// nhau (vd 1 action rồi tới 1 page rồi lại 1 action nữa). Vị trí này lấy trực tiếp từ
907+
// dòng khai báo `[[ten]]` trong file thông qua API vị trí của tomlj, không cần khai báo
908+
// thêm field `order` nào.
908909
//
909910
// Ví dụ:
910911
// [[group]]
@@ -977,23 +978,45 @@ class PageConfigReader {
977978
}
978979
}
979980

980-
// Gom toàn bộ node con của 1 bảng (root, hoặc bảng của 1 group), theo đúng thứ tự
981-
// mặc định (tomlNodeTypeOrder), trừ khi từng mục có field `order` để chỉ định vị trí.
981+
// Lấy số dòng (trong file gốc) nơi 1 mục được khai báo, để dùng làm căn cứ sắp xếp
982+
// "trên trước, dưới sau". Với bảng mảng [[ten]] (nhiều mục cùng tên), phải lấy vị trí
983+
// của TỪNG phần tử qua TomlArray, vì vị trí của chính khoá `ten` chỉ trỏ tới mục ĐẦU
984+
// TIÊN. Nếu vì lý do gì đó không lấy được vị trí (API thay đổi, lỗi...), trả về null
985+
// và nơi gọi sẽ tự rơi về thứ tự xuất hiện khi đọc (seq) để không bao giờ crash.
986+
private fun tomlEntryLine(parent: TomlTable, key: String, index: Int): Int? {
987+
return try {
988+
if (parent.isArray(key)) {
989+
val arr: TomlArray? = parent.getArray(key)
990+
arr?.inputPositionOf(index)?.line()
991+
} else if (parent.isTable(key)) {
992+
parent.inputPositionOf(key)?.line()
993+
} else {
994+
null
995+
}
996+
} catch (ex: Exception) {
997+
null
998+
}
999+
}
1000+
1001+
// Gom toàn bộ node con của 1 bảng (root, hoặc bảng của 1 group). Thứ tự hiển thị luôn
1002+
// theo đúng vị trí xuất hiện trong file (trên trước, dưới sau), không phân biệt loại
1003+
// mục và không cần field `order`.
9821004
private fun tomlChildren(parent: TomlTable): ArrayList<NodeInfoBase> {
983-
data class Entry(val order: Double, val seq: Int, val node: NodeInfoBase)
1005+
data class Entry(val line: Int, val seq: Int, val node: NodeInfoBase)
9841006

9851007
val entries = ArrayList<Entry>()
9861008
var seq = 0
987-
for ((typeIndex, type) in tomlNodeTypeOrder.withIndex()) {
988-
val defaultBase = typeIndex * 100000.0
989-
for (table in tomlEntries(parent, type)) {
1009+
for (type in tomlNodeTypeOrder) {
1010+
for ((index, table) in tomlEntries(parent, type).withIndex()) {
9901011
seq++
9911012
val node = tomlBuildNode(type, table) ?: continue
992-
val explicitOrder = tomlGet(table, "order")?.trim()?.toDoubleOrNull()
993-
entries.add(Entry(explicitOrder ?: (defaultBase + seq), seq, node))
1013+
val line = tomlEntryLine(parent, type, index) ?: Int.MAX_VALUE
1014+
entries.add(Entry(line, seq, node))
9941015
}
9951016
}
996-
return ArrayList(entries.sortedWith(compareBy({ it.order }, { it.seq })).map { it.node })
1017+
// Sắp theo dòng thực tế trong file; nếu không lấy được dòng (line == MAX_VALUE)
1018+
// thì rơi về đúng thứ tự đọc được (seq) để vẫn ổn định, không xáo trộn ngẫu nhiên.
1019+
return ArrayList(entries.sortedWith(compareBy({ it.line }, { it.seq })).map { it.node })
9971020
}
9981021

9991022
private fun tomlBuildNode(type: String, table: TomlTable): NodeInfoBase? {

app/src/main/java/com/omarea/krscript/ui/ActionParamsLayoutRender.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,15 @@ class ActionParamsLayoutRender(private var linearLayout: LinearLayout, activity:
625625
}
626626
}
627627

628+
// ========== readonly (tĩnh, khai báo trực tiếp bằng readonly="true") ==========
629+
// Param chỉ xem, không cho sửa trên UI -> giờ cũng KHÔNG gửi giá trị đi khi chạy
630+
// action, bỏ qua hoàn toàn khỏi kết quả (giống hệt depend-include-hidden="false").
631+
// Lưu ý: đây KHÔNG áp dụng cho depend-readonly (readonly do phụ thuộc điều kiện),
632+
// depend-readonly vẫn dùng cơ chế depend-include-hidden như trước, không đổi.
633+
if (actionParamInfo.readonly) {
634+
continue
635+
}
636+
628637
// Dùng visibilityState (kết quả logic của evaluateDependencies) thay vì đọc trực
629638
// tiếp View.visibility, vì với depend-readonly=true, view vẫn ở trạng thái
630639
// VISIBLE (chỉ bị mờ + khóa tương tác) dù về mặt logic vẫn được xem là "không

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ class TextEditorActivity : AppCompatActivity() {
894894

895895
val privateCacheDir = FileWrite.getPrivateFilePath(
896896
this,
897-
"hone/tmp/tmp_${System.currentTimeMillis()}.tmp"
897+
"home/tmp/tmp_${System.currentTimeMillis()}.tmp"
898898
) ?: return false
899899

900900
return try {

0 commit comments

Comments
 (0)