diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7e7bcec..56012fd 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -4,6 +4,14 @@ plugins { } android { + signingConfigs { + getByName("debug") { + storeFile = file("../app/swkey.jks") + storePassword = "123456" + keyPassword = "123456" + keyAlias = "android" + } + } namespace = "com.shuwei.intelligent.shelves" compileSdk = 34 diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a4006df..ddfff75 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,6 +9,8 @@ android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" /> + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/shuwei/intelligent/shelves/App.kt b/app/src/main/java/com/shuwei/intelligent/shelves/App.kt index b9a3cf6..5f3e382 100644 --- a/app/src/main/java/com/shuwei/intelligent/shelves/App.kt +++ b/app/src/main/java/com/shuwei/intelligent/shelves/App.kt @@ -1,6 +1,9 @@ package com.shuwei.intelligent.shelves import android.app.Application +import android.content.Intent +import android.content.IntentFilter +import com.shuwei.intelligent.shelves.utils.BootReceiver /** * @author: star @@ -18,6 +21,8 @@ class App : Application() { override fun onCreate() { super.onCreate() app = this + val filter = IntentFilter(Intent.ACTION_BOOT_COMPLETED) + registerReceiver(BootReceiver(), filter) } companion object { diff --git a/app/src/main/java/com/shuwei/intelligent/shelves/utils/BootReceiver.kt b/app/src/main/java/com/shuwei/intelligent/shelves/utils/BootReceiver.kt new file mode 100644 index 0000000..63e8c0d --- /dev/null +++ b/app/src/main/java/com/shuwei/intelligent/shelves/utils/BootReceiver.kt @@ -0,0 +1,18 @@ +package com.shuwei.intelligent.shelves.utils + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import com.shuwei.intelligent.shelves.HomeActivity +import kotlin.jvm.java + +class BootReceiver : BroadcastReceiver() { + override fun onReceive(context: Context, intent: Intent) { + if (Intent.ACTION_BOOT_COMPLETED == intent.action) { + // 启动服务或Activity + val launchIntent = Intent(context, HomeActivity::class.java) + launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + context.startActivity(launchIntent) + } + } +} diff --git a/app/src/main/res/layout-sw360dp/activity_base.xml b/app/src/main/res/layout/activity_base.xml similarity index 100% rename from app/src/main/res/layout-sw360dp/activity_base.xml rename to app/src/main/res/layout/activity_base.xml diff --git a/app/src/main/res/layout-sw360dp/activity_home.xml b/app/src/main/res/layout/activity_home.xml similarity index 100% rename from app/src/main/res/layout-sw360dp/activity_home.xml rename to app/src/main/res/layout/activity_home.xml diff --git a/app/src/main/res/layout-sw360dp/activity_shelf.xml b/app/src/main/res/layout/activity_shelf.xml similarity index 100% rename from app/src/main/res/layout-sw360dp/activity_shelf.xml rename to app/src/main/res/layout/activity_shelf.xml diff --git a/app/src/main/res/layout-sw360dp/custom_toast.xml b/app/src/main/res/layout/custom_toast.xml similarity index 100% rename from app/src/main/res/layout-sw360dp/custom_toast.xml rename to app/src/main/res/layout/custom_toast.xml diff --git a/app/src/main/res/layout-sw360dp/dialog_loading.xml b/app/src/main/res/layout/dialog_loading.xml similarity index 100% rename from app/src/main/res/layout-sw360dp/dialog_loading.xml rename to app/src/main/res/layout/dialog_loading.xml diff --git a/app/src/main/res/layout-sw360dp/layout_empty_view.xml b/app/src/main/res/layout/layout_empty_view.xml similarity index 100% rename from app/src/main/res/layout-sw360dp/layout_empty_view.xml rename to app/src/main/res/layout/layout_empty_view.xml diff --git a/app/src/main/res/layout-sw360dp/list_item_search.xml b/app/src/main/res/layout/list_item_search.xml similarity index 100% rename from app/src/main/res/layout-sw360dp/list_item_search.xml rename to app/src/main/res/layout/list_item_search.xml diff --git a/app/src/main/res/layout-sw360dp/list_item_shelf.xml b/app/src/main/res/layout/list_item_shelf.xml similarity index 100% rename from app/src/main/res/layout-sw360dp/list_item_shelf.xml rename to app/src/main/res/layout/list_item_shelf.xml