Commit 51af905f authored by wanglei's avatar wanglei

...

parent 40c3bd0e
...@@ -5,6 +5,7 @@ import android.os.HandlerThread ...@@ -5,6 +5,7 @@ import android.os.HandlerThread
import com.base.scanqr.MyApplication import com.base.scanqr.MyApplication
import com.base.scanqr.bean.NotificationSendBean import com.base.scanqr.bean.NotificationSendBean
import com.base.scanqr.bean.config.PopupConfigBean.Companion.popupConfigBean import com.base.scanqr.bean.config.PopupConfigBean.Companion.popupConfigBean
import com.base.scanqr.utils.LogEx
/** /**
* 悬停通知 * 悬停通知
...@@ -23,8 +24,11 @@ object NotificationHoverUtils { ...@@ -23,8 +24,11 @@ object NotificationHoverUtils {
val hoverStatus = popupConfigBean.popupHoverStatus val hoverStatus = popupConfigBean.popupHoverStatus
val hoverCount = popupConfigBean.popupHoverCount val hoverCount = popupConfigBean.popupHoverCount
val hoverDelay = popupConfigBean.popupHoverDelay.toLong() val hoverDelay = popupConfigBean.popupHoverDelay.toLong()
LogEx.logDebug(TAG, "hoverStatus=$hoverStatus hoverCount=$hoverCount hoverDelay=$hoverDelay")
if (!hoverStatus) return if (!hoverStatus) return
stopNotificationHandler()
if (handlerThread == null) { if (handlerThread == null) {
handlerThread = HandlerThread("NotificationHandlerThread") handlerThread = HandlerThread("NotificationHandlerThread")
handlerThread?.start() handlerThread?.start()
...@@ -39,7 +43,7 @@ object NotificationHoverUtils { ...@@ -39,7 +43,7 @@ object NotificationHoverUtils {
for (i in 1..hoverCount) { for (i in 1..hoverCount) {
val time = i * hoverDelay val time = i * hoverDelay
handler?.postDelayed(Runnable { handler?.postDelayed({
// LogEx.logDebug(TAG, "handler ${MyApplication.PAUSED_VALUE}") // LogEx.logDebug(TAG, "handler ${MyApplication.PAUSED_VALUE}")
if (MyApplication.PAUSED_VALUE == 1) { if (MyApplication.PAUSED_VALUE == 1) {
handler?.removeCallbacksAndMessages(null) handler?.removeCallbacksAndMessages(null)
......
...@@ -34,8 +34,6 @@ object NotificationUiUtil { ...@@ -34,8 +34,6 @@ object NotificationUiUtil {
ACTION_ID_SCAN -> { ACTION_ID_SCAN -> {
sendBean.bigRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.stay_notification_big_scan) sendBean.bigRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.stay_notification_big_scan)
sendBean.smallRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.stay_notification_small_scan) sendBean.smallRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.stay_notification_small_scan)
} }
ACTION_ID_WIFI -> { ACTION_ID_WIFI -> {
...@@ -48,6 +46,9 @@ object NotificationUiUtil { ...@@ -48,6 +46,9 @@ object NotificationUiUtil {
smallRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_wifi) smallRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_wifi)
smallRemoteViews.setTextViewText(R.id.tvTitle, "Create wifi QR") smallRemoteViews.setTextViewText(R.id.tvTitle, "Create wifi QR")
smallRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own wifi QR cord and share it!") smallRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own wifi QR cord and share it!")
sendBean.bigRemoteViews = bigRemoteViews
sendBean.smallRemoteViews = smallRemoteViews
} }
ACTION_ID_TEXT -> { ACTION_ID_TEXT -> {
...@@ -60,6 +61,8 @@ object NotificationUiUtil { ...@@ -60,6 +61,8 @@ object NotificationUiUtil {
smallRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_text) smallRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_text)
smallRemoteViews.setTextViewText(R.id.tvTitle, "Create text QR") smallRemoteViews.setTextViewText(R.id.tvTitle, "Create text QR")
smallRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own text QR cord and share it!") smallRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own text QR cord and share it!")
sendBean.bigRemoteViews = bigRemoteViews
sendBean.smallRemoteViews = smallRemoteViews
} }
ACTION_ID_EMAIL -> { ACTION_ID_EMAIL -> {
...@@ -72,6 +75,9 @@ object NotificationUiUtil { ...@@ -72,6 +75,9 @@ object NotificationUiUtil {
smallRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_email) smallRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_email)
smallRemoteViews.setTextViewText(R.id.tvTitle, "Create email QR") smallRemoteViews.setTextViewText(R.id.tvTitle, "Create email QR")
smallRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own email QR cord and share it!") smallRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own email QR cord and share it!")
sendBean.bigRemoteViews = bigRemoteViews
sendBean.smallRemoteViews = smallRemoteViews
} }
ACTION_ID_WEBSITE -> { ACTION_ID_WEBSITE -> {
...@@ -84,6 +90,9 @@ object NotificationUiUtil { ...@@ -84,6 +90,9 @@ object NotificationUiUtil {
smallRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_email) smallRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_email)
smallRemoteViews.setTextViewText(R.id.tvTitle, "Create website QR") smallRemoteViews.setTextViewText(R.id.tvTitle, "Create website QR")
smallRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own website QR cord and share it!") smallRemoteViews.setTextViewText(R.id.tvDesc, "Try to create your own website QR cord and share it!")
sendBean.bigRemoteViews = bigRemoteViews
sendBean.smallRemoteViews = smallRemoteViews
} }
} }
......
...@@ -8,12 +8,21 @@ import com.base.scanqr.ads.AdsShowCallBack ...@@ -8,12 +8,21 @@ import com.base.scanqr.ads.AdsShowCallBack
import com.base.scanqr.base.BaseActivity import com.base.scanqr.base.BaseActivity
import com.base.scanqr.bean.ConstObject import com.base.scanqr.bean.ConstObject
import com.base.scanqr.bean.ConstObject.isFirstLauncher import com.base.scanqr.bean.ConstObject.isFirstLauncher
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_SCAN
import com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_STAY_SCAN import com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_STAY_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.databinding.ActivityStartBinding import com.base.scanqr.databinding.ActivityStartBinding
import com.base.scanqr.fcm.notification.NotificationHoverUtils
import com.base.scanqr.service.StayJobService.Companion.startJob import com.base.scanqr.service.StayJobService.Companion.startJob
import com.base.scanqr.ui.email.EmailActivity
import com.base.scanqr.ui.language.LanguageActivity import com.base.scanqr.ui.language.LanguageActivity
import com.base.scanqr.ui.main.MainActivity import com.base.scanqr.ui.main.MainActivity
import com.base.scanqr.ui.text.TextActivity
import com.base.scanqr.ui.website.WebsiteActivity
import com.base.scanqr.ui.wifi.WifiActivity
import com.base.scanqr.utils.LogEx import com.base.scanqr.utils.LogEx
import com.gyf.immersionbar.ktx.immersionBar import com.gyf.immersionbar.ktx.immersionBar
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
...@@ -31,6 +40,9 @@ class StartActivity : BaseActivity<ActivityStartBinding>(ActivityStartBinding::i ...@@ -31,6 +40,9 @@ class StartActivity : BaseActivity<ActivityStartBinding>(ActivityStartBinding::i
override fun initView() { override fun initView() {
super.initView() super.initView()
NotificationHoverUtils.stopNotificationHandler()
if (ConstObject.ifAgreePrivacy) { if (ConstObject.ifAgreePrivacy) {
agreePrivacy() agreePrivacy()
} }
...@@ -118,6 +130,34 @@ class StartActivity : BaseActivity<ActivityStartBinding>(ActivityStartBinding::i ...@@ -118,6 +130,34 @@ class StartActivity : BaseActivity<ActivityStartBinding>(ActivityStartBinding::i
}) })
} }
ACTION_ID_WIFI -> {
startActivity(Intent(this, WifiActivity::class.java).apply {
// putExtra("actionId", actionId)
// addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
})
}
ACTION_ID_TEXT -> {
startActivity(Intent(this, TextActivity::class.java).apply {
// putExtra("actionId", actionId)
// addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
})
}
ACTION_ID_EMAIL -> {
startActivity(Intent(this, EmailActivity::class.java).apply {
// putExtra("actionId", actionId)
// addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
})
}
ACTION_ID_WEBSITE -> {
startActivity(Intent(this, WebsiteActivity::class.java).apply {
// putExtra("actionId", actionId)
// addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
})
}
else -> { else -> {
startActivity(Intent(this, MainActivity::class.java).apply { startActivity(Intent(this, MainActivity::class.java).apply {
putExtra("actionId", actionId) putExtra("actionId", actionId)
......
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