am d3555c81: Merge "Adding dismiss method on the top cards, and disabling the app info pane."
* commit 'd3555c81c8f9ef95089915c291b80696b55417d1': Adding dismiss method on the top cards, and disabling the app info pane.
This commit is contained in:
35
packages/SystemUI/res/drawable/recents_dismiss_dark.xml
Normal file
35
packages/SystemUI/res/drawable/recents_dismiss_dark.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:versionCode="1" >
|
||||
|
||||
<size
|
||||
android:height="16dp"
|
||||
android:width="16dp" />
|
||||
|
||||
<viewport
|
||||
android:viewportHeight="100"
|
||||
android:viewportWidth="100" />
|
||||
|
||||
<group>
|
||||
<path
|
||||
android:name="x"
|
||||
android:pathData="M0,0L100,100M0,100L100,0z"
|
||||
android:stroke="@color/recents_task_bar_dark_dismiss_color"
|
||||
android:strokeWidth="8.0"
|
||||
android:strokeLineCap="square" />
|
||||
</group>
|
||||
</vector>
|
||||
35
packages/SystemUI/res/drawable/recents_dismiss_light.xml
Normal file
35
packages/SystemUI/res/drawable/recents_dismiss_light.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:versionCode="1" >
|
||||
|
||||
<size
|
||||
android:height="16dp"
|
||||
android:width="16dp" />
|
||||
|
||||
<viewport
|
||||
android:viewportHeight="100"
|
||||
android:viewportWidth="100" />
|
||||
|
||||
<group>
|
||||
<path
|
||||
android:name="x"
|
||||
android:pathData="M0,0L100,100M0,100L100,0z"
|
||||
android:stroke="@color/recents_task_bar_light_dismiss_color"
|
||||
android:strokeWidth="8.0"
|
||||
android:strokeLineCap="square" />
|
||||
</group>
|
||||
</vector>
|
||||
@@ -63,6 +63,13 @@
|
||||
android:maxLines="2"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal" />
|
||||
<ImageView
|
||||
android:id="@+id/dismiss_task"
|
||||
android:layout_width="@dimen/recents_task_view_application_icon_size"
|
||||
android:layout_height="@dimen/recents_task_view_application_icon_size"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:padding="23dp"
|
||||
android:src="@drawable/recents_dismiss_dark" />
|
||||
</com.android.systemui.recents.views.TaskBarView>
|
||||
</com.android.systemui.recents.views.TaskView>
|
||||
|
||||
|
||||
@@ -52,10 +52,14 @@
|
||||
<!-- The default recents task bar background color. -->
|
||||
<color name="recents_task_bar_default_background_color">#e6444444</color>
|
||||
<!-- The default recents task bar text color. -->
|
||||
<color name="recents_task_bar_default_text_color">#ffffffff</color>
|
||||
<color name="recents_task_bar_default_text_color">#ffeeeeee</color>
|
||||
<!-- The recents task bar light text color to be drawn on top of dark backgrounds. -->
|
||||
<color name="recents_task_bar_light_text_color">#ffffffff</color>
|
||||
<color name="recents_task_bar_light_text_color">#ffeeeeee</color>
|
||||
<!-- The recents task bar dark text color to be drawn on top of light backgrounds. -->
|
||||
<color name="recents_task_bar_dark_text_color">#ff222222</color>
|
||||
<!-- The recents task bar light dismiss icon color to be drawn on top of dark backgrounds. -->
|
||||
<color name="recents_task_bar_light_dismiss_color">#ffeeeeee</color>
|
||||
<!-- The recents task bar dark dismiss icon color to be drawn on top of light backgrounds. -->
|
||||
<color name="recents_task_bar_dark_dismiss_color">#ff333333</color>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
<!-- The animation duration for animating in the info pane. -->
|
||||
<integer name="recents_animate_task_view_info_pane_duration">150</integer>
|
||||
<!-- The animation duration for animating the removal of a task view. -->
|
||||
<integer name="recents_animate_task_view_remove_duration">150</integer>
|
||||
<integer name="recents_animate_task_view_remove_duration">250</integer>
|
||||
<!-- The minimum alpha for the dim applied to cards that go deeper into the stack. -->
|
||||
<integer name="recents_max_task_stack_view_dim">96</integer>
|
||||
<!-- Transposes the search bar layout in landscape -->
|
||||
|
||||
@@ -227,7 +227,7 @@
|
||||
<dimen name="recents_task_view_z_increment">5dp</dimen>
|
||||
|
||||
<!-- The amount to translate when animating the removal of a task. -->
|
||||
<dimen name="recents_task_view_remove_anim_translation_x">75dp</dimen>
|
||||
<dimen name="recents_task_view_remove_anim_translation_x">100dp</dimen>
|
||||
|
||||
<!-- The amount of space a user has to scroll to dismiss any info panes. -->
|
||||
<dimen name="recents_task_stack_scroll_dismiss_info_pane_distance">50dp</dimen>
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Constants {
|
||||
// Enables the use of theme colors as the task bar background
|
||||
public static final boolean EnableTaskBarThemeColors = true;
|
||||
// Enables the info pane on long-press
|
||||
public static final boolean EnableInfoPane = true;
|
||||
public static final boolean EnableInfoPane = false;
|
||||
// Enables the search bar layout
|
||||
public static final boolean EnableSearchLayout = true;
|
||||
// Enables the dynamic shadows behind each task
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.systemui.recents;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
/* Common code */
|
||||
public class Utilities {
|
||||
@@ -54,12 +55,15 @@ public class Utilities {
|
||||
0.0722f * Color.blue(color));
|
||||
}
|
||||
|
||||
/** Returns the ideal text color to draw on top of a specified background color. */
|
||||
public static int getIdealTextColorForBackgroundColor(int color) {
|
||||
RecentsConfiguration configuration = RecentsConfiguration.getInstance();
|
||||
/** Returns the ideal color to draw on top of a specified background color. */
|
||||
public static int getIdealColorForBackgroundColor(int color, int lightRes, int darkRes) {
|
||||
int greyscale = colorToGreyscale(color);
|
||||
return (greyscale < 128) ? configuration.taskBarViewLightTextColor :
|
||||
configuration.taskBarViewDarkTextColor;
|
||||
|
||||
return (greyscale < 128) ? lightRes : darkRes;
|
||||
}
|
||||
/** Returns the ideal drawable to draw on top of a specified background color. */
|
||||
public static Drawable getIdealResourceForBackgroundColor(int color, Drawable lightRes,
|
||||
Drawable darkRes) {
|
||||
int greyscale = colorToGreyscale(color);
|
||||
return (greyscale < 128) ? lightRes : darkRes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
|
||||
package com.android.systemui.recents.views;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
@@ -32,9 +35,13 @@ import com.android.systemui.recents.model.Task;
|
||||
class TaskBarView extends FrameLayout {
|
||||
Task mTask;
|
||||
|
||||
ImageView mDismissButton;
|
||||
ImageView mApplicationIcon;
|
||||
TextView mActivityDescription;
|
||||
|
||||
Drawable mLightDismissDrawable;
|
||||
Drawable mDarkDismissDrawable;
|
||||
|
||||
public TaskBarView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
@@ -49,6 +56,9 @@ class TaskBarView extends FrameLayout {
|
||||
|
||||
public TaskBarView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
Resources res = context.getResources();
|
||||
mLightDismissDrawable = res.getDrawable(R.drawable.recents_dismiss_light);
|
||||
mDarkDismissDrawable = res.getDrawable(R.drawable.recents_dismiss_dark);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,6 +66,28 @@ class TaskBarView extends FrameLayout {
|
||||
// Initialize the icon and description views
|
||||
mApplicationIcon = (ImageView) findViewById(R.id.application_icon);
|
||||
mActivityDescription = (TextView) findViewById(R.id.activity_description);
|
||||
mDismissButton = (ImageView) findViewById(R.id.dismiss_task);
|
||||
}
|
||||
|
||||
/** Synchronizes this bar view's properties with the task's transform */
|
||||
void updateViewPropertiesToTaskTransform(TaskViewTransform animateFromTransform,
|
||||
TaskViewTransform toTransform, int duration) {
|
||||
RecentsConfiguration config = RecentsConfiguration.getInstance();
|
||||
if (duration > 0) {
|
||||
if (animateFromTransform != null) {
|
||||
mDismissButton.setAlpha(animateFromTransform.dismissAlpha);
|
||||
}
|
||||
mDismissButton.animate()
|
||||
.alpha(toTransform.dismissAlpha)
|
||||
.setStartDelay(0)
|
||||
.setDuration(duration)
|
||||
.setInterpolator(config.defaultBezierInterpolator)
|
||||
.withLayer()
|
||||
.start();
|
||||
} else {
|
||||
mDismissButton.setAlpha(toTransform.dismissAlpha);
|
||||
}
|
||||
mDismissButton.invalidate();
|
||||
}
|
||||
|
||||
/** Binds the bar view to the task */
|
||||
@@ -74,7 +106,10 @@ class TaskBarView extends FrameLayout {
|
||||
int tint = t.colorPrimary;
|
||||
if (Constants.DebugFlags.App.EnableTaskBarThemeColors && tint != 0) {
|
||||
setBackgroundColor(tint);
|
||||
mActivityDescription.setTextColor(Utilities.getIdealTextColorForBackgroundColor(tint));
|
||||
mActivityDescription.setTextColor(Utilities.getIdealColorForBackgroundColor(tint,
|
||||
configuration.taskBarViewLightTextColor, configuration.taskBarViewDarkTextColor));
|
||||
mDismissButton.setImageDrawable(Utilities.getIdealResourceForBackgroundColor(tint,
|
||||
mLightDismissDrawable, mDarkDismissDrawable));
|
||||
} else {
|
||||
setBackgroundColor(configuration.taskBarViewDefaultBackgroundColor);
|
||||
mActivityDescription.setTextColor(configuration.taskBarViewDefaultTextColor);
|
||||
|
||||
@@ -169,6 +169,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
transform.translationY = (int) (boundedT * overlapHeight - scaleYOffset);
|
||||
}
|
||||
|
||||
// Set the alphas
|
||||
transform.dismissAlpha = Math.max(-1f, Math.min(0f, t)) + 1f;
|
||||
|
||||
// Update the rect and visibility
|
||||
transform.rect.set(mTaskRect);
|
||||
if (t < -(numPeekCards + 1)) {
|
||||
@@ -1035,6 +1038,15 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskDismissed(TaskView tv) {
|
||||
Task task = tv.getTask();
|
||||
// Remove the task from the view
|
||||
mStack.removeTask(task);
|
||||
// Notify the callback that we've removed the task and it can clean up after it
|
||||
mCb.onTaskRemoved(task);
|
||||
}
|
||||
|
||||
/**** View.OnClickListener Implementation ****/
|
||||
|
||||
@Override
|
||||
@@ -1094,6 +1106,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
|
||||
@Override
|
||||
public void onComponentRemoved(Set<ComponentName> cns) {
|
||||
RecentsConfiguration config = RecentsConfiguration.getInstance();
|
||||
// For other tasks, just remove them directly if they no longer exist
|
||||
ArrayList<Task> tasks = mStack.getTasks();
|
||||
for (int i = tasks.size() - 1; i >= 0; i--) {
|
||||
@@ -1476,13 +1489,7 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
|
||||
@Override
|
||||
public void onChildDismissed(View v) {
|
||||
TaskView tv = (TaskView) v;
|
||||
Task task = tv.getTask();
|
||||
|
||||
// Remove the task from the view
|
||||
mSv.mStack.removeTask(task);
|
||||
|
||||
// Notify the callback that we've removed the task and it can clean up after it
|
||||
mSv.mCb.onTaskRemoved(task);
|
||||
mSv.onTaskDismissed(tv);
|
||||
|
||||
// Disable HW layers
|
||||
mSv.decHwLayersRefCount("swipeComplete");
|
||||
|
||||
@@ -45,6 +45,7 @@ public class TaskView extends FrameLayout implements View.OnClickListener,
|
||||
public void onTaskInfoPanelShown(TaskView tv);
|
||||
public void onTaskInfoPanelHidden(TaskView tv);
|
||||
public void onTaskAppInfoClicked(TaskView tv);
|
||||
public void onTaskDismissed(TaskView tv);
|
||||
|
||||
// public void onTaskViewReboundToTask(TaskView tv, Task t);
|
||||
}
|
||||
@@ -142,6 +143,10 @@ public class TaskView extends FrameLayout implements View.OnClickListener,
|
||||
int minZ = config.taskViewTranslationZMinPx;
|
||||
int incZ = config.taskViewTranslationZIncrementPx;
|
||||
|
||||
// Update the bar view
|
||||
mBarView.updateViewPropertiesToTaskTransform(animateFromTransform, toTransform, duration);
|
||||
|
||||
// Update this task view
|
||||
if (duration > 0) {
|
||||
if (animateFromTransform != null) {
|
||||
setTranslationY(animateFromTransform.translationY);
|
||||
@@ -379,6 +384,7 @@ public class TaskView extends FrameLayout implements View.OnClickListener,
|
||||
mInfoView.rebindToTask(mTask, reloadingTaskData);
|
||||
// Rebind any listeners
|
||||
mBarView.mApplicationIcon.setOnClickListener(this);
|
||||
mBarView.mDismissButton.setOnClickListener(this);
|
||||
mInfoView.mAppInfoButton.setOnClickListener(this);
|
||||
}
|
||||
mTaskDataLoaded = true;
|
||||
@@ -404,6 +410,15 @@ public class TaskView extends FrameLayout implements View.OnClickListener,
|
||||
hideInfoPane();
|
||||
} else if (v == mBarView.mApplicationIcon) {
|
||||
mCb.onTaskIconClicked(this);
|
||||
} else if (v == mBarView.mDismissButton) {
|
||||
// Animate out the view and call the callback
|
||||
final TaskView tv = this;
|
||||
animateRemoval(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mCb.onTaskDismissed(tv);
|
||||
}
|
||||
});
|
||||
} else if (v == mInfoView.mAppInfoButton) {
|
||||
mCb.onTaskAppInfoClicked(this);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ public class TaskViewTransform {
|
||||
public int translationY = 0;
|
||||
public float scale = 1f;
|
||||
public float alpha = 1f;
|
||||
public float dismissAlpha = 1f;
|
||||
public boolean visible = false;
|
||||
public Rect rect = new Rect();
|
||||
float t;
|
||||
@@ -36,6 +37,7 @@ public class TaskViewTransform {
|
||||
translationY = o.translationY;
|
||||
scale = o.scale;
|
||||
alpha = o.alpha;
|
||||
dismissAlpha = o.dismissAlpha;
|
||||
visible = o.visible;
|
||||
rect.set(o.rect);
|
||||
t = o.t;
|
||||
@@ -44,6 +46,6 @@ public class TaskViewTransform {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskViewTransform y: " + translationY + " scale: " + scale + " alpha: " + alpha +
|
||||
" visible: " + visible + " rect: " + rect;
|
||||
" visible: " + visible + " rect: " + rect + " dismissAlpha: " + dismissAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user