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

Commit 64fdc5c5 authored by Fabian Kozynski's avatar Fabian Kozynski
Browse files

Add panel using TaskView

Adds support for panel view. Controls that have favorites should migrate
seamlessly to Panels (see SelectionItem#matches). A couple notes:

* Apps with panels will not participate in seeding
* If there is at least one app with panel, we show that instead of
  initial view.
* If there is at least one app with panel, we don't open the app picker
  from the tile.
* We save the last selection immediately so selectedItem is always in
  sync with SharedPreferences.
* If we are seeing a panel, the overflow menu doesn't show Edit, and Add
  directs to the app picker.
* The panel is shown inside a Red rectangle. This is temporary for
  debugging purposes.
* Apps with panels are not shown in the Provider selector activity

Note that if the flag (2000), no ControlsServiceInfo will have a panel
component, and therefore there will be no panels, so we default to old
behavior

Test: manual
Test: atest com.android.systemui.controls.ui
Test: disable flag and see that everything behaves correctly, including
scroll view
Test: atest AppAdapterTest
Fixes: 243392556

Change-Id: If260e193e57bec8948581dd4b0fa2f29e610c866
parent 82587b1a
Loading
Loading
Loading
Loading
+0 −30
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2020 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<com.android.systemui.globalactions.MinHeightScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:scrollbars="none">
  <LinearLayout
      android:id="@+id/global_actions_controls_list"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      android:layout_marginLeft="@dimen/global_actions_side_margin"
      android:layout_marginRight="@dimen/global_actions_side_margin" />
</com.android.systemui.globalactions.MinHeightScrollView>
 No newline at end of file
+3 −12
Original line number Diff line number Diff line
@@ -15,28 +15,19 @@
     limitations under the License.
-->

<LinearLayout
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/control_detail_root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

  <com.android.systemui.globalactions.MinHeightScrollView
      android:layout_width="match_parent"
      android:layout_height="0dp"
      android:layout_weight="1"
      android:orientation="vertical"
      android:scrollbars="none">

    <LinearLayout
        android:id="@+id/global_actions_controls"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clipChildren="false"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:clipToPadding="false"
        android:paddingHorizontal="@dimen/controls_padding_horizontal" />

  </com.android.systemui.globalactions.MinHeightScrollView>
</LinearLayout>
</FrameLayout>
+24 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@

  <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      android:layout_marginTop="@dimen/controls_top_margin"
      android:layout_marginBottom="@dimen/controls_header_bottom_margin">
@@ -71,5 +71,27 @@
        android:background="?android:attr/selectableItemBackgroundBorderless" />
  </LinearLayout>

  <ScrollView
        android:id="@+id/controls_scroll_view"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="vertical"
        android:clipChildren="true"
        android:scrollbars="none">
    <include layout="@layout/global_actions_controls_list_view" />

  </ScrollView>

  <FrameLayout
      android:id="@+id/controls_panel"
      android:layout_width="match_parent"
      android:layout_height="0dp"
      android:layout_weight="1"
      android:layout_marginLeft="@dimen/global_actions_side_margin"
      android:layout_marginRight="@dimen/global_actions_side_margin"
      android:background="#ff0000"
      android:padding="@dimen/global_actions_side_margin"
      android:visibility="gone"
      />
</merge>
+2 −1
Original line number Diff line number Diff line
@@ -64,7 +64,8 @@ class AppAdapter(
                val localeComparator = compareBy<ControlsServiceInfo, CharSequence>(collator) {
                    it.loadLabel() ?: ""
                }
                listOfServices = serviceInfos.sortedWith(localeComparator)
                listOfServices = serviceInfos.filter { it.panelActivity == null }
                        .sortedWith(localeComparator)
                uiExecutor.execute(::notifyDataSetChanged)
            }
        }
+7 −0
Original line number Diff line number Diff line
@@ -27,10 +27,13 @@ import android.view.View
import android.view.ViewGroup
import android.view.WindowInsets
import android.view.WindowInsets.Type
import android.view.WindowManager
import androidx.activity.ComponentActivity
import com.android.systemui.R
import com.android.systemui.broadcast.BroadcastDispatcher
import com.android.systemui.controls.management.ControlsAnimations
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
import javax.inject.Inject

/**
@@ -44,6 +47,7 @@ class ControlsActivity @Inject constructor(
    private val uiController: ControlsUiController,
    private val broadcastDispatcher: BroadcastDispatcher,
    private val dreamManager: IDreamManager,
    private val featureFlags: FeatureFlags
) : ComponentActivity() {

    private lateinit var parent: ViewGroup
@@ -52,6 +56,9 @@ class ControlsActivity @Inject constructor(

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        if (featureFlags.isEnabled(Flags.USE_APP_PANELS)) {
            window.addPrivateFlags(WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY)
        }

        setContentView(R.layout.controls_fullscreen)

Loading