kongzue / DialogX

💬 DialogX dialog box component library, easy to use, more customizable, more scalable, easy to achieve a variety of dialog boxes. DialogX对话框组件库,更加方便易用,可自定义程度更高,扩展性更强,轻松实现各种对话框、菜单和提示效果,更有Material You、iOS、MIUI等主题扩展可选
Apache License 2.0
2.05k stars 215 forks source link

【BUG反馈】 BottomDialog setCustomView自定义view里面如果有DatePicker或者是TimePicker之类的性能不佳 #457

Closed lsCoding666 closed 1 month ago

lsCoding666 commented 1 month ago

⚠️ 重要阅读

问题描述

使用BottomDialog的自定义view,自定义view里面有个日期选择器和时间选择器,都是滚轮类型的,点击按钮后弹出,得等2秒以上才能弹出来 机型是红米K40、小米14

DialogX 版本

0.0.50.beta17.1

设备信息

小米14 android14

是否在 Demo 中能复现此问题?

问题截图/视频

以下是代码:

private void showDialog(){
        bottomDialog = BottomDialog.build().setCustomView(new OnBindView<BottomDialog>(R.layout.comit_customview_datepicker_timepicker_dialog) {

            @Override
            public void onBind(BottomDialog dialog, View v) {

            }
        }).setAllowInterceptTouch(false).show();
    }
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:maxHeight="570dp">

    <LinearLayout
        android:id="@+id/dialog_ll"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="vertical">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="48dp">

            <TextView
                android:id="@+id/dialog_title_tv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:text="标题" />

            <ImageView
                android:id="@+id/dialog_close_iv"
                android:layout_width="48dp"
                android:layout_height="48dp"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:layout_marginEnd="16dp"
                android:padding="16dp"
                android:src="@android:drawable/ic_menu_close_clear_cancel" />
        </RelativeLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#FFF1F2F2" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:tag="ScrollController"
            android:visibility="visible">

            <DatePicker
                android:id="@+id/dialog_date_picker"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="1dp"
                android:layout_weight="1"
                android:calendarViewShown="false"
                android:datePickerMode="spinner" />

            <TimePicker
                android:id="@+id/dialog_time_picker"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:timePickerMode="spinner" />

        </LinearLayout>

    </LinearLayout>

</RelativeLayout>

错误日志

2024-08-07 17:09:26.635  7911-7911  ScrollerOp...ionManager com.comit.dialogxtest                D  registerConfigChangedListener
2024-08-07 17:09:26.642  7911-7911  >>>                     com.comit.dialogxtest                I  BottomDialog(5591dc7).show on com.comit.dialogxtest.MainActivity@9a7ab4d
2024-08-07 17:09:27.863  7911-7911  Looper                  com.comit.dialogxtest                W  PerfMonitor longMsg : seq=4602 plan=17:09:26.547 late=102ms wall=1212ms running=1192ms runnable=8ms h=android.view.Choreographer$FrameHandler c=android.view.Choreographer$FrameDisplayEventReceiver procState=-1
2024-08-07 17:09:27.863  7911-7911  Looper                  com.comit.dialogxtest                W  PerfMonitor doFrame : time=1212ms vsyncFrame=0 latency=102ms procState=-1 historyMsgCount=2 (msgIndex=1 wall=103ms seq=4600 running=103ms h=android.view.ViewRootImpl$ViewRootHandler c=android.view.View$PerformClick)
2024-08-07 17:09:27.865  7911-7911  HandWritingStubImpl     com.comit.dialogxtest                I  refreshLastKeyboardType: 1
2024-08-07 17:09:27.865  7911-7911  HandWritingStubImpl     com.comit.dialogxtest                I  getCurrentKeyboardType: 1
2024-08-07 17:09:27.868  7911-7911  Choreographer           com.comit.dialogxtest                I  Skipped 146 frames!  The application may be doing too much work on its main thread.
2024-08-07 17:09:27.871  7911-7947  OpenGLRenderer          com.comit.dialogxtest                I  Davey! duration=1315ms; Flags=0, FrameTimelineVsyncId=31699926, IntendedVsync=119520647721793, Vsync=119520746936317, InputEventId=36459979, HandleInputStart=119520751069041, AnimationStart=119520751073103, PerformTraversalsStart=119520751251853, DrawStart=119521952355759, FrameDeadline=119520659388460, FrameInterval=119520749081384, FrameStartTime=8259601, SyncQueued=119521959620342, SyncStart=119521959689353, IssueDrawCommandsStart=119521961258051, SwapBuffers=119521962181176, FrameCompleted=119521963345603, DequeueBufferDuration=31979, QueueBufferDuration=397813, GpuCompleted=119521963345603, SwapBuffersCompleted=119521962919040, DisplayPresentTime=119520985507166, CommandSubmissionCompleted=119521962181176, 
2024-08-07 17:09:27.871  9534-9534  BaseInputMethodService  com.sohu.inputmethod.sogou.xiaomi    E  onStartInput app:com.comit.dialogxtest restarting:false
2024-08-07 17:09:27.872  7911-7911  Looper                  com.comit.dialogxtest                W  PerfMonitor doFrame : time=4ms vsyncFrame=0 latency=1213ms procState=-1 historyMsgCount=20 (msgIndex=1 wall=1212ms seq=4602 running=1192ms runnable=8ms late=102ms h=android.view.Choreographer$FrameHandler c=android.view.Choreographer$FrameDisplayEventReceiver)
kongzue commented 1 month ago

此问题系 Android14 系统的 bug,详情请参阅 Android14 设备上 debug 调试 app 出现卡顿的问题及临时修复办法

lsCoding666 commented 1 month ago

确实是这个问题 已经解决