From e153f3e3b9e98a88bc469f72c35862f6c0ee8770 Mon Sep 17 00:00:00 2001
From: lvmeng <848755140@qq.com>
Date: Fri, 22 Aug 2025 17:34:56 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=80=E6=9C=BA=E5=90=AF?=
=?UTF-8?q?=E5=8A=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/build.gradle.kts | 8 ++++++++
app/src/main/AndroidManifest.xml | 11 +++++++++++
.../java/com/shuwei/intelligent/shelves/App.kt | 5 +++++
.../intelligent/shelves/utils/BootReceiver.kt | 18 ++++++++++++++++++
.../activity_base.xml | 0
.../activity_home.xml | 0
.../activity_shelf.xml | 0
.../custom_toast.xml | 0
.../dialog_loading.xml | 0
.../layout_empty_view.xml | 0
.../list_item_search.xml | 0
.../list_item_shelf.xml | 0
12 files changed, 42 insertions(+)
create mode 100644 app/src/main/java/com/shuwei/intelligent/shelves/utils/BootReceiver.kt
rename app/src/main/res/{layout-sw360dp => layout}/activity_base.xml (100%)
rename app/src/main/res/{layout-sw360dp => layout}/activity_home.xml (100%)
rename app/src/main/res/{layout-sw360dp => layout}/activity_shelf.xml (100%)
rename app/src/main/res/{layout-sw360dp => layout}/custom_toast.xml (100%)
rename app/src/main/res/{layout-sw360dp => layout}/dialog_loading.xml (100%)
rename app/src/main/res/{layout-sw360dp => layout}/layout_empty_view.xml (100%)
rename app/src/main/res/{layout-sw360dp => layout}/list_item_search.xml (100%)
rename app/src/main/res/{layout-sw360dp => layout}/list_item_shelf.xml (100%)
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