- 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
- name: Build APK with Gradle
run: |
chmod +x scripts/languagelist_updater.sh
bash scripts/languagelist_updater.sh
mkdir -p out
chmod +x gradlew
./gradlew clean assembleDebug
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

View File

@ -15,6 +15,18 @@ Architectures:
- For x86 (i\*86): **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
- [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.~~

View File

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

View File

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