Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19dd8419 authored by Matt Pietal's avatar Matt Pietal
Browse files

Controls UI - Handle all apps removed

Add a sanity check before showing controls, just in case all apps were
removed while the controls views are shown.

Fixes: 158009684
Test: Remove/disable all controlsproviderservice apps
Change-Id: I72710353c3c7dd977c6fab87af99fe863b0fc3a3
parent bc109d01
Loading
Loading
Loading
Loading
+4 −6
Original line number Original line Diff line number Diff line
@@ -129,12 +129,15 @@ class ControlsUiControllerImpl @Inject constructor (
                        SelectionItem(it.loadLabel(), "", it.loadIcon(), it.componentName)
                        SelectionItem(it.loadLabel(), "", it.loadIcon(), it.componentName)
                    }
                    }
                    uiExecutor.execute {
                    uiExecutor.execute {
                        parent.removeAllViews()
                        if (lastItems.size > 0) {
                            onResult(lastItems)
                            onResult(lastItems)
                        }
                        }
                    }
                    }
                }
                }
            }
            }
        }
        }
    }


    override fun show(parent: ViewGroup, dismissGlobalActions: Runnable) {
    override fun show(parent: ViewGroup, dismissGlobalActions: Runnable) {
        Log.d(ControlsUiController.TAG, "show()")
        Log.d(ControlsUiController.TAG, "show()")
@@ -189,8 +192,6 @@ class ControlsUiControllerImpl @Inject constructor (
    }
    }


    private fun showSeedingView(items: List<SelectionItem>) {
    private fun showSeedingView(items: List<SelectionItem>) {
        parent.removeAllViews()

        val inflater = LayoutInflater.from(context)
        val inflater = LayoutInflater.from(context)
        inflater.inflate(R.layout.controls_no_favorites, parent, true)
        inflater.inflate(R.layout.controls_no_favorites, parent, true)
        val subtitle = parent.requireViewById<TextView>(R.id.controls_subtitle)
        val subtitle = parent.requireViewById<TextView>(R.id.controls_subtitle)
@@ -198,8 +199,6 @@ class ControlsUiControllerImpl @Inject constructor (
    }
    }


    private fun showInitialSetupView(items: List<SelectionItem>) {
    private fun showInitialSetupView(items: List<SelectionItem>) {
        parent.removeAllViews()

        val inflater = LayoutInflater.from(context)
        val inflater = LayoutInflater.from(context)
        inflater.inflate(R.layout.controls_no_favorites, parent, true)
        inflater.inflate(R.layout.controls_no_favorites, parent, true)


@@ -263,7 +262,6 @@ class ControlsUiControllerImpl @Inject constructor (
    }
    }


    private fun showControlsView(items: List<SelectionItem>) {
    private fun showControlsView(items: List<SelectionItem>) {
        parent.removeAllViews()
        controlViewsById.clear()
        controlViewsById.clear()


        createListView()
        createListView()