Search in sources :

Example 6 with GlifLayout

use of com.google.android.setupdesign.GlifLayout in project android_packages_apps_Settings by omnirom.

the class MainClearConfirm method establishFinalConfirmationState.

/**
 * Configure the UI for the final confirmation interaction
 */
private void establishFinalConfirmationState() {
    final GlifLayout layout = mContentView.findViewById(R.id.setup_wizard_layout);
    final FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class);
    mixin.setPrimaryButton(new FooterButton.Builder(getActivity()).setText(R.string.main_clear_button_text).setListener(mFinalClickListener).setButtonType(ButtonType.OTHER).setTheme(R.style.SudGlifButton_Primary).build());
}
Also used : GlifLayout(com.google.android.setupdesign.GlifLayout) FooterBarMixin(com.google.android.setupcompat.template.FooterBarMixin)

Example 7 with GlifLayout

use of com.google.android.setupdesign.GlifLayout in project android_packages_apps_Settings by omnirom.

the class ChooseSimActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.choose_sim_activity);
    Intent intent = getIntent();
    mHasPsim = intent.getBooleanExtra(KEY_HAS_PSIM, false);
    mNoPsimContinueToSettings = intent.getBooleanExtra(KEY_NO_PSIM_CONTINUE_TO_SETTINGS, false);
    updateSubscriptions();
    if (mEmbeddedSubscriptions.size() == 0) {
        Log.e(TAG, "Unable to find available eSIM subscriptions.");
        finish();
        return;
    }
    if (savedInstanceState != null) {
        mSelectedItemIndex = savedInstanceState.getInt(STATE_SELECTED_INDEX);
        mIsSwitching = savedInstanceState.getBoolean(STATE_IS_SWITCHING);
    }
    GlifLayout layout = findViewById(R.id.glif_layout);
    int subscriptionCount = mEmbeddedSubscriptions.size();
    if (mHasPsim) {
        // Choose a number to use
        subscriptionCount++;
    }
    layout.setHeaderText(getString(R.string.choose_sim_title));
    MessageFormat msgFormat = new MessageFormat(getString(R.string.choose_sim_text), Locale.getDefault());
    Map<String, Object> arguments = new HashMap<>();
    arguments.put("count", subscriptionCount);
    layout.setDescriptionText(msgFormat.format(arguments));
    displaySubscriptions();
    mSwitchToRemovableSlotSidecar = SwitchToRemovableSlotSidecar.get(getFragmentManager());
    mSwitchToEuiccSubscriptionSidecar = SwitchToEuiccSubscriptionSidecar.get(getFragmentManager());
}
Also used : MessageFormat(android.icu.text.MessageFormat) HashMap(java.util.HashMap) GlifLayout(com.google.android.setupdesign.GlifLayout) Intent(android.content.Intent)

Example 8 with GlifLayout

use of com.google.android.setupdesign.GlifLayout in project android_packages_apps_Settings by omnirom.

