Search in sources :

Example 11 with FooterButton

use of com.google.android.setupcompat.template.FooterButton in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class FaceEnrollEducation method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.face_enroll_education);
    getLayout().setHeaderText(R.string.security_settings_face_enroll_education_title);
    setTitle(R.string.security_settings_face_enroll_education_title);
    mHandler = new Handler();
    mFaceManager = Utils.getFaceManagerOrNull(this);
    mIllustrationNormal = findViewById(R.id.illustration_normal);
    mIllustrationAccessibility = findViewById(R.id.illustration_accessibility);
    mDescriptionText = findViewById(R.id.sud_layout_description);
    mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class);
    if (WizardManagerHelper.isAnySetupWizard(getIntent())) {
        mFooterBarMixin.setSecondaryButton(new FooterButton.Builder(this).setText(R.string.skip_label).setListener(this::onSkipButtonClick).setButtonType(FooterButton.ButtonType.SKIP).setTheme(R.style.SudGlifButton_Secondary).build());
    } else {
        mFooterBarMixin.setSecondaryButton(new FooterButton.Builder(this).setText(R.string.security_settings_face_enroll_introduction_cancel).setListener(this::onSkipButtonClick).setButtonType(FooterButton.ButtonType.CANCEL).setTheme(R.style.SudGlifButton_Secondary).build());
    }
    final FooterButton footerButton = new FooterButton.Builder(this).setText(R.string.security_settings_face_enroll_education_start).setListener(this::onNextButtonClick).setButtonType(FooterButton.ButtonType.NEXT).setTheme(R.style.SudGlifButton_Primary).build();
    boolean accessibilityEnabled = false;
    final AccessibilityManager accessibilityManager = getApplicationContext().getSystemService(AccessibilityManager.class);
    if (accessibilityManager != null) {
        // Add additional check for touch exploration. This prevents other accessibility
        // features such as Live Transcribe from defaulting to the accessibility setup.
        accessibilityEnabled = accessibilityManager.isEnabled() && accessibilityManager.isTouchExplorationEnabled();
    }
    mFooterBarMixin.setPrimaryButton(footerButton);
    final Button accessibilityButton = findViewById(R.id.accessibility_button);
    accessibilityButton.setOnClickListener(view -> {
        mSwitchDiversity.setChecked(true);
        accessibilityButton.setVisibility(View.GONE);
        mSwitchDiversity.setVisibility(View.VISIBLE);
    });
    mSwitchDiversity = findViewById(R.id.toggle_diversity);
    mSwitchDiversity.setListener(mSwitchDiversityListener);
    mSwitchDiversity.setOnClickListener(v -> {
        mSwitchDiversity.getSwitch().toggle();
    });
    if (accessibilityEnabled) {
        accessibilityButton.callOnClick();
    }
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager) FooterButton(com.google.android.setupcompat.template.FooterButton) CompoundButton(android.widget.CompoundButton) Button(android.widget.Button) FooterButton(com.google.android.setupcompat.template.FooterButton) Handler(android.os.Handler) FooterBarMixin(com.google.android.setupcompat.template.FooterBarMixin)

Aggregations

FooterButton (com.google.android.setupcompat.template.FooterButton)11 FooterBarMixin (com.google.android.setupcompat.template.FooterBarMixin)3 FingerprintManager (android.hardware.fingerprint.FingerprintManager)2 AccessibilityManager (android.view.accessibility.AccessibilityManager)2 Button (android.widget.Button)2 CompoundButton (android.widget.CompoundButton)2 TextView (android.widget.TextView)2 WifiManager (android.net.wifi.WifiManager)1 Handler (android.os.Handler)1 RequireScrollMixin (com.google.android.setupdesign.template.RequireScrollMixin)1