Merge "Overriding application icon with activity icon where available."
This commit is contained in:
@@ -63,13 +63,6 @@
|
||||
android:maxLines="2"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal" />
|
||||
<ImageView
|
||||
android:id="@+id/activity_icon"
|
||||
android:layout_width="@dimen/recents_task_view_activity_icon_size"
|
||||
android:layout_height="@dimen/recents_task_view_activity_icon_size"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:padding="12dp"
|
||||
android:visibility="invisible" />
|
||||
</com.android.systemui.recents.views.TaskBarView>
|
||||
</com.android.systemui.recents.views.TaskView>
|
||||
|
||||
|
||||
@@ -415,7 +415,10 @@ public class RecentsTaskLoader {
|
||||
ActivityInfo info = ssp.getActivityInfo(t.baseIntent.getComponent(), t.userId);
|
||||
String activityLabel = (t.activityLabel == null ? ssp.getActivityLabel(info) :
|
||||
t.activityLabel.toString());
|
||||
Bitmap activityIcon = t.activityIcon;
|
||||
BitmapDrawable activityIcon = null;
|
||||
if (t.activityIcon != null) {
|
||||
activityIcon = new BitmapDrawable(res, t.activityIcon);
|
||||
}
|
||||
boolean isForemostTask = (i == (taskCount - 1));
|
||||
|
||||
// Create a new task
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.systemui.recents.model;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
|
||||
@@ -69,8 +70,8 @@ public class Task {
|
||||
|
||||
public TaskKey key;
|
||||
public Drawable applicationIcon;
|
||||
public Drawable activityIcon;
|
||||
public String activityLabel;
|
||||
public Bitmap activityIcon;
|
||||
public Bitmap thumbnail;
|
||||
public boolean isActive;
|
||||
public int userId;
|
||||
@@ -82,7 +83,7 @@ public class Task {
|
||||
}
|
||||
|
||||
public Task(int id, boolean isActive, Intent intent, String activityTitle,
|
||||
Bitmap activityIcon, int userId) {
|
||||
BitmapDrawable activityIcon, int userId) {
|
||||
this.key = new TaskKey(id, intent, userId);
|
||||
this.activityLabel = activityTitle;
|
||||
this.activityIcon = activityIcon;
|
||||
|
||||
@@ -31,7 +31,6 @@ class TaskBarView extends FrameLayout {
|
||||
Task mTask;
|
||||
|
||||
ImageView mApplicationIcon;
|
||||
ImageView mActivityIcon;
|
||||
TextView mActivityDescription;
|
||||
|
||||
public TaskBarView(Context context) {
|
||||
@@ -54,23 +53,22 @@ class TaskBarView extends FrameLayout {
|
||||
protected void onFinishInflate() {
|
||||
// Initialize the icon and description views
|
||||
mApplicationIcon = (ImageView) findViewById(R.id.application_icon);
|
||||
mActivityIcon = (ImageView) findViewById(R.id.activity_icon);
|
||||
mActivityDescription = (TextView) findViewById(R.id.activity_description);
|
||||
}
|
||||
|
||||
/** Binds the bar view to the task */
|
||||
void rebindToTask(Task t, boolean animate) {
|
||||
mTask = t;
|
||||
if (t.applicationIcon != null) {
|
||||
// If an activity icon is defined, then we use that as the primary icon to show in the bar,
|
||||
// otherwise, we fall back to the application icon
|
||||
if (t.activityIcon != null) {
|
||||
mApplicationIcon.setImageDrawable(t.activityIcon);
|
||||
} else if (t.applicationIcon != null) {
|
||||
mApplicationIcon.setImageDrawable(t.applicationIcon);
|
||||
mActivityDescription.setText(t.activityLabel);
|
||||
if (t.activityIcon != null) {
|
||||
mActivityIcon.setImageBitmap(t.activityIcon);
|
||||
mActivityIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (animate) {
|
||||
// XXX: Investigate how expensive it will be to create a second bitmap and crossfade
|
||||
}
|
||||
}
|
||||
mActivityDescription.setText(t.activityLabel);
|
||||
if (animate) {
|
||||
// XXX: Investigate how expensive it will be to create a second bitmap and crossfade
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,8 +76,6 @@ class TaskBarView extends FrameLayout {
|
||||
void unbindFromTask() {
|
||||
mTask = null;
|
||||
mApplicationIcon.setImageDrawable(null);
|
||||
mActivityIcon.setImageBitmap(null);
|
||||
mActivityIcon.setVisibility(View.INVISIBLE);
|
||||
mActivityDescription.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user