Skip to content

KsuWebUI-SN 1.2-31

Choose a tag to compare

@dnascorpionofficial dnascorpionofficial released this 12 Nov 00:48
· 43 commits to main since this release
a1376b1

Tip

Highlights: you can now turn a module on or off right from the list (with a reboot prompt), modules show an Update available badge when a newer version exists, cards show the module's version code, and a new ℹ️ Information screen in the settings drawer explains every option and icon.

✨ New

  • Module on/off switch: every module card now has a switch at the end of the bottom row. Turning it off marks the module as disabled, turning it on enables it again. The change takes effect after a reboot, so the app then asks Reboot now or Later. If you flip the same module back before rebooting, the pending change is cancelled and no reboot is asked. If the change fails you get a "Couldn't change the module state" message.
  • Update available badge: if a module's module.prop has a numeric versionCode and an updateJson link, the app checks that link in the background when the list loads. When the module's published version code is higher than the installed one, its card shows a green Update available badge. Checks that fail or time out are ignored quietly.
  • Version code on cards: a "Version code: …" line now appears under the version on cards of modules that declare a versionCode.
  • Information screen: a new ℹ️ button next to Settings in the drawer opens a short guide. It explains Theme, Module Banners, Module Icons, Disabled Modules and Hidden Modules, and what each card icon and button means (disabled, hidden, update, pinned, settings gear, switch).

🔁 Changed

  • Status labels on cards: a module with one status still shows it as text (red Disabled or Hidden in place of the date, or the green Update available badge). A module with more than one status now shows small icons instead of the old combined "Disabled · Hidden" text, so the row no longer overflows.
  • Card bottom row: the settings gear moved to the start of the row, the size and date (or status) chips are centered in the space between the gear and the switch, and the switch sits at the end.
  • Translations: all the new texts are translated in Arabic, French, Polish, Japanese and Simplified Chinese.

🌍 For translation contributors

Translating the app (Click to expand)
  • Guided translation: scripts/add_language.py <code> now walks you through the translation. It creates values-<code>/strings.xml with every string marked <!-- TODO translate -->, shows each English string, and you type the translation and press Enter.
  • Skip and quit: Enter alone skips a string, and quit_translate saves and quits.
  • Saved as you go: every answer is written to the file straight away. Run the same command again to continue with the strings still marked.
  • Safety checks: placeholders like %s and %1$d must match the English text, and special characters are escaped for you. A table of what you translated is shown at the end.
  • Old behaviour: --create-only just creates the file so you can edit it by hand.
  • Docs: the English README and the translated ones in docs/ describe the new flow.
  • Checking: run python3 scripts/check_strings.py when you are done.

⚙️ Under the hood

For developers ⚠️ (Click to expand)

Module switch (MainActivity.kt)

  • setModuleEnabled(item, enable): runs touch or rm -f on /data/adb/modules/<id>/disable through Shell.cmd on App.executor, with single quotes in the id escaped. The switch is disabled while the command runs, then the card is rebuilt from the new state. On failure it shows module_toggle_failed.
  • Pending reboot tracking: markPendingReboot(id) keeps the ids changed since boot in the pending_reboot string set (KEY_PENDING_REBOOT) and stores the current /proc/sys/kernel/random/boot_id under pending_boot_id (KEY_PENDING_BOOT). A different boot id clears the set. Toggling an id a second time removes it, and the reboot prompt is only shown while the change still needs a reboot.
  • showRebootPrompt(enabled): uses a new showConfirm overload that takes CharSequence title and message plus custom Yes / No labels (reboot_now and the existing update_later). The old showConfirm(icon, title, message, onYes) now calls it.

Module updates

  • ModuleUpdateChecker.kt (new): latestVersionCode(url) only accepts links starting with http, uses a 6 second connect and read timeout, sends User-Agent: KsuWebUI-SN, accepts HTTP 200 only, reads at most 256 KB and returns the trimmed versionCode field of the JSON as a Long, or null on any problem.
  • checkModuleUpdates(mods): runs after the list is built. It only checks modules with a numeric versionCode and an updateJson link, at most 4 requests at a time (Semaphore(4)), and calls setModuleUpdate(id) on the main thread when the remote code is higher.
  • Module data class: new fields versionCode, updateJson and updateAvailable. The module.prop parser now reads versionCode and updateJson.

Card layout (item_module.xml, onBindViewHolder)

  • New views: version_code TextView, toggle (MaterialSwitch, scaled to 0.85), and the chips module_update, status_disabled, status_hidden and status_update. The three status chips are icon-only and are only used when a module has more than one status.
  • Status logic: statusCount counts disabled, hidden and update. Zero shows the date, one shows text (or the update chip), more than one shows the icon chips and hides the date chip.
  • Layout: the settings gear moved to the start of the bottom row. The chip group is wrapped in a FrameLayout with layout_weight="1" and the group centered inside it.

Information screen

  • showInfoDialog(): builds the dialog from the new dialog_info.xml, item_info_header.xml and item_info_row.xml, opened by the new drawer_info button in activity_main.xml (the Settings title row is now a horizontal row with the button at the end).
  • Resources: new drawables ic_info, ic_block and ic_update, and colors update_chip (#1E8E3E, #5BD982 in night), update_chip_text (#FFFFFF, #00210B in night) and status_red (#E53935).
  • Strings: 25 new strings (version_code, module_update_available, module_toggle, module_toggle_failed, reboot_to_enable, reboot_to_disable, reboot_to_apply_message, reboot_now, info_title, info_close and the info_* texts) in English, Arabic, French, Polish, Japanese and Simplified Chinese. check_strings.py passes and no TODO translate markers are left.