summaryrefslogtreecommitdiff
path: root/packages/SimAppDialog
diff options
context:
space:
mode:
authorJeff Davidson <jpd@google.com>2018-11-05 15:15:39 -0800
committerJeff Davidson <jpd@google.com>2018-11-06 17:31:06 +0000
commit36798b60c5e8f823b4027d49cca18fdc4704afa1 (patch)
treee3a80cde66f9369720c8df4d97c6e2428feede39 /packages/SimAppDialog
parent00b0f1d3edb44f1485b92cc758543806c7a943f1 (diff)
Add support for illustrations to SimAppDialog.
Previously these were provided in build-time resource overlays by overriding the entire install_carrier_app_activity.xml layout. This is no longer feasible with the move to runtime overlays as the layout cannot be precisely mimicked due to depending on styles and other parameters from the base APK (and is generally a bit more brittle). Instead, pull in the needed container from the current overlay, add a stub image and content description and hide the container by default so the base APK can be compiled, and provide a boolean that can be overridden along with the image and content description that is used to toggle the image display at runtime. Bug: 118823052 Test: atest GtsSimAppDialogTestCases (with and without overlay) Change-Id: Ic706df3091ce6c9f5d64ee22da6fa61b9b7b1e3c
Diffstat (limited to 'packages/SimAppDialog')
-rw-r--r--packages/SimAppDialog/res/drawable/illo_sim_app_dialog.xml18
-rw-r--r--packages/SimAppDialog/res/layout/install_carrier_app_activity.xml18
-rw-r--r--packages/SimAppDialog/res/values/bools.xml25
-rw-r--r--packages/SimAppDialog/res/values/strings.xml4
-rw-r--r--packages/SimAppDialog/src/com/android/simappdialog/InstallCarrierAppActivity.java5
5 files changed, 68 insertions, 2 deletions
diff --git a/packages/SimAppDialog/res/drawable/illo_sim_app_dialog.xml b/packages/SimAppDialog/res/drawable/illo_sim_app_dialog.xml
new file mode 100644
index 000000000000..8dd88b4bc0b0
--- /dev/null
+++ b/packages/SimAppDialog/res/drawable/illo_sim_app_dialog.xml
@@ -0,0 +1,18 @@
+<?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.
+-->
+<!-- Empty drawable as this is not displayed by default. Must be provided by resource overlay. -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android" />
diff --git a/packages/SimAppDialog/res/layout/install_carrier_app_activity.xml b/packages/SimAppDialog/res/layout/install_carrier_app_activity.xml
index 5bcce4d108a8..12f9bb6b13ea 100644
--- a/packages/SimAppDialog/res/layout/install_carrier_app_activity.xml
+++ b/packages/SimAppDialog/res/layout/install_carrier_app_activity.xml
@@ -37,6 +37,22 @@
android:text="@string/install_carrier_app_description_default"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
- </LinearLayout>
+
+ <com.android.setupwizardlib.view.FillContentLayout
+ android:id="@+id/illo_container"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:visibility="gone">
+
+ <ImageView
+ android:src="@drawable/illo_sim_app_dialog"
+ style="@style/SuwContentIllustration"
+ android:contentDescription="@string/install_carrier_app_image_content_description"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
+
+ </com.android.setupwizardlib.view.FillContentLayout>
+</LinearLayout>
</com.android.setupwizardlib.GlifLayout>
diff --git a/packages/SimAppDialog/res/values/bools.xml b/packages/SimAppDialog/res/values/bools.xml
new file mode 100644
index 000000000000..4953d5e3816b
--- /dev/null
+++ b/packages/SimAppDialog/res/values/bools.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!--
+ Whether to show an illustration on the screen asking the user to download the carrier app.
+ May be set to true in a resource overlay as long as a drawable asset with ID
+ illo_sim_app_dialog is provided, along with a content description for accessibility with
+ string ID install_carrier_app_image_content_description.
+ -->
+ <bool name="show_sim_app_dialog_illo">false</bool>
+</resources>
diff --git a/packages/SimAppDialog/res/values/strings.xml b/packages/SimAppDialog/res/values/strings.xml
index 87941cb25396..9e8359c7d62e 100644
--- a/packages/SimAppDialog/res/values/strings.xml
+++ b/packages/SimAppDialog/res/values/strings.xml
@@ -32,4 +32,6 @@
<string name="install_carrier_app_defer_action">Not now</string>
<!-- Name of the button for downloading the carrier app [CHAR LIMIT=25] -->
<string name="install_carrier_app_download_action">Download app</string>
-</resources> \ No newline at end of file
+ <!-- Empty placeholder string for an illustration content description that is supplied via resource overlay. [DO NOT TRANSLATE] -->
+ <string name="install_carrier_app_image_content_description" translatable="false" />
+</resources>
diff --git a/packages/SimAppDialog/src/com/android/simappdialog/InstallCarrierAppActivity.java b/packages/SimAppDialog/src/com/android/simappdialog/InstallCarrierAppActivity.java
index 9e9b80d39ed7..8e8d9f741a81 100644
--- a/packages/SimAppDialog/src/com/android/simappdialog/InstallCarrierAppActivity.java
+++ b/packages/SimAppDialog/src/com/android/simappdialog/InstallCarrierAppActivity.java
@@ -65,6 +65,11 @@ public class InstallCarrierAppActivity extends Activity implements View.OnClickL
Button downloadButton = findViewById(R.id.download_button);
downloadButton.setOnClickListener(this);
+ // Show/hide illo depending on whether one was provided in a resource overlay
+ boolean showIllo = getResources().getBoolean(R.bool.show_sim_app_dialog_illo);
+ View illoContainer = findViewById(R.id.illo_container);
+ illoContainer.setVisibility(showIllo ? View.VISIBLE : View.GONE);
+
// Include carrier name in description text if its present in the intent
Intent intent = getIntent();
if (intent != null) {