Shift storage wizards over to Glif theme.

This matches new UX best-practices, and allows us to remove some
special one-off hacks.

Test: visual
Bug: 70894690
Change-Id: I2705c731277cae7f19bce78a0a2a023ad0777b83
This commit is contained in:
Jeff Sharkey
2017-12-20 13:20:38 -07:00
parent 35d37784d0
commit ade52ca806
9 changed files with 78 additions and 92 deletions

View File

@@ -1860,35 +1860,43 @@
<!-- Exported for SystemUI to launch into --> <!-- Exported for SystemUI to launch into -->
<activity android:name=".deviceinfo.StorageWizardInit" <activity android:name=".deviceinfo.StorageWizardInit"
android:theme="@style/SuwThemeMaterial.Light" android:theme="@style/SetupWizardStorageStyle"
android:taskAffinity="com.android.settings.storage_wizard" android:taskAffinity="com.android.settings.storage_wizard"
android:exported="true" android:exported="true"
android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<activity android:name=".deviceinfo.StorageWizardFormatConfirm" <activity android:name=".deviceinfo.StorageWizardFormatConfirm"
android:theme="@style/SetupWizardStorageStyle"
android:taskAffinity="com.android.settings.storage_wizard" android:taskAffinity="com.android.settings.storage_wizard"
android:exported="false" /> android:exported="false" />
<activity android:name=".deviceinfo.StorageWizardFormatProgress" <activity android:name=".deviceinfo.StorageWizardFormatProgress"
android:theme="@style/SetupWizardStorageStyle"
android:taskAffinity="com.android.settings.storage_wizard" android:taskAffinity="com.android.settings.storage_wizard"
android:exported="false" /> android:exported="false" />
<activity android:name=".deviceinfo.StorageWizardMigrate" <activity android:name=".deviceinfo.StorageWizardMigrate"
android:theme="@style/SetupWizardStorageStyle"
android:taskAffinity="com.android.settings.storage_wizard" android:taskAffinity="com.android.settings.storage_wizard"
android:exported="false" /> android:exported="false" />
<activity android:name=".deviceinfo.StorageWizardMigrateConfirm" <activity android:name=".deviceinfo.StorageWizardMigrateConfirm"
android:theme="@style/SetupWizardStorageStyle"
android:taskAffinity="com.android.settings.storage_wizard" android:taskAffinity="com.android.settings.storage_wizard"
android:exported="false" /> android:exported="false" />
<activity android:name=".deviceinfo.StorageWizardMigrateProgress" <activity android:name=".deviceinfo.StorageWizardMigrateProgress"
android:theme="@style/SetupWizardStorageStyle"
android:taskAffinity="com.android.settings.storage_wizard" android:taskAffinity="com.android.settings.storage_wizard"
android:exported="true" android:exported="true"
android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<activity android:name=".deviceinfo.StorageWizardReady" <activity android:name=".deviceinfo.StorageWizardReady"
android:theme="@style/SetupWizardStorageStyle"
android:taskAffinity="com.android.settings.storage_wizard" android:taskAffinity="com.android.settings.storage_wizard"
android:exported="true" android:exported="true"
android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<activity android:name=".deviceinfo.StorageWizardMoveConfirm" <activity android:name=".deviceinfo.StorageWizardMoveConfirm"
android:theme="@style/SetupWizardStorageStyle"
android:taskAffinity="com.android.settings.storage_wizard" android:taskAffinity="com.android.settings.storage_wizard"
android:exported="false" /> android:exported="false" />
<activity android:name=".deviceinfo.StorageWizardMoveProgress" <activity android:name=".deviceinfo.StorageWizardMoveProgress"
android:theme="@style/SetupWizardStorageStyle"
android:taskAffinity="com.android.settings.storage_wizard" android:taskAffinity="com.android.settings.storage_wizard"
android:exported="true" android:exported="true"
android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 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
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/SuwGlifButtonBar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Space
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<Button
android:id="@+id/storage_next_button"
style="@style/SuwGlifButton.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/suw_next_button_label" />
</LinearLayout>

View File

@@ -14,13 +14,13 @@
limitations under the License. limitations under the License.
--> -->
<com.android.setupwizardlib.SetupWizardLayout <com.android.setupwizardlib.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/setup_wizard_layout" android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:suwBackgroundTile="@drawable/bg_tile_teal"> app:suwFooter="@layout/storage_wizard_footer">
<LinearLayout <LinearLayout
style="@style/SuwContentFrame" style="@style/SuwContentFrame"
@@ -49,4 +49,4 @@
</LinearLayout> </LinearLayout>
</com.android.setupwizardlib.SetupWizardLayout> </com.android.setupwizardlib.GlifLayout>

