2016-08-27 12:28:00 +02:00
|
|
|
/*
|
2017-06-13 00:11:15 +02:00
|
|
|
* Copyright (C) 2013-2017 microG Project Team
|
2016-08-27 12:28:00 +02:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package com.google.android.gms.auth.api.credentials;
|
|
|
|
|
2021-04-15 23:35:47 +02:00
|
|
|
import org.microg.gms.common.PublicApi;
|
2016-08-27 12:28:00 +02:00
|
|
|
import org.microg.safeparcel.AutoSafeParcelable;
|
|
|
|
import org.microg.safeparcel.SafeParceled;
|
|
|
|
|
2021-04-15 23:35:47 +02:00
|
|
|
@PublicApi
|
2016-08-27 12:28:00 +02:00
|
|
|
public class CredentialPickerConfig extends AutoSafeParcelable {
|
|
|
|
|
2021-04-15 23:35:47 +02:00
|
|
|
@Field(1000)
|
2016-08-27 12:28:00 +02:00
|
|
|
private int versionCode = 1;
|
|
|
|
|
2021-04-15 23:35:47 +02:00
|
|
|
@Field(1)
|
2016-08-27 12:28:00 +02:00
|
|
|
private boolean showAddAccountButton;
|
|
|
|
|
2021-04-15 23:35:47 +02:00
|
|
|
@Field(2)
|
2016-08-27 12:28:00 +02:00
|
|
|
private boolean showCancelButton;
|
|
|
|
|
2021-04-15 23:35:47 +02:00
|
|
|
@Field(3)
|
2016-08-27 12:28:00 +02:00
|
|
|
private boolean forNewAccount;
|
|
|
|
|
|
|
|
private CredentialPickerConfig() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public CredentialPickerConfig(boolean showAddAccountButton, boolean showCancelButton, boolean forNewAccount) {
|
|
|
|
this.showAddAccountButton = showAddAccountButton;
|
|
|
|
this.showCancelButton = showCancelButton;
|
|
|
|
this.forNewAccount = forNewAccount;
|
|
|
|
}
|
|
|
|
|
2021-04-15 23:35:47 +02:00
|
|
|
/**
|
|
|
|
* @deprecated It was determined that this method was not useful for developers.
|
|
|
|
*/
|
|
|
|
@Deprecated
|
2016-08-27 12:28:00 +02:00
|
|
|
public boolean isForNewAccount() {
|
|
|
|
return forNewAccount;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean shouldShowAddAccountButton() {
|
|
|
|
return showAddAccountButton;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean shouldShowCancelButton() {
|
|
|
|
return showCancelButton;
|
|
|
|
}
|
|
|
|
|
2021-04-15 23:35:47 +02:00
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return "CredentialPickerConfig{" +
|
|
|
|
"showAddAccountButton=" + showAddAccountButton +
|
|
|
|
", showCancelButton=" + showCancelButton +
|
|
|
|
'}';
|
|
|
|
}
|
|
|
|
|
2020-09-01 01:34:24 +02:00
|
|
|
public static class Builder {
|
2016-08-27 12:28:00 +02:00
|
|
|
private boolean showAddAccountButton;
|
|
|
|
private boolean showCancelButton;
|
|
|
|
private boolean forNewAccount;
|
|
|
|
|
|
|
|
public CredentialPickerConfig build() {
|
|
|
|
return new CredentialPickerConfig(showAddAccountButton, showCancelButton, forNewAccount);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether the hint request is for a new account sign-up flow.
|
|
|
|
*/
|
|
|
|
public Builder setForNewAccount(boolean forNewAccount) {
|
|
|
|
this.forNewAccount = forNewAccount;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether the add account button should be shown in credential picker dialog.
|
|
|
|
*/
|
|
|
|
public Builder setShowAddAccountButton(boolean showAddAccountButton) {
|
|
|
|
this.showAddAccountButton = showAddAccountButton;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether the cancel button should be shown in credential picker dialog.
|
|
|
|
*/
|
|
|
|
public Builder setShowCancelButton(boolean showCancelButton) {
|
|
|
|
this.showCancelButton = showCancelButton;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-01 01:27:05 +02:00
|
|
|
public static final Creator<CredentialPickerConfig> CREATOR = new AutoCreator<>(CredentialPickerConfig.class);
|
2016-08-27 12:28:00 +02:00
|
|
|
}
|