添加通知栏打开主窗口功能
This commit is contained in:
		| @@ -1,8 +1,8 @@ | ||||
| #Created by .winboll/winboll_app_build.gradle | ||||
| #Tue May 06 11:27:46 HKT 2025 | ||||
| #Tue May 06 03:32:02 GMT 2025 | ||||
| stageCount=2 | ||||
| libraryProject= | ||||
| baseVersion=15.0 | ||||
| publishVersion=15.0.1 | ||||
| buildCount=0 | ||||
| buildCount=1 | ||||
| baseBetaVersion=15.0.2 | ||||
|   | ||||
| @@ -5,17 +5,19 @@ package cc.winboll.studio.timestamp.utils; | ||||
|  * @Date 2025/05/05 21:10 | ||||
|  * @Describe TimeStampRemoteViewsUtil | ||||
|  */ | ||||
| import android.app.Notification; | ||||
| import android.app.NotificationChannel; | ||||
| import android.app.NotificationManager; | ||||
| import android.app.PendingIntent; | ||||
| import android.content.Context; | ||||
| import android.content.Intent; | ||||
| import android.os.Build; | ||||
| import android.widget.RemoteViews; | ||||
| import android.widget.TextView; | ||||
| import androidx.core.app.NotificationCompat; | ||||
| import cc.winboll.studio.timestamp.MainActivity; | ||||
| import cc.winboll.studio.timestamp.R; | ||||
| import cc.winboll.studio.timestamp.receivers.ButtonClickReceiver; | ||||
| import android.app.Notification; | ||||
|  | ||||
| public class TimeStampRemoteViewsUtil { | ||||
|  | ||||
| @@ -66,10 +68,10 @@ public class TimeStampRemoteViewsUtil { | ||||
|         // 这里虽然不能直接设置字体大小,但可以通过反射等方式尝试(不推荐,且有兼容性问题) | ||||
|          | ||||
|         // 创建点击通知后的意图 | ||||
|         //Intent intent = new Intent(mContext, MainActivity.class); | ||||
|         //PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); | ||||
|         Intent intent = new Intent(mContext, MainActivity.class); | ||||
|         PendingIntent pendingMainIntent = PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); | ||||
|         // 设置通知的点击事件 | ||||
|         //mRemoteViews.setOnClickPendingIntent(R.id.btn_copytimestamp, pendingIntent); | ||||
|         mRemoteViews.setOnClickPendingIntent(R.id.tv_timestamp, pendingMainIntent); | ||||
|          | ||||
|         // 创建点击按钮后要发送的广播 Intent | ||||
|         Intent broadcastIntent = new Intent(ButtonClickReceiver.BUTTON_COPYTIMESTAMP_ACTION); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 ZhanGSKen
					ZhanGSKen