File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
app/src/main/java/com/appcontrolx/ui Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -345,12 +345,12 @@ class AppListFragment : Fragment() {
345345 val pm = policyManager ? : return
346346 val rm = rollbackManager
347347
348- // Get app names for display
348+ // Quick app names - use package short name if not cached
349349 val appNames = packages.map { pkg ->
350350 adapter.getAppName(pkg) ? : pkg.substringAfterLast(" ." )
351351 }
352352
353- // Show new BottomSheet with countdown
353+ // Show BottomSheet IMMEDIATELY
354354 val bottomSheet = BatchProgressBottomSheet .newInstance(
355355 actionName = action.name,
356356 appNames = appNames,
@@ -375,10 +375,12 @@ class AppListFragment : Fragment() {
375375 loadApps(forceRefresh = true )
376376 }
377377 )
378+
379+ // Show immediately without waiting
378380 bottomSheet.show(childFragmentManager, BatchProgressBottomSheet .TAG )
379381
380- // Save snapshot before action
381- lifecycleScope.launch {
382+ // Save snapshot in background (non-blocking)
383+ lifecycleScope.launch( Dispatchers . IO ) {
382384 rm?.saveSnapshot(packages)
383385 }
384386 }
Original file line number Diff line number Diff line change @@ -50,8 +50,18 @@ class AppListAdapter(
5050
5151 fun isAllSelected (): Boolean = selectedPackages.size == currentList.size && currentList.isNotEmpty()
5252
53+ // Cache for O(1) lookup
54+ private val appNameCache = mutableMapOf<String , String >()
55+
56+ override fun submitList (list : List <AppInfo >? ) {
57+ // Build cache when list is submitted
58+ appNameCache.clear()
59+ list?.forEach { appNameCache[it.packageName] = it.appName }
60+ super .submitList(list)
61+ }
62+
5363 fun getAppName (packageName : String ): String? {
54- return currentList.find { it. packageName == packageName }?.appName
64+ return appNameCache[ packageName]
5565 }
5666
5767 private fun toggleSelection (packageName : String ) {
You can’t perform that action at this time.
0 commit comments