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