[6.7.0]
[fea] [shuttle] [bus] [绑定二维码]
This commit is contained in:
@@ -15,8 +15,5 @@
|
||||
<string name="network_error_tip">网络异常,请稍后重试</string>
|
||||
<string name="request_error_tip">请求出现异常,请稍后重试</string>
|
||||
|
||||
<string name="qr_cancel">取消</string>
|
||||
<string name="bind_driver_qr_title">扫描二维码完成车辆绑定</string>
|
||||
|
||||
<string name="biz_log_i_see">我知道了</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.mogo.och.common.module.wigets
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.lifecycle.LifecycleObserver
|
||||
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
|
||||
import com.mogo.och.common.module.R
|
||||
|
||||
/**
|
||||
* 带有title, tip,confirm,cancel的dialog
|
||||
*/
|
||||
class BindQRCodeDialogNew: BaseFloatDialog, LifecycleObserver {
|
||||
|
||||
private var qrBm : AppCompatImageView? = null
|
||||
private var qrCancel: AppCompatTextView? = null
|
||||
private var qrTitle: AppCompatTextView? = null
|
||||
|
||||
private var clickListener: ClickListener? = null
|
||||
|
||||
constructor(builder: Builder,context: Context) : super(context) {
|
||||
qrTitle?.text = builder.titleStr
|
||||
qrCancel?.text = builder.cancelStr
|
||||
qrBm?.setImageBitmap(builder.qrBm)
|
||||
}
|
||||
|
||||
init{
|
||||
setContentView(R.layout.bind_driver_qr_view)
|
||||
|
||||
setCanceledOnTouchOutside(true)
|
||||
|
||||
qrTitle = findViewById(R.id.qr_title)
|
||||
qrBm = findViewById(R.id.qr_bm)
|
||||
qrCancel = findViewById(R.id.bind_qr_cancel)
|
||||
|
||||
qrCancel?.setOnClickListener {
|
||||
clickListener?.cancel()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
fun setClickListener(clickListener: ClickListener) {
|
||||
this.clickListener = clickListener
|
||||
}
|
||||
|
||||
interface ClickListener{
|
||||
fun cancel()
|
||||
}
|
||||
|
||||
class Builder{
|
||||
var titleStr:String = ""
|
||||
var cancelStr:String = ""
|
||||
var qrBm: Bitmap? = null
|
||||
|
||||
fun title(title: String) : Builder{
|
||||
this.titleStr = title
|
||||
return this
|
||||
}
|
||||
|
||||
fun cancelStr(cancel: String) : Builder{
|
||||
this.cancelStr = cancel
|
||||
return this
|
||||
}
|
||||
|
||||
fun qrBm(bm: Bitmap) : Builder{
|
||||
this.qrBm = bm
|
||||
return this
|
||||
}
|
||||
|
||||
fun build(context: Context): BindQRCodeDialogNew? {
|
||||
return BindQRCodeDialogNew(this,context)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/common_button_cancle_click" android:state_pressed="true"/>
|
||||
<item android:drawable="@drawable/common_button_cancle_normal" android:state_pressed="false"/>
|
||||
<item android:drawable="@drawable/common_button_cancle_normal"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<solid android:color="@color/common_color_99000000"/>
|
||||
<corners android:radius="@dimen/dp_30"/>
|
||||
</shape>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<solid android:color="@color/common_color_4D000000"/>
|
||||
<corners android:radius="@dimen/dp_30"/>
|
||||
</shape>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<gradient android:startColor="@color/common_3B3D44" android:endColor="@color/common_2E323A" android:angle="270"/>
|
||||
<stroke android:color="@color/color_666C6C6C" android:width="@dimen/dp_2"/>
|
||||
<corners android:radius="@dimen/dp_50"/>
|
||||
</shape>
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/dp_890"
|
||||
android:layout_height="@dimen/dp_780"
|
||||
<com.mogo.och.common.module.wigets.OCHRoundConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:ignore="MissingDefaultResource"
|
||||
android:background="@drawable/bind_driver_qr_bg">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/dp_900"
|
||||
android:layout_height="@dimen/dp_745"
|
||||
android:background="@drawable/common_qr_dialog"
|
||||
app:roundLayoutRadius="@dimen/dp_50">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/qr_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bind_driver_qr_title"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/dp_56"
|
||||
android:layout_marginTop="@dimen/dp_48"
|
||||
android:textSize="@dimen/dp_45"
|
||||
android:layout_marginTop="@dimen/dp_75"
|
||||
android:textColor="@android:color/white"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
@@ -23,33 +24,27 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/qr_bm"
|
||||
android:layout_width="@dimen/dp_357"
|
||||
android:layout_height="@dimen/dp_357"
|
||||
android:layout_width="@dimen/dp_300"
|
||||
android:layout_height="@dimen/dp_300"
|
||||
android:padding="8dp"
|
||||
android:background="@android:color/white"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/qr_title"
|
||||
app:layout_constraintBottom_toTopOf="@+id/line"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/line"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2px"
|
||||
android:background="@color/qr_line_bg_color"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bind_qr_cancel"
|
||||
app:layout_constraintLeft_toLeftOf="parent"/>
|
||||
app:layout_constraintBottom_toTopOf="@+id/bind_qr_cancel"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/bind_qr_cancel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_162"
|
||||
android:layout_width="@dimen/dp_356"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/common_button_cancle"
|
||||
android:text="@string/qr_cancel"
|
||||
android:textSize="@dimen/dp_52"
|
||||
android:layout_marginBottom="@dimen/dp_65"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.mogo.och.common.module.wigets.OCHRoundConstraintLayout>
|
||||
@@ -8,7 +8,8 @@
|
||||
<color name="taxi_111533">#111533</color>
|
||||
<color name="taxi_878890">#878890</color>
|
||||
<color name="taxi_EF262C">#EF262C</color>
|
||||
<color name="taxi_4D000000">#4D000000</color>
|
||||
<color name="common_color_4D000000">#4D000000</color>
|
||||
<color name="common_color_99000000">#99000000</color>
|
||||
|
||||
<color name="och_dialog_bg_color">#3B4577</color>
|
||||
|
||||
@@ -35,4 +36,6 @@
|
||||
<color name="common_B3FFFFFF">#B3FFFFFF</color>
|
||||
<color name="common_cccccc">#CCCCCC</color>
|
||||
<color name="common_f7151d41">#F7151D41</color>
|
||||
<color name="common_3B3D44">#3B3D44</color>
|
||||
<color name="common_2E323A">#2E323A</color>
|
||||
</resources>
|
||||
@@ -25,7 +25,7 @@
|
||||
<string name="request_error_tip">请求出现异常,请稍后重试</string>
|
||||
|
||||
<string name="qr_cancel">取消</string>
|
||||
<string name="bind_driver_qr_title">扫描二维码完成车辆绑定</string>
|
||||
<string name="bind_driver_qr_title">请扫码绑定</string>
|
||||
|
||||
<string name="common_change2_autopilot2_manual">自动驾驶已退出,请立即接管,注意周边环境 小心驾驶</string>
|
||||
<string name="common_change2_pxjs_manual">平行驾驶已退出,请立即接管,注意周边环境 小心驾驶</string>
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.mogo.och.weaknet.repository.db.repository.TaskSiteDb
|
||||
import com.mogo.och.weaknet.ui.fragment.ShuttleFragment
|
||||
import com.mogo.och.weaknet.model.LineModel
|
||||
import com.mogo.och.weaknet.ui.bizswitch.SwitchBizView
|
||||
import com.mogo.och.weaknet.ui.qr.QrOpenView
|
||||
import com.mogo.och.weaknet.util.BusAnalyticsManager
|
||||
|
||||
/**
|
||||
@@ -60,4 +61,10 @@ class ShuttleDriverProvider : CommonServiceImpl() {
|
||||
SwitchBizView(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun createOchBindQRCodeView(context: Context?): View? {
|
||||
return context?.let {
|
||||
QrOpenView(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,27 +137,7 @@ class ShuttleFragment : MvpFragment<ShuttleFragment?, BusPresenter?>() {
|
||||
fun changeOverview(eventLogout: EventLogout) {
|
||||
when (eventLogout.messgae) {
|
||||
EventLogout.SHOW_QR_TYPE-> { //显示二维码
|
||||
d(
|
||||
SceneConstant.M_BUS + TAG, "changeOverview Event qrcode,sn = "
|
||||
+ SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
val qrUrl = String.format(
|
||||
FunctionBuildConfig.urlJson.bindDriverQRUrl,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
val bmQr = createQRCodeWithPicture(
|
||||
BitmapFactory.decodeResource(resources, R.drawable.icon_qr_center_logo),
|
||||
qrUrl, AutoSizeUtils.dp2px(context, 340f),
|
||||
AutoSizeUtils.dp2px(context, 340f), true
|
||||
)
|
||||
if (bmQr != null) {
|
||||
val builder = BindQRCodeDialog.Builder()
|
||||
builder.title(getString(R.string.bind_driver_qr_title))
|
||||
.cancelStr(getString(R.string.qr_cancel))
|
||||
.qrBm(bmQr).build(AbsMogoApplication.getApp())!!.show()
|
||||
} else {
|
||||
d(SceneConstant.M_BUS + TAG, "bmQr = null ")
|
||||
}
|
||||
|
||||
}
|
||||
EventLogout.SHOW_WAIT_UPLOAD_TASK-> {
|
||||
context?.let {
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.mogo.och.weaknet.ui.qr
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.BitmapFactory
|
||||
import android.util.AttributeSet
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.common.module.utils.createQRCodeWithPicture
|
||||
import com.mogo.och.common.module.wigets.BindQRCodeDialog
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
class QrOpenView : AppCompatImageView {
|
||||
|
||||
private val TAG = "QrOpenView"
|
||||
|
||||
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 fun initView() {
|
||||
setImageResource(R.drawable.bus_open_qr)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
|
||||
onClick {
|
||||
d(
|
||||
SceneConstant.M_BUS + TAG, "changeOverview Event qrcode,sn = "
|
||||
+ SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
val qrUrl = String.format(
|
||||
FunctionBuildConfig.urlJson.bindDriverQRUrl,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
val bmQr = createQRCodeWithPicture(
|
||||
BitmapFactory.decodeResource(resources, R.drawable.icon_qr_center_logo),
|
||||
qrUrl, AutoSizeUtils.dp2px(context, 340f),
|
||||
AutoSizeUtils.dp2px(context, 340f), true
|
||||
)
|
||||
if (bmQr != null) {
|
||||
val builder = BindQRCodeDialog.Builder()
|
||||
builder.title(ResourcesUtils.getString(R.string.bind_driver_qr_title))
|
||||
.cancelStr(ResourcesUtils.getString(R.string.qr_cancel))
|
||||
.qrBm(bmQr).build(AbsMogoApplication.getApp())!!.show()
|
||||
} else {
|
||||
d(SceneConstant.M_BUS + TAG, "bmQr = null ")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
try {
|
||||
initView()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
BIN
OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_open_qr.png
Executable file
BIN
OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_open_qr.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Reference in New Issue
Block a user