diff --git a/.idea/misc.xml b/.idea/misc.xml index 2048392..e4bca2a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -14,6 +14,7 @@ + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 797182f..0ae4838 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,7 +5,6 @@ - + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/fankes/miui/notify/service/QuickStartTileService.kt b/app/src/main/java/com/fankes/miui/notify/service/QuickStartTileService.kt new file mode 100644 index 0000000..150de8c --- /dev/null +++ b/app/src/main/java/com/fankes/miui/notify/service/QuickStartTileService.kt @@ -0,0 +1,36 @@ +/* + * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. + * Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com) + * https://github.com/fankes/MIUINativeNotifyIcon + * + * This software is non-free but opensource software: you can redistribute it + * and/or modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + *

+ * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * and eula along with this software. If not, see + * + * + * This file is Created by fankes on 2022/3/26. + */ +package com.fankes.miui.notify.service + +import android.service.quicksettings.TileService +import com.fankes.miui.notify.ui.activity.ConfigureActivity +import com.fankes.miui.notify.utils.factory.navigate + +class QuickStartTileService : TileService() { + + override fun onClick() { + super.onClick() + /** 启动通知图标优化列表窗口 */ + navigate() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fankes/miui/notify/utils/factory/FunctionFactory.kt b/app/src/main/java/com/fankes/miui/notify/utils/factory/FunctionFactory.kt index d993f13..edd783e 100644 --- a/app/src/main/java/com/fankes/miui/notify/utils/factory/FunctionFactory.kt +++ b/app/src/main/java/com/fankes/miui/notify/utils/factory/FunctionFactory.kt @@ -26,6 +26,7 @@ package com.fankes.miui.notify.utils.factory import android.app.Activity import android.app.Notification +import android.app.Service import android.content.ClipData import android.content.ClipboardManager import android.content.Context @@ -377,7 +378,15 @@ fun toast(msg: String) = Toast.makeText(appContext, msg, Toast.LENGTH_SHORT).sho * * [T] 为指定的 [Activity] */ -inline fun Context.navigate() = startActivity(Intent(this, T::class.java)) +inline fun Context.navigate() = runInSafe { startActivity(Intent(this, T::class.java)) } + +/** + * 跳转到指定页面 + * + * [T] 为指定的 [Activity] + */ +inline fun Service.navigate() = + runInSafe { startActivity(Intent(this, T::class.java).apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK }) } /** * 弹出 [Snackbar] diff --git a/app/src/main/res/drawable/ic_notify_icon.xml b/app/src/main/res/drawable/ic_notify_icon.xml index 30a3a2b..28818a5 100644 --- a/app/src/main/res/drawable/ic_notify_icon.xml +++ b/app/src/main/res/drawable/ic_notify_icon.xml @@ -3,7 +3,7 @@ android:height="150dp" android:viewportWidth="1024" android:viewportHeight="1024"> - + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ae9b782..6697c8f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,3 +1,4 @@ MIUI 原生通知图标 + 通知图标 \ No newline at end of file