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

Commit 35605750 authored by Vadim Tryshev's avatar Vadim Tryshev
Browse files

Implementing app-centric Shelf.

We finally get a UX decision for the Shelf.
Shelf won't have 2 parts - pinned and recents; it will have only 1 list where
all pinned and recent activities of the same kind are grouped under a single icon.
Clicking at that icon activates the latest running activity if it's present, or
starts a new one otherwise.

The above part is implemented in this CL. I removed stuff related to the separate
Recents pane, and moved surviving code to NavigationBarApps.

Later, we'll have menus popping up from the icon, which will allow pinning and unpinning,
and choosing a concrete activity to activate.

Bug: 20024603
Change-Id: Ia08fe62939f92c7ee4f102c07a31e7168a11f010
parent b161ff8f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1108,7 +1108,7 @@ public class ActivityManager {
     * of {@link #RECENT_WITH_EXCLUDED} and {@link #RECENT_IGNORE_UNAVAILABLE}.
     *
     * @return Returns a list of RecentTaskInfo records describing each of
     * the recent tasks.
     * the recent tasks. Most recently activated tasks go first.
     *
     * @hide
     */
+0 −24
Original line number Diff line number Diff line
<!--
Copyright (C) 2015 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="1dp"
        android:height="24dp"
        android:viewportWidth="1"
        android:viewportHeight="24">
    <path
        android:pathData="M0,0 L1,0 L1,24 L0,24 z"
        android:fillColor="#AAFFFFFF"/>
</vector>
+0 −30
Original line number Diff line number Diff line
@@ -82,21 +82,6 @@
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    />

                <ImageView android:id="@+id/app_divider"
                    android:focusable="false"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:src="@drawable/nav_app_divider"
                    />

                <com.android.systemui.statusbar.phone.NavigationBarRecents
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    />
            </LinearLayout>

            <FrameLayout
@@ -248,21 +233,6 @@
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    />

                <ImageView android:id="@+id/app_divider"
                    android:focusable="false"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:src="@drawable/nav_app_divider"
                    />

            <com.android.systemui.statusbar.phone.NavigationBarRecents
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                />
            </LinearLayout>

            <FrameLayout
+56 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 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.
 */

package com.android.systemui.statusbar.phone;

import android.app.ActivityManager.RecentTaskInfo;

import java.util.ArrayList;

/**
 * Data associated with an app button.
 */
class AppButtonData {
    public final AppInfo appInfo;
    public boolean pinned;
    // Recent tasks for this app, sorted by lastActiveTime, descending.
    public ArrayList<RecentTaskInfo> tasks;

    public AppButtonData(AppInfo appInfo, boolean pinned) {
        this.appInfo = appInfo;
        this.pinned = pinned;
    }

    /**
     * Returns true if the button contains no useful information and should be removed.
     */
    public boolean isEmpty() {
        return !pinned && (tasks == null || tasks.isEmpty());
    }

    public void addTask(RecentTaskInfo task) {
        if (tasks == null) {
            tasks = new ArrayList<RecentTaskInfo>();
        }
        tasks.add(task);
    }

    public void clearTasks() {
        if (tasks != null) {
            tasks.clear();
        }
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -39,4 +39,16 @@ class AppInfo {
    public UserHandle getUser() {
        return mUser;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final AppInfo other = (AppInfo) obj;
        return mComponentName.equals(other.mComponentName) && mUser.equals(other.mUser);
    }
}
Loading