code style opt, reduce build time : 1m30s
This commit is contained in:
@@ -37,8 +37,7 @@ class PushRepository(mContext: Context) {
|
||||
PushRepository(appContext)
|
||||
}
|
||||
|
||||
@JvmField
|
||||
val TAG: String = "PushRepository.kt"
|
||||
private const val TAG: String = "PushRepository.kt"
|
||||
}
|
||||
|
||||
// 被中断的push消息仅再次展示一次
|
||||
@@ -74,13 +73,13 @@ class PushRepository(mContext: Context) {
|
||||
Log.d("PushRepository", "pushBean = $bean")
|
||||
if (bean != null) {
|
||||
AnalyticsUtils.track(Config.NEWS_ARRIVE, "title", bean.title)
|
||||
if (bean.mainSchema == null || bean.mainSchema == "") {
|
||||
if (bean.mainSchema.isBlank()) {
|
||||
bean.mainSchema = ""
|
||||
}
|
||||
if (bean.imageUrl == null || bean.imageUrl == "null") {
|
||||
if (bean.imageUrl.isBlank()) {
|
||||
bean.imageUrl = ""
|
||||
}
|
||||
if (bean.appIcon == null || bean.appIcon == "null") {
|
||||
if (bean.appIcon.isBlank()) {
|
||||
bean.appIcon = ""
|
||||
}
|
||||
pushBeanQueue.offer(bean)
|
||||
@@ -144,10 +143,7 @@ class PushRepository(mContext: Context) {
|
||||
startIterate()
|
||||
}
|
||||
|
||||
private inline fun needDelay(bean: PushBean): Boolean {
|
||||
if (bean == null) {
|
||||
return false
|
||||
}
|
||||
private fun needDelay(bean: PushBean): Boolean {
|
||||
if (locationClient.lastKnowLocation != null) {
|
||||
if (bean.speedLimit > 0 && bean.speedLimit <= locationClient.lastKnowLocation.speed * 18 / 5) {
|
||||
Log.d("PushRepository", "speedLimit" + locationClient.lastKnowLocation.speed)
|
||||
|
||||
@@ -6,12 +6,12 @@ import androidx.core.view.get
|
||||
import androidx.core.view.isNotEmpty
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
val TAG: String = "AnimatorUtils.kt"
|
||||
const val TAG: String = "AnimatorUtils.kt"
|
||||
|
||||
fun startClearAnimator(root: ViewGroup, runnable: Runnable) {
|
||||
if (root.isNotEmpty()) {
|
||||
var view: View
|
||||
var size = root.childCount - 1
|
||||
val size = root.childCount - 1
|
||||
for (i in size downTo 0) {
|
||||
view = root[i]
|
||||
view.animate().translationX(-view.width.toFloat()).apply {
|
||||
@@ -27,7 +27,7 @@ fun startClearAnimator(root: ViewGroup, runnable: Runnable) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
runnable?.apply {
|
||||
runnable.apply {
|
||||
run()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class FloatView constructor(
|
||||
fun inflateView(@LayoutRes layoutId: Int)
|
||||
}
|
||||
|
||||
open abstract inner class PushView(context: Context) : FrameLayout(context),
|
||||
abstract inner class PushView(context: Context) : FrameLayout(context),
|
||||
PushViewController {
|
||||
lateinit var appIcon: ImageView
|
||||
lateinit var titleIconContainer: View
|
||||
@@ -95,7 +95,7 @@ class FloatView constructor(
|
||||
|
||||
fun hasButtons(bean: PushBean?): Boolean {
|
||||
bean?.buttons?.forEach {
|
||||
if (!it?.text?.isNullOrEmpty()) {
|
||||
if (!it.text?.isNullOrEmpty()) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.util.Log
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.module.push.Config
|
||||
import com.zhidao.auto.platform.voice.VoiceClient
|
||||
import com.mogo.module.push.model.PushBean
|
||||
import com.mogo.module.push.repository.PushRepository
|
||||
import com.mogo.module.push.utils.AnalyticsUtils
|
||||
@@ -119,8 +118,8 @@ class PushViewModel(
|
||||
}
|
||||
field?.showTimeoutShadow = field?.showTimeout?:0
|
||||
Log.d("yilz", "pushbean = $value")
|
||||
if (value != null && value!!.imageUrl == null) {
|
||||
value!!.imageUrl = ""
|
||||
if (value.imageUrl.isBlank()) {
|
||||
value.imageUrl = ""
|
||||
}
|
||||
if (floatView == null) {
|
||||
floatView = FloatView(this, mContext)
|
||||
|
||||
Reference in New Issue
Block a user