View File

@@ -14,13 +14,13 @@
limitations under the License. limitations under the License.
--> -->
<com.android.setupwizardlib.SetupWizardLayout <com.android.setupwizardlib.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/setup_wizard_layout" android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:suwBackgroundTile="@drawable/bg_tile_teal"> app:suwFooter="@layout/storage_wizard_footer">
<LinearLayout <LinearLayout
style="@style/SuwContentFrame" style="@style/SuwContentFrame"
@@ -66,4 +66,4 @@
</LinearLayout> </LinearLayout>
</com.android.setupwizardlib.SetupWizardLayout> </com.android.setupwizardlib.GlifLayout>

View File

@@ -14,13 +14,13 @@
limitations under the License. limitations under the License.
--> -->
<com.android.setupwizardlib.SetupWizardLayout <com.android.setupwizardlib.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/setup_wizard_layout" android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:suwBackgroundTile="@drawable/bg_tile_teal"> app:suwFooter="@layout/storage_wizard_footer">
<LinearLayout <LinearLayout
style="@style/SuwContentFrame" style="@style/SuwContentFrame"
@@ -58,4 +58,4 @@
</LinearLayout> </LinearLayout>
</com.android.setupwizardlib.SetupWizardLayout> </com.android.setupwizardlib.GlifLayout>

View File

@@ -14,13 +14,13 @@
limitations under the License. limitations under the License.
--> -->
<com.android.setupwizardlib.SetupWizardLayout <com.android.setupwizardlib.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/setup_wizard_layout" android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:suwBackgroundTile="@drawable/bg_tile_teal"> app:suwFooter="@layout/storage_wizard_footer">
<LinearLayout <LinearLayout
style="@style/SuwContentFrame" style="@style/SuwContentFrame"
@@ -54,4 +54,4 @@
</LinearLayout> </LinearLayout>
</com.android.setupwizardlib.SetupWizardLayout> </com.android.setupwizardlib.GlifLayout>

View File

@@ -14,13 +14,13 @@
limitations under the License. limitations under the License.
--> -->
<com.android.setupwizardlib.SetupWizardLayout <com.android.setupwizardlib.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/setup_wizard_layout" android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:suwBackgroundTile="@drawable/bg_tile_teal"> app:suwFooter="@layout/storage_wizard_footer">
<LinearLayout <LinearLayout
style="@style/SuwContentFrame" style="@style/SuwContentFrame"
@@ -39,4 +39,4 @@
</LinearLayout> </LinearLayout>
</com.android.setupwizardlib.SetupWizardLayout> </com.android.setupwizardlib.GlifLayout>

View File

@@ -362,8 +362,7 @@
<item name="android:textColor">?android:attr/textColorPrimary</item> <item name="android:textColor">?android:attr/textColorPrimary</item>
</style> </style>
<style name="SetupWizardStorageStyle" parent="@style/SuwThemeMaterial.Light"> <style name="SetupWizardStorageStyle" parent="@style/SuwThemeGlif.Light">
<item name="android:colorAccent">#ff009688</item>
</style> </style>
<style name="PreviewPagerPageIndicator"> <style name="PreviewPagerPageIndicator">

View File

