blob: 391cd8be33e1a3c923335ab1f7ece6d8a088a30f [file] [log] [blame]
Marcus Hagerotta8b448a2016-11-18 12:51:39 -08001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package com.android.contacts.activities;
17
18import android.app.Fragment;
19import android.app.FragmentManager;
20import android.os.Bundle;
21
22import com.android.contacts.AppCompatContactsActivity;
23import com.android.contacts.R;
24import com.android.contacts.SimImportFragment;
25import com.android.contacts.common.model.SimCard;
26
27/**
28 * Host activity for SimImportFragment
29 *
30 * Initially SimImportFragment was a DialogFragment but there were accessibility issues with
31 * that so it was changed to an activity
32 */
33public class SimImportActivity extends AppCompatContactsActivity {
34
35 public static final String EXTRA_SUBSCRIPTION_ID = "extraSubscriptionId";
36
37 @Override
38 protected void onCreate(Bundle savedInstanceState) {
39 super.onCreate(savedInstanceState);
40 setContentView(R.layout.sim_import_activity);
41 final FragmentManager fragmentManager = getFragmentManager();
42 Fragment fragment = fragmentManager.findFragmentByTag("SimImport");
43 if (fragment == null) {
44 fragment = SimImportFragment.newInstance(getIntent().getIntExtra(EXTRA_SUBSCRIPTION_ID,
45 SimCard.NO_SUBSCRIPTION_ID));
46 fragmentManager.beginTransaction().add(R.id.root, fragment, "SimImport").commit();
47 }
48 }
49}