[状态栏]由单排改成双排
[状态栏]由单排改成双排 [状态栏]xxxx [状态栏]xxxx
This commit is contained in:
@@ -3,7 +3,7 @@ package com.zhjt.mogo_core_function_devatools
|
|||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.view.View
|
import android.view.*
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||||
import com.mogo.eagle.core.data.deva.chain.ChainLogParam
|
import com.mogo.eagle.core.data.deva.chain.ChainLogParam
|
||||||
@@ -102,12 +102,12 @@ class DevaToolsProvider : IDevaToolsProvider {
|
|||||||
upgradeManager.downLoadPackage(mContext!!, downloadKey,downloadUrl)
|
upgradeManager.downLoadPackage(mContext!!, downloadKey,downloadUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun showStatusBar(ctx: Context, anchor: View) {
|
override fun showStatusBar(ctx: Context, container: ViewGroup) {
|
||||||
StatusManager.init(ctx, anchor)
|
StatusManager.init(ctx)
|
||||||
StatusManager.show()
|
StatusManager.show(container)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hideStatusBar() {
|
override fun hideStatusBar(container: ViewGroup) {
|
||||||
StatusManager.hide()
|
StatusManager.hide(container)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
|
@file:Suppress("COMPATIBILITY_WARNING")
|
||||||
|
|
||||||
package com.zhjt.mogo_core_function_devatools.status
|
package com.zhjt.mogo_core_function_devatools.status
|
||||||
|
|
||||||
import android.content.*
|
import android.content.*
|
||||||
import android.view.*
|
import android.view.*
|
||||||
import android.view.WindowManager.LayoutParams
|
|
||||||
import android.widget.*
|
|
||||||
import androidx.core.view.*
|
|
||||||
import androidx.lifecycle.*
|
import androidx.lifecycle.*
|
||||||
import androidx.lifecycle.Lifecycle.Event
|
import androidx.lifecycle.Lifecycle.Event
|
||||||
import androidx.lifecycle.Lifecycle.Event.ON_CREATE
|
import androidx.lifecycle.Lifecycle.Event.ON_CREATE
|
||||||
@@ -13,7 +12,6 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
|||||||
import com.mogo.eagle.core.function.call.autopilot.*
|
import com.mogo.eagle.core.function.call.autopilot.*
|
||||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||||
import com.mogo.eagle.core.utilcode.util.*
|
import com.mogo.eagle.core.utilcode.util.*
|
||||||
import com.zhjt.mogo_core_function_devatools.ext.*
|
|
||||||
import com.zhjt.mogo_core_function_devatools.status.entity.CanStatus
|
import com.zhjt.mogo_core_function_devatools.status.entity.CanStatus
|
||||||
import com.zhjt.mogo_core_function_devatools.status.entity.GpsStatus
|
import com.zhjt.mogo_core_function_devatools.status.entity.GpsStatus
|
||||||
import com.zhjt.mogo_core_function_devatools.status.entity.IpcStatus
|
import com.zhjt.mogo_core_function_devatools.status.entity.IpcStatus
|
||||||
@@ -29,11 +27,12 @@ import com.zhjt.mogo_core_function_devatools.status.flow.ipc.IpcImpl
|
|||||||
import com.zhjt.mogo_core_function_devatools.status.flow.nets.NetsImpl
|
import com.zhjt.mogo_core_function_devatools.status.flow.nets.NetsImpl
|
||||||
import com.zhjt.mogo_core_function_devatools.status.flow.rtk.RTKImpl
|
import com.zhjt.mogo_core_function_devatools.status.flow.rtk.RTKImpl
|
||||||
import com.zhjt.mogo_core_function_devatools.status.flow.trace.TracingImpl
|
import com.zhjt.mogo_core_function_devatools.status.flow.trace.TracingImpl
|
||||||
import com.zhjt.mogo_core_function_devatools.status.ui.*
|
import com.zhjt.mogo_core_function_devatools.status.ui.StatusView
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import mogo_msg.MogoReportMsg
|
import mogo_msg.MogoReportMsg
|
||||||
import java.lang.ref.*
|
import java.util.concurrent.*
|
||||||
|
|
||||||
|
|
||||||
object StatusManager {
|
object StatusManager {
|
||||||
|
|
||||||
@@ -41,18 +40,13 @@ object StatusManager {
|
|||||||
|
|
||||||
private lateinit var model: StatusModel
|
private lateinit var model: StatusModel
|
||||||
|
|
||||||
private var pop: PopupWindow? = null
|
|
||||||
|
|
||||||
private var timer: Job? = null
|
private var timer: Job? = null
|
||||||
|
|
||||||
private var context: WeakReference<Context>? = null
|
|
||||||
|
|
||||||
private var anchor: WeakReference<View>? = null
|
|
||||||
|
|
||||||
private var hasInit = false
|
private var hasInit = false
|
||||||
|
|
||||||
private var oldX = 0
|
private val listeners by lazy { CopyOnWriteArrayList<IStatusListener>() }
|
||||||
private var oldY = 0
|
|
||||||
|
|
||||||
private val listener = object : IMoGoAutopilotStatusListener {
|
private val listener = object : IMoGoAutopilotStatusListener {
|
||||||
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {
|
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {
|
||||||
@@ -93,7 +87,7 @@ object StatusManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun init(ctx: Context, anchor: View) {
|
fun init(ctx: Context) {
|
||||||
if (hasInit) {
|
if (hasInit) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -110,26 +104,6 @@ object StatusManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
context = WeakReference(ctx)
|
|
||||||
anchor.viewTreeObserver.addOnGlobalLayoutListener {
|
|
||||||
anchor.getLocationInWindow(IntArray(2).also {
|
|
||||||
val currentX = it[0]
|
|
||||||
val currentY = it[1]
|
|
||||||
var changed = false
|
|
||||||
if (oldX != currentX) {
|
|
||||||
oldX = currentX
|
|
||||||
changed = true
|
|
||||||
}
|
|
||||||
if (oldY != currentY) {
|
|
||||||
changed = true
|
|
||||||
oldY = currentY
|
|
||||||
}
|
|
||||||
if (changed && pop?.isShowing == true) {
|
|
||||||
pop?.update(getOffsetX(currentX), currentY + 130.PX, -1, -1)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.anchor = WeakReference(anchor)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onCreate(ctx: Context) {
|
private fun onCreate(ctx: Context) {
|
||||||
@@ -153,35 +127,42 @@ object StatusManager {
|
|||||||
model.update(it)
|
model.update(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
f.onCreate()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fun show() {
|
model.status.observe(ctx.lifeCycleOwner) {
|
||||||
val anchor = this.anchor?.get() ?: return
|
listeners.forEach { itx ->
|
||||||
context?.get()?.also { ctx ->
|
itx.onStatusChanged(it.second, it.first != null)
|
||||||
pop?.takeIf { it.isShowing }?.dismiss()
|
|
||||||
val content = StatusView(model, ctx)
|
|
||||||
content.doOnAttach {
|
|
||||||
for (f in flows) {
|
|
||||||
f.onCreate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val out = IntArray(2)
|
|
||||||
anchor.getLocationInWindow(out)
|
|
||||||
ctx.normalPop(content, width = LayoutParams.WRAP_CONTENT, height = LayoutParams.WRAP_CONTENT, gravity = Gravity.END or Gravity.TOP, startX = getOffsetX(out[0]), startY = out[1] + 130.PX , isFocusable = false)?.also {
|
|
||||||
pop = it
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getOffsetX(anchorX: Int): Int {
|
|
||||||
return ScreenUtils.getScreenWidth() - anchorX + 40.PX
|
fun registerListener(listener: IStatusListener) {
|
||||||
|
listeners.add(listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hide() {
|
|
||||||
pop?.takeIf { it.isShowing }?.dismiss()
|
fun unRegisterListener(listener: IStatusListener) {
|
||||||
|
listeners.remove(listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun show(container: ViewGroup) {
|
||||||
|
if (container.childCount > 0) {
|
||||||
|
if (container.visibility != View.VISIBLE) {
|
||||||
|
container.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val child = StatusView(model, container.context)
|
||||||
|
container.addView(child, ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun hide(container: ViewGroup) {
|
||||||
|
container.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun onDestroy(ctx: Context) {
|
private fun onDestroy(ctx: Context) {
|
||||||
hasInit = false
|
hasInit = false
|
||||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||||
@@ -190,7 +171,12 @@ object StatusManager {
|
|||||||
flows.forEach {
|
flows.forEach {
|
||||||
it.onDestroy()
|
it.onDestroy()
|
||||||
}
|
}
|
||||||
|
listeners.clear()
|
||||||
flows.clear()
|
flows.clear()
|
||||||
pop?.takeIf { it.isShowing }?.dismiss()
|
}
|
||||||
|
|
||||||
|
interface IStatusListener {
|
||||||
|
|
||||||
|
fun onStatusChanged(data: List<Status>, hasException: Boolean)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,12 +3,12 @@ package com.zhjt.mogo_core_function_devatools.status.entity
|
|||||||
import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing
|
import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing
|
||||||
import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing.*
|
import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing.*
|
||||||
|
|
||||||
internal sealed class Status
|
sealed class Status
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工控机
|
* 工控机
|
||||||
*/
|
*/
|
||||||
internal class IpcStatus(val enabled: Boolean = false): Status() {
|
class IpcStatus(val enabled: Boolean = false): Status() {
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (javaClass != other?.javaClass) return false
|
if (javaClass != other?.javaClass) return false
|
||||||
@@ -26,7 +26,7 @@ internal class IpcStatus(val enabled: Boolean = false): Status() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class NetStatus(val enabled: Boolean = false, var name: String? = null, val speed: Speed? = null): Status() {
|
class NetStatus(val enabled: Boolean = false, var name: String? = null, val speed: Speed? = null): Status() {
|
||||||
class Speed(val tx: Int, val rx: Int) {
|
class Speed(val tx: Int, val rx: Int) {
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
@@ -56,7 +56,7 @@ internal class NetStatus(val enabled: Boolean = false, var name: String? = null,
|
|||||||
/**
|
/**
|
||||||
* android系统定位状态
|
* android系统定位状态
|
||||||
*/
|
*/
|
||||||
internal class GpsStatus(val enabled: Boolean = false, val isGranted: Boolean = false): Status() {
|
class GpsStatus(val enabled: Boolean = false, val isGranted: Boolean = false): Status() {
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (javaClass != other?.javaClass) return false
|
if (javaClass != other?.javaClass) return false
|
||||||
@@ -81,7 +81,7 @@ internal class GpsStatus(val enabled: Boolean = false, val isGranted: Boolean =
|
|||||||
/**
|
/**
|
||||||
* RTK/GNSS定位状态
|
* RTK/GNSS定位状态
|
||||||
*/
|
*/
|
||||||
internal class RTKStatus(var enabled: Boolean = false, var desc: String = "RTK"): Status() {
|
class RTKStatus(var enabled: Boolean = false, var desc: String = "RTK"): Status() {
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (javaClass != other?.javaClass) return false
|
if (javaClass != other?.javaClass) return false
|
||||||
@@ -102,7 +102,7 @@ internal class RTKStatus(var enabled: Boolean = false, var desc: String = "RTK")
|
|||||||
/**
|
/**
|
||||||
* Can总线
|
* Can总线
|
||||||
*/
|
*/
|
||||||
internal class CanStatus(var enabled: Boolean = false): Status() {
|
class CanStatus(var enabled: Boolean = false): Status() {
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (javaClass != other?.javaClass) return false
|
if (javaClass != other?.javaClass) return false
|
||||||
@@ -125,7 +125,7 @@ internal class CanStatus(var enabled: Boolean = false): Status() {
|
|||||||
/**
|
/**
|
||||||
* 寻迹/算路/未知
|
* 寻迹/算路/未知
|
||||||
*/
|
*/
|
||||||
internal class TracingStatus(var state: Tracing = UNKNOWN): Status() {
|
class TracingStatus(var state: Tracing = UNKNOWN): Status() {
|
||||||
|
|
||||||
enum class Tracing(val code: String? = "") {
|
enum class Tracing(val code: String? = "") {
|
||||||
/**
|
/**
|
||||||
@@ -188,7 +188,7 @@ internal class TracingStatus(var state: Tracing = UNKNOWN): Status() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun String.toState(): Tracing? {
|
fun String.toState(): Tracing? {
|
||||||
return when(this) {
|
return when(this) {
|
||||||
"IMAP_TRA_EXIST" -> TRACK_FINDED
|
"IMAP_TRA_EXIST" -> TRACK_FINDED
|
||||||
"IMAP_TRA_LOADED" -> TRACK_LOADED
|
"IMAP_TRA_LOADED" -> TRACK_LOADED
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.content.*
|
|||||||
import android.graphics.*
|
import android.graphics.*
|
||||||
import android.graphics.drawable.*
|
import android.graphics.drawable.*
|
||||||
import android.transition.*
|
import android.transition.*
|
||||||
|
import android.util.*
|
||||||
import android.view.*
|
import android.view.*
|
||||||
import androidx.appcompat.widget.*
|
import androidx.appcompat.widget.*
|
||||||
import androidx.constraintlayout.widget.*
|
import androidx.constraintlayout.widget.*
|
||||||
@@ -42,7 +43,6 @@ internal class StatusView(private val model: StatusModel, ctx: Context): Constra
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun init() {
|
private fun init() {
|
||||||
isClickable = true
|
|
||||||
dot.background = shape(solid = Color.parseColor("#F33F1D"), shape = GradientDrawable.OVAL, width = 30.PX, height = 30.PX)
|
dot.background = shape(solid = Color.parseColor("#F33F1D"), shape = GradientDrawable.OVAL, width = 30.PX, height = 30.PX)
|
||||||
iv.also {
|
iv.also {
|
||||||
it.background = ContextCompat.getDrawable(context, R.drawable.icon_dev_status_un_fold)
|
it.background = ContextCompat.getDrawable(context, R.drawable.icon_dev_status_un_fold)
|
||||||
@@ -59,13 +59,14 @@ internal class StatusView(private val model: StatusModel, ctx: Context): Constra
|
|||||||
moveDuration = 0
|
moveDuration = 0
|
||||||
removeDuration = 0
|
removeDuration = 0
|
||||||
}
|
}
|
||||||
itx.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
itx.layoutManager = GridLayoutManager(context,4, GridLayoutManager.VERTICAL, false)
|
||||||
itx.background = shape(solid = Color.parseColor("#80000000"), radius = 40.PX)
|
itx.background = shape(solid = Color.parseColor("#80000000"), radius = 40.PX)
|
||||||
itx.addItemDecoration(
|
itx.addItemDecoration(
|
||||||
CommonDividerItemDecoration.Builder()
|
CommonDividerItemDecoration.Builder()
|
||||||
.horizontalExternalSpace(38.PX)
|
.horizontalExternalSpace(38.PX)
|
||||||
.verticalExternalSpace(30.PX)
|
.verticalExternalSpace(30.PX)
|
||||||
.spanCountLRCare(false)
|
.verticalInnerSpace(20.PX)
|
||||||
|
.spanCountTBCare(false)
|
||||||
.horizontalInnerSpace(50.PX)
|
.horizontalInnerSpace(50.PX)
|
||||||
.build()
|
.build()
|
||||||
)
|
)
|
||||||
@@ -90,6 +91,17 @@ internal class StatusView(private val model: StatusModel, ctx: Context): Constra
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onVisibilityChanged(changedView: View, visibility: Int) {
|
||||||
|
super.onVisibilityChanged(changedView, visibility)
|
||||||
|
if (changedView != this) {
|
||||||
|
if (visibility == View.VISIBLE) {
|
||||||
|
observer?.also { model.status.observeForever(it) }
|
||||||
|
} else {
|
||||||
|
observer?.also { model.status.removeObserver(it) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun animate(expand: Boolean) {
|
private fun animate(expand: Boolean) {
|
||||||
TransitionManager.beginDelayedTransition(this, AutoTransition().setDuration(200))
|
TransitionManager.beginDelayedTransition(this, AutoTransition().setDuration(200))
|
||||||
rv.visibility = if (expand) View.VISIBLE else View.INVISIBLE
|
rv.visibility = if (expand) View.VISIBLE else View.INVISIBLE
|
||||||
|
|||||||
@@ -8,13 +8,12 @@
|
|||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/rv"
|
android:id="@+id/rv"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="611px"
|
||||||
android:layout_height="156px"
|
android:layout_height="271px"
|
||||||
android:minWidth="902px"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/iv"
|
app:layout_constraintEnd_toStartOf="@+id/iv"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:layout_marginEnd="20px"
|
android:layout_marginEnd="42px"
|
||||||
android:overScrollMode="never"
|
android:overScrollMode="never"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@
|
|||||||
android:layout_height="107px"
|
android:layout_height="107px"
|
||||||
android:layout_marginBottom="20px"
|
android:layout_marginBottom="20px"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:layout_marginTop="12px"
|
||||||
app:layout_constraintStart_toEndOf="@+id/rv"
|
app:layout_constraintStart_toEndOf="@+id/rv"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:background="@drawable/icon_dev_status_un_fold"/>
|
android:background="@drawable/icon_dev_status_un_fold"/>
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ import java.util.*
|
|||||||
setProxyLimitingSpeedView(viewLimitingVelocity)
|
setProxyLimitingSpeedView(viewLimitingVelocity)
|
||||||
setViewNotificationProvider(this)
|
setViewNotificationProvider(this)
|
||||||
context?.also {
|
context?.also {
|
||||||
CallerDevaToolsManager.showStatusBar(it, vs_status_bar)
|
CallerDevaToolsManager.showStatusBar(it, statusBarContainer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1214,7 +1214,7 @@ import java.util.*
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun showSmallFragment() {
|
override fun showSmallFragment() {
|
||||||
CallerDevaToolsManager.hideStatusBar()
|
CallerDevaToolsManager.hideStatusBar(statusBarContainer)
|
||||||
// 加载全览模式图层
|
// 加载全览模式图层
|
||||||
val fragmentOverview = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_OVERVIEW)
|
val fragmentOverview = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_OVERVIEW)
|
||||||
.navigation() as BaseFragment
|
.navigation() as BaseFragment
|
||||||
@@ -1229,7 +1229,7 @@ import java.util.*
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun hideSmallFragment() {
|
override fun hideSmallFragment() {
|
||||||
context?.let { CallerDevaToolsManager.showStatusBar(it, vs_status_bar) }
|
context?.let { CallerDevaToolsManager.showStatusBar(it, statusBarContainer) }
|
||||||
val fragmentOverview = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_OVERVIEW)
|
val fragmentOverview = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_OVERVIEW)
|
||||||
.navigation() as BaseFragment
|
.navigation() as BaseFragment
|
||||||
activity?.supportFragmentManager?.beginTransaction()
|
activity?.supportFragmentManager?.beginTransaction()
|
||||||
|
|||||||
@@ -147,6 +147,7 @@
|
|||||||
android:layout_height="120px"
|
android:layout_height="120px"
|
||||||
android:layout_marginTop="30px"
|
android:layout_marginTop="30px"
|
||||||
android:layout_marginEnd="40px"
|
android:layout_marginEnd="40px"
|
||||||
|
|
||||||
android:background="@drawable/bg_waring_limiting_velocity"
|
android:background="@drawable/bg_waring_limiting_velocity"
|
||||||
android:elevation="@dimen/dp_10"
|
android:elevation="@dimen/dp_10"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
@@ -158,7 +159,7 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
|
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
|
||||||
app:layout_goneMarginEnd="40px"
|
app:layout_goneMarginEnd="40px"
|
||||||
app:layout_goneMarginTop="40px"
|
app:layout_goneMarginTop="40px"
|
||||||
tools:visibility="visible" />
|
tools:visibility="gone" />
|
||||||
|
|
||||||
<!--左右转向灯-->
|
<!--左右转向灯-->
|
||||||
<com.mogo.eagle.core.function.hmi.ui.turnlight.TurnLightViewStatus
|
<com.mogo.eagle.core.function.hmi.ui.turnlight.TurnLightViewStatus
|
||||||
@@ -189,13 +190,15 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
<View
|
<RelativeLayout
|
||||||
android:id="@+id/vs_status_bar"
|
android:id="@+id/statusBarContainer"
|
||||||
android:layout_width="107px"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="107px"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="30px"
|
android:layout_marginEnd="30px"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/viewLimitingVelocity"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/viewLimitingVelocity"
|
app:layout_constraintEnd_toStartOf="@+id/viewLimitingVelocity"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/viewLimitingVelocity"/>
|
app:layout_goneMarginTop="30px"
|
||||||
|
app:layout_goneMarginEnd="40px"/>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.mogo.eagle.core.function.api.devatools
|
|||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.view.View
|
import android.view.*
|
||||||
import com.alibaba.android.arouter.facade.template.IProvider
|
import com.alibaba.android.arouter.facade.template.IProvider
|
||||||
import com.mogo.eagle.core.data.deva.chain.ChainLogParam
|
import com.mogo.eagle.core.data.deva.chain.ChainLogParam
|
||||||
import com.mogo.eagle.core.data.deva.scene.SceneModule
|
import com.mogo.eagle.core.data.deva.scene.SceneModule
|
||||||
@@ -107,10 +107,10 @@ interface IDevaToolsProvider : IProvider {
|
|||||||
/**
|
/**
|
||||||
* 展示状态栏
|
* 展示状态栏
|
||||||
*/
|
*/
|
||||||
fun showStatusBar(ctx: Context, anchor: View)
|
fun showStatusBar(ctx: Context, container: ViewGroup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 隐藏状态栏
|
* 隐藏状态栏
|
||||||
*/
|
*/
|
||||||
fun hideStatusBar()
|
fun hideStatusBar(container: ViewGroup)
|
||||||
}
|
}
|
||||||
@@ -150,27 +150,18 @@ object CallerDevaToolsManager {
|
|||||||
/**
|
/**
|
||||||
* 展示状态栏
|
* 展示状态栏
|
||||||
*/
|
*/
|
||||||
fun showStatusBar(ctx: Context, anchor: View) {
|
fun showStatusBar(ctx: Context, container: ViewGroup) {
|
||||||
if (!AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
if (!AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||||
if (anchor.isLaidOut) {
|
devaToolsProviderApi?.showStatusBar(ctx, container)
|
||||||
devaToolsProviderApi?.showStatusBar(ctx, anchor)
|
|
||||||
} else {
|
|
||||||
anchor.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
|
|
||||||
override fun onGlobalLayout() {
|
|
||||||
devaToolsProviderApi?.showStatusBar(ctx, anchor)
|
|
||||||
anchor.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 隐藏状态栏
|
* 隐藏状态栏
|
||||||
*/
|
*/
|
||||||
fun hideStatusBar() {
|
fun hideStatusBar(container: ViewGroup) {
|
||||||
if (!AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
if (!AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||||
devaToolsProviderApi?.hideStatusBar()
|
devaToolsProviderApi?.hideStatusBar(container)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,12 +31,15 @@ class CommonDividerItemDecoration internal constructor(builder: Builder) : ItemD
|
|||||||
private var mSpanCountTBCare = false
|
private var mSpanCountTBCare = false
|
||||||
private val mHorizontalExternalSpace: Int
|
private val mHorizontalExternalSpace: Int
|
||||||
private val mVerticalExternalSpace: Int
|
private val mVerticalExternalSpace: Int
|
||||||
private var mLastRight = 0
|
|
||||||
private var mLastBottom = 0
|
|
||||||
private var mFromPosition = 0
|
private var mFromPosition = 0
|
||||||
private var mHorizontalDelta: Pair<Int, Int>? = null
|
private var mHorizontalDelta: Pair<Int, Int>? = null
|
||||||
private var mVerticalDelta: Pair<Int, Int>? = null
|
private var mVerticalDelta: Pair<Int, Int>? = null
|
||||||
|
|
||||||
|
private var mRightCache: HashMap<Int, Int> = HashMap()
|
||||||
|
private var mLeftCache: HashMap<Int, Int> = HashMap()
|
||||||
|
private var mBottomCache: HashMap<Int, Int> = HashMap()
|
||||||
|
private var mTopCache: HashMap<Int, Int> = HashMap()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 外部间隔结束位置是否需要
|
* 外部间隔结束位置是否需要
|
||||||
*/
|
*/
|
||||||
@@ -84,23 +87,28 @@ class CommonDividerItemDecoration internal constructor(builder: Builder) : ItemD
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val averageDistance = (((spanCount - 1) * mHorizontalInnerSpace + 2 * mHorizontalExternalSpace + deltaHL + deltaHR) * 1.0f / spanCount).toInt()
|
val averageDistance = (((spanCount - 1) * mHorizontalInnerSpace + 2 * mHorizontalExternalSpace + deltaHL + deltaHR) * 1.0f / spanCount).toInt()
|
||||||
Log.d("UUUU", "step::0::$averageDistance: lastRight: $mLastRight : state: $state " )
|
|
||||||
if (spanIndex == 0) {
|
if (spanIndex == 0) {
|
||||||
outRect.left = mHorizontalExternalSpace + deltaHL
|
outRect.left = mHorizontalExternalSpace + deltaHL
|
||||||
outRect.right = averageDistance - outRect.left
|
outRect.right = averageDistance - outRect.left
|
||||||
mLastRight = outRect.right
|
if (state.didStructureChange()) {
|
||||||
Log.d("UUUU", "step::1::$averageDistance: lastRight: $mLastRight" )
|
mRightCache[position] = outRect.right
|
||||||
|
}
|
||||||
|
Log.d("UUUU", "step::1::$averageDistance: outRect.right: ${outRect.right} ::outRect.left: ${outRect.left}:: position: $position :: state: $state" )
|
||||||
} else if (spanIndex == spanCount - 1) {
|
} else if (spanIndex == spanCount - 1) {
|
||||||
outRect.right = mHorizontalExternalSpace + deltaHR
|
outRect.right = mHorizontalExternalSpace + deltaHR
|
||||||
outRect.left = averageDistance - outRect.right
|
outRect.left = averageDistance - outRect.right
|
||||||
Log.d("UUUU", "step::2::$averageDistance: lastRight: $mLastRight ::outRect.left: ${outRect.left}" )
|
Log.d("UUUU", "step::2::$averageDistance: outRect.right: ${outRect.right} ::outRect.left: ${outRect.left} :: position: $position :: state: $state" )
|
||||||
} else {
|
} else {
|
||||||
outRect.left = mHorizontalInnerSpace - mLastRight
|
|
||||||
outRect.right = averageDistance - outRect.left
|
|
||||||
if (state.didStructureChange()) {
|
if (state.didStructureChange()) {
|
||||||
mLastRight = outRect.right
|
outRect.left = mHorizontalInnerSpace - (mRightCache[position - 1] ?: 0)
|
||||||
|
outRect.right = averageDistance - outRect.left
|
||||||
|
mLeftCache[position] = outRect.left
|
||||||
|
mRightCache[position] = outRect.right
|
||||||
|
} else {
|
||||||
|
outRect.left = mLeftCache[position]!!
|
||||||
|
outRect.right = mRightCache[position]!!
|
||||||
}
|
}
|
||||||
Log.d("UUUU", "step::2::$averageDistance: lastRight: $mLastRight ::outRect.left: ${outRect.left}" )
|
Log.d("UUUU", "step::2::$averageDistance: outRect.right: ${outRect.right} ::outRect.left: ${outRect.left} :: position: $position :: state: $state" )
|
||||||
}
|
}
|
||||||
} //所在的行数
|
} //所在的行数
|
||||||
if (lookUp.getSpanGroupIndex(childPosition, spanCount) == lookUp.getSpanGroupIndex(mFromPosition, spanCount)) {
|
if (lookUp.getSpanGroupIndex(childPosition, spanCount) == lookUp.getSpanGroupIndex(mFromPosition, spanCount)) {
|
||||||
@@ -130,15 +138,21 @@ class CommonDividerItemDecoration internal constructor(builder: Builder) : ItemD
|
|||||||
if (spanIndex == 0) {
|
if (spanIndex == 0) {
|
||||||
outRect.top = mVerticalExternalSpace + deltaVT
|
outRect.top = mVerticalExternalSpace + deltaVT
|
||||||
outRect.bottom = averageDistance - outRect.top
|
outRect.bottom = averageDistance - outRect.top
|
||||||
mLastBottom = outRect.bottom
|
if (state.didStructureChange()) {
|
||||||
|
mBottomCache[position] = outRect.bottom
|
||||||
|
}
|
||||||
} else if (spanIndex == spanCount - 1) {
|
} else if (spanIndex == spanCount - 1) {
|
||||||
outRect.top = mVerticalExternalSpace + deltaVB
|
outRect.top = mVerticalExternalSpace + deltaVB
|
||||||
outRect.bottom = averageDistance - outRect.top
|
outRect.bottom = averageDistance - outRect.top
|
||||||
} else {
|
} else {
|
||||||
outRect.top = mVerticalInnerSpace - mLastBottom
|
|
||||||
outRect.bottom = averageDistance - outRect.top
|
|
||||||
if (state.didStructureChange()) {
|
if (state.didStructureChange()) {
|
||||||
mLastBottom = outRect.bottom
|
outRect.top = mVerticalInnerSpace - (mBottomCache[position - 1] ?: 0 )
|
||||||
|
outRect.bottom = averageDistance - outRect.top
|
||||||
|
mBottomCache[position] = outRect.bottom
|
||||||
|
mTopCache[position] = outRect.top
|
||||||
|
} else {
|
||||||
|
outRect.top = mTopCache[position]!!
|
||||||
|
outRect.bottom = mBottomCache[position]!!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,15 +237,21 @@ class CommonDividerItemDecoration internal constructor(builder: Builder) : ItemD
|
|||||||
if (spanIndex == 0) {
|
if (spanIndex == 0) {
|
||||||
outRect.left = mHorizontalExternalSpace + deltaHL
|
outRect.left = mHorizontalExternalSpace + deltaHL
|
||||||
outRect.right = averageDistance - outRect.left
|
outRect.right = averageDistance - outRect.left
|
||||||
mLastRight = outRect.right
|
if (state.didStructureChange()) {
|
||||||
|
mRightCache[position] = outRect.right
|
||||||
|
}
|
||||||
} else if (spanIndex == spanCount - 1) {
|
} else if (spanIndex == spanCount - 1) {
|
||||||
outRect.right = mHorizontalExternalSpace + deltaHR
|
outRect.right = mHorizontalExternalSpace + deltaHR
|
||||||
outRect.left = averageDistance - outRect.right
|
outRect.left = averageDistance - outRect.right
|
||||||
} else {
|
} else {
|
||||||
outRect.left = mHorizontalInnerSpace - mLastRight
|
|
||||||
outRect.right = averageDistance - outRect.left
|
|
||||||
if (state.didStructureChange()) {
|
if (state.didStructureChange()) {
|
||||||
mLastRight = outRect.right
|
outRect.left = mHorizontalInnerSpace - (mRightCache[position - 1] ?: 0)
|
||||||
|
outRect.right = averageDistance - outRect.left
|
||||||
|
mLeftCache[position] = outRect.left
|
||||||
|
mRightCache[position] = outRect.right
|
||||||
|
} else {
|
||||||
|
outRect.left = mLeftCache[position]!!
|
||||||
|
outRect.right = mRightCache[position]!!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -282,15 +302,22 @@ class CommonDividerItemDecoration internal constructor(builder: Builder) : ItemD
|
|||||||
if (spanIndex == 0) {
|
if (spanIndex == 0) {
|
||||||
outRect.top = mVerticalExternalSpace + deltaVT
|
outRect.top = mVerticalExternalSpace + deltaVT
|
||||||
outRect.bottom = averageDistance - outRect.top
|
outRect.bottom = averageDistance - outRect.top
|
||||||
mLastBottom = outRect.bottom
|
if (state.didStructureChange()) {
|
||||||
|
mBottomCache[position] = outRect.bottom
|
||||||
|
}
|
||||||
} else if (spanIndex == spanCount - 1) {
|
} else if (spanIndex == spanCount - 1) {
|
||||||
outRect.top = mVerticalExternalSpace + deltaVB
|
outRect.top = mVerticalExternalSpace + deltaVB
|
||||||
outRect.bottom = averageDistance - outRect.top
|
outRect.bottom = averageDistance - outRect.top
|
||||||
} else {
|
} else {
|
||||||
outRect.top = mVerticalInnerSpace - mLastBottom
|
|
||||||
outRect.bottom = averageDistance - outRect.top
|
|
||||||
if (state.didStructureChange()) {
|
if (state.didStructureChange()) {
|
||||||
mLastBottom = outRect.bottom
|
outRect.top = mVerticalInnerSpace - (mBottomCache[position - 1] ?: 0)
|
||||||
|
outRect.bottom = averageDistance - outRect.top
|
||||||
|
mBottomCache[position] = outRect.bottom
|
||||||
|
mTopCache[position] = outRect.top
|
||||||
|
} else {
|
||||||
|
outRect.top = mTopCache[position]!!
|
||||||
|
outRect.bottom = mBottomCache[position]!!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user