android:screenOrientation="behind"
android:resizeableActivity="true"
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout"
- android:theme="@style/RecentsTheme.Wallpaper.Grid">
+ android:theme="@style/RecentsTheme.Grid">
<intent-filter>
<action android:name="com.android.systemui.recents.TOGGLE_RECENTS" />
</intent-filter>
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingStart="16dp"
- android:paddingEnd="12dp"
- style="?attr/taskIconStyle" />
+ android:paddingEnd="12dp" />
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
<!-- The offsets the tasks animate from when recents is launched while docking -->
<dimen name="recents_task_stack_animation_launched_while_docking_offset">192dp</dimen>
-
- <!-- -->
- <!-- Values specific to grid-based recents. -->
- <!-- -->
-
- <!-- Margins around recent tasks. -->
- <dimen name="recents_grid_margin_left">32dp</dimen>
- <dimen name="recents_grid_margin_top">70dp</dimen>
- <dimen name="recents_grid_margin_right">32dp</dimen>
- <dimen name="recents_grid_margin_bottom">90dp</dimen>
- <!-- Margins around the "Clear all" button. -->
- <dimen name="recents_grid_clear_all_margin_left">0dp</dimen>
- <dimen name="recents_grid_clear_all_margin_top">36dp</dimen>
- <dimen name="recents_grid_clear_all_margin_right">12dp</dimen>
- <dimen name="recents_grid_clear_all_margin_bottom">0dp</dimen>
- <!-- Padding in between task views. -->
- <dimen name="recents_grid_inter_task_padding">20dp</dimen>
- <!-- The height of each task view's header. -->
- <dimen name="recents_grid_task_header_height">44dp</dimen>
- <!-- The margin to separate the title from the edge of the header. -->
- <dimen name="recents_grid_task_title_margin_start">12dp</dimen>
- <!-- The padding for the dismiss button. -->
- <dimen name="recents_grid_task_dismiss_button_padding">8dp</dimen>
-
</resources>
<declare-styleable name="NotificationLinearLayout">
<attr name="insetLeft" format="dimension" />
</declare-styleable>
- <declare-styleable name="RecentsTheme">
+ <declare-styleable name="RecentsPanelView">
+ <attr name="recentItemLayout" format="reference" />
<!-- Style for the "Clear all" button. -->
<attr name="clearAllStyle" format="reference" />
- <!-- Style for task icons in Recents. -->
- <attr name="taskIconStyle" format="reference" />
</declare-styleable>
<declare-styleable name="DeadZone">
<attr name="minSize" format="dimension" />
<!-- The size of the PIP dismiss target. -->
<dimen name="pip_dismiss_target_size">48dp</dimen>
+
+ <!-- Values specific to grid-based recents. -->
+ <!-- Margins around recent tasks. -->
+ <dimen name="recents_grid_margin_left">15dp</dimen>
+ <dimen name="recents_grid_margin_top">70dp</dimen>
+ <dimen name="recents_grid_margin_right">15dp</dimen>
+ <dimen name="recents_grid_margin_bottom">90dp</dimen>
+ <!-- Margins around the "Clear all" button. -->
+ <dimen name="recents_grid_clear_all_margin_left">0dp</dimen>
+ <dimen name="recents_grid_clear_all_margin_top">30dp</dimen>
+ <dimen name="recents_grid_clear_all_margin_right">15dp</dimen>
+ <dimen name="recents_grid_clear_all_margin_bottom">0dp</dimen>
+ <!-- Padding in between task views. -->
+ <dimen name="recents_grid_inter_task_padding">15dp</dimen>
+
</resources>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:ambientShadowAlpha">0.35</item>
- <item name="clearAllStyle">@style/ClearAllButtonDefaultStyle</item>
- <item name="taskIconStyle">@style/TaskIconDefaultStyle</item>
</style>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowShowWallpaper">true</item>
<item name="android:windowDisablePreview">true</item>
+ <item name="clearAllStyle">@style/ClearAllButtonDefaultMargins</item>
</style>
- <style name="ClearAllButtonDefaultStyle">
+ <style name="ClearAllButtonDefaultMargins">
<item name="android:layout_marginStart">0dp</item>
<item name="android:layout_marginTop">0dp</item>
<item name="android:layout_marginEnd">0dp</item>
<item name="android:layout_marginBottom">0dp</item>
</style>
- <style name="TaskIconDefaultStyle">
- <item name="android:visibility">visible</item>
- </style>
-
<!-- Grid-based Recents theme. -->
- <style name="RecentsTheme.Wallpaper.Grid">
- <item name="clearAllStyle">@style/ClearAllButtonGridStyle</item>
- <item name="taskIconStyle">@style/TaskIconGridStyle</item>
+ <style name="RecentsTheme.Grid">
+ <item name="android:windowBackground">@color/transparent</item>
+ <item name="android:colorBackgroundCacheHint">@null</item>
+ <item name="android:windowShowWallpaper">true</item>
+ <item name="android:windowDisablePreview">true</item>
+ <item name="clearAllStyle">@style/ClearAllButtonLargeMargins</item>
</style>
- <style name="ClearAllButtonGridStyle">
+ <style name="ClearAllButtonLargeMargins">
<item name="android:layout_marginStart">@dimen/recents_grid_clear_all_margin_left</item>
<item name="android:layout_marginTop">@dimen/recents_grid_clear_all_margin_top</item>
<item name="android:layout_marginEnd">@dimen/recents_grid_clear_all_margin_right</item>
<item name="android:layout_marginBottom">@dimen/recents_grid_clear_all_margin_bottom</item>
</style>
- <style name="TaskIconGridStyle">
- <item name="android:visibility">gone</item>
- </style>
-
<!-- Performance optimized Recents theme (no wallpaper) -->
<style name="RecentsTheme.NoWallpaper">
<item name="android:windowBackground">@android:color/black</item>
public final static int MAX_VISIBLE_TASKS = 9;
private final static String TAG = "RecentsGridActivity";
+ private final static int TITLE_BAR_HEIGHT_DP = 64;
private ArrayList<Integer> mMargins = new ArrayList<>();
mTouchExplorationEnabled = ssp.isTouchExplorationEnabled();
mScreenSize = new Point();
getWindowManager().getDefaultDisplay().getRealSize(mScreenSize);
+ DisplayMetrics metrics = res.getDisplayMetrics();
+ mTitleBarHeightPx = (int) (TITLE_BAR_HEIGHT_DP *
+ ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT));
mStatusBarHeightPx = res.getDimensionPixelSize(R.dimen.status_bar_height);
mNavigationBarHeightPx = res.getDimensionPixelSize(R.dimen.navigation_bar_height);
- mTitleBarHeightPx = getResources().getDimensionPixelSize(
- R.dimen.recents_grid_task_header_height);
mRecentsView = (FrameLayout) findViewById(R.id.recents_view);
mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
return (TaskView) mInflater.inflate(R.layout.recents_task_view, mRecentsView, false);
}
- private void customizeTaskView(TaskView taskView) {
- Resources res = getResources();
- taskView.setOverlayHeaderOnThumbnailActionBar(false);
- View thumbnail = taskView.findViewById(R.id.task_view_thumbnail);
- thumbnail.setTranslationY(mTitleBarHeightPx);
-
- // These need to be adjusted in code to override behavior in TaskViewHeader (not defined
- // in layout XML code).
- View title = taskView.findViewById(R.id.title);
- FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) title.getLayoutParams();
- lp.setMarginStart(res.getDimensionPixelSize(R.dimen.recents_grid_task_title_margin_start));
- title.setLayoutParams(lp);
-
- View dismiss = taskView.findViewById(R.id.dismiss_task);
- int padding = res.getDimensionPixelSize(R.dimen.recents_grid_task_dismiss_button_padding);
- dismiss.setPadding(padding, padding, padding, padding);
- dismiss.getLayoutParams().height = mTitleBarHeightPx;
- dismiss.getLayoutParams().width = mTitleBarHeightPx;
- View header = taskView.findViewById(R.id.task_view_bar);
- header.getLayoutParams().height = mTitleBarHeightPx;
- }
-
private void removeTaskViews() {
for (View taskView : mTaskViews) {
ViewGroup parent = (ViewGroup) taskView.getParent();
taskView = mTaskViews.get(i);
} else {
taskView = createView();
- customizeTaskView(taskView);
}
taskView.onTaskBound(task, mTouchExplorationEnabled, mLastDisplayOrientation,
mDisplayRect);
private ObjectAnimator mOutlineAnimator;
private final TaskViewTransform mTargetAnimationTransform = new TaskViewTransform();
private ArrayList<Animator> mTmpAnimators = new ArrayList<>();
- private boolean mOverlayHeaderOnThumbnailActionBar;
@ViewDebug.ExportedProperty(deepExport=true, prefix="thumbnail_")
TaskViewThumbnail mThumbnailView;
Utilities.cancelAnimationWithoutCallbacks(mOutlineAnimator);
}
- /**
- * Sets whether the header should overlap (and hide) the action bar in the thumbnail, or
- * be stacked just above it.
- */
- public void setOverlayHeaderOnThumbnailActionBar(boolean flag) {
- mOverlayHeaderOnThumbnailActionBar = flag;
- if (!mOverlayHeaderOnThumbnailActionBar) {
- mThumbnailView.setSizeToFit(true);
- mThumbnailView.setOverlayHeaderOnThumbnailActionBar(false);
- mThumbnailView.updateThumbnailScale();
- }
- }
-
/** Enables/disables handling touch on this task view. */
public void setTouchEnabled(boolean enabled) {
setOnClickListener(enabled ? this : null);
@ViewDebug.ExportedProperty(category="recents")
private float mThumbnailScale;
private float mFullscreenThumbnailScale;
- private boolean mSizeToFit = false;
- private boolean mOverlayHeaderOnThumbnailActionBar = true;
private ActivityManager.TaskThumbnailInfo mThumbnailInfo;
private int mCornerRadius;
int thumbnailHeight = Math.min(viewHeight,
(int) (mThumbnailRect.height() * mThumbnailScale));
if (mBitmapShader != null && thumbnailWidth > 0 && thumbnailHeight > 0) {
- int topOffset = 0;
- if (mOverlayHeaderOnThumbnailActionBar) {
- topOffset = mTaskBar != null
- ? mTaskBar.getHeight() - mCornerRadius
- : 0;
- }
+ int topOffset = mTaskBar != null
+ ? mTaskBar.getHeight() - mCornerRadius
+ : 0;
// Draw the background, there will be some small overdraw with the thumbnail
if (thumbnailWidth < viewWidth) {
// If we haven't measured or the thumbnail is invalid, skip the thumbnail drawing
// and only draw the background color
mThumbnailScale = 0f;
- } else if (isStackTask && !mSizeToFit) {
+ } else if (isStackTask) {
float invThumbnailScale = 1f / mFullscreenThumbnailScale;
if (mDisplayOrientation == Configuration.ORIENTATION_PORTRAIT) {
if (mThumbnailInfo.screenOrientation == Configuration.ORIENTATION_PORTRAIT) {
}
}
- /** Sets whether the thumbnail should be resized to fit the task view in all orientations. */
- public void setSizeToFit(boolean flag) {
- mSizeToFit = flag;
- }
-
- /**
- * Sets whether the header should overlap (and hide) the action bar in the thumbnail, or
- * be stacked just above it.
- */
- public void setOverlayHeaderOnThumbnailActionBar(boolean flag) {
- this.mOverlayHeaderOnThumbnailActionBar = flag;
- }
-
/** Updates the clip rect based on the given task bar. */
void updateClipToTaskBar(View taskBar) {
mTaskBar = taskBar;