diff options
| author | 2016-04-06 22:56:32 +0000 | |
|---|---|---|
| committer | 2016-04-06 22:56:33 +0000 | |
| commit | 11cac9cead4e7c68d25c0b6f93387eb4dc1ae3e1 (patch) | |
| tree | 0f74c378f9453c3dffe00d394c1dea68b9d4198b | |
| parent | b2df6af902609cf43336521c9b68123a031a00a3 (diff) | |
| parent | 6af13300d455611f75634872109f5283a1ec6d59 (diff) | |
Merge changes I010309c5,Iefdf2f2a into nyc-dev
* changes:
Set status bar color to material_blue_grey_950 as specified by UX.
Revert 'Make Files drawer appear behind system ui bars' because of action mode bug
6 files changed, 6 insertions, 51 deletions
diff --git a/packages/DocumentsUI/res/values/colors.xml b/packages/DocumentsUI/res/values/colors.xml index 1660e26af4f8..cf0643d8ceaa 100644 --- a/packages/DocumentsUI/res/values/colors.xml +++ b/packages/DocumentsUI/res/values/colors.xml @@ -31,6 +31,7 @@ <color name="accent">@*android:color/accent_material_light</color> <color name="accent_dark">@*android:color/accent_material_dark</color> <color name="action_mode">@color/material_grey_400</color> + <color name="status_bar_color">@*android:color/material_blue_grey_950</color> <color name="band_select_background">#88ffffff</color> <color name="band_select_border">#44000000</color> diff --git a/packages/DocumentsUI/res/values/styles.xml b/packages/DocumentsUI/res/values/styles.xml index b0996aa6941c..9f09ebc480e5 100644 --- a/packages/DocumentsUI/res/values/styles.xml +++ b/packages/DocumentsUI/res/values/styles.xml @@ -30,6 +30,7 @@ <item name="android:colorAccent">@color/accent</item> <item name="colorActionMode">@color/action_mode</item> <item name="android:queryBackground">@color/menu_search_background</item> + <item name="android:statusBarColor">@color/status_bar_color</item> <item name="android:listDivider">@*android:drawable/list_divider_material</item> diff --git a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java index 0d6ddf2a2e29..4ee37a5988cd 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java +++ b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java @@ -101,16 +101,6 @@ public abstract class BaseActivity extends Activity @CallSuper @Override public void onCreate(Bundle icicle) { - // This flag is being set here as a result of the bug. When the flag was set in the - // styles.xml keyboard was messing the layout of dialogs (create dir, rename). - // Attempts were made to keep the flag in the main theme and to override it in the dialog - // layout xml or to create separate style for dialog and assign it in styles.xml. - // None of this brought successful results. - // Setting the flag works here most probably because of the timing when it is set. Also the - // setting might not affect the dialogs that are created in new windows or it affects them - // in the different way that having this in the style. - getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - // Record the time when onCreate is invoked for metric. mStartTime = new Date().getTime(); @@ -140,7 +130,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..8b13222dcce7 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/Display.java +++ b/packages/DocumentsUI/src/com/android/documentsui/Display.java @@ -20,8 +20,6 @@ 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 @@ -47,41 +45,12 @@ public final class Display { * Returns action bar height in raw 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 7a4099ae791e..14e6b69bfc19 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/DrawerController.java +++ b/packages/DocumentsUI/src/com/android/documentsui/DrawerController.java @@ -84,7 +84,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( diff --git a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java index 630f35901b0c..155d618ebc79 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java +++ b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java @@ -490,24 +490,19 @@ public class DirectoryFragment extends Fragment @Override public void onSelectionChanged() { mSelectionManager.getSelection(mSelected); - TypedValue color = new TypedValue(); if (mSelected.size() > 0) { if (DEBUG) Log.d(TAG, "Maybe starting action mode."); if (mActionMode == null) { if (DEBUG) Log.d(TAG, "Yeah. Starting action mode."); mActionMode = getActivity().startActionMode(this); } - getActivity().getTheme().resolveAttribute(R.attr.colorActionMode, color, true); updateActionMenu(); } else { if (DEBUG) Log.d(TAG, "Finishing action mode."); if (mActionMode != null) { mActionMode.finish(); } - getActivity().getTheme().resolveAttribute( - android.R.attr.colorPrimaryDark, color, true); } - getActivity().getWindow().setStatusBarColor(color.data); if (mActionMode != null) { final String title = Shared.getQuantityString(getActivity(), |