Devices with a hardware back button, such as atv remotes, can press back on the welcome screen and trigger a transition to a waiting screen then back to welcome. This should not be allowed. Change-Id: I2273d0d74fb1ef018074d4facc8e3793e7470f6f
77 lines
2.5 KiB
Java
77 lines
2.5 KiB
Java
/*
|
|
* SPDX-FileCopyrightText: 2016 The CyanogenMod Project
|
|
* SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
package org.lineageos.setupwizard;
|
|
|
|
import static org.lineageos.setupwizard.SetupWizardApp.ACTION_ACCESSIBILITY_SETTINGS;
|
|
import static org.lineageos.setupwizard.SetupWizardApp.ACTION_EMERGENCY_DIAL;
|
|
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import android.view.View;
|
|
import android.widget.Button;
|
|
import android.widget.TextView;
|
|
|
|
import com.google.android.setupcompat.template.FooterButtonStyleUtils;
|
|
import com.google.android.setupcompat.util.SystemBarHelper;
|
|
|
|
import org.lineageos.setupwizard.util.SetupWizardUtils;
|
|
|
|
public class WelcomeActivity extends SubBaseActivity {
|
|
|
|
@Override
|
|
protected void onStartSubactivity() {
|
|
}
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
onSetupStart();
|
|
SystemBarHelper.setBackButtonVisible(getWindow(), false);
|
|
setNextText(R.string.start);
|
|
Button startButton = findViewById(R.id.start);
|
|
Button emergButton = findViewById(R.id.emerg_dialer);
|
|
startButton.setOnClickListener(view -> onNextPressed());
|
|
findViewById(R.id.launch_accessibility)
|
|
.setOnClickListener(
|
|
view -> startSubactivity(new Intent(ACTION_ACCESSIBILITY_SETTINGS)));
|
|
|
|
FooterButtonStyleUtils.applyPrimaryButtonPartnerResource(this, startButton, true);
|
|
|
|
if (SetupWizardUtils.hasTelephony(this)) {
|
|
setSkipText(R.string.emergency_call);
|
|
emergButton.setOnClickListener(
|
|
view -> startSubactivity(new Intent(ACTION_EMERGENCY_DIAL)));
|
|
|
|
FooterButtonStyleUtils.applySecondaryButtonPartnerResource(this, emergButton, true);
|
|
} else {
|
|
emergButton.setVisibility(View.GONE);
|
|
}
|
|
|
|
TextView welcomeTitle = findViewById(R.id.welcome_title);
|
|
if (SetupWizardUtils.isManagedProfile(this)) {
|
|
welcomeTitle.setText(getString(R.string.setup_managed_profile_welcome_message));
|
|
} else {
|
|
welcomeTitle.setText(getString(R.string.setup_welcome_message,
|
|
getString(R.string.os_name)));
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void onBackPressed() {
|
|
}
|
|
|
|
@Override
|
|
protected int getLayoutResId() {
|
|
return R.layout.welcome_activity;
|
|
}
|
|
|
|
@Override
|
|
protected int getTitleResId() {
|
|
return -1;
|
|
}
|
|
}
|