diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/SpaceWarningDialog.java b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/SpaceWarningDialog.java index 0b1656014a..036f2cb2b0 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/SpaceWarningDialog.java +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/SpaceWarningDialog.java @@ -22,6 +22,8 @@ public class SpaceWarningDialog extends Dialog { private TextView tvCancel;//取消 private Activity mActivity; + private ClickListener clickListener; + public SpaceWarningDialog(@NonNull Activity activity) { super(activity, R.style.bad_case_dialog); mActivity = activity; @@ -49,8 +51,11 @@ public class SpaceWarningDialog extends Dialog { //清理磁盘 tvCleanDisk.setOnClickListener(v -> { //跳转录包管理页面 - if(mActivity!=null){ - CallerDevaToolsManager.INSTANCE.showBadCaseManagerView(mActivity); +// if(mActivity!=null){ +// CallerDevaToolsManager.INSTANCE.showBadCaseManagerView(mActivity); +// } + if(clickListener!=null){ + clickListener.showBadCaseManagerView(); } dismiss(); }); @@ -61,6 +66,10 @@ public class SpaceWarningDialog extends Dialog { }); } + public void setClickListener(ClickListener clickListener){ + this.clickListener = clickListener; + } + @Override public void onAttachedToWindow() { super.onAttachedToWindow(); @@ -71,4 +80,8 @@ public class SpaceWarningDialog extends Dialog { super.onDetachedFromWindow(); } + public interface ClickListener{ + void showBadCaseManagerView(); + } + } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/layout/dialog_space_warning.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/dialog_space_warning.xml index 475510356c..5cfa0f954f 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/res/layout/dialog_space_warning.xml +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/dialog_space_warning.xml @@ -80,17 +80,4 @@ android:progressDrawable="@drawable/space_warning_progress_bg" /> - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/layout/item_bag_manager.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/item_bag_manager.xml index 43fa322211..8cd8a75b48 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/res/layout/item_bag_manager.xml +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/item_bag_manager.xml @@ -64,13 +64,14 @@ (), private var bagManagerEntity: BagManagerEntity = BagManagerEntity() + private var spaceWarningDialog: SpaceWarningDialog ?=null + private var isShowWarningDialog = false + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) } @@ -407,13 +410,32 @@ class MoGoHmiFragment : MvpFragment(), super.onBagManagerResult(bagManager) //判断磁盘是否已满,展示预警弹窗 UiThreadHandler.post{ - if(bagManager.spaceInfoRespCount>0){ - for(spaceInfo in bagManager.spaceInfoRespList){ - for(bagSpaceInfo in spaceInfo.bagDirsSpaceInfoList){ - if(bagSpaceInfo.free == 0L){ - //磁盘空间已满 - val spaceWarningDialog = SpaceWarningDialog(context as Activity) - spaceWarningDialog.show() + if(bagManager.reqType == 1){ + if(bagManager.spaceInfoRespCount>0){ + for(spaceInfo in bagManager.spaceInfoRespList){ + for(bagSpaceInfo in spaceInfo.bagDirsSpaceInfoList){ + if(bagSpaceInfo.free == 0L){ + //磁盘空间已满 + if(!isShowWarningDialog){ + if(spaceWarningDialog == null){ + spaceWarningDialog = SpaceWarningDialog(context as Activity) + spaceWarningDialog?.setClickListener(object:SpaceWarningDialog.ClickListener{ + override fun showBadCaseManagerView() { + if(mBadCaseManagerView == null){ + toggleBagManagerView() + } + } + + }) + } + spaceWarningDialog?.let { + if(!it.isShowing){ + it.show() + } + } + isShowWarningDialog = true + } + } } } }