Update recent indicators to match spec.
Does not implement any animations. Flag: com.android.window.flags.enable_desktop_windowing_taskbar_running_apps Fix: 356394053 Test: go/testedequals Change-Id: If8e319b605beedd0e9b14dc37da1b5ffa12f3c9f
This commit is contained in:
@@ -52,7 +52,6 @@ import android.text.style.ImageSpan;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Property;
|
||||
import android.util.Size;
|
||||
import android.util.TypedValue;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
@@ -194,13 +193,15 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
private boolean mForceHideDot;
|
||||
|
||||
// These fields, related to showing running apps, are only used for Taskbar.
|
||||
private final Size mRunningAppIndicatorSize;
|
||||
private final int mRunningAppIndicatorWidth;
|
||||
private final int mMinimizedAppIndicatorWidth;
|
||||
private final int mRunningAppIndicatorHeight;
|
||||
private final int mRunningAppIndicatorTopMargin;
|
||||
private final Size mMinimizedAppIndicatorSize;
|
||||
private final int mMinimizedAppIndicatorTopMargin;
|
||||
private final Paint mRunningAppIndicatorPaint;
|
||||
private final Rect mRunningAppIconBounds = new Rect();
|
||||
private RunningAppState mRunningAppState;
|
||||
private final int mRunningAppIndicatorColor;
|
||||
private final int mMinimizedAppIndicatorColor;
|
||||
|
||||
/**
|
||||
* Various options for the running state of an app.
|
||||
@@ -277,22 +278,21 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
defaultIconSize);
|
||||
a.recycle();
|
||||
|
||||
mRunningAppIndicatorSize = new Size(
|
||||
getResources().getDimensionPixelSize(R.dimen.taskbar_running_app_indicator_width),
|
||||
getResources().getDimensionPixelSize(R.dimen.taskbar_running_app_indicator_height));
|
||||
mMinimizedAppIndicatorSize = new Size(
|
||||
getResources().getDimensionPixelSize(R.dimen.taskbar_minimized_app_indicator_width),
|
||||
getResources().getDimensionPixelSize(
|
||||
R.dimen.taskbar_minimized_app_indicator_height));
|
||||
mRunningAppIndicatorWidth =
|
||||
getResources().getDimensionPixelSize(R.dimen.taskbar_running_app_indicator_width);
|
||||
mMinimizedAppIndicatorWidth =
|
||||
getResources().getDimensionPixelSize(R.dimen.taskbar_minimized_app_indicator_width);
|
||||
mRunningAppIndicatorHeight =
|
||||
getResources().getDimensionPixelSize(R.dimen.taskbar_running_app_indicator_height);
|
||||
mRunningAppIndicatorTopMargin =
|
||||
getResources().getDimensionPixelSize(
|
||||
R.dimen.taskbar_running_app_indicator_top_margin);
|
||||
mMinimizedAppIndicatorTopMargin =
|
||||
getResources().getDimensionPixelSize(
|
||||
R.dimen.taskbar_minimized_app_indicator_top_margin);
|
||||
|
||||
mRunningAppIndicatorPaint = new Paint();
|
||||
mRunningAppIndicatorPaint.setColor(getResources().getColor(
|
||||
R.color.taskbar_running_app_indicator_color, context.getTheme()));
|
||||
mRunningAppIndicatorColor = getResources().getColor(
|
||||
R.color.taskbar_running_app_indicator_color, context.getTheme());
|
||||
mMinimizedAppIndicatorColor = getResources().getColor(
|
||||
R.color.taskbar_minimized_app_indicator_color, context.getTheme());
|
||||
|
||||
mLongPressHelper = new CheckLongPressHelper(this);
|
||||
|
||||
@@ -716,16 +716,26 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
return;
|
||||
}
|
||||
getIconBounds(mRunningAppIconBounds);
|
||||
// TODO(b/333872717): update color, shape, and size of indicator
|
||||
boolean isMinimized = mRunningAppState == RunningAppState.MINIMIZED;
|
||||
int indicatorTop =
|
||||
mRunningAppIconBounds.bottom + (isMinimized ? mMinimizedAppIndicatorTopMargin
|
||||
: mRunningAppIndicatorTopMargin);
|
||||
final Size indicatorSize =
|
||||
isMinimized ? mMinimizedAppIndicatorSize : mRunningAppIndicatorSize;
|
||||
canvas.drawRect(mRunningAppIconBounds.centerX() - indicatorSize.getWidth() / 2,
|
||||
indicatorTop, mRunningAppIconBounds.centerX() + indicatorSize.getWidth() / 2,
|
||||
indicatorTop + indicatorSize.getHeight(), mRunningAppIndicatorPaint);
|
||||
Utilities.scaleRectAboutCenter(
|
||||
mRunningAppIconBounds,
|
||||
IconShape.INSTANCE.get(getContext()).getNormalizationScale());
|
||||
|
||||
final boolean isMinimized = mRunningAppState == RunningAppState.MINIMIZED;
|
||||
final int indicatorTop = mRunningAppIconBounds.bottom + mRunningAppIndicatorTopMargin;
|
||||
final int indicatorWidth =
|
||||
isMinimized ? mMinimizedAppIndicatorWidth : mRunningAppIndicatorWidth;
|
||||
final float cornerRadius = mRunningAppIndicatorHeight / 2f;
|
||||
mRunningAppIndicatorPaint.setColor(
|
||||
isMinimized ? mMinimizedAppIndicatorColor : mRunningAppIndicatorColor);
|
||||
|
||||
canvas.drawRoundRect(
|
||||
mRunningAppIconBounds.centerX() - indicatorWidth / 2f,
|
||||
indicatorTop,
|
||||
mRunningAppIconBounds.centerX() + indicatorWidth / 2f,
|
||||
indicatorTop + mRunningAppIndicatorHeight,
|
||||
cornerRadius,
|
||||
cornerRadius,
|
||||
mRunningAppIndicatorPaint);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user