Search in sources :

Example 6 with FooterButton

use of com.google.android.setupcompat.template.FooterButton in project android_packages_apps_Settings by omnirom.

the class SetupFingerprintEnrollFinish method initViews.

@Override
protected void initViews() {
    super.initViews();
    FooterButton nextButton = getNextButton();
    nextButton.setText(this, R.string.next_label);
}
Also used : FooterButton(com.google.android.setupcompat.template.FooterButton)

Example 7 with FooterButton

use of com.google.android.setupcompat.template.FooterButton in project android_packages_apps_Settings by omnirom.

the class FingerprintEnrollFinish method onResume.

@Override
protected void onResume() {
    super.onResume();
    FooterButton addButton = mFooterBarMixin.getSecondaryButton();
    final FingerprintManager fpm = Utils.getFingerprintManagerOrNull(this);
    boolean hideAddAnother = false;
    if (fpm != null) {
        int enrolled = fpm.getEnrolledFingerprints(mUserId).size();
        int max = getResources().getInteger(com.android.internal.R.integer.config_fingerprintMaxTemplatesPerUser);
        hideAddAnother = enrolled >= max;
    }
    if (hideAddAnother) {
        // Don't show "Add" button if too many fingerprints already added
        addButton.setVisibility(View.INVISIBLE);
    } else {
        addButton.setOnClickListener(this::onAddAnotherButtonClick);
    }
}
Also used : FooterButton(com.google.android.setupcompat.template.FooterButton) FingerprintManager(android.hardware.fingerprint.FingerprintManager)

Example 8 with FooterButton

use of com.google.android.setupcompat.template.FooterButton in project android_packages_apps_Settings by omnirom.

the class WifiDppAddDeviceFragment method showErrorUi.

private void showErrorUi(int code, Intent resultIntent, boolean isConfigurationChange) {
    CharSequence summaryCharSequence;
    switch(code) {
        case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_INVALID_URI:
            summaryCharSequence = getText(R.string.wifi_dpp_qr_code_is_not_valid_format);
            break;
        case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_AUTHENTICATION:
            summaryCharSequence = getText(R.string.wifi_dpp_failure_authentication_or_configuration);
            break;
        case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE:
            summaryCharSequence = getText(R.string.wifi_dpp_failure_not_compatible);
            break;
        case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_CONFIGURATION:
            summaryCharSequence = getText(R.string.wifi_dpp_failure_authentication_or_configuration);
            break;
        case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_BUSY:
            if (isConfigurationChange) {
                return;
            }
            if (code == mLatestStatusCode) {
                throw (new IllegalStateException("Tried restarting EasyConnectSession but still" + "receiving EASY_CONNECT_EVENT_FAILURE_BUSY"));
            }
            mLatestStatusCode = code;
            final WifiManager wifiManager = getContext().getSystemService(WifiManager.class);
            wifiManager.stopEasyConnectSession();
            startWifiDppConfiguratorInitiator();
            return;
        case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_TIMEOUT:
            summaryCharSequence = getText(R.string.wifi_dpp_failure_timeout);
            break;
        case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_GENERIC:
            summaryCharSequence = getText(R.string.wifi_dpp_failure_generic);
            break;
        case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_NOT_SUPPORTED:
            summaryCharSequence = getString(R.string.wifi_dpp_failure_not_supported, getSsid());
            break;
        case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_INVALID_NETWORK:
            throw (new IllegalStateException("Wi-Fi DPP configurator used a non-PSK/non-SAE" + "network to handshake"));
        case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK:
            summaryCharSequence = getText(R.string.wifi_dpp_failure_cannot_find_network);
            break;
        case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION:
            summaryCharSequence = getText(R.string.wifi_dpp_failure_enrollee_authentication);
            break;
        case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION:
            summaryCharSequence = getText(R.string.wifi_dpp_failure_enrollee_rejected_configuration);
            break;
        default:
            throw (new IllegalStateException("Unexpected Wi-Fi DPP error"));
    }
    setHeaderTitle(R.string.wifi_dpp_could_not_add_device);
    mSummary.setText(summaryCharSequence);
    mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_error);
    mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
    FooterButton finishingButton = mLeftButton;
    if (hasRetryButton(code)) {
        mRightButton.setText(getContext(), R.string.retry);
    } else {
        mRightButton.setText(getContext(), R.string.done);
        finishingButton = mRightButton;
        mLeftButton.setVisibility(View.INVISIBLE);
    }
    finishingButton.setOnClickListener(v -> {
        getActivity().setResult(Activity.RESULT_CANCELED, resultIntent);
        getActivity().finish();
    });
    if (isEasyConnectHandshaking()) {
        mSummary.setText(R.string.wifi_dpp_sharing_wifi_with_this_device);
    }
    setProgressBarShown(isEasyConnectHandshaking());
    mRightButton.setVisibility(isEasyConnectHandshaking() ? View.INVISIBLE : View.VISIBLE);
    if (!isConfigurationChange) {
        mLatestStatusCode = code;
    }
}
Also used : WifiManager(android.net.wifi.WifiManager) FooterButton(com.google.android.setupcompat.template.FooterButton)

