WelcomeActivity: Only show emergency call button if supported

Change-Id: I569af46dfd3a026439817bb43ee55fdc855c6298
This commit is contained in:
Bruno Martins
2023-10-09 23:32:57 +01:00
parent 0e05ffc9d0
commit 0a77fdb0e9

View File

@@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2016 The CyanogenMod Project * Copyright (C) 2016 The CyanogenMod Project
* Copyright (C) 2017-2021 The LineageOS Project * Copyright (C) 2017-2023 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -26,6 +26,8 @@ import android.widget.TextView;
import com.google.android.setupcompat.template.FooterButtonStyleUtils; import com.google.android.setupcompat.template.FooterButtonStyleUtils;
import com.google.android.setupcompat.util.SystemBarHelper; import com.google.android.setupcompat.util.SystemBarHelper;
import org.lineageos.setupwizard.util.SetupWizardUtils;
public class WelcomeActivity extends BaseSetupWizardActivity { public class WelcomeActivity extends BaseSetupWizardActivity {
public static final String TAG = WelcomeActivity.class.getSimpleName(); public static final String TAG = WelcomeActivity.class.getSimpleName();
@@ -38,16 +40,22 @@ public class WelcomeActivity extends BaseSetupWizardActivity {
SystemBarHelper.setBackButtonVisible(getWindow(), false); SystemBarHelper.setBackButtonVisible(getWindow(), false);
mRootView = findViewById(R.id.setup_wizard_layout); mRootView = findViewById(R.id.setup_wizard_layout);
setNextText(R.string.start); setNextText(R.string.start);
setSkipText(R.string.emergency_call);
Button startButton = findViewById(R.id.start); Button startButton = findViewById(R.id.start);
Button emergButton = findViewById(R.id.emerg_dialer); Button emergButton = findViewById(R.id.emerg_dialer);
startButton.setOnClickListener(view -> onNextPressed()); startButton.setOnClickListener(view -> onNextPressed());
emergButton.setOnClickListener(view -> startEmergencyDialer());
findViewById(R.id.launch_accessibility) findViewById(R.id.launch_accessibility)
.setOnClickListener(view -> startAccessibilitySettings()); .setOnClickListener(view -> startAccessibilitySettings());
FooterButtonStyleUtils.applyPrimaryButtonPartnerResource(this, startButton, true); FooterButtonStyleUtils.applyPrimaryButtonPartnerResource(this, startButton, true);
if (SetupWizardUtils.hasTelephony(this)) {
setSkipText(R.string.emergency_call);
emergButton.setOnClickListener(view -> startEmergencyDialer());
FooterButtonStyleUtils.applySecondaryButtonPartnerResource(this, emergButton, true); FooterButtonStyleUtils.applySecondaryButtonPartnerResource(this, emergButton, true);
} else {
emergButton.setVisibility(View.GONE);
}
TextView welcomeTitle = findViewById(R.id.welcome_title); TextView welcomeTitle = findViewById(R.id.welcome_title);
welcomeTitle.setText(getString(R.string.setup_welcome_message, welcomeTitle.setText(getString(R.string.setup_welcome_message,