Commit 81cfccd2 authored by wanglei's avatar wanglei

...地震

parent 8a60c675
......@@ -38,6 +38,7 @@ class NotificationSendBean(
const val ACTION_ID_WEBSITE = "action_id_website"
const val ACTION_ID_CLEAN_JUNK = "action_id_clean_junk"
const val ACTION_ID_WEATHER = "action_id_weather"
const val ACTION_ID_WEATHER_2 = "action_id_weather_2"
const val ACTION_ID_APP_PROCESS = "action_id_app_process"
const val ACTION_ID_WHATSAPP = "action_id_whatsapp"
const val ACTION_ID_SCREEN_SHORT = "action_id_screen_short"
......
......@@ -15,6 +15,7 @@ import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_SCREEN
import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_SIMILAR
import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_TEXT
import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_WEATHER
import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_WEATHER_2
import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_WEBSITE
import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_WHATSAPP
import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_WIFI
......@@ -51,6 +52,20 @@ object MyNotificationManager {
private var sendBeanBlockingQueue = ArrayBlockingQueue<NotificationSendBean>(10)
/**
* 只测某些类型
*/
private var testWhere = listOf(
POPUP_WHERE_LOCK,
// POPUP_WHERE_BATTERY,
// POPUP_WHERE_PACKAGE,
// POPUP_WHERE_WORK_MANAGER,
// POPUP_WHERE_ALARM,
// POPUP_WHERE_TIMER,
// POPUP_WHERE_FILE_JOB,
// POPUP_WHERE_FCM
)
private val looper_actionId = listOf(
ACTION_ID_SCAN,
ACTION_ID_WIFI,
......@@ -65,6 +80,7 @@ object MyNotificationManager {
ACTION_ID_SIMILAR,
ACTION_ID_CONSTELLATION,
ACTION_ID_EARTHQUAKE,
ACTION_ID_WEATHER_2,
)
private var actionIdList = arrayListOf<String>()
......@@ -75,7 +91,7 @@ object MyNotificationManager {
val next = actionIdList[0]
actionIdList.removeAt(0)
if (BuildConfig.DEBUG) {
return ACTION_ID_EARTHQUAKE
return ACTION_ID_WEATHER_2
}
return next
}
......@@ -227,17 +243,5 @@ object MyNotificationManager {
return true
}
/**
* 只测某些类型
*/
private var testWhere = listOf(
POPUP_WHERE_LOCK,
// POPUP_WHERE_BATTERY,
// POPUP_WHERE_PACKAGE,
// POPUP_WHERE_WORK_MANAGER,
// POPUP_WHERE_ALARM,
// POPUP_WHERE_TIMER,
// POPUP_WHERE_FILE_JOB,
// POPUP_WHERE_FCM
)
}
\ No newline at end of file
......@@ -26,6 +26,7 @@ import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_SCREEN
import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_SIMILAR
import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_TEXT
import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_WEATHER
import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_WEATHER_2
import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_WEBSITE
import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_WHATSAPP
import com.base.scanqrclear.bean.NotificationSendBean.Companion.ACTION_ID_WIFI
......@@ -264,6 +265,43 @@ object NotificationUiUtil {
sendBean.bigRemoteViews = bigRemoteViews
}
ACTION_ID_WEATHER_2 -> {
val weatherBean: WeatherBean = WeatherUtils.getWeatherEntity() ?: return
if (weatherBean.list.isEmpty()) return
val smallRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.stay_notification_small_function)
val bigRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.notification_style_new)
val btnList = listOf(
"Tap to check!",
"Tap to find out!",
"Tap to discover!"
)
val wenAnList = listOf(
Pair("Rain or snow for some", "but sunny skies for many. How about $?"),
Pair("Rain or snow forecast for some", "but sunshine for many. What’s $ like?"),
Pair("Rain or snow for some", "but sunny days for many. What’s $ like?"),
)
val wenAn = wenAnList.random()
smallRemoteViews.setImageViewResource(R.id.ivIcon, R.mipmap.h_weather)
smallRemoteViews.setTextViewText(R.id.tvTitle, wenAn.first)
smallRemoteViews.setTextViewText(
R.id.tvDesc,
wenAn.second.replace("$", weatherBean.city)
)
bigRemoteViews.setImageViewResource(R.id.iv, R.mipmap.h_weather)
bigRemoteViews.setTextViewText(R.id.tvTitle, wenAn.first)
bigRemoteViews.setTextViewText(
R.id.tvDesc,
wenAn.second.replace("$", weatherBean.city)
)
sendBean.smallRemoteViews = smallRemoteViews
sendBean.bigRemoteViews = bigRemoteViews
}
}
......
......@@ -44,18 +44,13 @@ class HistoryFragment : BaseFragment<FragmentHistoryBinding>(FragmentHistoryBind
override fun initView() {
super.initView()
binding.flTop.updatePadding(top = BarUtils.getStatusBarHeight())
if (adsConfigBean.historyShowNative) {
AdsMgr.showNative(binding.flAd, R.layout.layout_admob_item)
} else {
binding.flAd.visibility = View.GONE
}
}
override fun onResumeOneShoot() {
super.onResumeOneShoot()
initAdapter()
viewModel.initData()
}
private fun initAdapter() {
......@@ -211,8 +206,20 @@ class HistoryFragment : BaseFragment<FragmentHistoryBinding>(FragmentHistoryBind
uiRefresh.invoke()
} else {
viewModel.dataRefreshBack = {
requireActivity().runOnUiThread {
val activity = requireActivity() as MainActivity?
activity?.runOnUiThread {
uiRefresh.invoke()
if (adsConfigBean.historyShowNative) {
if (viewModel.showHistoryTabNative()) {
binding.flAd.visibility = View.VISIBLE
AdsMgr.showNative(binding.flAd, R.layout.layout_admob_item)
} else {
binding.flAd.visibility = View.GONE
}
} else {
binding.flAd.visibility = View.GONE
}
}
}
}
......
......@@ -9,6 +9,8 @@ import com.base.scanqrclear.bean.FunctionUIBean
import com.base.scanqrclear.bean.MessageUIBean
import com.base.scanqrclear.bean.ProductUIBean
import com.base.scanqrclear.bean.ScanBean
import com.base.scanqrclear.bean.ScanBean.Companion.CREATE_TYPE_SCAN
import com.base.scanqrclear.bean.ScanBean.Companion.CREATE_TYPE_USER
import com.base.scanqrclear.bean.TelephoneUIBean
import com.base.scanqrclear.bean.TextUIBean
import com.base.scanqrclear.bean.WebsiteUIBean
......@@ -24,6 +26,12 @@ class HistoryViewModel() : ViewModel() {
var historyList = arrayListOf<ScanBean>()
fun showHistoryTabNative(): Boolean {
return historyList.filter { it.createType == CREATE_TYPE_USER }.size < 3 &&
historyList.filter { it.createType == CREATE_TYPE_SCAN }.size < 3
}
var dataRefreshFinish = AtomicBoolean(false)
var dataRefreshBack: (() -> Unit)? = null
......
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