Example 9 with FooterButton

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

the class FaceEnrollIntroduction method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mFaceManager = Utils.getFaceManagerOrNull(this);
    mFaceFeatureProvider = FeatureFactory.getFactory(getApplicationContext()).getFaceFeatureProvider();
    mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class);
    if (WizardManagerHelper.isAnySetupWizard(getIntent())) {
        mFooterBarMixin.setSecondaryButton(new FooterButton.Builder(this).setText(R.string.security_settings_face_enroll_introduction_no_thanks).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_no_thanks).setListener(this::onCancelButtonClick).setButtonType(FooterButton.ButtonType.CANCEL).setTheme(R.style.SudGlifButton_Secondary).build());
    }
    FooterButton.Builder nextButtonBuilder = new FooterButton.Builder(this).setText(R.string.security_settings_face_enroll_introduction_agree).setButtonType(FooterButton.ButtonType.NEXT).setTheme(R.style.SudGlifButton_Primary);
    if (maxFacesEnrolled()) {
        nextButtonBuilder.setListener(this::onNextButtonClick);
        mFooterBarMixin.setPrimaryButton(nextButtonBuilder.build());
    } else {
        final FooterButton agreeButton = nextButtonBuilder.build();
        mFooterBarMixin.setPrimaryButton(agreeButton);
        final RequireScrollMixin requireScrollMixin = getLayout().getMixin(RequireScrollMixin.class);
        requireScrollMixin.requireScrollWithButton(this, agreeButton, R.string.security_settings_face_enroll_introduction_more, button -> {
            onNextButtonClick(button);
        });
    }
    final TextView footer2 = findViewById(R.id.face_enroll_introduction_footer_part_2);
    final int footer2TextResource = mFaceFeatureProvider.isAttentionSupported(getApplicationContext()) ? R.string.security_settings_face_enroll_introduction_footer_part_2 : R.string.security_settings_face_settings_footer_attention_not_supported;
    footer2.setText(footer2TextResource);
    if (FaceUnlockUtils.hasMotoFaceUnlock() && mHasPassword && mToken != null) {
        openMotoFaceUnlock();
    }
}
Also used : FooterButton(com.google.android.setupcompat.template.FooterButton) FooterBarMixin(com.google.android.setupcompat.template.FooterBarMixin) TextView(android.widget.TextView) RequireScrollMixin(com.google.android.setupdesign.template.RequireScrollMixin)

Example 10 with FooterButton

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

the class SetupFingerprintEnrollIntroduction method initViews.

@Override
protected void initViews() {
    super.initViews();
    TextView description = (TextView) findViewById(R.id.sud_layout_description);
    description.setText(R.string.security_settings_fingerprint_enroll_introduction_message_setup);
    FooterButton nextButton = getNextButton();
    nextButton.setText(this, R.string.security_settings_fingerprint_enroll_introduction_continue_setup);
    final FooterButton cancelButton = getCancelButton();
    cancelButton.setText(this, R.string.security_settings_fingerprint_enroll_introduction_cancel_setup);
}
Also used : FooterButton(com.google.android.setupcompat.template.FooterButton) TextView(android.widget.TextView)

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