Merge "Migrating to new footer button for storage migrated pages"

This commit is contained in:
Pasty Chang
2018-12-21 03:27:06 +00:00
committed by Android (Google) Code Review
8 changed files with 29 additions and 154 deletions

View File

@@ -1,46 +0,0 @@
<?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">
<Button
android:id="@+id/storage_back_button"
style="@style/SuwGlifButton.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onNavigateBack"
android:visibility="gone"
android:text="@string/wizard_back" />
<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:onClick="onNavigateNext"
android:visibility="gone"
android:text="@string/wizard_next" />
</LinearLayout>

View File

@@ -19,8 +19,7 @@
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:sucFooter="@layout/storage_wizard_footer">
android:layout_height="match_parent">
<LinearLayout
style="@style/SuwContentFrame"

View File

@@ -19,8 +19,7 @@
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:sucFooter="@layout/storage_wizard_footer">
android:layout_height="match_parent">
<LinearLayout
style="@style/SuwContentFrame"

View File

@@ -1,52 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 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"
android:id="@+id/suw_layout_navigation_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/suw_navbar_back"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<Button
android:id="@+id/suw_navbar_more"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone" />
<Button
android:id="@+id/suw_navbar_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:text="@string/wizard_next"
android:textColor="@android:color/white"
android:backgroundTint="@color/storage_wizard_button" />
</LinearLayout>

View File

@@ -19,8 +19,7 @@
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:sucFooter="@layout/storage_wizard_footer">
android:layout_height="match_parent">
<LinearLayout
style="@style/SuwContentFrame"

View File

@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 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.
-->
<com.google.android.setupdesign.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:sucFooter="@layout/storage_wizard_footer">
<LinearLayout
style="@style/SuwContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/storage_wizard_ready_body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/suw_description_margin_top"
android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
android:textColor="?android:attr/textColorPrimary" />
</LinearLayout>
</com.google.android.setupdesign.GlifLayout>

View File

@@ -35,7 +35,6 @@ import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
@@ -45,6 +44,8 @@ import androidx.fragment.app.FragmentActivity;
import com.android.settings.R;
import com.android.settingslib.Utils;
import com.google.android.setupcompat.item.FooterButton;
import com.google.android.setupcompat.template.ButtonFooterMixin;
import com.google.android.setupdesign.GlifLayout;
import java.text.NumberFormat;
@@ -62,8 +63,9 @@ public abstract class StorageWizardBase extends FragmentActivity {
protected VolumeInfo mVolume;
protected DiskInfo mDisk;
private Button mBack;
private Button mNext;
private ButtonFooterMixin mButtonFooterMixin;
private FooterButton mBack;
private FooterButton mNext;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -92,8 +94,25 @@ public abstract class StorageWizardBase extends FragmentActivity {
public void setContentView(@LayoutRes int layoutResID) {
super.setContentView(layoutResID);
mBack = requireViewById(R.id.storage_back_button);
mNext = requireViewById(R.id.storage_next_button);
mButtonFooterMixin = getGlifLayout().getMixin(ButtonFooterMixin.class);
mButtonFooterMixin.setSecondaryButton(
new FooterButton(
this,
R.string.wizard_back,
this::onNavigateBack,
FooterButton.ButtonType.OTHER,
R.style.SuwGlifButton_Secondary)
);
mButtonFooterMixin.setPrimaryButton(
new FooterButton(
this,
R.string.wizard_next,
this::onNavigateNext,
FooterButton.ButtonType.NEXT,
R.style.SuwGlifButton_Primary)
);
mBack = mButtonFooterMixin.getSecondaryButton();
mNext = mButtonFooterMixin.getPrimaryButton();
setIcon(com.android.internal.R.drawable.ic_sd_card_48dp);
}
@@ -104,11 +123,11 @@ public abstract class StorageWizardBase extends FragmentActivity {
super.onDestroy();
}
protected Button getBackButton() {
protected FooterButton getBackButton() {
return mBack;
}
protected Button getNextButton() {
protected FooterButton getNextButton() {
return mNext;
}

View File

@@ -30,7 +30,6 @@ import com.android.settings.R;
import com.android.settings.overlay.FeatureFactory;
public class StorageWizardInit extends StorageWizardBase {
private Button mExternal;
private Button mInternal;
private boolean mIsPermittedToAdopt;
@@ -49,7 +48,6 @@ public class StorageWizardInit extends StorageWizardBase {
setHeaderText(R.string.storage_wizard_init_v2_title, getDiskShortDescription());
mExternal = requireViewById(R.id.storage_wizard_init_external);
mInternal = requireViewById(R.id.storage_wizard_init_internal);
setBackButtonText(R.string.storage_wizard_init_v2_later);