Revert "Grid recents: tweak task header layout to better match mocks"

This reverts commit 4701b99356.

Change-Id: Id1a2f93f55b32e6544083254bb16e3d3722aa3dd
This commit is contained in:
Manu Cornet
2016-12-13 17:32:20 +00:00
parent 4701b99356
commit c733803433
9 changed files with 36 additions and 106 deletions

View File

@@ -297,7 +297,7 @@
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>

View File

@@ -30,8 +30,7 @@
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"

View File

@@ -99,28 +99,4 @@
<!-- 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>

View File

@@ -28,11 +28,10 @@
<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" />

View File

@@ -716,4 +716,19 @@
<!-- 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>

View File

@@ -25,8 +25,6 @@
<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>
@@ -36,36 +34,32 @@
<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>

View File

@@ -76,6 +76,7 @@ public class RecentsGridActivity extends Activity {
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<>();
@@ -119,10 +120,11 @@ public class RecentsGridActivity extends Activity {
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 |
@@ -160,28 +162,6 @@ public class RecentsGridActivity extends Activity {
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();
@@ -311,7 +291,6 @@ public class RecentsGridActivity extends Activity {
taskView = mTaskViews.get(i);
} else {
taskView = createView();
customizeTaskView(taskView);
}
taskView.onTaskBound(task, mTouchExplorationEnabled, mLastDisplayOrientation,
mDisplayRect);

View File

@@ -146,7 +146,6 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
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;
@@ -362,19 +361,6 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
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);

View File

@@ -60,8 +60,6 @@ public class TaskViewThumbnail extends View {
@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;
@@ -136,12 +134,9 @@ public class TaskViewThumbnail extends View {
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) {
@@ -235,7 +230,7 @@ public class TaskViewThumbnail extends View {
// 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) {
@@ -267,19 +262,6 @@ public class TaskViewThumbnail extends View {
}
}
/** 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;