Commit 40c3bd0e authored by wanglei's avatar wanglei

...

parent 11e5ed70
......@@ -3,7 +3,11 @@ package com.base.scanqr.fcm.notification
import android.content.Context
import com.base.scanqr.BuildConfig
import com.base.scanqr.bean.NotificationSendBean
import com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_EMAIL
import com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_SCAN
import com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_TEXT
import com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_WEBSITE
import com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_WIFI
import com.base.scanqr.bean.NotificationSendBean.Companion.POPUP_WHERE_LOCK
import com.base.scanqr.bean.config.PopupConfigBean.Companion.popupConfigBean
import com.base.scanqr.helper.EventUtils
......@@ -31,6 +35,10 @@ object NotificationManager {
private val looper_actionId = listOf(
ACTION_ID_SCAN,
ACTION_ID_WIFI,
ACTION_ID_TEXT,
ACTION_ID_EMAIL,
ACTION_ID_WEBSITE,
)
private var actionIdList = arrayListOf<String>()
......
......@@ -13,7 +13,11 @@ import androidx.core.graphics.drawable.IconCompat
import com.base.scanqr.MyApplication
import com.base.scanqr.R
import com.base.scanqr.bean.NotificationSendBean
import com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_EMAIL
import com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_SCAN
import com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_TEXT
import com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_WEBSITE
import com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_WIFI
import com.base.scanqr.ui.start.StartActivity
import kotlin.random.Random
......@@ -31,12 +35,63 @@ object NotificationUiUtil {
sendBean.bigRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.stay_notification_big_scan)
sendBean.smallRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.stay_notification_small_scan)
val intent = Intent(sendBean.context, StartActivity::class.java)
intent.putExtra("actionId", sendBean.actionId)
sendBean.intent = intent
}
ACTION_ID_WIFI -> {
val bigRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.stay_notification_big_function)
val smallRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.stay_notification_small_function)
bigRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_wifi)
bigRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own wifi QR cord and share it!")
smallRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_wifi)
smallRemoteViews.setTextViewText(R.id.tvTitle, "Create wifi QR")
smallRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own wifi QR cord and share it!")
}
ACTION_ID_TEXT -> {
val bigRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.stay_notification_big_function)
val smallRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.stay_notification_small_function)
bigRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_text)
bigRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own text QR cord and share it!")
smallRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_text)
smallRemoteViews.setTextViewText(R.id.tvTitle, "Create text QR")
smallRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own text QR cord and share it!")
}
ACTION_ID_EMAIL -> {
val bigRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.stay_notification_big_function)
val smallRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.stay_notification_small_function)
bigRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_email)
bigRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own email QR cord and share it!")
smallRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_email)
smallRemoteViews.setTextViewText(R.id.tvTitle, "Create email QR")
smallRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own email QR cord and share it!")
}
ACTION_ID_WEBSITE -> {
val bigRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.stay_notification_big_function)
val smallRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.stay_notification_small_function)
bigRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_website)
bigRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own website QR cord and share it!")
smallRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_email)
smallRemoteViews.setTextViewText(R.id.tvTitle, "Create website QR")
smallRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own website QR cord and share it!")
}
}
val intent = Intent(sendBean.context, StartActivity::class.java)
intent.putExtra("actionId", sendBean.actionId)
sendBean.intent = intent
sendCustomNotification(sendBean)
}
......
......@@ -12,11 +12,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:src="@mipmap/h_wifi"
tools:ignore="ContentDescription" />
tools:ignore="ContentDescription"
tools:src="@mipmap/h_wifi" />
<TextView
android:id="@+id/tv_desc"
android:id="@+id/tvDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment