- Add language updater scripts
- [Custom controls] fix startup error
This commit is contained in:
khanhduytran0 2020-11-19 09:54:09 +07:00
parent e43c868c60
commit 1eef60c6e8
5 changed files with 30 additions and 13 deletions

View File

@ -14,9 +14,13 @@ jobs:
java-version: 1.8 java-version: 1.8
- name: Build APK with Gradle - name: Build APK with Gradle
run: | run: |
chmod +x scripts/languagelist_updater.sh
bash scripts/languagelist_updater.sh
mkdir -p out mkdir -p out
chmod +x gradlew chmod +x gradlew
./gradlew clean assembleDebug ./gradlew clean assembleDebug
mv app/build/outputs/apk/debug/app-debug.apk out/app-debug.apk mv app/build/outputs/apk/debug/app-debug.apk out/app-debug.apk
# mv app/build/intermediates/merged_native_libs/debug/out/lib out/debug_lib # mv app/build/intermediates/merged_native_libs/debug/out/lib out/debug_lib

View File

@ -15,6 +15,18 @@ Architectures:
- For x86 (i\*86): **working**. - For x86 (i\*86): **working**.
- For x86_64 (amd64): **working**. - For x86_64 (amd64): **working**.
## Building
- Because languages are auto added by Crowdin, so need to run language list generator before build. In this directory, run:
```
# On Linux, Mac OS:
chmod +x scripts/languagelist_updater.sh
bash scripts/languagelist_updater.sh
# On Windows:
scripts\languagelist_updater.bat
```
- Then, build use Android Studio.
## Current status ## Current status
- [x] **Removed** ~~BinaryExecutor: execute `java` binary, no `JNIInvocation`.~~ - [x] **Removed** ~~BinaryExecutor: execute `java` binary, no `JNIInvocation`.~~
- [x] **Temporary removed** ~~JVDroid OpenJDK 11 (32 and 64-bit ARM and x86). Partial, no error `can't lock mutex`, but now exit with none output.~~ - [x] **Temporary removed** ~~JVDroid OpenJDK 11 (32 and 64-bit ARM and x86). Partial, no error `can't lock mutex`, but now exit with none output.~~

View File

@ -212,15 +212,14 @@ public class PojavLoginActivity extends AppCompatActivity
langAdapter.add(new DisplayableLocale(Locale.getDefault(), defaultLangChar)); langAdapter.add(new DisplayableLocale(Locale.getDefault(), defaultLangChar));
langAdapter.add(new DisplayableLocale(Locale.ENGLISH)); langAdapter.add(new DisplayableLocale(Locale.ENGLISH));
// TODO better way to read language list
try { try {
ZipFile thisApk = new ZipFile(getApplicationInfo().publicSourceDir); BufferedReader reader = new BufferedReader(new InputStreamReader(getAssets().open("language_list.txt")));
Enumeration<?> thisEntries = thisApk.entries(); String line;
while (thisEntries.hasMoreElements()) { while ((line = reader.readLine()) != null) {
File currFile = new File("/" + ((ZipEntry) thisEntries.nextElement()).getName()); File currFile = new File("/" + line);
System.out.println(currFile.getAbsolutePath()); System.out.println(currFile.getAbsolutePath());
if (currFile.getAbsolutePath().startsWith("/res/values-") && currFile.getName().startsWith("values-")) { if (currFile.getAbsolutePath().contains("/values-") || currFile.getName().startsWith("values-")) {
// TODO use regex // TODO use regex(?)
Locale thisLocale = new Locale(currFile.getName().replace("values-", "").replace("-r", "-")); Locale thisLocale = new Locale(currFile.getName().replace("values-", "").replace("-r", "-"));
langAdapter.add(new DisplayableLocale(thisLocale)); langAdapter.add(new DisplayableLocale(thisLocale));
} }

View File

@ -46,6 +46,8 @@ public class ControlButton extends Button implements OnLongClickListener, OnTouc
public void setProperties(ControlData properties, boolean changePos) { public void setProperties(ControlData properties, boolean changePos) {
mProperties = properties; mProperties = properties;
properties.update();
// com.android.internal.R.string.delete // com.android.internal.R.string.delete
// android.R.string. // android.R.string.
setText(properties.name); setText(properties.name);

View File

@ -1,8 +1,8 @@
#!/bin/bash @echo off
# TODO
THISDIR = `dirname $0`
LANGFILE = $THISDIR/../app/src/main/assets/language_list.txt
rm $LANGFILE set thisdir = "%~dp0"
ls $THISDIR/../app/src/main/res/values-* >> $LANGFILE set langfile = %thisdir%\..\app\src\main\assets\language_list.txt
rm %langfile%
dir %thisdir%\..\app\src\main\res\values-* /s /b > %langfile%