[5.0.0]
[unlock screen]
This commit is contained in:
@@ -9,7 +9,6 @@ import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIController
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.MMsgBoxButtonView
|
||||
import com.mogo.eagle.core.function.view.SiteMarkerBean
|
||||
@@ -205,7 +204,6 @@ class MainFragment :
|
||||
override fun initViews(savedInstanceState: Bundle?) {
|
||||
super.initViews(savedInstanceState)
|
||||
mapBizView.onCreate(savedInstanceState)
|
||||
getMapUIController()?.setAllGesturesEnabled(false)
|
||||
omvOverMap.onCreateView(savedInstanceState)
|
||||
}
|
||||
|
||||
@@ -223,6 +221,9 @@ class MainFragment :
|
||||
super.onResume()
|
||||
mapBizView.onResume()
|
||||
omvOverMap.onResume()
|
||||
UiThreadHandler.postDelayed({
|
||||
getMapUIController()?.setAllGesturesEnabled(false)
|
||||
},200)
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
package com.mogo.och.bus.passenger.ui.lockview
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.taxi.passenger.widget.animutils.AnimationsContainer
|
||||
import kotlinx.android.synthetic.main.m1_devices_lock_unlock.view.aciv_screen_lock
|
||||
import kotlinx.android.synthetic.main.m1_devices_lock_unlock.view.aciv_screen_lock_bg
|
||||
import kotlinx.android.synthetic.main.m1_devices_lock_unlock.view.aciv_screen_unlock_ani
|
||||
|
||||
class LockAndUnlockView : ConstraintLayout, LockManager.LockStatusCallback {
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attributeSet,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
val TAG = "UnLockView"
|
||||
|
||||
private var animations: AnimationsContainer? = null
|
||||
private var downType: DownType = DownType.NONE
|
||||
|
||||
private var handler: Handler?=null
|
||||
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.m1_devices_lock_unlock, this, true)
|
||||
handler = object : Handler(Looper.myLooper()!!) {
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
when (msg.what) {
|
||||
2 -> {// 解锁
|
||||
LockManager.setLock(LockManager.LockStatus.UNLOCK)
|
||||
animations?.stop()
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
LockManager.setAutoStatusCallback(TAG, this)
|
||||
aciv_screen_unlock_ani?.let {
|
||||
animations = AnimationsContainer(R.array.openlock, 24, it)
|
||||
animations!!.setOnAnimStopListener(object :
|
||||
AnimationsContainer.OnAnimationStoppedListener {
|
||||
override fun AnimationStopped() {
|
||||
it.setImageDrawable(null)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
LockManager.setAutoStatusCallback(TAG, null)
|
||||
}
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent?): Boolean {
|
||||
when (event?.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
if (LockManager.getLockStatus()==LockManager.LockStatus.LOCKED) {
|
||||
downType = DownType.LOCK
|
||||
LockManager.setLock(LockManager.LockStatus.UNLOCKING)
|
||||
handler?.sendEmptyMessageDelayed(2,1_000)
|
||||
} else {
|
||||
downType = DownType.UNLOCK
|
||||
}
|
||||
CallerLogger.d(TAG, "ACTION_DOWN")
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_MOVE -> {}
|
||||
MotionEvent.ACTION_UP -> {
|
||||
if (downType == DownType.LOCK) {
|
||||
handler?.let {
|
||||
if (it.hasMessages(2)) {
|
||||
it.removeMessages(2)
|
||||
LockManager.setLock(LockManager.LockStatus.LOCKED)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (LockManager.getLockStatus()==LockManager.LockStatus.UNLOCK) {
|
||||
CallerLogger.d(TAG, "onClick")
|
||||
LockManager.setLock(LockManager.LockStatus.LOCKED)
|
||||
}
|
||||
}
|
||||
CallerLogger.d(TAG, "ACTION_UP")
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_CANCEL -> {
|
||||
handler?.let {
|
||||
if (it.hasMessages(2)) {
|
||||
it.removeMessages(2)
|
||||
LockManager.setLock(LockManager.LockStatus.LOCKED)
|
||||
}
|
||||
}
|
||||
CallerLogger.d(TAG, "ACTION_CANCEL")
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
enum class DownType {
|
||||
NONE, LOCK, UNLOCK
|
||||
}
|
||||
|
||||
override fun lockStatusChange(isLock: LockManager.LockStatus) {
|
||||
setImageStatus(LockManager.getStatusViewVisable(),isLock)
|
||||
}
|
||||
|
||||
override fun statusViewvisableChange(statusView: Int) {
|
||||
setImageStatus(statusView,LockManager.getLockStatus())
|
||||
}
|
||||
|
||||
private fun setImageStatus(statusView: Int,lockStatus: LockManager.LockStatus){
|
||||
when (statusView) {
|
||||
View.GONE -> {
|
||||
when (lockStatus) {
|
||||
LockManager.LockStatus.LOCKED -> {
|
||||
aciv_screen_lock.setImageResource(R.drawable.charter_p_lock_normal)
|
||||
}
|
||||
LockManager.LockStatus.UNLOCK -> {
|
||||
aciv_screen_lock.setImageResource(R.drawable.charter_p_unlock)
|
||||
}
|
||||
}
|
||||
aciv_screen_lock_bg?.setImageResource(R.drawable.charger_p_normal)
|
||||
}
|
||||
View.VISIBLE -> {
|
||||
when (lockStatus) {
|
||||
LockManager.LockStatus.LOCKED -> {
|
||||
aciv_screen_lock.setImageResource(R.drawable.charter_p_lock)
|
||||
aciv_screen_lock_bg?.setImageResource(R.drawable.charter_p_lock_bg)
|
||||
animations?.stop()
|
||||
}
|
||||
LockManager.LockStatus.UNLOCKING -> {
|
||||
aciv_screen_lock.setImageResource(R.drawable.charter_p_lock)
|
||||
aciv_screen_lock_bg?.setImageDrawable(null)
|
||||
animations?.reStart()
|
||||
}
|
||||
LockManager.LockStatus.UNLOCK -> {
|
||||
aciv_screen_lock.setImageResource(R.drawable.charter_p_unlock)
|
||||
aciv_screen_lock_bg?.setImageResource(R.drawable.charger_p_normal)
|
||||
animations?.stop()
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
try {
|
||||
initView()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.mogo.och.bus.passenger.ui.lockview
|
||||
import android.os.Handler
|
||||
import android.os.HandlerThread
|
||||
import android.os.Message
|
||||
import android.view.View
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
@@ -10,7 +11,10 @@ import java.util.concurrent.ConcurrentHashMap
|
||||
object LockManager {
|
||||
|
||||
@Volatile
|
||||
private var isLock:Boolean = false
|
||||
private var lockStatus:LockStatus = LockStatus.UNLOCK
|
||||
|
||||
private var statusView:Int = View.GONE
|
||||
|
||||
private var handler:Handler?=null
|
||||
|
||||
private const val TAG = "LockManager"
|
||||
@@ -24,7 +28,7 @@ object LockManager {
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "2分钟没有触摸屏幕导致锁屏")
|
||||
setLock(true)
|
||||
setLock(LockStatus.LOCKED)
|
||||
}
|
||||
}
|
||||
reStartCountDown()
|
||||
@@ -46,26 +50,48 @@ object LockManager {
|
||||
|
||||
|
||||
fun reStartCountDown(){
|
||||
CallerLogger.d(TAG,"重置时间")
|
||||
handler?.removeMessages(1)
|
||||
handler?.sendEmptyMessageDelayed(1,120_000)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun isLocak():Boolean{
|
||||
CallerLogger.d(TAG,"锁定状态:${isLock}")
|
||||
return isLock
|
||||
fun getLockStatus():LockStatus{
|
||||
CallerLogger.d(TAG,"锁定状态:${lockStatus}")
|
||||
return lockStatus
|
||||
}
|
||||
@Synchronized
|
||||
fun setLock(isLock: Boolean){
|
||||
if(this.isLock!=isLock){
|
||||
this.isLock = isLock
|
||||
fun setLock(isLock: LockStatus){
|
||||
if(this.lockStatus!=isLock){
|
||||
this.lockStatus = isLock
|
||||
mLockChnageListener.forEach {
|
||||
it.value.lockStatusChange(this.isLock)
|
||||
it.value.lockStatusChange(this.lockStatus)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getStatusViewVisable():Int{
|
||||
return statusView
|
||||
}
|
||||
|
||||
fun setStatusView(visable:Int){
|
||||
if(this.statusView!=visable){
|
||||
this.statusView = visable
|
||||
mLockChnageListener.forEach {
|
||||
it.value.statusViewvisableChange(this.statusView)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface LockStatusCallback {
|
||||
fun lockStatusChange(isLock: Boolean)
|
||||
fun lockStatusChange(isLock: LockStatus)
|
||||
|
||||
fun statusViewvisableChange(statusView:Int){}
|
||||
}
|
||||
|
||||
enum class LockStatus{
|
||||
LOCKED,
|
||||
UNLOCKING,
|
||||
UNLOCK
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.mogo.och.bus.passenger.ui.lockview
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.bus.passenger.R
|
||||
@@ -21,7 +23,9 @@ class LockViewConstrainLayout : ConstraintLayout {
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
private var acivScreenLock:UnLockView?=null
|
||||
private var acivScreenLock: AppCompatImageView?=null
|
||||
private var uvOnlyUnlock:AppCompatImageView?=null
|
||||
private var uv_only_unlock:UnlockView?=null
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
@@ -37,30 +41,35 @@ class LockViewConstrainLayout : ConstraintLayout {
|
||||
if (acivScreenLock == null) {
|
||||
acivScreenLock = findViewById(R.id.aciv_screen_lock)
|
||||
}
|
||||
if (uvOnlyUnlock == null) {
|
||||
uvOnlyUnlock = findViewById(R.id.aciv_only_unlock)
|
||||
}
|
||||
if (uv_only_unlock == null) {
|
||||
uv_only_unlock = findViewById(R.id.uv_only_unlock)
|
||||
}
|
||||
|
||||
LockManager.reStartCountDown()
|
||||
|
||||
var needInterceptTouch = true
|
||||
acivScreenLock?.apply {
|
||||
event?.let {
|
||||
val location = IntArray(2)
|
||||
getLocationInWindow(location)
|
||||
CallerLogger.d("LockViewConstrainLayout", "${location[0]}---${location[1]}--${location[0]+width}---${location[1]+height}---${it.rawX}----${it.rawY}")
|
||||
val mleft = location[0]
|
||||
val mtop = location[1]
|
||||
val mright = location[0]+width
|
||||
val mbottom = location[1]+height
|
||||
if (it.rawX > mleft && it.rawX < mright && it.rawY > mtop && it.rawY < mbottom) {
|
||||
// 不拦截
|
||||
needInterceptTouch = false
|
||||
CallerLogger.d("LockViewConstrainLayout", "不拦截")
|
||||
event?.let {
|
||||
var need1 = true
|
||||
uv_only_unlock?.let { parentImage->
|
||||
if(parentImage.visibility!=View.GONE){
|
||||
need1 = needIntercept(it,uvOnlyUnlock)
|
||||
}
|
||||
}
|
||||
val need2 = needIntercept(it,acivScreenLock)
|
||||
if(!need1||!need2){
|
||||
needInterceptTouch = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CallerLogger.d("LockViewConstrainLayout", "是否拦截 ${needInterceptTouch}")
|
||||
return if(needInterceptTouch) {
|
||||
if(LockManager.isLocak()){
|
||||
|
||||
if(LockManager.getLockStatus()==LockManager.LockStatus.LOCKED){
|
||||
LockManager.setStatusView(View.VISIBLE)
|
||||
uv_only_unlock?.visibility = View.VISIBLE
|
||||
true
|
||||
}else{
|
||||
super.onInterceptTouchEvent(event)
|
||||
@@ -70,5 +79,27 @@ class LockViewConstrainLayout : ConstraintLayout {
|
||||
}
|
||||
}
|
||||
|
||||
private fun needIntercept(event: MotionEvent,view: View?):Boolean {
|
||||
view?.apply {
|
||||
val location = IntArray(2)
|
||||
getLocationInWindow(location)
|
||||
CallerLogger.d(
|
||||
"LockViewConstrainLayout",
|
||||
"${location[0]}---${location[1]}--${location[0] + width}---${location[1] + height}---${event.rawX}----${event.rawY}"
|
||||
)
|
||||
val mleft = location[0]
|
||||
val mtop = location[1]
|
||||
val mright = location[0] + width
|
||||
val mbottom = location[1] + height
|
||||
if (event.rawX > mleft && event.rawX < mright && event.rawY > mtop && event.rawY < mbottom) {
|
||||
CallerLogger.d("LockViewConstrainLayout", "不拦截")
|
||||
// 不拦截
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.ui.lockview
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import com.mogo.och.taxi.passenger.widget.animutils.AnimationsContainer
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
class UnLockView : AppCompatImageView, LockManager.LockStatusCallback {
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attributeSet,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
val TAG = "UnLockView"
|
||||
|
||||
private var animations: AnimationsContainer?=null
|
||||
private var aciv_screen_unlock_ani: ImageView?=null
|
||||
private var unLockDelay: Disposable? = null
|
||||
private var downType:DownType = DownType.NONE
|
||||
|
||||
override fun dispatchTouchEvent(event: MotionEvent?): Boolean {
|
||||
return super.dispatchTouchEvent(event)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
if (parent is ViewGroup) {
|
||||
aciv_screen_unlock_ani = (parent as ViewGroup).findViewById(R.id.aciv_screen_unlock_ani)
|
||||
aciv_screen_unlock_ani?.let {
|
||||
animations = AnimationsContainer(R.array.openlock,12,it)
|
||||
animations!!.setOnAnimStopListener(object :AnimationsContainer.OnAnimationStoppedListener{
|
||||
override fun AnimationStopped() {
|
||||
it.setImageDrawable(null)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
LockManager.setAutoStatusCallback(TAG,this)
|
||||
}
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent?): Boolean {
|
||||
when (event?.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
if(LockManager.isLocak()){
|
||||
downType = DownType.LOCK
|
||||
animations?.reStart()
|
||||
RxUtils.disposeSubscribe(unLockDelay)
|
||||
unLockDelay = RxUtils.createSubscribe {
|
||||
LockManager.setLock(false)
|
||||
animations?.stop()
|
||||
}
|
||||
}else{
|
||||
downType = DownType.UNLOCK
|
||||
}
|
||||
CallerLogger.d(TAG,"ACTION_DOWN")
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {}
|
||||
MotionEvent.ACTION_UP -> {
|
||||
if(downType==DownType.LOCK) {
|
||||
RxUtils.disposeSubscribe(unLockDelay)
|
||||
animations?.stop()
|
||||
}else{
|
||||
if (!LockManager.isLocak()) {
|
||||
CallerLogger.d(TAG,"onClick")
|
||||
LockManager.setLock(true)
|
||||
}
|
||||
}
|
||||
CallerLogger.d(TAG,"ACTION_UP")
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_CANCEL -> {
|
||||
RxUtils.disposeSubscribe(unLockDelay)
|
||||
animations?.stop()
|
||||
CallerLogger.d(TAG,"ACTION_CANCEL")
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
enum class DownType{
|
||||
NONE,LOCK,UNLOCK
|
||||
}
|
||||
|
||||
override fun lockStatusChange(isLock: Boolean) {
|
||||
if(isLock){
|
||||
setImageResource(R.drawable.charter_p_lock)
|
||||
}else{
|
||||
setImageResource(R.drawable.charter_p_unlock)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.mogo.och.bus.passenger.ui.lockview
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import kotlinx.android.synthetic.main.m1_devices_unlock.view.aciv_only_unlock
|
||||
import kotlinx.android.synthetic.main.m1_devices_unlock.view.actv_lock_status
|
||||
|
||||
class UnlockView : ConstraintLayout, LockManager.LockStatusCallback {
|
||||
|
||||
private val TAG = "UnlockView"
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attributeSet,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
private var handler: Handler?=null
|
||||
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.m1_devices_unlock, this, true)
|
||||
handler = object : Handler(Looper.myLooper()!!) {
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
when (msg.what) {
|
||||
1 -> {// 时间到隐藏view
|
||||
visibility = View.GONE
|
||||
}
|
||||
2 -> {// 解锁
|
||||
LockManager.setLock(LockManager.LockStatus.UNLOCK)
|
||||
sendEmptyMessageDelayed(1, 2_000)
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
LockManager.setAutoStatusCallback(TAG,this)
|
||||
}
|
||||
|
||||
override fun setVisibility(visibility: Int) {
|
||||
super.setVisibility(visibility)
|
||||
LockManager.setStatusView(visibility)
|
||||
when (visibility) {
|
||||
View.VISIBLE -> {
|
||||
CallerLogger.d(TAG,"VISIBLE")
|
||||
handler?.removeMessages(1)
|
||||
handler?.sendEmptyMessageDelayed(1,2_000)
|
||||
}
|
||||
View.GONE -> {
|
||||
handler?.removeMessages(1)
|
||||
CallerLogger.d(TAG,"GONE")
|
||||
}
|
||||
View.INVISIBLE -> {
|
||||
CallerLogger.d(TAG,"INVISIBLE")
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent?): Boolean {
|
||||
if(LockManager.getLockStatus()!=LockManager.LockStatus.UNLOCK) {
|
||||
when (event?.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
handler?.removeMessages(1)
|
||||
handler?.sendEmptyMessageDelayed(2, 1_000)
|
||||
LockManager.setLock(LockManager.LockStatus.UNLOCKING)
|
||||
CallerLogger.d(TAG, "ACTION_DOWN")
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_MOVE -> {}
|
||||
MotionEvent.ACTION_UP -> {
|
||||
handler?.let {
|
||||
if (it.hasMessages(2)) {
|
||||
it.removeMessages(2)
|
||||
LockManager.setLock(LockManager.LockStatus.LOCKED)
|
||||
handler?.sendEmptyMessageDelayed(1, 2_000)
|
||||
}
|
||||
}
|
||||
CallerLogger.d(TAG, "ACTION_UP")
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_CANCEL -> {
|
||||
handler?.let {
|
||||
if (it.hasMessages(2)) {
|
||||
it.removeMessages(2)
|
||||
LockManager.setLock(LockManager.LockStatus.LOCKED)
|
||||
handler?.sendEmptyMessageDelayed(1, 2_000)
|
||||
}
|
||||
}
|
||||
CallerLogger.d(TAG, "ACTION_CANCEL")
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
init {
|
||||
try {
|
||||
initView()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun lockStatusChange(isLock: LockManager.LockStatus) {
|
||||
UiThreadHandler.post {
|
||||
visibility = View.VISIBLE
|
||||
when (isLock) {
|
||||
LockManager.LockStatus.LOCKED -> {
|
||||
// 锁定
|
||||
actv_lock_status.text = "长按开锁键1秒,快速解锁"
|
||||
aciv_only_unlock.setImageResource(R.drawable.charter_p_only_lock)
|
||||
}
|
||||
LockManager.LockStatus.UNLOCKING -> {
|
||||
// 开锁中
|
||||
actv_lock_status.text = "开锁中.."
|
||||
aciv_only_unlock.setImageResource(R.drawable.charter_p_only_unlocking)
|
||||
}
|
||||
LockManager.LockStatus.UNLOCK -> {
|
||||
// 解锁成功
|
||||
actv_lock_status.text = "已解锁"
|
||||
aciv_only_unlock.setImageResource(R.drawable.charter_p_only_unlock)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:endColor="#F2E0E9F8"
|
||||
android:startColor="#F2F4F8FF" />
|
||||
<corners android:radius="@dimen/dp_36" />
|
||||
</shape>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"
|
||||
android:layout_width="@dimen/dp_138"
|
||||
android:layout_height="@dimen/dp_138">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_screen_lock_bg"
|
||||
android:layout_width="@dimen/dp_138"
|
||||
android:layout_height="@dimen/dp_138"
|
||||
android:src="@drawable/charger_p_normal"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_screen_lock"
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:src="@drawable/charter_p_unlock"
|
||||
app:layout_constraintTop_toTopOf="@+id/aciv_screen_lock_bg"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/aciv_screen_lock_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_screen_lock_bg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_screen_lock_bg"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_screen_unlock_ani"
|
||||
android:layout_width="@dimen/dp_90"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
app:layout_constraintTop_toTopOf="@+id/aciv_screen_lock_bg"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/aciv_screen_lock_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_screen_lock_bg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_screen_lock_bg" />
|
||||
</merge>
|
||||
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"
|
||||
android:background="@color/bus_p_m1_66000000"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_lock_status"
|
||||
android:background="@drawable/charter_p_only_unlock_bg"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_width="@dimen/dp_420"
|
||||
android:layout_height="@dimen/dp_320">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_only_unlock"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_56"
|
||||
android:src="@drawable/charter_p_only_unlock"
|
||||
android:layout_width="@dimen/dp_180"
|
||||
android:layout_height="@dimen/dp_180"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/actv_lock_status"
|
||||
android:text="长按开锁键1秒杀,快速解锁"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_only_unlock"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_only_unlock"
|
||||
app:layout_constraintTop_toBottomOf="@+id/aciv_only_unlock"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:textSize="@dimen/dp_29"
|
||||
android:textColor="@color/bus_p_m1_112b57"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/gl_horizontal_center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:src="@drawable/charter_p_arrow_lock"
|
||||
android:layout_marginTop="-15dp"
|
||||
android:layout_marginStart="-15dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/cl_lock_status"
|
||||
app:layout_constraintTop_toTopOf="@+id/gl_horizontal_center"
|
||||
android:layout_width="@dimen/dp_637"
|
||||
android:layout_height="@dimen/dp_241"/>
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -36,38 +36,11 @@
|
||||
android:id="@+id/aciv_map_2_default"
|
||||
android:layout_width="@dimen/dp_148"
|
||||
android:layout_height="@dimen/dp_150"
|
||||
android:layout_marginBottom="-15dp"
|
||||
android:src="@drawable/bus_p_overmap_reset"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bb_boorombar"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_screen_lock_bg"
|
||||
android:layout_width="@dimen/dp_138"
|
||||
android:layout_height="@dimen/dp_138"
|
||||
android:src="@drawable/charter_p_lock_bg"
|
||||
app:layout_constraintBottom_toTopOf="@+id/aciv_map_2_default"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.lockview.UnLockView
|
||||
android:id="@+id/aciv_screen_lock"
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:src="@drawable/charter_p_unlock"
|
||||
app:layout_constraintTop_toTopOf="@+id/aciv_screen_lock_bg"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/aciv_screen_lock_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_screen_lock_bg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_screen_lock_bg"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/aciv_screen_unlock_ani"
|
||||
android:layout_width="@dimen/dp_90"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
app:layout_constraintTop_toTopOf="@+id/aciv_screen_lock_bg"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/aciv_screen_lock_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_screen_lock_bg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_screen_lock_bg" />
|
||||
|
||||
<!--pnc行为决策-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.vehicle.PncActionsView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -172,4 +145,23 @@
|
||||
app:layout_constraintEnd_toEndOf="@+id/mapBizView"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.lockview.UnlockView
|
||||
android:id="@+id/uv_only_unlock"
|
||||
android:visibility="gone"
|
||||
android:background="@color/bus_p_m1_66000000"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.lockview.LockAndUnlockView
|
||||
android:layout_width="@dimen/dp_138"
|
||||
android:layout_height="@dimen/dp_138"
|
||||
app:layout_constraintBottom_toTopOf="@+id/aciv_map_2_default"
|
||||
android:layout_marginBottom="-30dp"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
|
||||
</com.mogo.och.bus.passenger.ui.lockview.LockViewConstrainLayout>
|
||||
@@ -51,4 +51,5 @@
|
||||
<color name="bus_p_m1_CCFFFFFF">#CCFFFFFF</color>
|
||||
<color name="bus_p_m1_80ffffff">#80FFFFFF</color>
|
||||
<color name="bus_p_m1_f0e0efff">#F0E0EFFF </color>
|
||||
<color name="bus_p_m1_66000000">#66000000</color>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user