File tree Expand file tree Collapse file tree
java/com/omarea/common/ui
krscript/src/main/java/com/omarea/krscript/ui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,10 +22,14 @@ class DialogAppChooser(
2222 private var allowAllSelect = true
2323 private var excludeApps: Array <String > = arrayOf()
2424 private lateinit var adapter: AdapterAppChooser
25+ private var loadingView: View ? = null
2526
2627 override fun onViewCreated (view : View , savedInstanceState : Bundle ? ) {
2728 super .onViewCreated(view, savedInstanceState)
2829
30+ loadingView = view.findViewById(R .id.loading)
31+ showLoading(true )
32+
2933 val absListView = view.findViewById<AbsListView >(R .id.app_list)
3034 setup(absListView)
3135
@@ -110,6 +114,10 @@ if (multiple) {
110114 gridView.adapter = adapter
111115 }
112116
117+ fun showLoading (show : Boolean ) {
118+ loadingView?.visibility = if (show) View .VISIBLE else View .GONE
119+ }
120+
113121 fun notifyDataChanged () {
114122 if (::adapter.isInitialized) {
115123 adapter.notifyDataSetChanged()
Original file line number Diff line number Diff line change 8585 style =" @style/dialogConfirmBtn"
8686 android : text =" @string/btn_confirm" >
8787 </Button >
88+
89+ <ProgressBar
90+ android : id =" @+id/loading"
91+ android : layout_marginTop =" 12dp"
92+ android : layout_width =" match_parent"
93+ android : layout_height =" 8dp"
94+ android : visibility =" gone"
95+ style =" ?android:attr/progressBarStyleLarge" />
8896 </LinearLayout >
8997</LinearLayout >
Original file line number Diff line number Diff line change @@ -66,6 +66,8 @@ class ParamsAppChooserRender(
6666
6767 // ✅ SHOW NGAY
6868 dialog.show(context.supportFragmentManager, " app-chooser" )
69+
70+ dialog.showLoading(true )
6971
7072 // ✅ LOAD SAU KHI DIALOG ĐÃ HIỆN
7173 loadPackagesAsync(dialog, actionParamInfo.type == " packages" )
@@ -142,6 +144,7 @@ class ParamsAppChooserRender(
142144 }
143145 setSelectStatus()
144146 dialog.notifyDataChanged()
147+ dialog.showLoading(false )
145148 }
146149 }
147150 }
You can’t perform that action at this time.
0 commit comments