summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Shubham Basu <basushubham@google.com> 2021-08-04 12:12:08 -0700
committer Shubham Basu <basushubham@google.com> 2021-08-14 02:07:52 +0000
commiteb9fdff44143d4726fea4d265eab605e0a9cc5f0 (patch)
tree66da7690f41678b8f27f2ca86c0c770da0f65492
parentf83b417f7fe87e23aadb92917378569f006fd7df (diff)
work profile pause material next change
Bug: 195281572 Test: manual Screenshots: Screenshots: Android S: https://screenshot.googleplex.com/ALGrpwLRxXKoooo.png https://screenshot.googleplex.com/vGUL2FKcU5jCgDm.png Dark https://screenshot.googleplex.com/3iG3dsgcfZGi2ap.png Android R: https://screenshot.googleplex.com/9pRGqoAzV4HCoFf.png https://screenshot.googleplex.com/6JCFywtpuK5Dcb7.png Dark https://screenshot.googleplex.com/8oWPVThGp6twNGy.png Change-Id: I6392445a81c7399d1cddfe47e50e4efef9864c67
-rw-r--r--res/layout/directory_header.xml1
-rw-r--r--res/layout/item_doc_inflated_message_cross_profile.xml4
-rw-r--r--res/values-h600dp-v31/dimens.xml19
-rw-r--r--res/values-night-v31/colors.xml24
-rw-r--r--res/values-night-v31/styles.xml6
-rw-r--r--res/values-v31/colors.xml1
-rw-r--r--res/values-v31/dimens.xml2
-rw-r--r--res/values-v31/styles.xml7
-rw-r--r--res/values-v31/styles_text.xml22
-rw-r--r--res/values/colors.xml2
-rw-r--r--res/values/dimens.xml2
-rw-r--r--src/com/android/documentsui/BaseActivity.java15
-rw-r--r--src/com/android/documentsui/dirlist/DirectoryFragment.java8
-rw-r--r--src/com/android/documentsui/dirlist/InflateMessageDocumentHolder.java7
14 files changed, 117 insertions, 3 deletions
diff --git a/res/layout/directory_header.xml b/res/layout/directory_header.xml
index 7dcecb815..93e8b545c 100644
--- a/res/layout/directory_header.xml
+++ b/res/layout/directory_header.xml
@@ -64,6 +64,7 @@
<include layout="@layout/apps_row"/>
<LinearLayout
+ android:id="@+id/header_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/root_info_header_horizontal_padding"
diff --git a/res/layout/item_doc_inflated_message_cross_profile.xml b/res/layout/item_doc_inflated_message_cross_profile.xml
index ad5c8c14a..520d39812 100644
--- a/res/layout/item_doc_inflated_message_cross_profile.xml
+++ b/res/layout/item_doc_inflated_message_cross_profile.xml
@@ -17,6 +17,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
@@ -64,6 +65,9 @@
android:layout_marginTop="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ app:cornerRadius="@dimen/cross_profile_button_corner_radius"
+ app:strokeWidth="@dimen/cross_profile_button_stroke_width"
+ app:strokeColor="@color/work_profile_button_stroke_color"
style="@style/EmptyStateButton"/>
</LinearLayout>
</LinearLayout>
diff --git a/res/values-h600dp-v31/dimens.xml b/res/values-h600dp-v31/dimens.xml
new file mode 100644
index 000000000..6da529151
--- /dev/null
+++ b/res/values-h600dp-v31/dimens.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+<resources>
+ <dimen name="item_doc_inflated_message_padding_top">30dp</dimen>
+</resources>
diff --git a/res/values-night-v31/colors.xml b/res/values-night-v31/colors.xml
new file mode 100644
index 000000000..b37507879
--- /dev/null
+++ b/res/values-night-v31/colors.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2013 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.
+-->
+
+<resources>
+ <color name="tab_selected_text_color">@android:color/black</color>
+ <color name="tab_default_background_color">
+ @*android:color/system_neutral1_800
+ </color> <!-- neutral 800 -->
+ <color name="work_profile_button_stroke_color">
+ @*android:color/system_neutral1_400
+ </color> <!-- neutral 400 -->
+</resources>
diff --git a/res/values-night-v31/styles.xml b/res/values-night-v31/styles.xml
index bdf73edd1..f58593c58 100644
--- a/res/values-night-v31/styles.xml
+++ b/res/values-night-v31/styles.xml
@@ -21,4 +21,10 @@
<item name="android:actionMenuTextColor">@*android:color/accent_device_default_dark</item>
<item name="android:textAllCaps">false</item>
</style>
+
+ <style name="TabTextAppearance" parent="@android:style/TextAppearance.Material.Medium">
+ <item name="android:textSize">14sp</item>
+ <item name="fontFamily">@string/config_fontFamilyMedium</item>
+ <item name="android:textColor">?android:attr/colorAccent</item>
+ </style>
</resources>
diff --git a/res/values-v31/colors.xml b/res/values-v31/colors.xml
index 6168f2692..40296850b 100644
--- a/res/values-v31/colors.xml
+++ b/res/values-v31/colors.xml
@@ -16,4 +16,5 @@
<resources>
<color name="tab_selected_text_color">@android:color/white</color>
+ <color name="work_profile_button_stroke_color">#747775</color> <!-- neutral 500 -->
</resources>
diff --git a/res/values-v31/dimens.xml b/res/values-v31/dimens.xml
index 5140fc70b..517a12d2f 100644
--- a/res/values-v31/dimens.xml
+++ b/res/values-v31/dimens.xml
@@ -19,4 +19,6 @@
<dimen name="button_corner_radius">20dp</dimen>
<dimen name="tab_selector_indicator_height">0dp</dimen>
<dimen name="profile_tab_padding">20dp</dimen>
+ <dimen name="cross_profile_button_corner_radius">30dp</dimen>
+ <dimen name="cross_profile_button_stroke_width">1dp</dimen>
</resources>
diff --git a/res/values-v31/styles.xml b/res/values-v31/styles.xml
index 79926aafb..83bd86f5e 100644
--- a/res/values-v31/styles.xml
+++ b/res/values-v31/styles.xml
@@ -38,4 +38,11 @@
<item name="android:backgroundTint">@android:color/white</item>
<item name="android:textColor">?android:colorAccent</item>
</style>
+
+ <style name="EmptyStateButton" parent="@style/Widget.MaterialComponents.Button.OutlinedButton">
+ <item name="android:backgroundTint">@android:color/transparent</item>
+ <item name="android:textColor">?android:attr/colorAccent</item>
+ <item name="android:textAllCaps">false</item>
+ <item name="android:textAppearance">@style/EmptyStateButtonTextAppearance</item>
+ </style>
</resources>
diff --git a/res/values-v31/styles_text.xml b/res/values-v31/styles_text.xml
new file mode 100644
index 000000000..4307c51a3
--- /dev/null
+++ b/res/values-v31/styles_text.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<resources>
+ <style name="EmptyStateTitleText">
+ <item name="android:textColor">@color/empty_state_text</item>
+ <item name="android:textSize">18sp</item>
+ <item name="fontFamily">@string/config_fontFamilyMedium</item>
+ </style>
+</resources> \ No newline at end of file
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 77b5f95f3..032a5605d 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -56,4 +56,6 @@
<color name="tab_selected_text_color">@color/primary</color>
<color name="tab_default_background_color">#E0E0E0</color>
+
+ <color name="work_profile_button_stroke_color">@color/primary</color>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 90c346c8c..4019304aa 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -129,4 +129,6 @@
<dimen name="refresh_icon_range">64dp</dimen>
<dimen name="item_doc_inflated_message_padding_top">0dp</dimen>
+ <dimen name="cross_profile_button_corner_radius">0dp</dimen>
+ <dimen name="cross_profile_button_stroke_width">0dp</dimen>
</resources>
diff --git a/src/com/android/documentsui/BaseActivity.java b/src/com/android/documentsui/BaseActivity.java
index b4ab5bdf0..c6cbc1936 100644
--- a/src/com/android/documentsui/BaseActivity.java
+++ b/src/com/android/documentsui/BaseActivity.java
@@ -75,6 +75,7 @@ import com.android.documentsui.sidebar.RootsFragment;
import com.android.documentsui.sorting.SortController;
import com.android.documentsui.sorting.SortModel;
+import com.android.documentsui.util.VersionUtils;
import com.google.android.material.appbar.AppBarLayout;
import java.util.ArrayList;
@@ -719,6 +720,20 @@ public abstract class BaseActivity
}
}
+ public void updateHeader(boolean shouldHideHeader){
+ View headerContainer = findViewById(R.id.header_container);
+ if(headerContainer == null){
+ updateHeaderTitle();
+ return;
+ }
+ if (shouldHideHeader) {
+ headerContainer.setVisibility(View.GONE);
+ } else {
+ headerContainer.setVisibility(View.VISIBLE);
+ updateHeaderTitle();
+ }
+ }
+
public void updateHeaderTitle() {
if (!mState.stack.isInitialized()) {
//stack has not initialized, the header will update after the stack finishes loading
diff --git a/src/com/android/documentsui/dirlist/DirectoryFragment.java b/src/com/android/documentsui/dirlist/DirectoryFragment.java
index 25efb8c50..a5306bd97 100644
--- a/src/com/android/documentsui/dirlist/DirectoryFragment.java
+++ b/src/com/android/documentsui/dirlist/DirectoryFragment.java
@@ -111,6 +111,7 @@ import com.android.documentsui.services.FileOperations;
import com.android.documentsui.sorting.SortDimension;
import com.android.documentsui.sorting.SortModel;
+import com.android.documentsui.util.VersionUtils;
import com.google.common.base.Objects;
import java.io.IOException;
@@ -1428,8 +1429,11 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On
// update. We need to update the menu here to ensure the status is correct.
mInjector.menuManager.updateModel(mModel);
mInjector.menuManager.updateOptionMenu();
-
- mActivity.updateHeaderTitle();
+ if (VersionUtils.isAtLeastS()) {
+ mActivity.updateHeader(update.hasCrossProfileException());
+ } else {
+ mActivity.updateHeaderTitle();
+ }
}
}
}
diff --git a/src/com/android/documentsui/dirlist/InflateMessageDocumentHolder.java b/src/com/android/documentsui/dirlist/InflateMessageDocumentHolder.java
index 4b1113675..2e2b92128 100644
--- a/src/com/android/documentsui/dirlist/InflateMessageDocumentHolder.java
+++ b/src/com/android/documentsui/dirlist/InflateMessageDocumentHolder.java
@@ -26,6 +26,7 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import com.android.documentsui.R;
+import com.android.documentsui.util.VersionUtils;
/**
* RecyclerView.ViewHolder class that displays a message when there are no contents
@@ -108,7 +109,11 @@ final class InflateMessageDocumentHolder extends MessageHolder {
} else {
mCrossProfileMessage.setVisibility(View.GONE);
}
- mCrossProfileImage.setImageDrawable(mMessage.getIcon());
+ if (VersionUtils.isAtLeastS()) {
+ mCrossProfileImage.setVisibility(View.GONE);
+ } else {
+ mCrossProfileImage.setImageDrawable(mMessage.getIcon());
+ }
if (!TextUtils.isEmpty(mMessage.getButtonString())) {
mCrossProfileButton.setVisibility(View.VISIBLE);
mCrossProfileButton.setText(mMessage.getButtonString());