6.6.1 - Alpha2 - 打包单文件时包名后缀中文自动拼音化

This commit is contained in:
SuperMonster003
2024-12-05 01:07:53 +08:00
parent 0a8c648f9a
commit b76ad3508d
3 changed files with 12 additions and 7 deletions

View File

@@ -31,6 +31,7 @@ import org.autojs.autojs.project.ProjectConfig;
import org.autojs.autojs.runtime.ScriptRuntime;
import org.autojs.autojs.runtime.api.AppUtils;
import org.autojs.autojs.runtime.api.AppUtils.Companion.SimpleVersionInfo;
import org.autojs.autojs.runtime.api.augment.pinyin.Pinyin;
import org.autojs.autojs.ui.BaseActivity;
import org.autojs.autojs.ui.common.NotAskAgainDialog;
import org.autojs.autojs.ui.filechooser.FileChooserDialogBuilder;
@@ -386,8 +387,11 @@ public class BuildActivity extends BaseActivity implements ApkBuilder.ProgressCa
}
private static String generatePackageNameSuffix(ScriptFile file) {
String name = file.getSimplifiedName()
.replaceAll("\\W+", "_");
String name = file.getSimplifiedName();
if (name.matches(".*[\\u4e00-\\u9fff].*")) {
name = Pinyin.ofRhino(name);
}
name = name.replaceAll("\\W+", "_");
if (name.matches("^\\d.*")) {
name = "app_" + name;
}