blob: 10ea618bd9c12091bd8f266bf12a6b440c926930 [file] [log] [blame]
cretin453593f032016-04-20 16:21:05 -07001/*
2 * Copyright (C) 2016 The CyanogenMod Project
Oliver Scottf58c0f42024-01-08 14:52:12 -05003 * Copyright (C) 2017-2024 The LineageOS Project
cretin453593f032016-04-20 16:21:05 -07004 *
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;
cretin453593f032016-04-20 16:21:05 -070019
Oliver Scottf58c0f42024-01-08 14:52:12 -050020import static org.lineageos.setupwizard.SetupWizardApp.ACTION_ACCESSIBILITY_SETTINGS;
21import static org.lineageos.setupwizard.SetupWizardApp.ACTION_EMERGENCY_DIAL;
22
23import android.content.Intent;
cretin453593f032016-04-20 16:21:05 -070024import android.os.Bundle;
cretin453593f032016-04-20 16:21:05 -070025import android.view.View;
Erfan Abdic0f54a32022-02-21 20:33:31 +033026import android.widget.Button;
Erfan Abdi618dfb22022-02-21 22:49:24 +033027import android.widget.TextView;
cretin453593f032016-04-20 16:21:05 -070028
Erfan Abdic0f54a32022-02-21 20:33:31 +033029import com.google.android.setupcompat.template.FooterButtonStyleUtils;
Timi Rautamäkiab4f1232021-08-23 16:56:13 +000030import com.google.android.setupcompat.util.SystemBarHelper;
31
Bruno Martins0a77fdb2023-10-09 23:32:57 +010032import org.lineageos.setupwizard.util.SetupWizardUtils;
33
Oliver Scottf58c0f42024-01-08 14:52:12 -050034public class WelcomeActivity extends SubBaseActivity {
cretin453593f032016-04-20 16:21:05 -070035
36 public static final String TAG = WelcomeActivity.class.getSimpleName();
37
Oliver Scottf58c0f42024-01-08 14:52:12 -050038 @Override
39 protected void onStartSubactivity() {
40 }
cretin453593f032016-04-20 16:21:05 -070041
42 @Override
43 protected void onCreate(Bundle savedInstanceState) {
44 super.onCreate(savedInstanceState);
Oliver Scottf58c0f42024-01-08 14:52:12 -050045 onSetupStart();
Timi Rautamäkiab4f1232021-08-23 16:56:13 +000046 SystemBarHelper.setBackButtonVisible(getWindow(), false);
Oliver Scottf58c0f42024-01-08 14:52:12 -050047 View rootView = findViewById(R.id.setup_wizard_layout);
Timi Rautamäkiab4f1232021-08-23 16:56:13 +000048 setNextText(R.string.start);
Erfan Abdic0f54a32022-02-21 20:33:31 +033049 Button startButton = findViewById(R.id.start);
50 Button emergButton = findViewById(R.id.emerg_dialer);
51 startButton.setOnClickListener(view -> onNextPressed());
Timi Rautamäkif6dbf842021-08-24 19:19:25 +000052 findViewById(R.id.launch_accessibility)
Oliver Scottf58c0f42024-01-08 14:52:12 -050053 .setOnClickListener(
54 view -> startSubactivity(new Intent(ACTION_ACCESSIBILITY_SETTINGS)));
Erfan Abdic0f54a32022-02-21 20:33:31 +033055
56 FooterButtonStyleUtils.applyPrimaryButtonPartnerResource(this, startButton, true);
Bruno Martins0a77fdb2023-10-09 23:32:57 +010057
58 if (SetupWizardUtils.hasTelephony(this)) {
59 setSkipText(R.string.emergency_call);
Oliver Scottf58c0f42024-01-08 14:52:12 -050060 emergButton.setOnClickListener(
61 view -> startSubactivity(new Intent(ACTION_EMERGENCY_DIAL)));
Bruno Martins0a77fdb2023-10-09 23:32:57 +010062
63 FooterButtonStyleUtils.applySecondaryButtonPartnerResource(this, emergButton, true);
64 } else {
65 emergButton.setVisibility(View.GONE);
66 }
Erfan Abdi618dfb22022-02-21 22:49:24 +033067
68 TextView welcomeTitle = findViewById(R.id.welcome_title);
69 welcomeTitle.setText(getString(R.string.setup_welcome_message,
70 getString(R.string.os_name)));
cretin453593f032016-04-20 16:21:05 -070071 }
72
73 @Override
Oliver Scottf58c0f42024-01-08 14:52:12 -050074 protected int getLayoutResId() {
75 return R.layout.welcome_activity;
Michael Bestasb7b34b92021-08-25 19:13:30 +030076 }
cretin45d4cea552016-04-25 11:00:04 -070077
78 @Override
Oliver Scottf58c0f42024-01-08 14:52:12 -050079 protected int getTitleResId() {
80 return -1;
cretin45d4cea552016-04-25 11:00:04 -070081 }
cretin453593f032016-04-20 16:21:05 -070082}