| cretin45 | 3593f03 | 2016-04-20 16:21:05 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The CyanogenMod Project |
| Oliver Scott | f58c0f4 | 2024-01-08 14:52:12 -0500 | [diff] [blame^] | 3 | * Copyright (C) 2017-2024 The LineageOS Project |
| cretin45 | 3593f03 | 2016-04-20 16:21:05 -0700 | [diff] [blame] | 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 Bestas | c83309e | 2018-02-03 17:42:13 +0200 | [diff] [blame] | 18 | package org.lineageos.setupwizard; |
| cretin45 | 3593f03 | 2016-04-20 16:21:05 -0700 | [diff] [blame] | 19 | |
| Oliver Scott | f58c0f4 | 2024-01-08 14:52:12 -0500 | [diff] [blame^] | 20 | import static org.lineageos.setupwizard.SetupWizardApp.ACTION_ACCESSIBILITY_SETTINGS; |
| 21 | import static org.lineageos.setupwizard.SetupWizardApp.ACTION_EMERGENCY_DIAL; |
| 22 | |
| 23 | import android.content.Intent; |
| cretin45 | 3593f03 | 2016-04-20 16:21:05 -0700 | [diff] [blame] | 24 | import android.os.Bundle; |
| cretin45 | 3593f03 | 2016-04-20 16:21:05 -0700 | [diff] [blame] | 25 | import android.view.View; |
| Erfan Abdi | c0f54a3 | 2022-02-21 20:33:31 +0330 | [diff] [blame] | 26 | import android.widget.Button; |
| Erfan Abdi | 618dfb2 | 2022-02-21 22:49:24 +0330 | [diff] [blame] | 27 | import android.widget.TextView; |
| cretin45 | 3593f03 | 2016-04-20 16:21:05 -0700 | [diff] [blame] | 28 | |
| Erfan Abdi | c0f54a3 | 2022-02-21 20:33:31 +0330 | [diff] [blame] | 29 | import com.google.android.setupcompat.template.FooterButtonStyleUtils; |
| Timi Rautamäki | ab4f123 | 2021-08-23 16:56:13 +0000 | [diff] [blame] | 30 | import com.google.android.setupcompat.util.SystemBarHelper; |
| 31 | |
| Bruno Martins | 0a77fdb | 2023-10-09 23:32:57 +0100 | [diff] [blame] | 32 | import org.lineageos.setupwizard.util.SetupWizardUtils; |
| 33 | |
| Oliver Scott | f58c0f4 | 2024-01-08 14:52:12 -0500 | [diff] [blame^] | 34 | public class WelcomeActivity extends SubBaseActivity { |
| cretin45 | 3593f03 | 2016-04-20 16:21:05 -0700 | [diff] [blame] | 35 | |
| 36 | public static final String TAG = WelcomeActivity.class.getSimpleName(); |
| 37 | |
| Oliver Scott | f58c0f4 | 2024-01-08 14:52:12 -0500 | [diff] [blame^] | 38 | @Override |
| 39 | protected void onStartSubactivity() { |
| 40 | } |
| cretin45 | 3593f03 | 2016-04-20 16:21:05 -0700 | [diff] [blame] | 41 | |
| 42 | @Override |
| 43 | protected void onCreate(Bundle savedInstanceState) { |
| 44 | super.onCreate(savedInstanceState); |
| Oliver Scott | f58c0f4 | 2024-01-08 14:52:12 -0500 | [diff] [blame^] | 45 | onSetupStart(); |
| Timi Rautamäki | ab4f123 | 2021-08-23 16:56:13 +0000 | [diff] [blame] | 46 | SystemBarHelper.setBackButtonVisible(getWindow(), false); |
| Oliver Scott | f58c0f4 | 2024-01-08 14:52:12 -0500 | [diff] [blame^] | 47 | View rootView = findViewById(R.id.setup_wizard_layout); |
| Timi Rautamäki | ab4f123 | 2021-08-23 16:56:13 +0000 | [diff] [blame] | 48 | setNextText(R.string.start); |
| Erfan Abdi | c0f54a3 | 2022-02-21 20:33:31 +0330 | [diff] [blame] | 49 | Button startButton = findViewById(R.id.start); |
| 50 | Button emergButton = findViewById(R.id.emerg_dialer); |
| 51 | startButton.setOnClickListener(view -> onNextPressed()); |
| Timi Rautamäki | f6dbf84 | 2021-08-24 19:19:25 +0000 | [diff] [blame] | 52 | findViewById(R.id.launch_accessibility) |
| Oliver Scott | f58c0f4 | 2024-01-08 14:52:12 -0500 | [diff] [blame^] | 53 | .setOnClickListener( |
| 54 | view -> startSubactivity(new Intent(ACTION_ACCESSIBILITY_SETTINGS))); |
| Erfan Abdi | c0f54a3 | 2022-02-21 20:33:31 +0330 | [diff] [blame] | 55 | |
| 56 | FooterButtonStyleUtils.applyPrimaryButtonPartnerResource(this, startButton, true); |
| Bruno Martins | 0a77fdb | 2023-10-09 23:32:57 +0100 | [diff] [blame] | 57 | |
| 58 | if (SetupWizardUtils.hasTelephony(this)) { |
| 59 | setSkipText(R.string.emergency_call); |
| Oliver Scott | f58c0f4 | 2024-01-08 14:52:12 -0500 | [diff] [blame^] | 60 | emergButton.setOnClickListener( |
| 61 | view -> startSubactivity(new Intent(ACTION_EMERGENCY_DIAL))); |
| Bruno Martins | 0a77fdb | 2023-10-09 23:32:57 +0100 | [diff] [blame] | 62 | |
| 63 | FooterButtonStyleUtils.applySecondaryButtonPartnerResource(this, emergButton, true); |
| 64 | } else { |
| 65 | emergButton.setVisibility(View.GONE); |
| 66 | } |
| Erfan Abdi | 618dfb2 | 2022-02-21 22:49:24 +0330 | [diff] [blame] | 67 | |
| 68 | TextView welcomeTitle = findViewById(R.id.welcome_title); |
| 69 | welcomeTitle.setText(getString(R.string.setup_welcome_message, |
| 70 | getString(R.string.os_name))); |
| cretin45 | 3593f03 | 2016-04-20 16:21:05 -0700 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | @Override |
| Oliver Scott | f58c0f4 | 2024-01-08 14:52:12 -0500 | [diff] [blame^] | 74 | protected int getLayoutResId() { |
| 75 | return R.layout.welcome_activity; |
| Michael Bestas | b7b34b9 | 2021-08-25 19:13:30 +0300 | [diff] [blame] | 76 | } |
| cretin45 | d4cea55 | 2016-04-25 11:00:04 -0700 | [diff] [blame] | 77 | |
| 78 | @Override |
| Oliver Scott | f58c0f4 | 2024-01-08 14:52:12 -0500 | [diff] [blame^] | 79 | protected int getTitleResId() { |
| 80 | return -1; |
| cretin45 | d4cea55 | 2016-04-25 11:00:04 -0700 | [diff] [blame] | 81 | } |
| cretin45 | 3593f03 | 2016-04-20 16:21:05 -0700 | [diff] [blame] | 82 | } |