blob: 1dfc69f9bab580d0e76128afa9560adeb4ed1883 [file] [log] [blame]
cretin45d4cea552016-04-25 11:00:04 -07001/*
2 * Copyright (C) 2016 The CyanogenMod Project
3 * Copyright (C) 2017 The LineageOS Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
Michael Bestasc83309e2018-02-03 17:42:13 +020018package org.lineageos.setupwizard;
cretin45d4cea552016-04-25 11:00:04 -070019
20import android.os.Bundle;
21import android.widget.ImageView;
22
Chirayu Desai0ebdabe2019-09-13 01:12:59 +053023import com.google.android.setupcompat.util.ResultCodes;
cretin45d4cea552016-04-25 11:00:04 -070024
Michael Bestasc83309e2018-02-03 17:42:13 +020025import org.lineageos.setupwizard.util.PhoneMonitor;
cretin45d4cea552016-04-25 11:00:04 -070026
27public class SimMissingActivity extends BaseSetupWizardActivity {
28
29 public static final String TAG = SimMissingActivity.class.getSimpleName();
30
31 private static final int SIM_DEFAULT = 0;
32 private static final int SIM_SIDE = 1;
33 private static final int SIM_BACK = 2;
34
35 private PhoneMonitor mPhoneMonitor;
36
37 @Override
38 protected void onCreate(Bundle savedInstanceState) {
39 super.onCreate(savedInstanceState);
40 mPhoneMonitor = PhoneMonitor.getInstance();
41 if (!mPhoneMonitor.simMissing()) {
42 finishAction(RESULT_OK);
43 }
44 setNextText(R.string.skip);
45 final int simLocation = getResources().getInteger(
46 R.integer.sim_image_type);
47 ImageView simLogo = ((ImageView)findViewById(R.id.sim_slot_image));
48 switch (simLocation) {
49 case SIM_SIDE:
50 simLogo.setImageResource(R.drawable.sim_side);
51 break;
52 case SIM_BACK:
53 simLogo.setImageResource(R.drawable.sim_back);
54 break;
55 default:
56 simLogo.setImageResource(R.drawable.sim);
57 simLogo.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
58 }
59 }
60
61 @Override
62 public void onNavigateNext() {
63 if (mPhoneMonitor.simMissing()) {
64 nextAction(ResultCodes.RESULT_SKIP);
65 } else {
66 super.onNavigateNext();
67 }
68 }
69
70 @Override
71 protected int getTransition() {
72 return TRANSITION_ID_SLIDE;
73 }
74
75 @Override
76 protected int getLayoutResId() {
77 return R.layout.sim_missing_page;
78 }
79
80 @Override
81 protected int getTitleResId() {
82 return R.string.setup_sim_missing;
83 }
84
85 @Override
86 protected int getIconResId() {
87 return R.drawable.ic_sim;
88 }
89
90}