Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
Updater: MiuiStringToast: Add PendingIntent usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
YuKongA committed Jan 10, 2024
1 parent e9927be commit 45fabac
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package top.yukonga.update.logic.utils.miuiStringToast
import android.annotation.SuppressLint
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.widget.Toast
Expand All @@ -18,6 +19,7 @@ import top.yukonga.update.logic.utils.miuiStringToast.res.Right
import top.yukonga.update.logic.utils.miuiStringToast.res.StringToastBean
import top.yukonga.update.logic.utils.miuiStringToast.res.StringToastBundle
import top.yukonga.update.logic.utils.miuiStringToast.res.TextParams
import top.yukonga.update.ui.MainActivity
import java.lang.reflect.InvocationTargetException

object MiuiStringToast {
Expand Down Expand Up @@ -52,8 +54,8 @@ object MiuiStringToast {
val str = gson.toJson(stringToastBean)
val bundle: Bundle = StringToastBundle.Builder()
.setPackageName(BuildConfig.APPLICATION_ID)
.setStrongToastCategory(StrongToastCategory.TEXT_BITMAP.value)
.setTarget(null as PendingIntent?)
.setStrongToastCategory(StrongToastCategory.TEXT_BITMAP_INTENT.value)
.setTarget(PendingIntent.getActivity(context, 0, Intent(context, MainActivity::class.java), PendingIntent.FLAG_IMMUTABLE))
.setDuration(2500L)
.setLevel(0.0f)
.setRapidRate(0.0f)
Expand Down

0 comments on commit 45fabac

Please sign in to comment.