OSDN Git Service

Revert "Grid recents: tweak task header layout to better match mocks"
authorManu Cornet <manucornet@google.com>
Tue, 13 Dec 2016 17:32:20 +0000 (17:32 +0000)
committerManu Cornet <manucornet@google.com>
Tue, 13 Dec 2016 17:32:20 +0000 (17:32 +0000)
This reverts commit 4701b993569cc5c9347571f84db8973a95c35495.

Change-Id: Id1a2f93f55b32e6544083254bb16e3d3722aa3dd

packages/SystemUI/AndroidManifest.xml
packages/SystemUI/res/layout/recents_task_view_header.xml
packages/SystemUI/res/values-sw600dp/dimens.xml
packages/SystemUI/res/values/attrs.xml
packages/SystemUI/res/values/dimens.xml
packages/SystemUI/res/values/styles.xml
packages/SystemUI/src/com/android/systemui/recents/grid/RecentsGridActivity.java
packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java

index 066c6b8..d232e00 100644 (file)
                   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>
index ba43102..5ee242d 100644 (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"
index db54a7e..7e63cbf 100644 (file)
 
     <!-- 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>
index 5123947..a229866 100644 (file)
     <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" />
index a5378a0..a7d4aa0 100644 (file)
 
     <!-- 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>
index 3b7238a..08b8988 100644 (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>
 
 
         <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>
index d0a0f24..71c2148 100644 (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);
index 11f2766..de7def6 100644 (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);
index 712f48a..c46adf1 100644 (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;