Merge "Revert "Change to use setupdesign library""
This commit is contained in:
@@ -7,8 +7,7 @@ android_app {
|
|||||||
|
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"androidx.legacy_legacy-support-v4",
|
"androidx.legacy_legacy-support-v4",
|
||||||
"setupcompat",
|
"setup-wizard-lib",
|
||||||
"setupdesign",
|
|
||||||
],
|
],
|
||||||
|
|
||||||
resource_dirs: ["res"],
|
resource_dirs: ["res"],
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
android:name=".InstallCarrierAppActivity"
|
android:name=".InstallCarrierAppActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:permission="android.permission.NETWORK_SETTINGS"
|
android:permission="android.permission.NETWORK_SETTINGS"
|
||||||
android:theme="@style/SudThemeGlif.Light">
|
android:theme="@style/SuwThemeGlif.Light">
|
||||||
</activity>
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -14,17 +14,18 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<com.google.android.setupdesign.GlifLayout
|
<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"
|
||||||
android:icon="@drawable/ic_signal_cellular_alt_rounded"
|
android:icon="@drawable/ic_signal_cellular_alt_rounded"
|
||||||
app:sucHeaderText="@string/install_carrier_app_title">
|
app:suwHeaderText="@string/install_carrier_app_title"
|
||||||
|
app:suwFooter="@layout/install_carrier_app_footer">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
style="@style/SudContentFrame"
|
style="@style/SuwContentFrame"
|
||||||
android:id="@+id/content_frame"
|
android:id="@+id/content_frame"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -32,12 +33,12 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/install_carrier_app_description"
|
android:id="@+id/install_carrier_app_description"
|
||||||
style="@style/SudDescription.Glif"
|
style="@style/SuwDescription.Glif"
|
||||||
android:text="@string/install_carrier_app_description_default"
|
android:text="@string/install_carrier_app_description_default"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
<com.google.android.setupdesign.view.FillContentLayout
|
<com.android.setupwizardlib.view.FillContentLayout
|
||||||
android:id="@+id/illo_container"
|
android:id="@+id/illo_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -46,12 +47,12 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:src="@drawable/illo_sim_app_dialog"
|
android:src="@drawable/illo_sim_app_dialog"
|
||||||
style="@style/SudContentIllustration"
|
style="@style/SuwContentIllustration"
|
||||||
android:contentDescription="@string/install_carrier_app_image_content_description"
|
android:contentDescription="@string/install_carrier_app_image_content_description"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
</com.google.android.setupdesign.view.FillContentLayout>
|
</com.android.setupwizardlib.view.FillContentLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</com.google.android.setupdesign.GlifLayout>
|
</com.android.setupwizardlib.GlifLayout>
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2018 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.android.setupwizardlib.view.ButtonBarLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/footer"
|
||||||
|
style="@style/SuwGlifButtonBar.Stackable"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/skip_button"
|
||||||
|
style="@style/SuwGlifButton.Secondary"
|
||||||
|
android:text="@string/install_carrier_app_defer_action"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/download_button"
|
||||||
|
style="@style/SuwGlifButton.Primary"
|
||||||
|
android:text="@string/install_carrier_app_download_action"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</com.android.setupwizardlib.view.ButtonBarLayout>
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
|
||||||
<style name="SetupWizardPartnerResource">
|
|
||||||
<!-- Disable to use partner overlay theme for outside setupwizard flow. -->
|
|
||||||
<item name="sucUsePartnerResource">false</item>
|
|
||||||
<!-- Enable heavy theme style inside setupwizard flow. -->
|
|
||||||
<item name="sudUsePartnerHeavyTheme">true</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -17,17 +17,14 @@ package com.android.simappdialog;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.sysprop.SetupWizardProperties;
|
import android.sysprop.SetupWizardProperties;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.google.android.setupcompat.template.FooterBarMixin;
|
import com.android.setupwizardlib.util.WizardManagerHelper;
|
||||||
import com.google.android.setupcompat.template.FooterButton;
|
|
||||||
import com.google.android.setupdesign.GlifLayout;
|
|
||||||
import com.google.android.setupdesign.util.ThemeResolver;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity that gives a user the choice to download the SIM app or defer until a later time
|
* Activity that gives a user the choice to download the SIM app or defer until a later time
|
||||||
@@ -38,7 +35,7 @@ import com.google.android.setupdesign.util.ThemeResolver;
|
|||||||
* Can display the carrier app name if its passed into the intent with key
|
* Can display the carrier app name if its passed into the intent with key
|
||||||
* {@link #BUNDLE_KEY_CARRIER_NAME}
|
* {@link #BUNDLE_KEY_CARRIER_NAME}
|
||||||
*/
|
*/
|
||||||
public class InstallCarrierAppActivity extends Activity {
|
public class InstallCarrierAppActivity extends Activity implements View.OnClickListener {
|
||||||
/**
|
/**
|
||||||
* Key for the carrier app name that will be displayed as the app to download. If unset, a
|
* Key for the carrier app name that will be displayed as the app to download. If unset, a
|
||||||
* default description will be used
|
* default description will be used
|
||||||
@@ -53,33 +50,20 @@ public class InstallCarrierAppActivity extends Activity {
|
|||||||
protected void onCreate(Bundle icicle) {
|
protected void onCreate(Bundle icicle) {
|
||||||
// Setup theme for aosp/pixel
|
// Setup theme for aosp/pixel
|
||||||
setTheme(
|
setTheme(
|
||||||
new ThemeResolver.Builder()
|
WizardManagerHelper.getThemeRes(
|
||||||
.setDefaultTheme(R.style.SudThemeGlifV3_Light)
|
SetupWizardProperties.theme().orElse(""),
|
||||||
.build()
|
R.style.SuwThemeGlif_Light
|
||||||
.resolve(SetupWizardProperties.theme().orElse(""),
|
)
|
||||||
/* suppressDayNight= */ false));
|
);
|
||||||
|
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
setContentView(R.layout.install_carrier_app_activity);
|
setContentView(R.layout.install_carrier_app_activity);
|
||||||
|
|
||||||
GlifLayout layout = findViewById(R.id.setup_wizard_layout);
|
Button notNowButton = findViewById(R.id.skip_button);
|
||||||
FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class);
|
notNowButton.setOnClickListener(this);
|
||||||
mixin.setSecondaryButton(
|
|
||||||
new FooterButton.Builder(this)
|
|
||||||
.setText(R.string.install_carrier_app_defer_action)
|
|
||||||
.setListener(this::onSkipButtonClick)
|
|
||||||
.setButtonType(FooterButton.ButtonType.SKIP)
|
|
||||||
.setTheme(R.style.SudGlifButton_Secondary)
|
|
||||||
.build());
|
|
||||||
|
|
||||||
mixin.setPrimaryButton(
|
|
||||||
new FooterButton.Builder(this)
|
|
||||||
.setText(R.string.install_carrier_app_download_action)
|
|
||||||
.setListener(this::onDownloadButtonClick)
|
|
||||||
.setButtonType(FooterButton.ButtonType.OTHER)
|
|
||||||
.setTheme(R.style.SudGlifButton_Primary)
|
|
||||||
.build());
|
|
||||||
|
|
||||||
|
Button downloadButton = findViewById(R.id.download_button);
|
||||||
|
downloadButton.setOnClickListener(this);
|
||||||
|
|
||||||
// Show/hide illo depending on whether one was provided in a resource overlay
|
// Show/hide illo depending on whether one was provided in a resource overlay
|
||||||
boolean showIllo = getResources().getBoolean(R.bool.show_sim_app_dialog_illo);
|
boolean showIllo = getResources().getBoolean(R.bool.show_sim_app_dialog_illo);
|
||||||
@@ -98,17 +82,15 @@ public class InstallCarrierAppActivity extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
|
public void onClick(View v) {
|
||||||
theme.applyStyle(R.style.SetupWizardPartnerResource, true);
|
switch (v.getId()) {
|
||||||
super.onApplyThemeResource(theme, resid, first);
|
case R.id.skip_button:
|
||||||
}
|
finish(DEFER_RESULT);
|
||||||
|
break;
|
||||||
protected void onSkipButtonClick(View view) {
|
case R.id.download_button:
|
||||||
finish(DEFER_RESULT);
|
finish(DOWNLOAD_RESULT);
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
protected void onDownloadButtonClick(View view) {
|
|
||||||
finish(DOWNLOAD_RESULT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void finish(int resultCode) {
|
private void finish(int resultCode) {
|
||||||
|
|||||||
Reference in New Issue
Block a user