From 2d37a734e657554c60183984ca0ac60d08db6083 Mon Sep 17 00:00:00 2001 From: Raymond Yang Date: Thu, 3 Aug 2023 12:41:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=87=AA=E8=A8=82=E5=9C=96?= =?UTF-8?q?=E7=89=87UI=E8=B3=87=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../floatingwindow/utils/PreferenceUtil.kt | 5 +++++ app/src/main/res/layout/activity_setting.xml | 19 +++++++++++++++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 25 insertions(+) diff --git a/app/src/main/java/com/ray650128/floatingwindow/utils/PreferenceUtil.kt b/app/src/main/java/com/ray650128/floatingwindow/utils/PreferenceUtil.kt index f4a9390..a696e38 100644 --- a/app/src/main/java/com/ray650128/floatingwindow/utils/PreferenceUtil.kt +++ b/app/src/main/java/com/ray650128/floatingwindow/utils/PreferenceUtil.kt @@ -14,6 +14,7 @@ object PreferenceUtil { private const val Y_AXIS_OFFSET = "Y_AXIS_OFFSET" private const val GRAVITY = "GRAVITY" private const val ICON = "ICON" + private const val ICON_PATH = "ICON_PATH" private val sharedPreferences = MyApp.appContext.getSharedPreferences(MAIN_KEY, Context.MODE_PRIVATE) @@ -32,4 +33,8 @@ object PreferenceUtil { var icon: Int get() = sharedPreferences.getInt(ICON, R.drawable.ic_chicken) set(value) = sharedPreferences.edit().putInt(ICON, value).apply() + + var iconPath: String? + get() = sharedPreferences.getString(ICON_PATH, "") + set(value) = sharedPreferences.edit().putString(ICON_PATH, value).apply() } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_setting.xml b/app/src/main/res/layout/activity_setting.xml index 6f5da0b..da0ab2f 100644 --- a/app/src/main/res/layout/activity_setting.xml +++ b/app/src/main/res/layout/activity_setting.xml @@ -129,4 +129,23 @@ app:layout_constraintStart_toEndOf="@+id/textView7" app:layout_constraintTop_toBottomOf="@+id/edYOffset" /> + + +