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:
@@ -1860,35 +1860,43 @@
|
||||
|
||||
<!-- Exported for SystemUI to launch into -->
|
||||
<activity android:name=".deviceinfo.StorageWizardInit"
|
||||
android:theme="@style/SuwThemeMaterial.Light"
|
||||
android:theme="@style/SetupWizardStorageStyle"
|
||||
android:taskAffinity="com.android.settings.storage_wizard"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
||||
<activity android:name=".deviceinfo.StorageWizardFormatConfirm"
|
||||
android:theme="@style/SetupWizardStorageStyle"
|
||||
android:taskAffinity="com.android.settings.storage_wizard"
|
||||
android:exported="false" />
|
||||
<activity android:name=".deviceinfo.StorageWizardFormatProgress"
|
||||
android:theme="@style/SetupWizardStorageStyle"
|
||||
android:taskAffinity="com.android.settings.storage_wizard"
|
||||
android:exported="false" />
|
||||
<activity android:name=".deviceinfo.StorageWizardMigrate"
|
||||
android:theme="@style/SetupWizardStorageStyle"
|
||||
android:taskAffinity="com.android.settings.storage_wizard"
|
||||
android:exported="false" />
|
||||
<activity android:name=".deviceinfo.StorageWizardMigrateConfirm"
|
||||
android:theme="@style/SetupWizardStorageStyle"
|
||||
android:taskAffinity="com.android.settings.storage_wizard"
|
||||
android:exported="false" />
|
||||
<activity android:name=".deviceinfo.StorageWizardMigrateProgress"
|
||||
android:theme="@style/SetupWizardStorageStyle"
|
||||
android:taskAffinity="com.android.settings.storage_wizard"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
||||
<activity android:name=".deviceinfo.StorageWizardReady"
|
||||
android:theme="@style/SetupWizardStorageStyle"
|
||||
android:taskAffinity="com.android.settings.storage_wizard"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
||||
|
||||
<activity android:name=".deviceinfo.StorageWizardMoveConfirm"
|
||||
android:theme="@style/SetupWizardStorageStyle"
|
||||
android:taskAffinity="com.android.settings.storage_wizard"
|
||||
android:exported="false" />
|
||||
<activity android:name=".deviceinfo.StorageWizardMoveProgress"
|
||||
android:theme="@style/SetupWizardStorageStyle"
|
||||
android:taskAffinity="com.android.settings.storage_wizard"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
||||
|
35
res/layout/storage_wizard_footer.xml
Normal file
35
res/layout/storage_wizard_footer.xml
Normal 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>
|
@@ -14,13 +14,13 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<com.android.setupwizardlib.SetupWizardLayout
|
||||
<com.android.setupwizardlib.GlifLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/setup_wizard_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:suwBackgroundTile="@drawable/bg_tile_teal">
|
||||
app:suwFooter="@layout/storage_wizard_footer">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/SuwContentFrame"
|
||||
@@ -49,4 +49,4 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.android.setupwizardlib.SetupWizardLayout>
|
||||
</com.android.setupwizardlib.GlifLayout>
|
||||
|
@@ -14,13 +14,13 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<com.android.setupwizardlib.SetupWizardLayout
|
||||
<com.android.setupwizardlib.GlifLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/setup_wizard_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:suwBackgroundTile="@drawable/bg_tile_teal">
|
||||
app:suwFooter="@layout/storage_wizard_footer">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/SuwContentFrame"
|
||||
@@ -66,4 +66,4 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.android.setupwizardlib.SetupWizardLayout>
|
||||
</com.android.setupwizardlib.GlifLayout>
|
||||
|
@@ -14,13 +14,13 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<com.android.setupwizardlib.SetupWizardLayout
|
||||
<com.android.setupwizardlib.GlifLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/setup_wizard_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:suwBackgroundTile="@drawable/bg_tile_teal">
|
||||
app:suwFooter="@layout/storage_wizard_footer">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/SuwContentFrame"
|
||||
@@ -58,4 +58,4 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.android.setupwizardlib.SetupWizardLayout>
|
||||
</com.android.setupwizardlib.GlifLayout>
|
||||
|
@@ -14,13 +14,13 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<com.android.setupwizardlib.SetupWizardLayout
|
||||
<com.android.setupwizardlib.GlifLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/setup_wizard_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:suwBackgroundTile="@drawable/bg_tile_teal">
|
||||
app:suwFooter="@layout/storage_wizard_footer">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/SuwContentFrame"
|
||||
@@ -54,4 +54,4 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.android.setupwizardlib.SetupWizardLayout>
|
||||
</com.android.setupwizardlib.GlifLayout>
|
||||
|
@@ -14,13 +14,13 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<com.android.setupwizardlib.SetupWizardLayout
|
||||
<com.android.setupwizardlib.GlifLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/setup_wizard_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:suwBackgroundTile="@drawable/bg_tile_teal">
|
||||
app:suwFooter="@layout/storage_wizard_footer">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/SuwContentFrame"
|
||||
@@ -39,4 +39,4 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.android.setupwizardlib.SetupWizardLayout>
|
||||
</com.android.setupwizardlib.GlifLayout>
|
||||
|
@@ -362,8 +362,7 @@
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="SetupWizardStorageStyle" parent="@style/SuwThemeMaterial.Light">
|
||||
<item name="android:colorAccent">#ff009688</item>
|
||||
<style name="SetupWizardStorageStyle" parent="@style/SuwThemeGlif.Light">
|
||||
</style>
|
||||
|
||||
<style name="PreviewPagerPageIndicator">
|
||||
|
@@ -20,7 +20,9 @@ import static com.android.settings.deviceinfo.StorageSettings.TAG;
|
||||
|
||||
import android.annotation.LayoutRes;
|
||||
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.SystemClock;
|
||||
import android.os.storage.DiskInfo;
|
||||
@@ -30,16 +32,12 @@ import android.os.storage.VolumeInfo;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.setupwizardlib.SetupWizardLayout;
|
||||
import com.android.setupwizardlib.view.Illustration;
|
||||
import com.android.setupwizardlib.GlifLayout;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
@@ -51,8 +49,7 @@ public abstract class StorageWizardBase extends Activity {
|
||||
protected VolumeInfo mVolume;
|
||||
protected DiskInfo mDisk;
|
||||
|
||||
private View mCustomNav;
|
||||
private Button mCustomNext;
|
||||
private Button mNext;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -72,8 +69,6 @@ public abstract class StorageWizardBase extends Activity {
|
||||
mDisk = mVolume.getDisk();
|
||||
}
|
||||
|
||||
setTheme(R.style.SetupWizardStorageStyle);
|
||||
|
||||
if (mDisk != null) {
|
||||
mStorage.registerListener(mStorageListener);
|
||||
}
|
||||
@@ -83,53 +78,13 @@ public abstract class StorageWizardBase extends Activity {
|
||||
public void setContentView(@LayoutRes int layoutResID) {
|
||||
super.setContentView(layoutResID);
|
||||
|
||||
// Our wizard is a unique flower, so it has custom buttons
|
||||
final ViewGroup navParent = (ViewGroup) findViewById(R.id.suw_layout_navigation_bar)
|
||||
.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() {
|
||||
mNext = (Button) findViewById(R.id.storage_next_button);
|
||||
mNext.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
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
|
||||
@@ -139,11 +94,11 @@ public abstract class StorageWizardBase extends Activity {
|
||||
}
|
||||
|
||||
protected Button getNextButton() {
|
||||
return mCustomNext;
|
||||
return mNext;
|
||||
}
|
||||
|
||||
protected SetupWizardLayout getSetupWizardLayout() {
|
||||
return (SetupWizardLayout) findViewById(R.id.setup_wizard_layout);
|
||||
protected GlifLayout getGlifLayout() {
|
||||
return (GlifLayout) findViewById(R.id.setup_wizard_layout);
|
||||
}
|
||||
|
||||
protected ProgressBar getProgressBar() {
|
||||
@@ -158,7 +113,7 @@ public abstract class StorageWizardBase extends Activity {
|
||||
|
||||
protected void setHeaderText(int resId, String... args) {
|
||||
final CharSequence headerText = TextUtils.expandTemplate(getText(resId), args);
|
||||
getSetupWizardLayout().setHeaderText(headerText);
|
||||
getGlifLayout().setHeaderText(headerText);
|
||||
setTitle(headerText);
|
||||
}
|
||||
|
||||
@@ -178,27 +133,16 @@ public abstract class StorageWizardBase extends Activity {
|
||||
protected static final int ILLUSTRATION_PORTABLE = 2;
|
||||
|
||||
protected void setIllustrationType(int type) {
|
||||
switch (type) {
|
||||
case ILLUSTRATION_SETUP:
|
||||
getSetupWizardLayout().setIllustration(
|
||||
R.drawable.bg_setup_header,
|
||||
R.drawable.bg_header_horizontal_tile);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
// TODO: map type to updated icons once provided by UX
|
||||
TypedArray array = obtainStyledAttributes(new int[] {android.R.attr.colorAccent});
|
||||
Drawable icon = getDrawable(com.android.internal.R.drawable.ic_sd_card_48dp).mutate();
|
||||
icon.setTint(array.getColor(0, 0));
|
||||
array.recycle();
|
||||
getGlifLayout().setIcon(icon);
|
||||
}
|
||||
|
||||
protected void setKeepScreenOn(boolean keepScreenOn) {
|
||||
getSetupWizardLayout().setKeepScreenOn(keepScreenOn);
|
||||
getGlifLayout().setKeepScreenOn(keepScreenOn);
|
||||
}
|
||||
|
||||
public void onNavigateNext() {
|
||||
|
Reference in New Issue
Block a user