Merge branch 'dev_robotaxi-d_230912_6.1.0' into base_3.4.0-map-sdk
@@ -1,251 +0,0 @@
|
||||
package com.mogo.och.taxi.passenger.ui.video
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.graphics.PixelFormat
|
||||
import android.os.Build
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import android.widget.SeekBar
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.wigets.OCHGradientTextView
|
||||
import com.mogo.och.taxi.passenger.R
|
||||
|
||||
/**
|
||||
* 视频全屏播放
|
||||
*
|
||||
* @author yangyakun
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object FloatingDistanceInfoUtils {
|
||||
private const val TAG = "OverlayViewUtils"
|
||||
private var windowManager: WindowManager? = null
|
||||
|
||||
@Volatile
|
||||
private var isShowing = false
|
||||
|
||||
private var params:WindowManager.LayoutParams?=null
|
||||
private var paramsBottom:WindowManager.LayoutParams?=null
|
||||
|
||||
|
||||
private var orderInfoView: View?=null
|
||||
private var processView: SeekBar?=null
|
||||
|
||||
// 距离
|
||||
private var actvDistancew: OCHGradientTextView?=null
|
||||
// 距离单位
|
||||
private var actvDistancewUnit: AppCompatTextView?=null
|
||||
// 剩余时间
|
||||
private var actvSurplusTime: OCHGradientTextView?=null
|
||||
// 到达时间
|
||||
private var actvArrivedTime: OCHGradientTextView?=null
|
||||
|
||||
private var actvSpeed: OCHGradientTextView?=null
|
||||
|
||||
|
||||
/**
|
||||
* 添加覆盖View在Activity上面
|
||||
*/
|
||||
@JvmOverloads
|
||||
fun showOverlayView(context: Activity,ani: Int = -1,sumDis:Int) {
|
||||
if (isShowing) {
|
||||
return
|
||||
}
|
||||
if (windowManager == null) {
|
||||
windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
|
||||
}
|
||||
|
||||
orderInfoView = LayoutInflater.from(context)
|
||||
.inflate(R.layout.taxi_p_window_float_distance_info, null) as ConstraintLayout
|
||||
orderInfoView?.let { view ->
|
||||
// 设置View显示模式,沉浸式的侵入到状态栏,导航栏
|
||||
view.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION)
|
||||
layoutParams(ani)
|
||||
actvSpeed = view.findViewById(R.id.actv_speed)
|
||||
actvDistancew = view.findViewById(R.id.actv_distancew)
|
||||
actvDistancewUnit = view.findViewById(R.id.actv_distancew_unit)
|
||||
actvSurplusTime = view.findViewById(R.id.actv_surplus_time)
|
||||
actvArrivedTime = view.findViewById(R.id.actv_arrived_time)
|
||||
|
||||
val intArrayOf = intArrayOf(
|
||||
context.resources.getColor(R.color.taxi_p_video_gradient_end),
|
||||
context.resources.getColor(R.color.taxi_p_video_gradient_start)
|
||||
)
|
||||
|
||||
actvSpeed?.setVertrial(true)
|
||||
actvSpeed?.setmColorList(intArrayOf)
|
||||
|
||||
actvDistancew?.setVertrial(true)
|
||||
actvDistancew?.setmColorList(intArrayOf)
|
||||
|
||||
actvSurplusTime?.setVertrial(true)
|
||||
actvSurplusTime?.setmColorList(intArrayOf)
|
||||
|
||||
actvArrivedTime?.setVertrial(true)
|
||||
actvArrivedTime?.setmColorList(intArrayOf)
|
||||
|
||||
processView = SeekBar(context)
|
||||
processView?.let {
|
||||
it.max = sumDis
|
||||
layoutParamsBottom(-1)
|
||||
it.setPadding(0,0,0,0)
|
||||
it.progressDrawable = ContextCompat.getDrawable(context,R.drawable.taxi_video_order_process)
|
||||
it.thumb = null
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
it.maxHeight = 14
|
||||
it.minHeight = 14
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 如果正在展示中,并且lastOverlayView不为null,先做移除操作,保证覆盖在最上面的View只有一个,防止叠加导致无法移除
|
||||
dismissOverlayView()
|
||||
|
||||
try {
|
||||
windowManager!!.addView(orderInfoView, params)
|
||||
windowManager!!.addView(processView, paramsBottom)
|
||||
isShowing = true
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun layoutParams(ani: Int) {
|
||||
if(params ==null) {
|
||||
params = WindowManager.LayoutParams()
|
||||
}
|
||||
params = WindowManager.LayoutParams()
|
||||
params?.let {
|
||||
it.width = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
it.height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
it.alpha = 1.0f
|
||||
it.gravity = Gravity.END or Gravity.TOP
|
||||
it.x = 0
|
||||
it.y = 199
|
||||
it.format = PixelFormat.RGBA_8888
|
||||
// 设置窗口类型为应用子窗口,和PopupWindow同类型
|
||||
it.type = WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL
|
||||
// 没有边界限制,允许窗口扩展到屏幕外
|
||||
it.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS or
|
||||
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or
|
||||
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
|
||||
if (ani != -1) {
|
||||
it.windowAnimations = ani
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun layoutParamsBottom(ani: Int) {
|
||||
if(paramsBottom ==null) {
|
||||
paramsBottom = WindowManager.LayoutParams()
|
||||
}
|
||||
paramsBottom = WindowManager.LayoutParams()
|
||||
paramsBottom?.let {
|
||||
it.width = WindowManager.LayoutParams.MATCH_PARENT
|
||||
it.height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
it.alpha = 1.0f
|
||||
it.gravity = Gravity.START or Gravity.BOTTOM
|
||||
it.x = 0
|
||||
it.y = 0
|
||||
it.format = PixelFormat.RGBA_8888
|
||||
// 设置窗口类型为应用子窗口,和PopupWindow同类型
|
||||
it.type = WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL
|
||||
// 没有边界限制,允许窗口扩展到屏幕外
|
||||
it.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS or
|
||||
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or
|
||||
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
|
||||
if (ani != -1) {
|
||||
it.windowAnimations = ani
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setSpeed(speed: Float) {
|
||||
val newSpeed: Int = (Math.abs(speed) * 3.6f).toInt() // 倒车时工控机反馈定位信息中speed为负值
|
||||
|
||||
UiThreadHandler.post {
|
||||
actvSpeed?.text = "$newSpeed"
|
||||
}
|
||||
}
|
||||
|
||||
fun setDistance(meters:Long,remainDis: String?, disUnit: String, time: Int, arriveTime: String) {
|
||||
UiThreadHandler.post {
|
||||
actvDistancew?.text = "$remainDis"
|
||||
actvDistancewUnit?.text = "距离($disUnit)"
|
||||
actvSurplusTime?.text = "$time"
|
||||
actvArrivedTime?.text = arriveTime
|
||||
|
||||
processView?.let {
|
||||
val process = it.max - meters
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
it.setProgress(process.toInt(), true)
|
||||
}else{
|
||||
it.progress = process.toInt()
|
||||
}
|
||||
it.jumpDrawablesToCurrentState()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除覆盖View在Activity上面
|
||||
*/
|
||||
fun dismissOverlayView() {
|
||||
if (!isShowing) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
if (windowManager != null && orderInfoView != null) {
|
||||
windowManager!!.removeViewImmediate(orderInfoView)
|
||||
params = null
|
||||
}
|
||||
if (windowManager != null && processView != null) {
|
||||
windowManager!!.removeViewImmediate(processView)
|
||||
paramsBottom = null
|
||||
}
|
||||
if(windowManager!=null){
|
||||
windowManager = null
|
||||
}
|
||||
if (orderInfoView!=null) {
|
||||
orderInfoView = null
|
||||
}
|
||||
if(processView!=null){
|
||||
processView = null
|
||||
}
|
||||
actvDistancew?.let {
|
||||
actvDistancew = null
|
||||
}
|
||||
actvDistancewUnit?.let {
|
||||
actvDistancewUnit = null
|
||||
}
|
||||
actvSurplusTime?.let {
|
||||
actvSurplusTime = null
|
||||
}
|
||||
actvArrivedTime?.let {
|
||||
actvArrivedTime = null
|
||||
}
|
||||
actvSpeed?.let {
|
||||
actvSpeed = null
|
||||
}
|
||||
|
||||
isShowing = false
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 495 B |
|
Before Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 897 KiB After Width: | Height: | Size: 897 KiB |
|
Before Width: | Height: | Size: 450 KiB After Width: | Height: | Size: 450 KiB |
|
Before Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 941 KiB |
|
Before Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 20 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable-xhdpi/taxi_p_bottom_bar_bg.png
Normal file → Executable file
|
Before Width: | Height: | Size: 339 KiB After Width: | Height: | Size: 64 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable-xhdpi/taxi_p_bottom_bar_select_bg.png
Normal file → Executable file
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 256 B |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable-xhdpi/taxi_p_itinerary_bg.png
Normal file → Executable file
|
Before Width: | Height: | Size: 228 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 783 B |
|
Before Width: | Height: | Size: 588 B |
BIN
OCH/taxi/passenger/src/main/res/drawable-xhdpi/taxi_p_map_car_light.png
Normal file → Executable file
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 17 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable-xhdpi/taxi_p_pnc_bg.png
Normal file → Executable file
|
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable-xhdpi/taxi_p_setting_view_bg.png
Executable file
|
After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 17 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable-xhdpi/taxi_p_status_bg.png
Normal file → Executable file
|
Before Width: | Height: | Size: 169 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 2.2 MiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable-xhdpi/taxi_p_video_holder.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 120 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable-xhdpi/taxi_p_video_light_bg.png
Normal file → Executable file
|
Before Width: | Height: | Size: 5.4 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 185 KiB |
|
Before Width: | Height: | Size: 123 KiB |
|
Before Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00000.png
Normal file → Executable file
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 42 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00001.png
Normal file → Executable file
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 40 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00002.png
Normal file → Executable file
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 42 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00003.png
Normal file → Executable file
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 40 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00004.png
Normal file → Executable file
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 39 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00005.png
Normal file → Executable file
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 41 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00006.png
Normal file → Executable file
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 39 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00007.png
Normal file → Executable file
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 40 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00008.png
Normal file → Executable file
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 41 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00009.png
Normal file → Executable file
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 37 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00010.png
Normal file → Executable file
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 37 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00011.png
Normal file → Executable file
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 40 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00012.png
Normal file → Executable file
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 37 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00013.png
Normal file → Executable file
|
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 37 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00014.png
Normal file → Executable file
|
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 35 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00015.png
Normal file → Executable file
|
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 40 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00016.png
Normal file → Executable file
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 37 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00017.png
Normal file → Executable file
|
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 35 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00018.png
Normal file → Executable file
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 36 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00019.png
Normal file → Executable file
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 34 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00020.png
Normal file → Executable file
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 39 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00021.png
Normal file → Executable file
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 40 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00022.png
Normal file → Executable file
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 40 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00023.png
Normal file → Executable file
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 38 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00024.png
Normal file → Executable file
|
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 38 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00025.png
Normal file → Executable file
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 40 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00026.png
Normal file → Executable file
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 38 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00027.png
Normal file → Executable file
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 43 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00028.png
Normal file → Executable file
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 44 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00029.png
Normal file → Executable file
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 40 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00030.png
Normal file → Executable file
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 40 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00031.png
Normal file → Executable file
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 41 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00032.png
Normal file → Executable file
|
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 40 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00033.png
Normal file → Executable file
|
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 41 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00034.png
Normal file → Executable file
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 39 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/light_00000.png
Normal file → Executable file
|
Before Width: | Height: | Size: 239 KiB After Width: | Height: | Size: 38 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/light_00001.png
Normal file → Executable file
|
Before Width: | Height: | Size: 287 KiB After Width: | Height: | Size: 45 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/light_00002.png
Normal file → Executable file
|
Before Width: | Height: | Size: 344 KiB After Width: | Height: | Size: 50 KiB |