@@ -20,7 +20,9 @@ import static com.android.settings.deviceinfo.StorageSettings.TAG;
import android.annotation.LayoutRes; import android.annotation.LayoutRes;
import android.app.Activity; import android.app.Activity;
import android.graphics.Color; import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.os.SystemClock; import android.os.SystemClock;
import android.os.storage.DiskInfo; import android.os.storage.DiskInfo;
@@ -30,16 +32,12 @@ import android.os.storage.VolumeInfo;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button; import android.widget.Button;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import com.android.settings.R; import com.android.settings.R;
import com.android.setupwizardlib.SetupWizardLayout; import com.android.setupwizardlib.GlifLayout;
import com.android.setupwizardlib.view.Illustration;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.List; import java.util.List;
@@ -51,8 +49,7 @@ public abstract class StorageWizardBase extends Activity {
protected VolumeInfo mVolume; protected VolumeInfo mVolume;
protected DiskInfo mDisk; protected DiskInfo mDisk;
private View mCustomNav; private Button mNext;
private Button mCustomNext;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@@ -72,8 +69,6 @@ public abstract class StorageWizardBase extends Activity {
mDisk = mVolume.getDisk(); mDisk = mVolume.getDisk();
} }
setTheme(R.style.SetupWizardStorageStyle);
if (mDisk != null) { if (mDisk != null) {
mStorage.registerListener(mStorageListener); mStorage.registerListener(mStorageListener);
} }
@@ -83,53 +78,13 @@ public abstract class StorageWizardBase extends Activity {
public void setContentView(@LayoutRes int layoutResID) { public void setContentView(@LayoutRes int layoutResID) {
super.setContentView(layoutResID); super.setContentView(layoutResID);
// Our wizard is a unique flower, so it has custom buttons mNext = (Button) findViewById(R.id.storage_next_button);
final ViewGroup navParent = (ViewGroup) findViewById(R.id.suw_layout_navigation_bar) mNext.setOnClickListener(new View.OnClickListener() {
.getParent();
mCustomNav = getLayoutInflater().inflate(R.layout.storage_wizard_navigation,
navParent, false);
mCustomNext = (Button) mCustomNav.findViewById(R.id.suw_navbar_next);
mCustomNext.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
onNavigateNext(); onNavigateNext();
} }
}); });
// Swap our custom navigation bar into place
for (int i = 0; i < navParent.getChildCount(); i++) {
if (navParent.getChildAt(i).getId() == R.id.suw_layout_navigation_bar) {
navParent.removeViewAt(i);
navParent.addView(mCustomNav, i);
break;
}
}
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
final Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS |
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
window.setStatusBarColor(Color.TRANSPARENT);
mCustomNav.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
final View scrollView = findViewById(R.id.suw_bottom_scroll_view);
scrollView.setVerticalFadingEdgeEnabled(true);
scrollView.setFadingEdgeLength(scrollView.getVerticalFadingEdgeLength() * 2);
if (findViewById(R.id.suw_layout_decor) instanceof Illustration) {
// Our header illustration already have padding baked in
final View title = findViewById(R.id.suw_layout_title);
title.setPadding(title.getPaddingLeft(), 0, title.getPaddingRight(),
title.getPaddingBottom());
}
} }
@Override @Override
@@ -139,11 +94,11 @@ public abstract class StorageWizardBase extends Activity {
} }
protected Button getNextButton() { protected Button getNextButton() {
return mCustomNext; return mNext;
} }
protected SetupWizardLayout getSetupWizardLayout() { protected GlifLayout getGlifLayout() {
return (SetupWizardLayout) findViewById(R.id.setup_wizard_layout); return (GlifLayout) findViewById(R.id.setup_wizard_layout);
} }
protected ProgressBar getProgressBar() { protected ProgressBar getProgressBar() {
@@ -158,7 +113,7 @@ public abstract class StorageWizardBase extends Activity {
protected void setHeaderText(int resId, String... args) { protected void setHeaderText(int resId, String... args) {
final CharSequence headerText = TextUtils.expandTemplate(getText(resId), args); final CharSequence headerText = TextUtils.expandTemplate(getText(resId), args);
getSetupWizardLayout().setHeaderText(headerText); getGlifLayout().setHeaderText(headerText);
setTitle(headerText); setTitle(headerText);
} }
@@ -178,27 +133,16 @@ public abstract class StorageWizardBase extends Activity {
protected static final int ILLUSTRATION_PORTABLE = 2; protected static final int ILLUSTRATION_PORTABLE = 2;
protected void setIllustrationType(int type) { protected void setIllustrationType(int type) {
switch (type) { // TODO: map type to updated icons once provided by UX
case ILLUSTRATION_SETUP: TypedArray array = obtainStyledAttributes(new int[] {android.R.attr.colorAccent});
getSetupWizardLayout().setIllustration( Drawable icon = getDrawable(com.android.internal.R.drawable.ic_sd_card_48dp).mutate();
R.drawable.bg_setup_header, icon.setTint(array.getColor(0, 0));
R.drawable.bg_header_horizontal_tile); array.recycle();
break; getGlifLayout().setIcon(icon);
case ILLUSTRATION_INTERNAL:
getSetupWizardLayout().setIllustration(
R.drawable.bg_internal_storage_header,
R.drawable.bg_header_horizontal_tile);
break;
case ILLUSTRATION_PORTABLE:
getSetupWizardLayout().setIllustration(
R.drawable.bg_portable_storage_header,
R.drawable.bg_header_horizontal_tile);
break;
}
} }
protected void setKeepScreenOn(boolean keepScreenOn) { protected void setKeepScreenOn(boolean keepScreenOn) {
getSetupWizardLayout().setKeepScreenOn(keepScreenOn); getGlifLayout().setKeepScreenOn(keepScreenOn);
} }
public void onNavigateNext() { public void onNavigateNext() {