the class BiometricEnrollIntroduction method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        mConfirmingCredentials = savedInstanceState.getBoolean(KEY_CONFIRMING_CREDENTIALS);
    }
    Intent intent = getIntent();
    if (intent.getStringExtra(WizardManagerHelper.EXTRA_THEME) == null) {
        // Put the theme in the intent so it gets propagated to other activities in the flow
        intent.putExtra(WizardManagerHelper.EXTRA_THEME, SetupWizardUtils.getThemeString(intent));
    }
    mBiometricUnlockDisabledByAdmin = isDisabledByAdmin();
    setContentView(getLayoutResource());
    mParentalConsentRequired = ParentalControlsUtils.parentConsentRequired(this, getModality()) != null;
    if (mBiometricUnlockDisabledByAdmin && !mParentalConsentRequired) {
        setHeaderText(getHeaderResDisabledByAdmin());
    } else {
        setHeaderText(getHeaderResDefault());
    }
    mErrorText = getErrorTextView();
    mUserManager = UserManager.get(this);
    updatePasswordQuality();
    if (!mConfirmingCredentials) {
        if (!mHasPassword) {
            // No password registered, launch into enrollment wizard.
            mConfirmingCredentials = true;
            launchChooseLock();
        } else if (!BiometricUtils.containsGatekeeperPasswordHandle(getIntent()) && mToken == null) {
            // It's possible to have a token but mLaunchedConfirmLock == false, since
            // ChooseLockGeneric can pass us a token.
            mConfirmingCredentials = true;
            launchConfirmLock(getConfirmLockTitleResId());
        }
    }
    final GlifLayout layout = getLayout();
    mFooterBarMixin = layout.getMixin(FooterBarMixin.class);
    mFooterBarMixin.setPrimaryButton(getPrimaryFooterButton());
    mFooterBarMixin.setSecondaryButton(getSecondaryFooterButton(), true);
    mFooterBarMixin.getSecondaryButton().setVisibility(View.INVISIBLE);
    final RequireScrollMixin requireScrollMixin = layout.getMixin(RequireScrollMixin.class);
    requireScrollMixin.requireScrollWithButton(this, getPrimaryFooterButton(), getMoreButtonTextRes(), this::onNextButtonClick);
    requireScrollMixin.setOnRequireScrollStateChangedListener(scrollNeeded -> {
        // Update text of primary button from "More" to "Agree".
        final int primaryButtonTextRes = scrollNeeded ? getMoreButtonTextRes() : getAgreeButtonTextRes();
        getPrimaryFooterButton().setText(this, primaryButtonTextRes);
        // Show secondary button once scroll is completed.
        if (!scrollNeeded) {
            getSecondaryFooterButton().setVisibility(View.VISIBLE);
        }
    });
}
Also used : GlifLayout(com.google.android.setupdesign.GlifLayout) FooterBarMixin(com.google.android.setupcompat.template.FooterBarMixin) Intent(android.content.Intent) RequireScrollMixin(com.google.android.setupdesign.template.RequireScrollMixin)

Example 9 with GlifLayout

use of com.google.android.setupdesign.GlifLayout in project android_packages_apps_Settings by omnirom.

the class StorageWizardBase method setIcon.

protected void setIcon(int resId) {
    final GlifLayout layout = getGlifLayout();
    final Drawable icon = getDrawable(resId).mutate();
    icon.setTintList(Utils.getColorAccent(layout.getContext()));
    layout.setIcon(icon);
}
Also used : GlifLayout(com.google.android.setupdesign.GlifLayout) Drawable(android.graphics.drawable.Drawable)

Example 10 with GlifLayout

use of com.google.android.setupdesign.GlifLayout in project android_packages_apps_Settings by omnirom.

the class MainClear method setUpInitiateButton.

private void setUpInitiateButton() {
    if (mInitiateButton != null) {
        return;
    }
    final GlifLayout layout = mContentView.findViewById(R.id.setup_wizard_layout);
    final FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class);
    mixin.setPrimaryButton(new FooterButton.Builder(getActivity()).setText(R.string.main_clear_button_text).setListener(mInitiateListener).setButtonType(ButtonType.OTHER).setTheme(R.style.SudGlifButton_Primary).build());
    mInitiateButton = mixin.getPrimaryButton();
}
Also used : GlifLayout(com.google.android.setupdesign.GlifLayout) FooterBarMixin(com.google.android.setupcompat.template.FooterBarMixin)

Aggregations

GlifLayout (com.google.android.setupdesign.GlifLayout)11 FooterBarMixin (com.google.android.setupcompat.template.FooterBarMixin)8 Intent (android.content.Intent)2 Drawable (android.graphics.drawable.Drawable)2 MessageFormat (android.icu.text.MessageFormat)1 RequireScrollMixin (com.google.android.setupdesign.template.RequireScrollMixin)1 HashMap (java.util.HashMap)1