Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36798b60 authored by Jeff Davidson's avatar Jeff Davidson
Browse files

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
parent 00b0f1d3
Loading
Loading
Loading
Loading
+18 −0
Original line number Original line Diff line number Diff line
<?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" />
+17 −1
Original line number Original line Diff line number Diff line
@@ -37,6 +37,22 @@
            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.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>
</LinearLayout>


</com.android.setupwizardlib.GlifLayout>
</com.android.setupwizardlib.GlifLayout>
+25 −0
Original line number Original line Diff line number Diff line
<?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>
+3 −1
Original line number Original line Diff line number Diff line
@@ -32,4 +32,6 @@
    <string name="install_carrier_app_defer_action">Not now</string>
    <string name="install_carrier_app_defer_action">Not now</string>
    <!-- Name of the button for downloading the carrier app [CHAR LIMIT=25] -->
    <!-- Name of the button for downloading the carrier app [CHAR LIMIT=25] -->
    <string name="install_carrier_app_download_action">Download app</string>
    <string name="install_carrier_app_download_action">Download app</string>
    <!-- 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>
</resources>
+5 −0
Original line number Original line Diff line number Diff line
@@ -65,6 +65,11 @@ public class InstallCarrierAppActivity extends Activity implements View.OnClickL
        Button downloadButton = findViewById(R.id.download_button);
        Button downloadButton = findViewById(R.id.download_button);
        downloadButton.setOnClickListener(this);
        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
        // Include carrier name in description text if its present in the intent
        Intent intent = getIntent();
        Intent intent = getIntent();
        if (intent != null) {
        if (intent != null) {