From 0574d169ba1e649d8bd54d28ba74b9707e675e37 Mon Sep 17 00:00:00 2001 From: Daichi Hirono Date: Wed, 23 Mar 2016 17:19:30 +0900 Subject: [PATCH] Revert "Make status bar translucent. Make drawer appera below status bar." This reverts commit 4639136c3b4bc22064323a193f06d6585e1a171a. The commit breaks the following CTS tests. * android.appsecurity.cts.DocumentsTest#testCreateExisting FAIL * android.appsecurity.cts.DocumentsTest#testCreateNew FAIL BUG=27805363,27570567 Change-Id: Ic9f1d98714a78afe548eb5ae9afa118ddc83cccc --- packages/DocumentsUI/res/values/styles.xml | 4 +-- .../src/com/android/documentsui/BaseActivity.java | 1 - .../src/com/android/documentsui/Display.java | 41 +++------------------- .../com/android/documentsui/DrawerController.java | 2 +- 4 files changed, 7 insertions(+), 41 deletions(-) diff --git a/packages/DocumentsUI/res/values/styles.xml b/packages/DocumentsUI/res/values/styles.xml index b16554c5f90d..a548d89838f1 100644 --- a/packages/DocumentsUI/res/values/styles.xml +++ b/packages/DocumentsUI/res/values/styles.xml @@ -36,8 +36,6 @@ false true true - true - false stateUnspecified|adjustUnspecified @@ -45,7 +43,7 @@ diff --git a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java index e68ed13d7855..29110275716e 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java +++ b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java @@ -127,7 +127,6 @@ public abstract class BaseActivity extends Activity mSearchManager = new SearchViewManager(this, icicle); DocumentsToolbar toolbar = (DocumentsToolbar) findViewById(R.id.toolbar); - Display.adjustToolbar(toolbar, this); setActionBar(toolbar); mNavigator = new NavigationView( mDrawer, diff --git a/packages/DocumentsUI/src/com/android/documentsui/Display.java b/packages/DocumentsUI/src/com/android/documentsui/Display.java index d46a3eac94e9..bae2d58c7abb 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/Display.java +++ b/packages/DocumentsUI/src/com/android/documentsui/Display.java @@ -20,15 +20,13 @@ import android.app.Activity; import android.content.Context; import android.graphics.Point; import android.util.TypedValue; -import android.view.WindowManager; -import android.widget.Toolbar; /* * Convenience class for getting display related attributes */ public final class Display { /* - * Returns the screen width in raw pixels. + * Returns the screen width in pixels. */ public static float screenWidth(Activity activity) { Point size = new Point(); @@ -44,44 +42,15 @@ public final class Display { } /* - * Returns action bar height in raw pixels. + * Returns action bar height in pixels. */ public static float actionBarHeight(Context context) { - int height = 0; + int actionBarHeight = 0; TypedValue tv = new TypedValue(); if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) { - height = TypedValue.complexToDimensionPixelSize(tv.data, + actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, context.getResources().getDisplayMetrics()); } - return height; - } - - /* - * Returns status bar height in raw pixels. - */ - private static int statusBarHeight(Context context) { - int height = 0; - int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", - "android"); - if (resourceId > 0) { - height = context.getResources().getDimensionPixelSize(resourceId); - } - return height; - } - - /* - * Adjusts toolbar for the layout with translucent status bar. Increases the - * height of the toolbar and adds padding at the top to accommodate status bar visible above - * toolbar. - */ - public static void adjustToolbar(Toolbar toolbar, Activity activity) { - if ((activity.getWindow().getAttributes().flags - & WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) != 0) { - int statusBarHeight = Display.statusBarHeight(activity); - toolbar.getLayoutParams().height = (int) (Display.actionBarHeight(activity) - + statusBarHeight); - toolbar.setPadding(toolbar.getPaddingLeft(), statusBarHeight, toolbar.getPaddingRight(), - toolbar.getPaddingBottom()); - } + return actionBarHeight; } } diff --git a/packages/DocumentsUI/src/com/android/documentsui/DrawerController.java b/packages/DocumentsUI/src/com/android/documentsui/DrawerController.java index 2dbb730c601a..020f2c0ad875 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/DrawerController.java +++ b/packages/DocumentsUI/src/com/android/documentsui/DrawerController.java @@ -55,7 +55,7 @@ abstract class DrawerController implements DrawerListener { View drawer = activity.findViewById(R.id.drawer_roots); Toolbar toolbar = (Toolbar) activity.findViewById(R.id.roots_toolbar); - Display.adjustToolbar(toolbar, activity); + drawer.getLayoutParams().width = calculateDrawerWidth(activity); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( -- 2.11.0