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

Commit 37c8d8ef authored by Winson Chung's avatar Winson Chung
Browse files

Moving task view layout into resource.

- Using new activity icon/labels

Change-Id: If27bf60d2df75813213e9f3095baeb03085da8f7
parent 1d22bd19
Loading
Loading
Loading
Loading
+49 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 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.recents.views.TaskView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" 
    android:layout_height="match_parent">
    <com.android.systemui.recents.views.TaskThumbnailView
        android:id="@+id/task_view_thumbnail"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    <com.android.systemui.recents.views.TaskBarView
        android:id="@+id/task_view_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="top|center_horizontal"
        android:background="#88000000">
        <ImageView
            android:id="@+id/activity_icon"
            android:layout_width="@dimen/recents_task_view_icon_size"
            android:layout_height="@dimen/recents_task_view_icon_size"
            android:layout_gravity="top|left"
            android:padding="8dp" />
        <TextView
            android:id="@+id/activity_description"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|left"
            android:layout_marginLeft="@dimen/recents_task_view_icon_size"
            android:textSize="24sp"
            android:textColor="#ffffffff"
            android:text="@string/recents_empty_message"
            android:fontFamily="sans-serif-thin" />
    </com.android.systemui.recents.views.TaskBarView>
</com.android.systemui.recents.views.TaskView>

+3 −0
Original line number Diff line number Diff line
@@ -229,4 +229,7 @@

    <!-- Default distance from each snap target that GlowPadView considers a "hit" -->
    <dimen name="glowpadview_inner_radius">15dip</dimen>

    <!-- The size of the icon in the recents task view. -->
    <dimen name="recents_task_view_icon_size">60dp</dimen>
</resources>
+1 −7
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@ public class Constants {
            public static final boolean ClickEvents = false;
            public static final boolean TouchEvents = false;
            public static final boolean MeasureAndLayout = false;
            public static final boolean Clipping = false;
            public static final boolean HwLayers = false;
        }

@@ -107,14 +106,9 @@ public class Constants {

            public static final boolean AnimateFrontTaskIconOnEnterRecents = true;
            public static final boolean AnimateFrontTaskIconOnLeavingRecents = true;
            public static final boolean AnimateFrontTaskIconOnEnterUseClip = false;
            public static final boolean AnimateFrontTaskIconOnLeavingUseClip = false;
            public static final boolean DrawColoredTaskBars = false;

            public static final boolean UseRoundedCorners = true;
            public static final float RoundedCornerRadiusDps = 3;

            public static final float TaskBarHeightDps = 54;
            public static final float TaskIconSizeDps = 60;
        }
    }
}
 No newline at end of file
+26 −17
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.ComponentCallbacks2;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
@@ -360,6 +361,7 @@ public class RecentsTaskLoader {
    /** Reload the set of recent tasks */
    SpaceNode reload(Context context, int preloadCount) {
        Console.log(Constants.DebugFlags.App.TaskDataLoader, "[RecentsTaskLoader|reload]");
        Resources res = context.getResources();
        ArrayList<Task> tasksToForceLoad = new ArrayList<Task>();
        TaskStack stack = new TaskStack(context);
        SpaceNode root = new SpaceNode(context);
@@ -415,15 +417,22 @@ public class RecentsTaskLoader {
                            "[RecentsTaskLoader|preloadTask]",
                            "i: " + i + " task: " + t.baseIntent.getComponent().getPackageName());

                    Task task = new Task(t.persistentId, t.baseIntent, title);
                    String label = (t.activityLabel == null ? title : t.activityLabel.toString());
                    BitmapDrawable bd = null;
                    if (t.activityIcon != null) {
                        bd = new BitmapDrawable(res, t.activityIcon);
                    }
                    Task task = new Task(t.persistentId, t.baseIntent, label, bd);

                    // Load the icon (if possible and not the foremost task, from the cache)
                    if (task.icon != null) {
                        mIconCache.put(task.key, task.icon);
                    } else {
                        if (!isForemostTask) {
                            task.icon = mIconCache.get(task.key);

                            if (task.icon != null) {
                            // Even though we get things from the cache, we should update them if
                            // they've changed in the bg
                                // Even though we get things from the cache, we should update them
                                // if they've changed in the bg
                                tasksToForceLoad.add(task);
                            }
                        }
@@ -435,11 +444,11 @@ public class RecentsTaskLoader {
                                task.icon = mDefaultIcon;
                            }
                        }
                    }

                    // Load the thumbnail (if possible and not the foremost task, from the cache)
                    if (!isForemostTask) {
                        task.thumbnail = mThumbnailCache.get(task.key);

                        if (task.thumbnail != null) {
                            // Even though we get things from the cache, we should update them if
                            // they've changed in the bg
@@ -468,7 +477,7 @@ public class RecentsTaskLoader {
                    for (int j = 0; j < Constants.Values.RecentsTaskLoader.TaskEntryMultiplier; j++) {
                        Console.log(Constants.DebugFlags.App.TaskDataLoader,
                                "  [RecentsTaskLoader|task]", t.baseIntent.getComponent().getPackageName());
                        stack.addTask(new Task(t.persistentId, t.baseIntent, title));
                        stack.addTask(new Task(t.persistentId, t.baseIntent, title, null, null));
                    }
                }
            }
+2 −2
Original line number Diff line number Diff line
@@ -67,8 +67,8 @@ public class Task {

    TaskCallbacks mCb;

    public Task(int id, Intent intent, String activityTitle) {
        this(id, intent, activityTitle, null, null);
    public Task(int id, Intent intent, String activityTitle, Drawable icon) {
        this(id, intent, activityTitle, icon, null);
    }

    public Task(int id, Intent intent, String activityTitle, Drawable icon, Bitmap thumbnail) {
Loading