Skip to content

Commit 10e138c

Browse files
committed
modify:
[Android]-新增一机多控同步异常弹窗
1 parent 78c2431 commit 10e138c

File tree

5 files changed

+156
-41
lines changed

5 files changed

+156
-41
lines changed

Android/app/src/main/java/com/didichuxing/doraemondemo/MainDebugActivityOkhttpV3.kt

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import com.didichuxing.doraemondemo.retrofit.GithubService
4040
import com.didichuxing.doraemonkit.DoKit
4141
import com.didichuxing.doraemonkit.constant.CachesKey
4242
import com.didichuxing.doraemonkit.kit.crash.CrashCaptureManager
43+
import com.didichuxing.doraemonkit.kit.mc.all.ui.McDialogDoKitView
4344
import com.didichuxing.doraemonkit.util.DoKitImageUtil
4445
import com.didichuxing.doraemonkit.util.LogHelper
4546
import com.facebook.drawee.backends.pipeline.Fresco
@@ -154,36 +155,7 @@ class MainDebugActivityOkhttpV3 : BaseActivity(), View.OnClickListener,
154155
mAdapter.setOnItemClickListener { _, view, position ->
155156
when (datas[position]) {
156157
"测试" -> {
157-
lifecycleScope
158-
// lifecycleScope.launch {
159-
// val helloworld = async {
160-
// "Hello world!!"
161-
// }.await()
162-
//
163-
// LogHelper.i(TAG, helloworld)
164-
// }
165-
//
166-
// flow<Int> {
167-
// List(5) {
168-
// emit(it)
169-
// }
170-
// }.map {
171-
// it * 2
172-
// }
173-
174-
lifecycleScope.launch {
175-
//withContext(Dispatchers.IO) {
176-
val sleepDeferred = async {
177-
sleep2()
178-
}
179-
180-
val string = sleepDeferred.await()
181-
182-
Log.i(TAG, string)
183-
184-
//}
185-
}
186-
158+
DoKit.launchFloating<McDialogDoKitView>()
187159
}
188160
"显示/隐藏Dokit入口" -> {
189161
if (DoKit.isMainIconShow) {
@@ -657,4 +629,4 @@ class MainDebugActivityOkhttpV3 : BaseActivity(), View.OnClickListener,
657629
const val TAG = "MainDebugActivity"
658630

659631
}
660-
}
632+
}

Android/config.gradle

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
ext {
22
publish_config = [
3-
//0:发布到到本地localRepoURL仓库
4-
//1:发布到滴滴内部仓库 一般不建议使用 如果需要发布到滴滴内网仓库需要将版本号改得比较大 假如版本号跟jcenter上的一致会由于缓存导致没法下载最新的jcenter的线上代码
5-
//2:发布到maven_central远程仓库
6-
archives_type: 0,
7-
//0:依赖dokit本地module运行
8-
//1:依赖dokit远程aar运行
9-
run_type : 0,
10-
group_id : 'io.github.didi.dokit',
11-
version : '3.5.0.100'
3+
//0:发布到到本地localRepoURL仓库
4+
//1:发布到滴滴内部仓库 一般不建议使用 如果需要发布到滴滴内网仓库需要将版本号改得比较大 假如版本号跟jcenter上的一致会由于缓存导致没法下载最新的jcenter的线上代码
5+
//2:发布到maven_central远程仓库
6+
archives_type: 0,
7+
//0:依赖dokit本地module运行
8+
//1:依赖dokit远程aar运行
9+
run_type : 0,
10+
group_id : 'io.github.didi.dokit',
11+
version : '3.5.0.100'
1212
]
1313

1414
android = [compileSdkVersion : 29,
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package com.didichuxing.doraemonkit.kit.mc.all.ui
2+
3+
import android.content.Context
4+
import android.view.Gravity
5+
import android.view.LayoutInflater
6+
import android.view.View
7+
import android.widget.FrameLayout
8+
import android.widget.TextView
9+
import com.didichuxing.doraemonkit.DoKit
10+
import com.didichuxing.doraemonkit.kit.core.AbsDokitView
11+
import com.didichuxing.doraemonkit.kit.core.DokitViewLayoutParams
12+
import com.didichuxing.doraemonkit.mc.R
13+
14+
/**
15+
* Created by jintai on 2019/09/26.
16+
* 在相应的界面上弹出提示框
17+
*/
18+
class McDialogDoKitView : AbsDokitView() {
19+
20+
lateinit var mTvExceptionType: TextView
21+
lateinit var mTvOk: TextView
22+
23+
override fun onCreate(context: Context) {}
24+
override fun onDestroy() {
25+
super.onDestroy()
26+
}
27+
28+
override fun onCreateView(context: Context, view: FrameLayout): View {
29+
return LayoutInflater.from(context).inflate(R.layout.dk_dokitview_dialog, null)
30+
}
31+
32+
override fun initDokitViewLayoutParams(params: DokitViewLayoutParams) {
33+
params.flags = DokitViewLayoutParams.FLAG_NOT_FOCUSABLE_AND_NOT_TOUCHABLE
34+
params.gravity = Gravity.CENTER
35+
params.width = DokitViewLayoutParams.MATCH_PARENT
36+
params.height = DokitViewLayoutParams.MATCH_PARENT
37+
}
38+
39+
override fun onViewCreated(view: FrameLayout) {
40+
mTvExceptionType = findViewById<TextView>(R.id.exception_type)!!
41+
mTvOk = findViewById<TextView>(R.id.tv_ok)!!
42+
mTvOk.setOnClickListener {
43+
DoKit.removeFloating(McDialogDoKitView::class.java)
44+
}
45+
}
46+
47+
/**
48+
* 解决ViewCheckDrawDokitView的margin被改变的bug
49+
*/
50+
override fun onResume() {
51+
super.onResume()
52+
}
53+
54+
override fun canDrag(): Boolean {
55+
return false
56+
}
57+
}

Android/dokit-mc/src/main/java/com/didichuxing/doraemonkit/kit/mc/client/ClientSyncFailedImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,4 @@ class ClientSyncFailedImpl : ClientSyncFailedListener {
9696
private fun showFailDialog() {
9797

9898
}
99-
}
99+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:background="@color/dk_color_aa000000">
6+
7+
8+
<LinearLayout
9+
android:layout_width="280dp"
10+
android:layout_height="wrap_content"
11+
android:layout_centerInParent="true"
12+
android:background="@color/dk_color_FFFFFF"
13+
android:orientation="vertical">
14+
15+
<TextView
16+
android:id="@+id/title"
17+
android:layout_width="wrap_content"
18+
android:layout_height="wrap_content"
19+
android:layout_gravity="center_horizontal"
20+
android:layout_marginTop="20dp"
21+
android:text="一机多控同步异常"
22+
android:textColor="@color/dk_color_333333"
23+
android:textSize="21sp"
24+
android:textStyle="bold" />
25+
26+
<View
27+
style="@style/DK.Divider"
28+
android:layout_marginTop="20dp" />
29+
30+
<LinearLayout
31+
android:layout_width="match_parent"
32+
android:layout_height="wrap_content"
33+
android:layout_marginTop="16dp"
34+
android:orientation="vertical"
35+
android:paddingLeft="20dp"
36+
android:paddingRight="20dp">
37+
38+
<TextView
39+
android:layout_width="wrap_content"
40+
android:layout_height="wrap_content"
41+
android:text="异常类型"
42+
android:textColor="@color/dk_color_333333"
43+
android:textSize="16sp" />
44+
45+
<TextView
46+
android:id="@+id/exception_type"
47+
android:layout_width="match_parent"
48+
android:layout_height="wrap_content"
49+
android:layout_marginTop="@dimen/dk_dp_5"
50+
android:maxLines="2"
51+
android:text="主从机页面不一致"
52+
android:textColor="@color/dk_color_FF0006"
53+
android:textSize="14sp" />
54+
55+
56+
<TextView
57+
android:layout_width="match_parent"
58+
android:layout_height="wrap_content"
59+
android:layout_marginTop="@dimen/dk_dp_16"
60+
android:text="备注:详细信息请在dokit.cn平台一机多控模块查看"
61+
android:textColor="@color/dk_color_333333"
62+
android:textSize="14sp" />
63+
64+
65+
</LinearLayout>
66+
67+
<View
68+
style="@style/DK.Divider"
69+
android:layout_marginTop="20dp" />
70+
71+
72+
<TextView
73+
android:id="@+id/tv_ok"
74+
style="@style/DK.Text.Blue"
75+
android:layout_width="match_parent"
76+
android:layout_height="wrap_content"
77+
android:background="@drawable/dk_dialog_button_background"
78+
android:gravity="center_horizontal"
79+
android:padding="10dp"
80+
android:text="确认"
81+
android:textColor="@color/dk_color_55A8FD"
82+
android:textSize="20sp" />
83+
84+
</LinearLayout>
85+
86+
</RelativeLayout>

0 commit comments

Comments
 (0)