提交 59566f79 编写于 作者: 囧jt's avatar 囧jt

modify:

[Android]- Release v3.4.3 & v3.4.3.1
上级 66232439
......@@ -20,6 +20,7 @@ import com.didichuxing.doraemonkit.kit.mc.all.view_info.DokitViewInfo
import com.didichuxing.doraemonkit.kit.mc.all.view_info.ViewC12c
import com.didichuxing.doraemonkit.kit.mc.server.DoKitWsServer
import com.didichuxing.doraemonkit.kit.mc.util.ViewPathUtil
import com.didichuxing.doraemonkit.util.ConvertUtils
import com.didichuxing.doraemonkit.util.LogHelper
import de.robv.android.xposed.XC_MethodHook
......@@ -230,20 +231,20 @@ class View_onInitializeAccessibilityEventHook : XC_MethodHook() {
acc.movementGranularity,
acc.toIndex,
acc.action,
acc.maxScrollX,
acc.maxScrollY,
ConvertUtils.px2dp(acc.maxScrollX.toFloat()),
ConvertUtils.px2dp(acc.maxScrollY.toFloat()),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
acc.scrollDeltaX
ConvertUtils.px2dp(acc.scrollDeltaX.toFloat())
} else {
-1
},
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
acc.scrollDeltaY
ConvertUtils.px2dp(acc.scrollDeltaY.toFloat())
} else {
-1
},
acc.scrollX,
acc.scrollY,
ConvertUtils.px2dp(acc.scrollX.toFloat()),
ConvertUtils.px2dp(acc.scrollY.toFloat()),
acc.isScrollable,
acc.contentChangeTypes,
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
......
......@@ -32,34 +32,37 @@ class DoKitMcActivity : BaseActivity() {
fun changeFragment(wsMode: WSMode) {
val fragment: Fragment = when (wsMode) {
WSMode.RECORDING,
WSMode.UNKNOW -> {
mTitlebar.setTitle("一机多控(主页)")
DoKitMcMainFragment()
}
WSMode.HOST -> {
mTitlebar.setTitle("一机多控(主机)")
DoKitMcHostFragment()
}
WSMode.CLIENT -> {
mTitlebar.setTitle("一机多控(从机)")
DoKitMcClientFragment()
}
mTitlebar.postDelayed({
val fragment: Fragment = when (wsMode) {
WSMode.RECORDING,
WSMode.UNKNOW -> {
mTitlebar.setTitle("一机多控(主页)")
DoKitMcMainFragment()
}
WSMode.HOST -> {
mTitlebar.setTitle("一机多控(主机)")
DoKitMcHostFragment()
}
WSMode.CLIENT -> {
mTitlebar.setTitle("一机多控(从机)")
DoKitMcClientFragment()
}
WSMode.MC_CASELIST -> {
mTitlebar.setTitle("一机多控(用例列表)")
DoKitMcDatasFragment()
WSMode.MC_CASELIST -> {
mTitlebar.setTitle("一机多控(用例列表)")
DoKitMcDatasFragment()
}
else -> {
mTitlebar.setTitle("一机多控(主页)")
DoKitMcMainFragment()
}
}
else -> {
mTitlebar.setTitle("一机多控(主页)")
DoKitMcMainFragment()
}
}
supportFragmentManager.beginTransaction()
.replace(R.id.fragment_container_view, fragment)
.commitNowAllowingStateLoss()
supportFragmentManager.beginTransaction()
.replace(R.id.fragment_container_view, fragment)
.commitNowAllowingStateLoss()
}, 100)
}
}
\ No newline at end of file
......@@ -6,14 +6,18 @@ import android.widget.TextView
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.didichuxing.doraemonkit.constant.WSMode
import com.didichuxing.doraemonkit.extension.doKitGlobalScope
import com.didichuxing.doraemonkit.kit.core.DoKitManager
import com.didichuxing.doraemonkit.kit.core.BaseFragment
import com.didichuxing.doraemonkit.kit.mc.ability.McHttpManager
import com.didichuxing.doraemonkit.kit.mc.all.DoKitMcManager
import com.didichuxing.doraemonkit.kit.mc.data.McConfigInfo
import com.didichuxing.doraemonkit.mc.R
import com.didichuxing.doraemonkit.util.SPUtils
import com.didichuxing.doraemonkit.util.ToastUtils
import com.didichuxing.doraemonkit.widget.recyclerview.DividerItemDecoration
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
/**
......@@ -39,10 +43,7 @@ class DoKitMcDatasFragment : BaseFragment() {
super.onViewCreated(view, savedInstanceState)
mRv = findViewById(R.id.rv)
mEmpty = findViewById(R.id.tv_empty)
mRv.layoutManager = LinearLayoutManager(requireActivity())
val decoration = DividerItemDecoration(DividerItemDecoration.VERTICAL)
decoration.setDrawable(resources.getDrawable(R.drawable.dk_divider))
mRv.addItemDecoration(decoration)
mAdapter = McCaseListAdapter(mutableListOf<McCaseInfo>())
mAdapter.setOnItemClickListener { adapter, _, pos ->
val item = adapter.data[pos] as McCaseInfo
......@@ -59,11 +60,25 @@ class DoKitMcDatasFragment : BaseFragment() {
saveCaseId(item.caseId)
ToastUtils.showShort("用例: ${item.caseName} 已被选中")
}
if (DoKitManager.WS_MODE == WSMode.HOST) {
doKitGlobalScope.launch {
delay(100)
adapter.notifyDataSetChanged()
}
} else {
adapter.notifyDataSetChanged()
}
adapter.notifyDataSetChanged()
}
mRv.adapter = mAdapter
mRv.apply {
adapter = mAdapter
layoutManager = LinearLayoutManager(requireActivity())
val decoration = DividerItemDecoration(DividerItemDecoration.VERTICAL)
decoration.setDrawable(resources.getDrawable(R.drawable.dk_divider))
addItemDecoration(decoration)
}
lifecycleScope.launch {
val data = McHttpManager.caseList<McCaseInfo>().data
data?.let {
......
......@@ -329,19 +329,28 @@ object WSClientProcessor {
when (targetView) {
is ScrollView -> {
viewC12c.accEventInfo?.let { accEventInfo ->
targetView.smoothScrollTo(accEventInfo.scrollX!!, accEventInfo.scrollY!!)
targetView.smoothScrollTo(
ConvertUtils.dp2px(accEventInfo.scrollX!!.toFloat()),
ConvertUtils.dp2px(accEventInfo.scrollY!!.toFloat())
)
}
}
is NestedScrollView -> {
viewC12c.accEventInfo?.let { accEventInfo ->
targetView.smoothScrollTo(accEventInfo.scrollX!!, accEventInfo.scrollY!!)
targetView.smoothScrollTo(
ConvertUtils.dp2px(accEventInfo.scrollX!!.toFloat()),
ConvertUtils.dp2px(accEventInfo.scrollY!!.toFloat())
)
}
}
is HorizontalScrollView -> {
viewC12c.accEventInfo?.let { accEventInfo ->
targetView.smoothScrollTo(accEventInfo.scrollX!!, accEventInfo.scrollY!!)
targetView.smoothScrollTo(
ConvertUtils.dp2px(accEventInfo.scrollX!!.toFloat()),
ConvertUtils.dp2px(accEventInfo.scrollY!!.toFloat())
)
}
}
......@@ -351,7 +360,7 @@ object WSClientProcessor {
accEventInfo.fromIndex!! == 0 -> {
targetView.smoothScrollToPosition(0)
}
accEventInfo.toIndex!! + 1 == targetView.adapter?.itemCount -> {
accEventInfo.toIndex!! == targetView.adapter?.itemCount!! - 1 -> {
targetView.smoothScrollToPosition(accEventInfo.toIndex)
}
else -> {
......@@ -359,7 +368,26 @@ object WSClientProcessor {
}
}
//targetView.smoothScrollToPosition(accEventInfo.fromIndex!!)
// if (targetView.layoutManager is LinearLayoutManager) {
// val layoutManager = targetView.layoutManager as LinearLayoutManager
// if (layoutManager.orientation == RecyclerView.VERTICAL) {
// if (targetView.scrollY <= ConvertUtils.dp2px(10.0f)) {
// targetView.smoothScrollBy(
// ConvertUtils.dp2px(accEventInfo.scrollDeltaX!!.toFloat()),
// ConvertUtils.dp2px(accEventInfo.scrollDeltaY!!.toFloat())
// )
// }
//
// } else {
// if (targetView.scrollX <= ConvertUtils.dp2px(10.0f)) {
// targetView.smoothScrollBy(
// ConvertUtils.dp2px(accEventInfo.scrollDeltaX!!.toFloat()),
// ConvertUtils.dp2px(accEventInfo.scrollDeltaY!!.toFloat())
// )
// }
// }
// }
}
}
......
......@@ -4,14 +4,12 @@ import android.view.View
import android.view.ViewGroup
import android.view.ViewParent
import android.widget.ListView
import androidx.core.view.children
import androidx.fragment.app.FragmentPagerAdapter
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager
import com.didichuxing.doraemonkit.extension.tagName
import com.didichuxing.doraemonkit.util.ResourceUtils
import com.didichuxing.doraemonkit.kit.core.DokitFrameLayout
import com.didichuxing.doraemonkit.kit.mc.all.view_info.SystemViewInfo
import com.didichuxing.doraemonkit.util.UIUtils
......@@ -26,112 +24,110 @@ import com.didichuxing.doraemonkit.util.UIUtils
*/
object ViewPathUtil {
/**
* @param strategy
* 0:当前事件发生的view就为特殊的view
* 1:当前事件发生的view不是特殊的view
*/
private fun addSpecialSystemViewInfo(
private fun addParentViewInfo(
systemViewInfos: MutableList<SystemViewInfo>,
parent: ViewGroup?,
view: View,
strategy: Int
) {
if (strategy == 0) {
when (view) {
is ViewPager,
is ListView,
parent?.let {
when (parent) {
is RecyclerView -> {
systemViewInfos.add(
SystemViewInfo(
view::class.tagName,
UIUtils.getRealIdText(view),
if (view is ViewGroup) {
view.childCount
} else {
-1
},
-1,
parent::class.tagName,
UIUtils.getRealIdText(parent),
parent.childCount,
parent.indexOfChild(view),
true,
-1,
isCurrentEventView = true
parent.getChildAdapterPosition(view)
)
)
}
else -> {
is ListView -> {
systemViewInfos.add(
SystemViewInfo(
view::class.tagName,
UIUtils.getRealIdText(view),
if (view is ViewGroup) {
view.childCount
} else {
-1
},
-1,
false,
-1,
isCurrentEventView = true
parent::class.tagName,
UIUtils.getRealIdText(parent),
parent.childCount,
parent.indexOfChild(view),
true,
parent.getPositionForView(view)
)
)
}
}
} else {
parent?.let {
when (parent) {
is RecyclerView -> {
systemViewInfos.add(
SystemViewInfo(
parent::class.tagName,
UIUtils.getRealIdText(parent),
parent.childCount,
parent.indexOfChild(view),
true,
parent.getChildAdapterPosition(view)
)
)
}
is ListView -> {
systemViewInfos.add(
SystemViewInfo(
parent::class.tagName,
UIUtils.getRealIdText(parent),
parent.childCount,
parent.indexOfChild(view),
true,
parent.getPositionForView(view)
)
)
}
is ViewPager -> {
systemViewInfos.add(
SystemViewInfo(
parent::class.tagName,
UIUtils.getRealIdText(parent),
parent.indexOfChild(view),
parent.childCount,
true,
parent.currentItem
)
is ViewPager -> {
systemViewInfos.add(
SystemViewInfo(
parent::class.tagName,
UIUtils.getRealIdText(parent),
parent.indexOfChild(view),
parent.childCount,
true,
parent.currentItem
)
}
else -> {
systemViewInfos.add(
SystemViewInfo(
parent::class.tagName,
UIUtils.getRealIdText(parent),
parent.indexOfChild(view),
parent.indexOfChild(view)
)
)
}
else -> {
systemViewInfos.add(
SystemViewInfo(
parent::class.tagName,
UIUtils.getRealIdText(parent),
parent.indexOfChild(view),
parent.indexOfChild(view)
)
}
)
}
}
}
}
private fun addSelfViewInfo(
systemViewInfos: MutableList<SystemViewInfo>,
view: View
) {
when (view) {
is ViewPager,
is ListView,
is RecyclerView -> {
systemViewInfos.add(
SystemViewInfo(
view::class.tagName,
UIUtils.getRealIdText(view),
if (view is ViewGroup) {
view.childCount
} else {
-1
},
-1,
true,
-1,
isCurrentEventView = true
)
)
}
else -> {
systemViewInfos.add(
SystemViewInfo(
view::class.tagName,
UIUtils.getRealIdText(view),
if (view is ViewGroup) {
view.childCount
} else {
-1
},
-1,
false,
-1,
isCurrentEventView = true
)
)
}
}
}
/**
......@@ -139,23 +135,18 @@ object ViewPathUtil {
*/
fun createViewPathOfWindow(view: View): MutableList<SystemViewInfo> {
val systemViewInfos: MutableList<SystemViewInfo> = mutableListOf()
addSpecialSystemViewInfo(
systemViewInfos, if (view.parent is ViewGroup) {
view.parent as ViewGroup
} else {
null
}, view, 0
)
addSelfViewInfo(systemViewInfos, view)
var parentViewGroup: ViewParent? = view.parent
if (parentViewGroup is ViewGroup) {
addSpecialSystemViewInfo(systemViewInfos, parentViewGroup, view, 1)
addParentViewInfo(systemViewInfos, parentViewGroup, view)
}
while (parentViewGroup != null && parentViewGroup::class.tagName != "android.view.ViewRootImpl") {
if (parentViewGroup is ViewGroup) {
val currentView: ViewGroup = parentViewGroup
if (parentViewGroup.parent is ViewGroup) {
parentViewGroup = parentViewGroup.parent as ViewGroup
addSpecialSystemViewInfo(systemViewInfos, parentViewGroup, currentView, 1)
addParentViewInfo(systemViewInfos, parentViewGroup, currentView)
} else {
parentViewGroup = parentViewGroup.parent
}
......
......@@ -31,14 +31,13 @@
android:id="@+id/tv_host"
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_marginTop="15dp"
android:background="@drawable/dk_btn_mc_bg"
android:text="@string/dk_kit_multi_control_host"
android:textAllCaps="false"
android:textColor="@color/dk_color_FFFFFF"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginTop="15dp"
/>
android:textStyle="bold" />
<Button
android:id="@+id/tv_client"
......
......@@ -19,13 +19,13 @@ android.injected.testOnly=false
kotlin.code.style=official
#dokit全局配置
## 插件开关
DOKIT_PLUGIN_SWITCH=false
DOKIT_PLUGIN_SWITCH=true
## 插件日志
DOKIT_LOG_SWITCH=true
## webview 的全限定名
DOKIT_WEBVIEW_CLASS_NAME=com/didichuxing/doraemonkit/widget/webview/MyWebView
## dokit 慢函数开关
DOKIT_METHOD_SWITCH=false
DOKIT_METHOD_SWITCH=true
## dokit 函数调用栈层级
DOKIT_METHOD_STACK_LEVEL=2
## 0:调用栈模式 打印函数调用栈 需添加指定入口 默认为application onCreate 和attachBaseContext
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册