Skip to content

Commit

Permalink
喵喵喵
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonLeeeaf committed Jan 15, 2025
1 parent 5bdb6a2 commit af63790
Show file tree
Hide file tree
Showing 12 changed files with 176 additions and 35 deletions.
23 changes: 19 additions & 4 deletions .androidide/editor/openedFiles.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
{
"allFiles": [
{
"file": "/storage/emulated/0/MoonLeaf/Projects/MndroLua/moon3/build.gradle",
"selection": {
"end": {
"column": 23,
"index": 217,
"line": 13
},
"start": {
"column": 23,
"index": 217,
"line": 13
}
}
},
{
"file": "/storage/emulated/0/MoonLeaf/Projects/MndroLua/app/build.gradle",
"selection": {
"end": {
"column": 23,
"index": 391,
"line": 15
"index": 421,
"line": 16
},
"start": {
"column": 23,
"index": 391,
"line": 15
"index": 421,
"line": 16
}
}
}
Expand Down
34 changes: 6 additions & 28 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
android {
namespace 'io.github.moonleeeaf.androlua'
compileSdk 34
ndkVersion "20.1.5948944"

defaultConfig {
applicationId "io.github.moonleeeaf.androlua"
Expand All @@ -13,32 +14,16 @@ android {
// 然而我需要最低兼容 sdk21, Shizuku并非必须
// 本程序所生成的软件将不能提交给 Google play(至少和我没任何关系)
targetSdk 30
versionCode 30100
versionName "3.0.1"
versionCode 30200
versionName "3.0.2"

vectorDrawables {
useSupportLibrary true
}

// 目前暂时不需要用Android-IDE编译C代码
// 因此先用以前编译的代码

// AndLua原本编译的无法使用 string.dump
// 因此需要自己编译一份

/* ndk {
abiFilters 'armeabi-v7a'
} */
}

/*
// 该死的 为什么死活没有aidl编译过程
// 真tm该死 浪费半天时间
sourceSets {
main {
java.srcDirs = ['src/main/java', 'src/main/aidl']
}
}
*/

packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
Expand All @@ -61,19 +46,12 @@ android {
debuggable true
jniDebuggable true
}
debugMin {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'

debuggable true
jniDebuggable true
}
}
/* externalNativeBuild {
externalNativeBuild {
ndkBuild {
path 'src/main/jni/android.mk'
}
} */
}
productFlavors {
}
}
Expand Down
20 changes: 19 additions & 1 deletion app/src/main/assets/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ function onVersionChanged(n, o)
local dlg = MaterialDialog(activity)
local title = "欢迎回家~"
local msg = [[
MndroLua 3.0.2
也就加了个AboutDialog 属实是水了个版本()
另外移除了 jniLibs 取而代之的是编译 jni
MndroLua 3.0.1
UI调整: moon3.widget.Toolbar 使用更加接近 android.widget.Toolbar 的文字样式 :)
Expand Down Expand Up @@ -862,6 +866,9 @@ m = {
--[[{ MenuItem,
title = "联系作者",
id = "more_qq", },]]
{ MenuItem,
title = "更新日志",
id = "update_log", },
{ MenuItem,
title = "关于",
id = "more_about", },
Expand Down Expand Up @@ -1609,10 +1616,20 @@ func.qq = function()
joinQQGroup(key)
end

func.about = function()
func.update_log = function()
onVersionChanged("", "")
end

import "android.text.Html"

func.about = function()
local dialog = AboutDialog(this)
.updateInfo(this, true)
.setMoreInfo(Html.fromHtml("在 <a href='https://github.com/Crescent-of-Maya/MndroLua'>GitHub</a> 查看源码"))
dialog.MoreInfoView.MovementMethod = LinkMovementMethod.getInstance()
dialog.show()
end

func.fiximport = function()
save()
activity.newActivity("javaapi/fiximport", { luaproject, luapath })
Expand Down Expand Up @@ -1653,6 +1670,7 @@ function onMenuItemSelected(id, item)
[optmenu.more_manual] = func.manual,
[optmenu.more_donation] = func.donation,
--[optmenu.more_qq] = func.qq,
[optmenu.update_log] = func.update_log,
[optmenu.more_about] = func.about,
[optmenu.plugin] = func.plugin,
}
Expand Down
Binary file added app/src/main/jniLibs.zip
Binary file not shown.
Binary file removed app/src/main/jniLibs/arm64-v8a/libluajava.so
Binary file not shown.
Binary file removed app/src/main/jniLibs/armeabi-v7a/libluajava.so
Binary file not shown.
Binary file removed app/src/main/jniLibs/x86/libluajava.so
Binary file not shown.
Binary file removed app/src/main/jniLibs/x86_64/libluajava.so
Binary file not shown.
Binary file added app/src/main/jni_bak.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions moon3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
// applicationId "moon3"
minSdk 21
targetSdk 34
versionCode 20100
versionName "2.0.1"
versionCode 21000
versionName "2.1.0"

vectorDrawables {
useSupportLibrary true
Expand Down
86 changes: 86 additions & 0 deletions moon3/src/main/java/moon3/app/AboutDialog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package moon3.app;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.widget.ImageView;
import android.widget.TextView;

// 感谢:
// https://github.com/RikkaApps/Shizuku/blob/master/manager/src/main/java/moe/shizuku/manager/home/HomeActivity.kt
// https://github.com/RikkaApps/Shizuku/blob/master/manager/src/main/res/layout/about_dialog.xml
public class AboutDialog extends MaterialDialog {

public AboutDialog(Context context) {
this(context, 0);
}

public AboutDialog(Context context, int overrideThemeResId) {
super(context, overrideThemeResId);

setView(getLayoutInflater().inflate(moon3.R.layout.about_dialog_layout, null));
}

public AboutDialog setAppName(CharSequence appName) {
TextView v = getView().findViewById(moon3.R.id.app_name);
v.setText(appName);
return this;
}

public AboutDialog setAppIcon(Drawable icon) {
ImageView v = getView().findViewById(android.R.id.icon);
v.setImageDrawable(icon);
return this;
}

// Api:23
public AboutDialog setAppIcon(Icon icon) {
ImageView v = getView().findViewById(android.R.id.icon);
v.setImageIcon(icon);
return this;
}

public AboutDialog setAppIcon(Bitmap icon) {
ImageView v = getView().findViewById(android.R.id.icon);
v.setImageBitmap(icon);
return this;
}

public AboutDialog setVersionName(CharSequence versionName) {
TextView v = getView().findViewById(moon3.R.id.version_name);
v.setText(versionName);
return this;
}

public AboutDialog setMoreInfo(CharSequence moreInfo) {
TextView v = getMoreInfoView();
v.setText(moreInfo);
return this;
}

public TextView getMoreInfoView() {
return getView().findViewById(moon3.R.id.more_info);
}

public AboutDialog updateInfo(Context c) {
return updateInfo(c, false);
}

public AboutDialog updateInfo(Context c, boolean includeVersionCode) {
try {
PackageManager pm = c.getPackageManager();
PackageInfo info = pm.getPackageInfo(c.getPackageName(), 0);

setAppIcon(info.applicationInfo.loadIcon(pm));
setAppName(info.applicationInfo.loadLabel(pm));
setVersionName(info.versionName + (includeVersionCode ? " (" + info.versionCode + ")" : ""));
} catch(Exception e) {
e.printStackTrace();
}
return this;
}

}
44 changes: 44 additions & 0 deletions moon3/src/main/res/layout/about_dialog_layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:padding="?android:dialogPreferredPadding">

<ImageView
android:id="@android:id/icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:importantForAccessibility="no" />

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:orientation="vertical">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/app_name"
android:textAppearance="@android:style/TextAppearance.Material.Body1"
android:textSize="18sp" />

<TextView
android:id="@+id/version_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp" />

<TextView
android:id="@+id/more_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textColor="?android:textColorSecondary"
android:textSize="14sp" />

</LinearLayout>

</LinearLayout>

0 comments on commit af63790

Please sign in to comment.