diff --git a/mpmaster/.gitignore b/mpmaster/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/mpmaster/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/mpmaster/build.gradle b/mpmaster/build.gradle new file mode 100644 index 00000000..15925e7f --- /dev/null +++ b/mpmaster/build.gradle @@ -0,0 +1,38 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 32 + + defaultConfig { + applicationId "com.xypower.mpmaster" + minSdk 28 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.3.0' + implementation 'com.google.android.material:material:1.4.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/mpmaster/proguard-rules.pro b/mpmaster/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/mpmaster/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/mpmaster/src/main/AndroidManifest.xml b/mpmaster/src/main/AndroidManifest.xml new file mode 100644 index 00000000..a59fbf69 --- /dev/null +++ b/mpmaster/src/main/AndroidManifest.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/MainActivity.java b/mpmaster/src/main/java/com/xypower/mpmaster/MainActivity.java new file mode 100644 index 00000000..9ffe7744 --- /dev/null +++ b/mpmaster/src/main/java/com/xypower/mpmaster/MainActivity.java @@ -0,0 +1,14 @@ +package com.xypower.mpmaster; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } +} \ No newline at end of file diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/UpdateReceiver.java b/mpmaster/src/main/java/com/xypower/mpmaster/UpdateReceiver.java new file mode 100644 index 00000000..1c097dee --- /dev/null +++ b/mpmaster/src/main/java/com/xypower/mpmaster/UpdateReceiver.java @@ -0,0 +1,50 @@ +package com.xypower.mpmaster; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +// import com.dev.devapi.api.SysApi; + +public class UpdateReceiver extends BroadcastReceiver { + + private static final String TAG = UpdateReceiver.class.getSimpleName(); + + private static final String APP_PACKAGE_MPMASTER = "com.xypower.mpapp"; + + @Override + public void onReceive(Context context, Intent intent) { + String packageName = intent.getDataString(); + + packageChanged(context, intent.getAction(), packageName, APP_PACKAGE_MPMASTER); + packageChanged(context, intent.getAction(), packageName, context.getPackageName()); + } + + private void packageChanged(Context context, String action, String packageName, String targetPackageName) { + if (action.equals(Intent.ACTION_PACKAGE_REPLACED)) { // Upgrade Broadcast + Log.e(TAG, "onReceive:Upgraded and Restart the App:" + targetPackageName); + if (packageName.equals("package:" + targetPackageName)) { + // SysApi.enableApp(context, targetPackageName); + restartAPP(context, targetPackageName); + } + } else if (action.equals(Intent.ACTION_PACKAGE_ADDED)) {// Install broadcast + Log.e(TAG, "onReceive:Installed and Start the App:" + targetPackageName); + if (packageName.equals("package:" + targetPackageName)) { + /*SystemUtil.reBootDevice();*/ + // SysApi.enableApp(context, targetPackageName); + restartAPP(context, targetPackageName); + } + } else if (action.equals(Intent.ACTION_PACKAGE_REMOVED)) { // Uninstall + // Logger.e(TAG, "onReceive:uninstall" + packageName); + } + } + + public static void restartAPP(Context context, String packageName) { + Intent intent = context.getPackageManager() + .getLaunchIntentForPackage(packageName); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + context.startActivity(intent); + // ActManager.getAppManager().finishAllActivity(); + } +} \ No newline at end of file diff --git a/mpmaster/src/main/res/drawable-v24/ic_launcher_foreground.xml b/mpmaster/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/mpmaster/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/mpmaster/src/main/res/drawable/ic_launcher_background.xml b/mpmaster/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/mpmaster/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mpmaster/src/main/res/layout/activity_main.xml b/mpmaster/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..17eab17b --- /dev/null +++ b/mpmaster/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/mpmaster/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/mpmaster/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/mpmaster/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/mpmaster/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/mpmaster/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/mpmaster/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/mpmaster/src/main/res/mipmap-hdpi/ic_launcher.webp b/mpmaster/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 00000000..c209e78e Binary files /dev/null and b/mpmaster/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/mpmaster/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/mpmaster/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 00000000..b2dfe3d1 Binary files /dev/null and b/mpmaster/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/mpmaster/src/main/res/mipmap-mdpi/ic_launcher.webp b/mpmaster/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 00000000..4f0f1d64 Binary files /dev/null and b/mpmaster/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/mpmaster/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/mpmaster/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 00000000..62b611da Binary files /dev/null and b/mpmaster/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/mpmaster/src/main/res/mipmap-xhdpi/ic_launcher.webp b/mpmaster/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 00000000..948a3070 Binary files /dev/null and b/mpmaster/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/mpmaster/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/mpmaster/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..1b9a6956 Binary files /dev/null and b/mpmaster/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/mpmaster/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/mpmaster/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 00000000..28d4b77f Binary files /dev/null and b/mpmaster/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/mpmaster/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/mpmaster/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9287f508 Binary files /dev/null and b/mpmaster/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/mpmaster/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/mpmaster/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 00000000..aa7d6427 Binary files /dev/null and b/mpmaster/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/mpmaster/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/mpmaster/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9126ae37 Binary files /dev/null and b/mpmaster/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/mpmaster/src/main/res/values-night/themes.xml b/mpmaster/src/main/res/values-night/themes.xml new file mode 100644 index 00000000..2721e52c --- /dev/null +++ b/mpmaster/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/mpmaster/src/main/res/values/colors.xml b/mpmaster/src/main/res/values/colors.xml new file mode 100644 index 00000000..f8c6127d --- /dev/null +++ b/mpmaster/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/mpmaster/src/main/res/values/strings.xml b/mpmaster/src/main/res/values/strings.xml new file mode 100644 index 00000000..2b4e2255 --- /dev/null +++ b/mpmaster/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + MpMaster + \ No newline at end of file diff --git a/mpmaster/src/main/res/values/themes.xml b/mpmaster/src/main/res/values/themes.xml new file mode 100644 index 00000000..30b6a07d --- /dev/null +++ b/mpmaster/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/mpmaster/src/main/res/xml/backup_rules.xml b/mpmaster/src/main/res/xml/backup_rules.xml new file mode 100644 index 00000000..fa0f996d --- /dev/null +++ b/mpmaster/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/mpmaster/src/main/res/xml/data_extraction_rules.xml b/mpmaster/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 00000000..9ee9997b --- /dev/null +++ b/mpmaster/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index a616bed1..28f50470 100644 --- a/settings.gradle +++ b/settings.gradle @@ -16,4 +16,5 @@ rootProject.name = "MicroPhoto" include ':app' // include ':opencv' -// project(':opencv').projectDir = new File(opencvsdk + '/sdk') \ No newline at end of file +// project(':opencv').projectDir = new File(opencvsdk + '/sdk') +include ':mpmaster'