android:layout_height="wrap_content"
android:text="@string/security_settings_fingerprint_enroll_finish_message"/>
- <Space
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_weight="1" />
-
- <com.google.android.setupdesign.view.ButtonBarLayout
- style="@style/SuwGlifButtonBar.Stackable"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="8dp"
- android:clipChildren="false"
- android:clipToPadding="false">
-
- <Button
- style="@style/SetupWizardButton.Negative"
- android:id="@+id/add_another_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginEnd="8dp"
- android:text="@string/fingerprint_enroll_button_add" />
-
- <Space
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_weight="1" />
-
- <Button
- style="@style/SetupWizardButton.Positive"
- android:id="@+id/next_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/security_settings_fingerprint_enroll_done" />
-
- </com.google.android.setupdesign.view.ButtonBarLayout>
-
</LinearLayout>
<com.google.android.setupdesign.view.FillContentLayout
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- style="?attr/face_layout_theme"
- app:sucFooter="@layout/face_enroll_enrolling_footer">
+ style="?attr/face_layout_theme">
<LinearLayout
style="@style/SuwContentFrame"
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2018 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-
-<!-- TODO: Use aapt:attr when it is fixed (b/36809755) -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/SuwGlifButtonBar"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <Button
- style="@style/SuwGlifButton.Secondary"
- android:id="@+id/skip_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/security_settings_face_enroll_enrolling_skip" />
-
-</LinearLayout>
android:id="@+id/setup_wizard_layout"
style="?attr/face_layout_theme"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:sucFooter="@layout/face_enroll_finish_footer">
+ android:layout_height="match_parent">
<LinearLayout
style="@style/SuwContentFrame"
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2018 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-
-<!-- TODO: Use aapt:attr when it is fixed (b/36809755) -->
-<com.google.android.setupdesign.view.ButtonBarLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/SuwGlifButtonBar.Stackable"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <Space
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_weight="1" />
-
- <Button
- style="@style/SuwGlifButton.Primary"
- android:id="@+id/next_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/security_settings_face_enroll_done" />
-
-</com.google.android.setupdesign.view.ButtonBarLayout>
style="?attr/face_layout_theme"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:sucFooter="@layout/face_enroll_introduction_footer">
+ android:layout_height="match_parent">
<LinearLayout
style="@style/SuwContentFrame"
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2018 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-
-<!-- TODO: Use aapt:attr when it is fixed (b/36809755) -->
-<com.google.android.setupdesign.view.ButtonBarLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/SuwGlifButtonBar.Stackable"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <Button
- android:id="@+id/face_cancel_button"
- style="@style/SuwGlifButton.Secondary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/security_settings_face_enroll_introduction_cancel" />
-
- <Space
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_weight="1" />
-
- <Button
- android:id="@+id/face_next_button"
- style="@style/SuwGlifButton.Primary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/wizard_next" />
-
-</com.google.android.setupdesign.view.ButtonBarLayout>
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- style="?attr/fingerprint_layout_theme"
- app:sucFooter="@layout/fingerprint_enroll_enrolling_base_footer">
+ style="?attr/fingerprint_layout_theme">
<LinearLayout
style="@style/SuwContentFrame"
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2017 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- TODO: Use aapt:attr when it is fixed (b/36809755) -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/SuwGlifButtonBar"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <Button
- style="@style/SuwGlifButton.Secondary"
- android:id="@+id/skip_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/security_settings_fingerprint_enroll_enrolling_skip" />
-
-</LinearLayout>
android:id="@+id/setup_wizard_layout"
style="?attr/fingerprint_layout_theme"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:sucFooter="@layout/fingerprint_enroll_find_sensor_base_footer">
+ android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2017 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- TODO: Use aapt:attr when it is fixed (b/36809755) -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/SuwGlifButtonBar"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <Button
- style="@style/SuwGlifButton.Secondary"
- android:id="@+id/skip_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/skip_label" />
-
-</LinearLayout>
android:id="@+id/setup_wizard_layout"
style="?attr/fingerprint_layout_theme"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:sucFooter="@layout/fingerprint_enroll_finish_base_footer">
+ android:layout_height="match_parent">
<LinearLayout
style="@style/SuwContentFrame"
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2017 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- TODO: Use aapt:attr when it is fixed (b/36809755) -->
-<com.google.android.setupdesign.view.ButtonBarLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/SuwGlifButtonBar.Stackable"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <Button
- style="@style/SuwGlifButton.Secondary"
- android:id="@+id/add_another_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/fingerprint_enroll_button_add" />
-
- <Space
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_weight="1" />
-
- <Button
- style="@style/SuwGlifButton.Primary"
- android:id="@+id/next_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/security_settings_fingerprint_enroll_done" />
-
-</com.google.android.setupdesign.view.ButtonBarLayout>
style="?attr/fingerprint_layout_theme"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:sucFooter="@layout/fingerprint_enroll_introduction_footer">
+ android:layout_height="match_parent">
<LinearLayout
style="@style/SuwContentFrame"
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2017 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License
--->
-
-<!-- TODO: Use aapt:attr when it is fixed (b/36809755) -->
-<com.google.android.setupdesign.view.ButtonBarLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/SuwGlifButtonBar.Stackable"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <Button
- android:id="@+id/fingerprint_cancel_button"
- style="@style/SuwGlifButton.Secondary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/security_settings_fingerprint_enroll_introduction_cancel" />
-
- <Space
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_weight="1" />
-
- <Button
- android:id="@+id/fingerprint_next_button"
- style="@style/SuwGlifButton.Primary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/wizard_next" />
-
-</com.google.android.setupdesign.view.ButtonBarLayout>
import android.os.UserHandle;
import android.text.TextUtils;
import android.view.View;
-import android.widget.Button;
import android.widget.TextView;
import com.android.settings.R;
import com.android.settings.core.InstrumentedActivity;
import com.android.settings.password.ChooseLockSettingsHelper;
+import com.google.android.setupcompat.item.FooterButton;
+import com.google.android.setupcompat.template.ButtonFooterMixin;
import com.google.android.setupdesign.GlifLayout;
/**
* Base activity for all biometric enrollment steps.
*/
-public abstract class BiometricEnrollBase extends InstrumentedActivity
- implements View.OnClickListener {
+public abstract class BiometricEnrollBase extends InstrumentedActivity {
public static final String EXTRA_KEY_LAUNCHED_CONFIRM = "launched_confirm_lock";
public static final String EXTRA_KEY_REQUIRE_VISION = "accessibility_vision";
protected boolean mLaunchedConfirmLock;
protected byte[] mToken;
protected int mUserId;
+ protected ButtonFooterMixin mButtonFooterMixin;
@Override
protected void onCreate(Bundle savedInstanceState) {
protected void initViews() {
getWindow().setStatusBarColor(Color.TRANSPARENT);
- Button nextButton = getNextButton();
- if (nextButton != null) {
- nextButton.setOnClickListener(this);
- }
}
protected GlifLayout getLayout() {
setHeaderText(resId, false /* force */);
}
- protected Button getNextButton() {
- return (Button) findViewById(R.id.next_button);
- }
-
- @Override
- public void onClick(View v) {
- if (v == getNextButton()) {
- onNextButtonClick();
+ protected FooterButton getNextButton() {
+ if (mButtonFooterMixin != null) {
+ return mButtonFooterMixin.getPrimaryButton();
}
+ return null;
}
- protected void onNextButtonClick() {
+ protected void onNextButtonClick(View view) {
}
protected Intent getFingerprintEnrollingIntent() {
import android.os.UserHandle;
import android.os.UserManager;
import android.view.View;
-import android.widget.Button;
import android.widget.TextView;
import com.android.settings.R;
import com.android.settings.password.ChooseLockGeneric;
import com.android.settings.password.ChooseLockSettingsHelper;
+import com.google.android.setupcompat.item.FooterButton;
import com.google.android.setupdesign.span.LinkSpan;
/**
/**
* @return the cancel button
*/
- protected abstract Button getCancelButton();
+ protected abstract FooterButton getCancelButton();
/**
* @return the next button
*/
- protected abstract Button getNextButton();
+ protected abstract FooterButton getNextButton();
/**
* @return the error TextView
setHeaderText(getHeaderResDefault());
}
- Button cancelButton = getCancelButton();
- cancelButton.setOnClickListener(v -> onCancelButtonClick());
-
mErrorText = getErrorTextView();
mUserManager = UserManager.get(this);
}
@Override
- protected void onNextButtonClick() {
+ protected void onNextButtonClick(View view) {
// Lock thingy is already set up, launch directly to the next page
launchNextEnrollingActivity(mToken);
}
super.onActivityResult(requestCode, resultCode, data);
}
- protected void onCancelButtonClick() {
+ protected void onCancelButtonClick(View view) {
finish();
}
super.onBackPressed();
}
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.skip_button:
- setResult(RESULT_SKIP);
- finish();
- break;
- default:
- super.onClick(v);
- }
+ protected void onSkipButtonClick(View view) {
+ setResult(RESULT_SKIP);
+ finish();
}
public void startEnrollment() {
import android.view.View;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
-import android.widget.Button;
import android.widget.TextView;
import com.android.internal.logging.nano.MetricsProto;
import java.util.ArrayList;
+import com.google.android.setupcompat.item.FooterButton;
+import com.google.android.setupcompat.template.ButtonFooterMixin;
public class FaceEnrollEnrolling extends BiometricsEnrollEnrolling {
mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(
this, android.R.interpolator.linear_out_slow_in);
- Button skipButton = findViewById(R.id.skip_button);
- skipButton.setOnClickListener(this);
+ mButtonFooterMixin = getLayout().getMixin(ButtonFooterMixin.class);
+ mButtonFooterMixin.setSecondaryButton(
+ new FooterButton(
+ this,
+ R.string.security_settings_face_enroll_enrolling_skip,
+ this::onSkipButtonClick,
+ FooterButton.ButtonType.SKIP,
+ R.style.SuwGlifButton_Secondary)
+ );
if (!getIntent().getBooleanExtra(BiometricEnrollBase.EXTRA_KEY_REQUIRE_DIVERSITY, true)) {
mDisabledFeatures.add(FaceManager.FEATURE_REQUIRE_REQUIRE_DIVERSITY);
package com.android.settings.biometrics.face;
import android.os.Bundle;
+import android.view.View;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.biometrics.BiometricEnrollBase;
+import com.google.android.setupcompat.item.FooterButton;
+import com.google.android.setupcompat.template.ButtonFooterMixin;
+
/**
* Activity which concludes face enrollment.
*/
super.onCreate(savedInstanceState);
setContentView(R.layout.face_enroll_finish);
setHeaderText(R.string.security_settings_face_enroll_finish_title);
+
+ mButtonFooterMixin = getLayout().getMixin(ButtonFooterMixin.class);
+ mButtonFooterMixin.setPrimaryButton(
+ new FooterButton(
+ this,
+ R.string.security_settings_face_enroll_done,
+ this::onNextButtonClick,
+ FooterButton.ButtonType.NEXT,
+ R.style.SuwGlifButton_Primary)
+ );
}
@Override
}
@Override
- public void onNextButtonClick() {
+ public void onNextButtonClick(View view) {
setResult(RESULT_FINISHED);
finish();
}
import com.android.settings.password.ChooseLockSettingsHelper;
import com.android.settingslib.RestrictedLockUtilsInternal;
+import com.google.android.setupcompat.item.FooterButton;
+import com.google.android.setupcompat.template.ButtonFooterMixin;
import com.google.android.setupdesign.span.LinkSpan;
public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
mSwitchVision = findViewById(R.id.toggle_vision);
mSwitchDiversity = findViewById(R.id.toggle_diversity);
+
+ mButtonFooterMixin = getLayout().getMixin(ButtonFooterMixin.class);
+ mButtonFooterMixin.setSecondaryButton(
+ new FooterButton(
+ this,
+ R.string.security_settings_face_enroll_introduction_cancel,
+ this::onCancelButtonClick,
+ FooterButton.ButtonType.SKIP,
+ R.style.SuwGlifButton_Secondary)
+ );
+
+ mButtonFooterMixin.setPrimaryButton(
+ new FooterButton(
+ this,
+ R.string.wizard_next,
+ this::onNextButtonClick,
+ FooterButton.ButtonType.NEXT,
+ R.style.SuwGlifButton_Primary)
+ );
}
@Override
}
@Override
- protected Button getCancelButton() {
- return findViewById(R.id.face_cancel_button);
+ protected FooterButton getCancelButton() {
+ if (mButtonFooterMixin != null) {
+ return mButtonFooterMixin.getSecondaryButton();
+ }
+ return null;
}
@Override
- protected Button getNextButton() {
- return findViewById(R.id.face_next_button);
+ protected FooterButton getNextButton() {
+ if (mButtonFooterMixin != null) {
+ return mButtonFooterMixin.getPrimaryButton();
+ }
+ return null;
}
@Override
import android.view.View;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
-import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.android.settings.biometrics.BiometricsEnrollEnrolling;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+import com.google.android.setupcompat.item.FooterButton;
+import com.google.android.setupcompat.template.ButtonFooterMixin;
+
/**
* Activity which handles the actual enrolling for fingerprint.
*/
mProgressBar = (ProgressBar) findViewById(R.id.fingerprint_progress_bar);
mVibrator = getSystemService(Vibrator.class);
- Button skipButton = findViewById(R.id.skip_button);
- skipButton.setOnClickListener(this);
+ mButtonFooterMixin = getLayout().getMixin(ButtonFooterMixin.class);
+ mButtonFooterMixin.setSecondaryButton(
+ new FooterButton(
+ this,
+ R.string.security_settings_fingerprint_enroll_enrolling_skip,
+ this::onSkipButtonClick,
+ FooterButton.ButtonType.SKIP,
+ R.style.SuwGlifButton_Secondary)
+ );
final LayerDrawable fingerprintDrawable = (LayerDrawable) mProgressBar.getBackground();
mIconAnimationDrawable = (AnimatedVectorDrawable)
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
import android.view.View;
-import android.widget.Button;
import androidx.annotation.Nullable;
import com.android.settings.biometrics.BiometricEnrollBase;
import com.android.settings.biometrics.BiometricEnrollSidecar.Listener;
import com.android.settings.password.ChooseLockSettingsHelper;
+import com.google.android.setupcompat.item.FooterButton;
+import com.google.android.setupcompat.template.ButtonFooterMixin;
/**
* Activity explaining the fingerprint sensor location for fingerprint enrollment.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getContentView());
- Button skipButton = findViewById(R.id.skip_button);
- skipButton.setOnClickListener(this);
+ mButtonFooterMixin = getLayout().getMixin(ButtonFooterMixin.class);
+ mButtonFooterMixin.setSecondaryButton(
+ new FooterButton(
+ this,
+ R.string.skip_label,
+ this::onSkipButtonClick,
+ FooterButton.ButtonType.SKIP,
+ R.style.SuwGlifButton_Secondary)
+ );
setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title);
}
}
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.skip_button:
- onSkipButtonClick();
- break;
- default:
- super.onClick(v);
- }
- }
-
- protected void onSkipButtonClick() {
+ protected void onSkipButtonClick(View view) {
setResult(RESULT_SKIP);
finish();
}
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
import android.view.View;
-import android.widget.Button;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.biometrics.BiometricEnrollBase;
+import com.google.android.setupcompat.item.FooterButton;
+import com.google.android.setupcompat.template.ButtonFooterMixin;
+
/**
* Activity which concludes fingerprint enrollment.
*/
super.onCreate(savedInstanceState);
setContentView(R.layout.fingerprint_enroll_finish);
setHeaderText(R.string.security_settings_fingerprint_enroll_finish_title);
+
+ mButtonFooterMixin = getLayout().getMixin(ButtonFooterMixin.class);
+ mButtonFooterMixin.setSecondaryButton(
+ new FooterButton(
+ this,
+ R.string.fingerprint_enroll_button_add,
+ null,
+ FooterButton.ButtonType.SKIP,
+ R.style.SuwGlifButton_Secondary)
+ );
+
+ mButtonFooterMixin.setPrimaryButton(
+ new FooterButton(
+ this,
+ R.string.security_settings_fingerprint_enroll_done,
+ this::onNextButtonClick,
+ FooterButton.ButtonType.NEXT,
+ R.style.SuwGlifButton_Primary)
+ );
}
@Override
protected void onResume() {
super.onResume();
- Button addButton = (Button) findViewById(R.id.add_another_button);
+ FooterButton addButton = mButtonFooterMixin.getSecondaryButton();
final FingerprintManager fpm = Utils.getFingerprintManagerOrNull(this);
boolean hideAddAnother = false;
// Don't show "Add" button if too many fingerprints already added
addButton.setVisibility(View.INVISIBLE);
} else {
- addButton.setOnClickListener(this);
+ addButton.setOnClickListener(this::onAddAnotherButtonClick);
}
}
@Override
- protected void onNextButtonClick() {
+ protected void onNextButtonClick(View view) {
setResult(RESULT_FINISHED);
finish();
}
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.add_another_button) {
- startActivityForResult(getFingerprintEnrollingIntent(), REQUEST_ADD_ANOTHER);
- }
- super.onClick(v);
+ private void onAddAnotherButtonClick(View view) {
+ startActivityForResult(getFingerprintEnrollingIntent(), REQUEST_ADD_ANOTHER);
}
@Override
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
import android.util.Log;
-import android.widget.Button;
import android.widget.TextView;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settingslib.HelpUtils;
import com.android.settingslib.RestrictedLockUtilsInternal;
+import com.google.android.setupcompat.item.FooterButton;
+import com.google.android.setupcompat.template.ButtonFooterMixin;
import com.google.android.setupdesign.span.LinkSpan;
public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mFingerprintManager = Utils.getFingerprintManagerOrNull(this);
+
+ mButtonFooterMixin = getLayout().getMixin(ButtonFooterMixin.class);
+ mButtonFooterMixin.setSecondaryButton(
+ new FooterButton(
+ this,
+ R.string.security_settings_face_enroll_introduction_cancel,
+ this::onCancelButtonClick,
+ FooterButton.ButtonType.SKIP,
+ R.style.SuwGlifButton_Secondary)
+ );
+
+ mButtonFooterMixin.setPrimaryButton(
+ new FooterButton(
+ this,
+ R.string.wizard_next,
+ this::onNextButtonClick,
+ FooterButton.ButtonType.NEXT,
+ R.style.SuwGlifButton_Primary)
+ );
}
@Override
}
@Override
- protected Button getCancelButton() {
- return findViewById(R.id.fingerprint_cancel_button);
+ protected FooterButton getCancelButton() {
+ if (mButtonFooterMixin != null) {
+ return mButtonFooterMixin.getSecondaryButton();
+ }
+ return null;
}
@Override
- protected Button getNextButton() {
- return findViewById(R.id.fingerprint_next_button);
+ protected FooterButton getNextButton() {
+ if (mButtonFooterMixin != null) {
+ return mButtonFooterMixin.getPrimaryButton();
+ }
+ return null;
}
@Override
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.hardware.fingerprint.FingerprintManager;
-import android.widget.Button;
import com.android.settings.R;
import com.android.settings.Utils;
+import com.google.android.setupcompat.item.FooterButton;
+
public class FingerprintSuggestionActivity extends SetupFingerprintEnrollIntroduction {
@Override
protected void initViews() {
super.initViews();
- final Button cancelButton = findViewById(R.id.fingerprint_cancel_button);
- cancelButton.setText(R.string.security_settings_fingerprint_enroll_introduction_cancel);
+ final FooterButton cancelButton = getCancelButton();
+ cancelButton.setText(
+ this, R.string.security_settings_fingerprint_enroll_introduction_cancel);
}
@Override
import android.content.Intent;
import android.os.Bundle;
import android.os.UserHandle;
+import android.view.View;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
}
@Override
- protected void onSkipButtonClick() {
+ protected void onSkipButtonClick(View view) {
new SkipFingerprintDialog().show(getSupportFragmentManager());
}
import com.android.settings.SetupWizardUtils;
import com.android.settings.password.ChooseLockSettingsHelper;
+import com.google.android.setupcompat.item.FooterButton;
+
public class SetupFingerprintEnrollFinish extends FingerprintEnrollFinish {
@Override
@Override
protected void initViews() {
super.initViews();
- Button nextButton = findViewById(R.id.next_button);
- nextButton.setText(R.string.next_label);
+ FooterButton nextButton = getNextButton();
+ nextButton.setText(this, R.string.next_label);
}
@Override
import android.os.Bundle;
import android.os.UserHandle;
import android.os.storage.StorageManager;
-import android.widget.Button;
+import android.view.View;
import android.widget.TextView;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.password.SetupChooseLockGeneric;
import com.android.settings.password.SetupSkipDialog;
+import com.google.android.setupcompat.item.FooterButton;
+
public class SetupFingerprintEnrollIntroduction extends FingerprintEnrollIntroduction {
private static final String KEY_LOCK_SCREEN_PRESENT = "wasLockScreenPresent";
private boolean mAlreadyHadLockScreenSetup = false;
description.setText(
R.string.security_settings_fingerprint_enroll_introduction_message_setup);
- Button nextButton = getNextButton();
+ FooterButton nextButton = getNextButton();
nextButton.setText(
- R.string.security_settings_fingerprint_enroll_introduction_continue_setup);
+ this, R.string.security_settings_fingerprint_enroll_introduction_continue_setup);
- final Button cancelButton = (Button) findViewById(R.id.fingerprint_cancel_button);
+ final FooterButton cancelButton = getCancelButton();
cancelButton.setText(
- R.string.security_settings_fingerprint_enroll_introduction_cancel_setup);
+ this, R.string.security_settings_fingerprint_enroll_introduction_cancel_setup);
}
@Override
}
@Override
- protected void onCancelButtonClick() {
+ protected void onCancelButtonClick(View view) {
if (isKeyguardSecure()) {
// If the keyguard is already set up securely (maybe the user added a backup screen
// lock and skipped fingerprint), return RESULT_SKIP directly.
android:id="@+id/setup_wizard_layout"
style="?attr/fingerprint_layout_theme"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:sucFooter="@layout/fingerprint_enroll_find_sensor_base_footer">
+ android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.shadow.ShadowUtils;
+import com.google.android.setupcompat.PartnerCustomizationLayout;
+import com.google.android.setupcompat.template.ButtonFooterMixin;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@Test
public void clickSkip_shouldReturnResultSkip() {
- Button skipButton = mActivity.findViewById(R.id.skip_button);
- skipButton.performClick();
+ PartnerCustomizationLayout layout = mActivity.findViewById(R.id.setup_wizard_layout);
+ layout.getMixin(ButtonFooterMixin.class).getSecondaryButtonView().performClick();
ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
assertThat(shadowActivity.getResultCode()).named("result code")
import com.android.settings.testutils.shadow.ShadowLockPatternUtils;
import com.android.settings.testutils.shadow.ShadowUserManager;
+import com.google.android.setupcompat.PartnerCustomizationLayout;
+import com.google.android.setupcompat.template.ButtonFooterMixin;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
mController.create().resume();
- final Button cancelButton = mController.get().findViewById(R.id.fingerprint_cancel_button);
+ PartnerCustomizationLayout layout =
+ mController.get().findViewById(R.id.setup_wizard_layout);
+ final Button cancelButton =
+ layout.getMixin(ButtonFooterMixin.class).getSecondaryButtonView();
assertThat(cancelButton.getText().toString()).isEqualTo("Cancel");
assertThat(cancelButton.getVisibility()).named("Cancel visible").isEqualTo(View.VISIBLE);
cancelButton.performClick();
import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
import com.android.settings.testutils.shadow.ShadowUtils;
+import com.google.android.setupcompat.PartnerCustomizationLayout;
+import com.google.android.setupcompat.template.ButtonFooterMixin;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Robolectric.buildActivity(SetupFingerprintEnrollFindSensor.class,
intent).setup().get();
- final Button skipButton = activity.findViewById(R.id.skip_button);
- skipButton.performClick();
+ PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
+ layout.getMixin(ButtonFooterMixin.class).getSecondaryButtonView().performClick();
final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog).isNotNull();
import com.android.settings.testutils.shadow.ShadowStorageManager;
import com.android.settings.testutils.shadow.ShadowUserManager;
+import com.google.android.setupcompat.PartnerCustomizationLayout;
+import com.google.android.setupcompat.template.ButtonFooterMixin;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
mController.create().resume();
- final Button skipButton = mController.get().findViewById(R.id.fingerprint_cancel_button);
+ PartnerCustomizationLayout layout =
+ mController.get().findViewById(R.id.setup_wizard_layout);
+ final Button skipButton =
+ layout.getMixin(ButtonFooterMixin.class).getSecondaryButtonView();
assertThat(skipButton.getVisibility()).named("Skip visible").isEqualTo(View.VISIBLE);
skipButton.performClick();
mController.create().resume();
- final Button skipButton = mController.get().findViewById(R.id.fingerprint_cancel_button);
+ PartnerCustomizationLayout layout =
+ mController.get().findViewById(R.id.setup_wizard_layout);
+ final Button skipButton =
+ layout.getMixin(ButtonFooterMixin.class).getSecondaryButtonView();
assertThat(skipButton.getVisibility()).named("Skip visible").isEqualTo(View.VISIBLE);
skipButton.performClick();
getShadowKeyguardManager().setIsKeyguardSecure(false);
SetupFingerprintEnrollIntroduction activity = mController.create().resume().get();
- final Button skipButton = activity.findViewById(R.id.fingerprint_cancel_button);
+ PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
+ final Button skipButton =
+ layout.getMixin(ButtonFooterMixin.class).getSecondaryButtonView();
getShadowKeyguardManager().setIsKeyguardSecure(true);
skipButton.performClick();
getShadowKeyguardManager().setIsKeyguardSecure(true);
SetupFingerprintEnrollIntroduction activity = mController.create().resume().get();
- final Button skipButton = activity.findViewById(R.id.fingerprint_cancel_button);
+ PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
+ final Button skipButton =
+ layout.getMixin(ButtonFooterMixin.class).getSecondaryButtonView();
skipButton.performClick();
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
SetupFingerprintEnrollIntroduction activity = mController.get();
- final Button nextButton = activity.findViewById(R.id.fingerprint_next_button);
- nextButton.performClick();
+ PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
+ layout.getMixin(ButtonFooterMixin.class).getPrimaryButtonView().performClick();
+
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
IntentForResult startedActivity = shadowActivity.getNextStartedActivityForResult();
import com.android.settings.R;
+import com.google.android.setupcompat.PartnerCustomizationLayout;
+import com.google.android.setupcompat.template.ButtonFooterMixin;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
intending(hasComponent(enrollingComponent))
.respondWith(new ActivityResult(Activity.RESULT_CANCELED, null));
- onView(withId(R.id.add_another_button)).perform(click());
+ PartnerCustomizationLayout layout =
+ mActivityRule.getActivity().findViewById(R.id.setup_wizard_layout);
+ layout.getMixin(ButtonFooterMixin.class).getPrimaryButtonView().performClick();
intended(hasComponent(enrollingComponent));
assertFalse(mActivityRule.getActivity().isFinishing());
intending(hasComponent(enrollingComponent))
.respondWith(new ActivityResult(Activity.RESULT_OK, null));
- onView(withId(R.id.add_another_button)).perform(click());
+ PartnerCustomizationLayout layout =
+ mActivityRule.getActivity().findViewById(R.id.setup_wizard_layout);
+ layout.getMixin(ButtonFooterMixin.class).getPrimaryButtonView().performClick();
intended(hasComponent(enrollingComponent));
assertTrue(mActivityRule.getActivity().isFinishing());
import com.android.settings.R;
+import com.google.android.setupcompat.PartnerCustomizationLayout;
+import com.google.android.setupcompat.template.ButtonFooterMixin;
+
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
final TextView errorTextView = (TextView) mActivity.findViewById(R.id.error_text);
assertNotNull(errorTextView.getText().toString());
- final Button nextButton = (Button) mActivity.findViewById(R.id.fingerprint_next_button);
+ PartnerCustomizationLayout layout = mActivity.findViewById(R.id.setup_wizard_layout);
+ final Button nextButton = layout.getMixin(ButtonFooterMixin.class).getPrimaryButtonView();
assertEquals(View.GONE, nextButton.getVisibility());
}