diff options
19 files changed, 75 insertions, 83 deletions
diff --git a/res/color/item_doc_grid_tint_dark.xml b/res/color/item_doc_grid_tint_dark.xml deleted file mode 100644 index 6c40827ba..000000000 --- a/res/color/item_doc_grid_tint_dark.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item - android:state_activated="true" - android:color="@color/item_grid_tint_dark" - android:alpha=".15" /> - <item - android:color="@android:color/transparent" /> -</selector> diff --git a/res/color/search_chip_text_color.xml b/res/color/search_chip_text_color.xml index b9893eda8..b18675210 100644 --- a/res/color/search_chip_text_color.xml +++ b/res/color/search_chip_text_color.xml @@ -18,5 +18,5 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true" android:color="?attr/colorAccent"/> <item android:state_enabled="true" android:color="?attr/colorOnSurface"/> - <item android:state_enabled="false" android:color="@color/text_hint_dark"/> + <item android:state_enabled="false" android:color="@color/text_hint"/> </selector>
\ No newline at end of file diff --git a/res/drawable/grid_item_background_dark.xml b/res/drawable-night/grid_item_background.xml index 88becada3..1767d401c 100644 --- a/res/drawable/grid_item_background_dark.xml +++ b/res/drawable-night/grid_item_background.xml @@ -15,10 +15,10 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:drawable="@color/item_doc_background_selected_dark" + <item android:drawable="@color/item_doc_background_selected" android:state_selected="true" /> - <item android:drawable="@color/item_hover_color_dark" + <item android:drawable="@color/item_hover_color" android:state_drag_hovered="true" /> - <item android:drawable="@color/item_doc_background_dark" + <item android:drawable="@color/item_doc_background" android:state_selected="false" /> </selector>
\ No newline at end of file diff --git a/res/drawable/text_cursor.xml b/res/drawable/text_cursor.xml index 986e36c11..e5a606af2 100644 --- a/res/drawable/text_cursor.xml +++ b/res/drawable/text_cursor.xml @@ -16,5 +16,5 @@ <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <size android:width="1dp" /> - <solid android:color="?attr/textCursorColor"/> + <solid android:color="@color/text_hint"/> </shape>
\ No newline at end of file diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml index 1303d1255..a5f1ff4ab 100644 --- a/res/values-night/colors.xml +++ b/res/values-night/colors.xml @@ -14,8 +14,20 @@ limitations under the License. --> <resources> + <color name="accent">#2297f0</color> + <color name="root_icon_color">#9AA0A6</color> <color name="chip_stroke_color">@android:color/transparent</color> <color name="chip_selected_background_color">#FF3D4657</color> <color name="chip_ripple_color">#FF5195EA</color> + + <color name="item_doc_background">@color/g_grey</color> + <color name="item_doc_background_disabled">@color/g_light_grey</color> + <color name="item_doc_background_selected">#4d2297f0</color> + <color name="item_grid_tint">#ff0e70e8</color> + <color name="item_hover_color">#ff5f6368</color> + + <color name="text_hint">#fff8f9fa</color> + <color name="text_handle">#ff3ce4fa</color> + <color name="text_highlight">#ff3ce4fa</color> </resources> diff --git a/res/values-night/styles.xml b/res/values-night/styles.xml index 1495d0d74..a55492454 100644 --- a/res/values-night/styles.xml +++ b/res/values-night/styles.xml @@ -16,14 +16,14 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="CardViewStyle" parent="@style/Widget.MaterialComponents.CardView"> - <item name="colorBackgroundFloating">@drawable/grid_item_background_dark</item> + <item name="colorBackgroundFloating">@drawable/grid_item_background</item> <item name="cardPreventCornerOverlap">false</item> <item name="cardCornerRadius">@dimen/grid_item_radius</item> <item name="cardElevation">@dimen/grid_item_elevation</item> </style> <style name="BottomSheetDialogStyle" parent="@style/Theme.MaterialComponents.BottomSheetDialog"> - <item name="android:colorBackground">@color/g_dark_grey</item> + <item name="colorBackgroundFloating">@drawable/grid_item_background</item> <item name="android:textColorPrimary">@color/g_light_grey</item> <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:windowIsFloating">false</item> diff --git a/res/values-night/themes.xml b/res/values-night/themes.xml index 6111c86bf..e16213087 100644 --- a/res/values-night/themes.xml +++ b/res/values-night/themes.xml @@ -24,7 +24,7 @@ <item name="colorPrimaryDark">@color/g_grey</item> <item name="colorPrimary">?attr/colorAccent</item> <item name="colorSecondary">@color/g_dark_grey</item> - <item name="colorAccent">@color/accent_dark</item> + <item name="colorAccent">@color/accent</item> <item name="queryBackground">@color/menu_search_background</item> <item name="windowActionBar">false</item> @@ -33,13 +33,13 @@ <item name="actionModeBackground">?android:attr/colorBackground</item> <item name="materialCardViewStyle">@style/CardViewStyle</item> - <item name="textHandleColor">@color/text_handle_dark</item> - <item name="textCursorColor">@color/text_cursor_dark</item> + <item name="textHandleColor">@color/text_handle</item> + <item name="textCursorColor">@color/text_hint</item> - <item name="gridItemTint">@color/item_doc_grid_tint_dark</item> - <item name="gridItemColor">@color/item_doc_background_dark</item> - <item name="gridItemSelectedColor">@color/item_doc_background_selected_dark</item> - <item name="gridItemDisableColor">@color/item_doc_background_disabled_dark</item> + <item name="gridItemTint">@color/item_doc_grid_tint</item> + <item name="gridItemColor">@color/item_doc_background</item> + <item name="gridItemSelectedColor">@color/item_doc_background_selected</item> + <item name="gridItemDisableColor">@color/item_doc_background_disabled</item> <item name="android:colorBackground">@color/g_dark_grey</item> <item name="android:windowBackground">?android:attr/colorBackground</item> @@ -48,6 +48,6 @@ <item name="android:windowLightNavigationBar">false</item> <item name="android:listDivider">@drawable/list_divider</item> <item name="android:windowSoftInputMode">stateUnspecified|adjustUnspecified</item> - <item name="android:actionBarSize">@dimen/actionBarSize</item> + <item name="android:actionBarSize">@dimen/action_bar_size</item> </style> </resources> diff --git a/res/values/colors.xml b/res/values/colors.xml index 5d78cf5e0..e68920f1f 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -24,19 +24,12 @@ <color name="drawer_border">#ffd4d4d4</color> <color name="menu_search_background">@android:color/transparent</color> - <color name="primary_dark">@color/g_dark_grey</color> <color name="primary">@android:color/white</color> <color name="accent">#004ac2</color> - <color name="accent_dark">#2297f0</color> - <color name="text_cursor">@color/text_hint</color> - <color name="text_cursor_dark">@color/text_hint_dark</color> <color name="text_handle">#ffcdf5fa</color> - <color name="text_handle_dark">#ff3ce4fa</color> <color name="text_highlight">#ffcdf5fa</color> - <color name="text_highlight_dark">#ff3ce4fa</color> <color name="text_hint">#ff80868b</color> - <color name="text_hint_dark">#fff8f9fa</color> <color name="text_secondary">#ff5f6368</color> <color name="band_select_background">#88ffffff</color> @@ -49,10 +42,7 @@ <color name="root_focus_color">?android:attr/colorControlHighlight</color> <color name="item_hover_color">#ffe0e0e0</color> - <color name="item_hover_color_dark">#ff5f6368</color> - <item name="root_icon_disabled_alpha" format="float" type="dimen">?android:attr/disabledAlpha - </item> <color name="doc_icon_color">#ff5a5a5a</color> <color name="tool_bar_color">@android:color/white</color> <color name="tool_bar_gradient_max">#7f000000</color> @@ -62,16 +52,12 @@ <color name="item_doc_title_disabled">?android:attr/textColorSecondaryInverse</color> <color name="item_doc_details">?android:attr/textColorSecondary</color> <color name="item_doc_background">@android:color/white</color> - <color name="item_doc_background_dark">@color/g_grey</color> <color name="item_doc_background_disabled">#fff4f4f4</color> - <color name="item_doc_background_disabled_dark">@color/g_light_grey</color> <color name="item_doc_background_selected">#4d3367d6</color> - <color name="item_doc_background_selected_dark">#4d2297f0</color> <color name="item_breadcrumb_background_hovered">#1affffff</color> <color name="item_doc_droppable_background">#ffe8f0fb</color> <color name="item_doc_not_droppable_background">#ffe0e0e0</color> <color name="item_grid_tint">#ff127beb</color> - <color name="item_grid_tint_dark">#ff0e70e8</color> <color name="item_drag_shadow_background">@android:color/white</color> <color name="item_drag_shadow_container_background">@android:color/transparent</color> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index c3896ab8d..b68a46487 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -21,6 +21,7 @@ <dimen name="root_icon_size">24dp</dimen> <dimen name="root_icon_margin">0dp</dimen> <dimen name="root_spacer_padding">0dp</dimen> + <dimen name="root_icon_disabled_alpha">?android:attr/disabledAlpha</dimen> <dimen name="check_icon_size">30dp</dimen> <dimen name="zoom_icon_size">22dp</dimen> <dimen name="list_item_thumbnail_size">40dp</dimen> @@ -106,7 +107,7 @@ <dimen name="search_bar_background_margin_end">0dp</dimen> <dimen name="search_bar_margin">8dp</dimen> <dimen name="search_bar_text_size">16dp</dimen> - <dimen name="actionBarSize">48dp</dimen> + <dimen name="action_bar_size">48dp</dimen> <!--This value should equal actionBarSize + (2 x search_bar_margin)--> <dimen name="action_bar_space_height">64dp</dimen> diff --git a/res/values/styles.xml b/res/values/styles.xml index d095f5b2d..2b961297f 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -64,7 +64,7 @@ </style> <style name="SnackbarButtonStyle" parent="@style/Widget.AppCompat.Button.Borderless"> - <item name="android:textColor">@color/accent_dark</item> + <item name="android:textColor">@color/accent</item> </style> <style name="BottomSheetDialogStyle" parent="@style/Theme.MaterialComponents.BottomSheetDialog"> diff --git a/res/values/themes.xml b/res/values/themes.xml index 5f0ff7f50..f5b1ad432 100644 --- a/res/values/themes.xml +++ b/res/values/themes.xml @@ -35,7 +35,7 @@ <item name="materialCardViewStyle">@style/CardViewStyle</item> <item name="textHandleColor">@color/text_handle</item> - <item name="textCursorColor">@color/text_cursor</item> + <item name="textCursorColor">@color/text_hint</item> <item name="gridItemTint">@color/item_doc_grid_tint</item> <item name="gridItemColor">@color/item_doc_background</item> @@ -51,6 +51,6 @@ <item name="android:windowLightNavigationBar">true</item> <item name="android:listDivider">@drawable/list_divider</item> <item name="android:windowSoftInputMode">stateUnspecified|adjustUnspecified</item> - <item name="android:actionBarSize">@dimen/actionBarSize</item> + <item name="android:actionBarSize">@dimen/action_bar_size</item> </style> </resources> diff --git a/src/com/android/documentsui/AbstractActionHandler.java b/src/com/android/documentsui/AbstractActionHandler.java index ff55ff7cc..aaa961204 100644 --- a/src/com/android/documentsui/AbstractActionHandler.java +++ b/src/com/android/documentsui/AbstractActionHandler.java @@ -434,7 +434,7 @@ public abstract class AbstractActionHandler<T extends FragmentActivity & CommonA mActivity.getActionBar().setBackgroundDrawable(new ColorDrawable( mActivity.getResources().getColor(R.color.primary))); mActivity.getWindow().setStatusBarColor( - mActivity.getResources().getColor(R.color.primary_dark)); + mActivity.getResources().getColor(R.color.g_dark_grey)); } } diff --git a/src/com/android/documentsui/BaseActivity.java b/src/com/android/documentsui/BaseActivity.java index 41d1658e2..e166b8734 100644 --- a/src/com/android/documentsui/BaseActivity.java +++ b/src/com/android/documentsui/BaseActivity.java @@ -355,7 +355,6 @@ public abstract class BaseActivity } updateHeaderTitle(); - mAppsRowManager.updateView(this); } @Override @@ -482,6 +481,7 @@ public abstract class BaseActivity invalidateOptionsMenu(); mSortController.onViewModeChanged(mState.derivedMode); mSearchManager.updateChips(getCurrentRoot().derivedMimeTypes); + mAppsRowManager.updateView(this); } private final List<String> getExcludedAuthorities() { diff --git a/src/com/android/documentsui/dirlist/AppsRowManager.java b/src/com/android/documentsui/dirlist/AppsRowManager.java index 49474ab9f..d24b31d50 100644 --- a/src/com/android/documentsui/dirlist/AppsRowManager.java +++ b/src/com/android/documentsui/dirlist/AppsRowManager.java @@ -69,17 +69,17 @@ public class AppsRowManager { return mDataList; } - private boolean shouldShow(State state, boolean isSearching) { + private boolean shouldShow(State state) { boolean isHiddenAction = state.action == State.ACTION_CREATE || state.action == State.ACTION_OPEN_TREE || state.action == State.ACTION_PICK_COPY_DESTINATION; - return state.stack.isRecents() && !isSearching && !isHiddenAction && mDataList.size() > 0; + return state.stack.isRecents() && !isHiddenAction && mDataList.size() > 0; } public void updateView(BaseActivity activity) { final View appsRowLayout = activity.findViewById(R.id.apps_row); - if (!shouldShow(activity.getDisplayState(), activity.isSearchExpanded())) { + if (!shouldShow(activity.getDisplayState())) { appsRowLayout.setVisibility(View.GONE); return; } diff --git a/src/com/android/documentsui/files/FilesActivity.java b/src/com/android/documentsui/files/FilesActivity.java index 0a533e51f..8457538c2 100644 --- a/src/com/android/documentsui/files/FilesActivity.java +++ b/src/com/android/documentsui/files/FilesActivity.java @@ -106,7 +106,7 @@ public class FilesActivity extends BaseActivity implements ActionHandler.Addons mInjector.selectionMgr, mDrawer, this::focusSidebar, - getColor(R.color.accent_dark)); + getColor(R.color.accent)); mInjector.menuManager = new MenuManager( mInjector.features, diff --git a/src/com/android/documentsui/picker/PickActivity.java b/src/com/android/documentsui/picker/PickActivity.java index 3a4ce46d1..124279a5d 100644 --- a/src/com/android/documentsui/picker/PickActivity.java +++ b/src/com/android/documentsui/picker/PickActivity.java @@ -103,7 +103,7 @@ public class PickActivity extends BaseActivity implements ActionHandler.Addons { mInjector.selectionMgr, mDrawer, this::focusSidebar, - getColor(R.color.accent_dark)); + getColor(R.color.accent)); mInjector.menuManager = new MenuManager(mSearchManager, mState, new DirectoryDetails(this)); diff --git a/tests/unit/com/android/documentsui/dirlist/AppsRowManagerTest.java b/tests/unit/com/android/documentsui/dirlist/AppsRowManagerTest.java index 73340906a..ded81818b 100644 --- a/tests/unit/com/android/documentsui/dirlist/AppsRowManagerTest.java +++ b/tests/unit/com/android/documentsui/dirlist/AppsRowManagerTest.java @@ -116,7 +116,6 @@ public class AppsRowManagerTest { public void testUpdateView_matchedState_showRow() { mState.action = State.ACTION_BROWSE; mState.stack.changeRoot(TestProvidersAccess.RECENTS); - when(mActivity.isSearchExpanded()).thenReturn(false); final List<Item> rootList = new ArrayList<>(); rootList.add(new RootItem(TestProvidersAccess.INSPECTOR, mActionHandler)); mAppsRowManager.updateList(rootList); @@ -130,7 +129,6 @@ public class AppsRowManagerTest { @Test public void testUpdateView_notInRecent_hideRow() { mState.action = State.ACTION_BROWSE; - when(mActivity.isSearchExpanded()).thenReturn(false); final List<Item> rootList = new ArrayList<>(); rootList.add(new RootItem(TestProvidersAccess.INSPECTOR, mActionHandler)); mAppsRowManager.updateList(rootList); @@ -147,7 +145,6 @@ public class AppsRowManagerTest { mState.action = State.ACTION_OPEN_TREE; mState.stack.changeRoot(TestProvidersAccess.RECENTS); - when(mActivity.isSearchExpanded()).thenReturn(false); final List<Item> rootList = new ArrayList<>(); rootList.add(new RootItem(TestProvidersAccess.INSPECTOR, mActionHandler)); mAppsRowManager.updateList(rootList); @@ -161,7 +158,6 @@ public class AppsRowManagerTest { public void testUpdateView_noItems_hideRow() { mState.action = State.ACTION_BROWSE; mState.stack.changeRoot(TestProvidersAccess.RECENTS); - when(mActivity.isSearchExpanded()).thenReturn(false); final List<Item> rootList = new ArrayList<>(); mAppsRowManager.updateList(rootList); @@ -170,20 +166,5 @@ public class AppsRowManagerTest { assertEquals(View.GONE, mAppsRow.getVisibility()); } - - @Test - public void testUpdateView_inSearching_hideRow() { - mState.action = State.ACTION_BROWSE; - mState.stack.changeRoot(TestProvidersAccess.RECENTS); - final List<Item> rootList = new ArrayList<>(); - rootList.add(new RootItem(TestProvidersAccess.INSPECTOR, mActionHandler)); - mAppsRowManager.updateList(rootList); - - when(mActivity.isSearchExpanded()).thenReturn(true); - - mAppsRowManager.updateView(mActivity); - - assertEquals(View.GONE, mAppsRow.getVisibility()); - } } diff --git a/tests/unit/com/android/documentsui/ui/DarkThemeUiTest.java b/tests/unit/com/android/documentsui/ui/DarkThemeUiTest.java index 8f02b3b47..b6c8ce33e 100644 --- a/tests/unit/com/android/documentsui/ui/DarkThemeUiTest.java +++ b/tests/unit/com/android/documentsui/ui/DarkThemeUiTest.java @@ -65,6 +65,12 @@ public class DarkThemeUiTest extends ThemeUiTestBase { } @Test + public void themeNightModeEnable_gridItemTintColorShouldBeThemeable() { + assertTheme(R.styleable.GridItem, R.styleable.GridItem_gridItemTint, + mTheme.getResources().getColor(R.color.item_doc_grid_tint, mTheme)); + } + + @Test public void themeNightModeEnable_windowLightNavigationBarShouldBeFalse() { assertTheme(R.styleable.SystemWindow, R.styleable.SystemWindow_android_windowLightNavigationBar, false); @@ -93,4 +99,16 @@ public class DarkThemeUiTest extends ThemeUiTestBase { assertTheme(R.styleable.SystemWindow, R.styleable.SystemWindow_android_statusBarColor, mExpectedDarkGreyColor); } + + @Test + public void appCompatThemeNightModeEnable_colorAccentShouldBeThemeable() { + assertTheme(R.styleable.AppCompatTheme, R.styleable.AppCompatTheme_colorAccent, + mTheme.getResources().getColor(R.color.accent, mTheme)); + } + + @Test + public void appCompatThemeNightModeEnable_colorPrimaryShouldBeThemeable() { + assertTheme(R.styleable.AppCompatTheme, R.styleable.AppCompatTheme_colorPrimary, + mTheme.getResources().getColor(R.color.accent, mTheme)); + } }
\ No newline at end of file diff --git a/tests/unit/com/android/documentsui/ui/ThemeUiTest.java b/tests/unit/com/android/documentsui/ui/ThemeUiTest.java index 008e46b9d..66f66dc5c 100644 --- a/tests/unit/com/android/documentsui/ui/ThemeUiTest.java +++ b/tests/unit/com/android/documentsui/ui/ThemeUiTest.java @@ -54,6 +54,12 @@ public class ThemeUiTest extends ThemeUiTestBase { } @Test + public void themeNightModeDisable_gridItemTintColorShouldBeThemeable() { + assertTheme(R.styleable.GridItem, R.styleable.GridItem_gridItemTint, + mTheme.getResources().getColor(R.color.item_doc_grid_tint, mTheme)); + } + + @Test public void themeNightModeDisable_windowLightNavigationBarShouldBeTrue() { assertTheme(R.styleable.SystemWindow, R.styleable.SystemWindow_android_windowLightNavigationBar, true); @@ -82,4 +88,16 @@ public class ThemeUiTest extends ThemeUiTestBase { assertTheme(R.styleable.SystemWindow, R.styleable.SystemWindow_android_statusBarColor, Color.WHITE); } + + @Test + public void appCompatThemeNightModeDisable_colorAccentShouldBeThemeable() { + assertTheme(R.styleable.AppCompatTheme, R.styleable.AppCompatTheme_colorAccent, + mTheme.getResources().getColor(R.color.accent, mTheme)); + } + + @Test + public void appCompatThemeNightModeDisable_colorPrimaryShouldBeThemeable() { + assertTheme(R.styleable.AppCompatTheme, R.styleable.AppCompatTheme_colorPrimary, + mTheme.getResources().getColor(R.color.accent, mTheme)); + } } |