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

Commit 35c17844 authored by Marcus Hagerott's avatar Marcus Hagerott Committed by Android (Google) Code Review
Browse files

Merge "Make SIM import screen an activity" into ub-contactsdialer-h-dev

parents 9a1fa86f a8b448a1
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -441,6 +441,11 @@
        <activity android:name=".common.vcard.ShareVCardActivity"
                  android:theme="@style/BackgroundOnlyTheme" />

         <activity android:name=".activities.SimImportActivity"
             android:theme="@style/PeopleThemeAppCompat.FullScreenDialog.SimImportActivity"
             android:label="@string/sim_import_title" />


        <service
            android:name=".common.vcard.VCardService"
            android:exported="false" />
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 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.
-->
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
+4 −4
Original line number Diff line number Diff line
@@ -1879,11 +1879,11 @@
    <!-- Toast shown on settings screen when importing from SIM completes with an error -->
    <string name="sim_import_failed_toast">Failed to import SIM contacts</string>

    <!-- Title of SIM import dialog for accessibility; this isn't displayed but is announced
     by talkback when the window is shown -->
    <string name="sim_import_dialog_title">Select contacts to import</string>
    <!-- Title of the SIM import activity; this isn't displayed but is announced by talkback
         when the window is first opened [CHAR LIMIT=40] -->
    <string name="sim_import_title">Import from SIM</string>

    <!-- Content description of the cancel navigation icon shown in SIM import dialog toolbar -->
    <!-- Content description of the cancel navigation icon shown in SIM import screen toolbar -->
    <string name="sim_import_cancel_content_description">Cancel import</string>

    <!-- Alert for letting user know that their device auto-sync setting is turned off,
+16 −6
Original line number Diff line number Diff line
@@ -38,7 +38,9 @@
        <item name="android:listViewStyle">@style/ListViewStyle</item>
        <!-- We need to use a light ripple behind ActionBar items in order for them to
             be visible when using some of the darker ActionBar tints -->
        <item name="android:actionBarItemBackground">@drawable/item_background_material_borderless_dark</item>
        <item name="android:actionBarItemBackground">
            @drawable/item_background_material_borderless_dark
        </item>
    </style>

    <style name="PeopleTheme" parent="@android:style/Theme.Material.Light">
@@ -441,6 +443,7 @@
        <item name="android:fontFamily">sans-serif-medium</item>
        <item name="android:textAllCaps">true</item>
    </style>

    <style name="DirectoryHeader">
        <item name="android:background">@android:color/transparent</item>
    </style>
@@ -549,9 +552,16 @@ background and text color. See also android:style/Widget.Holo.TextView.ListSepar
    <style name="PeopleThemeAppCompat.FullScreenDialog">
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowActionBar">false</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:listSelector">?android:attr/listChoiceBackgroundIndicator</item>
        <item name="android:windowAnimationStyle">@style/FullScreenDialogAnimationStyle</item>
    </style>

    <style name="PeopleThemeAppCompat.FullScreenDialog.SimImportActivity">
        <!-- This is necessary because the window is partially transparent during the enter
             and exit animations -->
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:statusBarColor">@color/contextual_selection_bar_status_bar_color</item>
    </style>
</resources>
+9 −17
Original line number Diff line number Diff line
@@ -15,8 +15,8 @@
 */
package com.android.contacts;

import android.app.Dialog;
import android.app.DialogFragment;
import android.app.Activity;
import android.app.Fragment;
import android.app.LoaderManager;
import android.content.AsyncTaskLoader;
import android.content.Context;
@@ -59,13 +59,12 @@ import java.util.Set;
 * Dialog that presents a list of contacts from a SIM card that can be imported into a selected
 * account
 */
public class SimImportFragment extends DialogFragment
public class SimImportFragment extends Fragment
        implements LoaderManager.LoaderCallbacks<SimImportFragment.LoaderResult>,
        AdapterView.OnItemClickListener, AbsListView.OnScrollListener {

    private static final String KEY_SUFFIX_SELECTED_IDS = "_selectedIds";
    private static final String ARG_SUBSCRIPTION_ID = "subscriptionId";
    private static final String TAG = "SimImportFragment";

    private ContactsPreferences mPreferences;
    private AccountTypeManager mAccountTypeManager;
@@ -86,7 +85,6 @@ public class SimImportFragment extends DialogFragment
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setStyle(STYLE_NORMAL, R.style.PeopleThemeAppCompat_FullScreenDialog);
        mPreferences = new ContactsPreferences(getContext());
        mAccountTypeManager = AccountTypeManager.getInstance(getActivity());
        mAdapter = new SimContactAdapter(getActivity());
@@ -96,15 +94,6 @@ public class SimImportFragment extends DialogFragment
                args.getInt(ARG_SUBSCRIPTION_ID, SimCard.NO_SUBSCRIPTION_ID);
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        Dialog dialog = super.onCreateDialog(savedInstanceState);
        // Set the title for accessibility. It isn't displayed but will get announced when the
        // window is shown
        dialog.setTitle(R.string.sim_import_dialog_title);
        return dialog;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
@@ -113,7 +102,8 @@ public class SimImportFragment extends DialogFragment

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        final View view = inflater.inflate(R.layout.fragment_sim_import, container, false);

        mAccountHeaderContainer = view.findViewById(R.id.account_header_container);
@@ -151,7 +141,8 @@ public class SimImportFragment extends DialogFragment
            public void onClick(View v) {
                importCurrentSelections();
                // Do we wait for import to finish?
                dismiss();
                getActivity().setResult(Activity.RESULT_OK);
                getActivity().finish();
            }
        });

@@ -159,7 +150,8 @@ public class SimImportFragment extends DialogFragment
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                getActivity().setResult(Activity.RESULT_CANCELED);
                getActivity().finish();
            }
        });

Loading