130 lines
4.0 KiB
Java
130 lines
4.0 KiB
Java
package com.google.android.gms.common;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.TypedArray;
|
|
import android.util.AttributeSet;
|
|
import android.util.Log;
|
|
import android.view.View;
|
|
import android.widget.FrameLayout;
|
|
import com.google.android.gms.common.api.Scope;
|
|
import com.google.android.gms.common.internal.zaaa;
|
|
import com.google.android.gms.common.internal.zaz;
|
|
import com.google.android.gms.dynamic.RemoteCreator;
|
|
import java.lang.annotation.Retention;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public final class SignInButton extends FrameLayout implements View.OnClickListener {
|
|
public static final int COLOR_AUTO = 2;
|
|
public static final int COLOR_DARK = 0;
|
|
public static final int COLOR_LIGHT = 1;
|
|
public static final int SIZE_ICON_ONLY = 2;
|
|
public static final int SIZE_STANDARD = 0;
|
|
public static final int SIZE_WIDE = 1;
|
|
private int zaa;
|
|
private int zab;
|
|
private View zac;
|
|
private View.OnClickListener zad;
|
|
|
|
@Retention(RetentionPolicy.SOURCE)
|
|
/* loaded from: classes3.dex */
|
|
public @interface ButtonSize {
|
|
}
|
|
|
|
@Retention(RetentionPolicy.SOURCE)
|
|
/* loaded from: classes3.dex */
|
|
public @interface ColorScheme {
|
|
}
|
|
|
|
public SignInButton(Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
private final void zaa(Context context) {
|
|
View view = this.zac;
|
|
if (view != null) {
|
|
removeView(view);
|
|
}
|
|
try {
|
|
this.zac = zaz.zaa(context, this.zaa, this.zab);
|
|
} catch (RemoteCreator.RemoteCreatorException unused) {
|
|
Log.w("SignInButton", "Sign in button not found, using placeholder instead");
|
|
int i = this.zaa;
|
|
int i4 = this.zab;
|
|
zaaa zaaaVar = new zaaa(context, null);
|
|
zaaaVar.zaa(context.getResources(), i, i4);
|
|
this.zac = zaaaVar;
|
|
}
|
|
addView(this.zac);
|
|
this.zac.setEnabled(isEnabled());
|
|
this.zac.setOnClickListener(this);
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
View.OnClickListener onClickListener = this.zad;
|
|
if (onClickListener == null || view != this.zac) {
|
|
return;
|
|
}
|
|
onClickListener.onClick(this);
|
|
}
|
|
|
|
public void setColorScheme(int i) {
|
|
setStyle(this.zaa, i);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void setEnabled(boolean z3) {
|
|
super.setEnabled(z3);
|
|
this.zac.setEnabled(z3);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void setOnClickListener(View.OnClickListener onClickListener) {
|
|
this.zad = onClickListener;
|
|
View view = this.zac;
|
|
if (view != null) {
|
|
view.setOnClickListener(this);
|
|
}
|
|
}
|
|
|
|
@Deprecated
|
|
public void setScopes(Scope[] scopeArr) {
|
|
setStyle(this.zaa, this.zab);
|
|
}
|
|
|
|
public void setSize(int i) {
|
|
setStyle(i, this.zab);
|
|
}
|
|
|
|
public void setStyle(int i, int i4) {
|
|
this.zaa = i;
|
|
this.zab = i4;
|
|
zaa(getContext());
|
|
}
|
|
|
|
public SignInButton(Context context, AttributeSet attributeSet) {
|
|
this(context, attributeSet, 0);
|
|
}
|
|
|
|
@Deprecated
|
|
public void setStyle(int i, int i4, Scope[] scopeArr) {
|
|
setStyle(i, i4);
|
|
}
|
|
|
|
public SignInButton(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
this.zad = null;
|
|
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, com.google.android.gms.base.R.styleable.SignInButton, 0, 0);
|
|
try {
|
|
this.zaa = obtainStyledAttributes.getInt(com.google.android.gms.base.R.styleable.SignInButton_buttonSize, 0);
|
|
this.zab = obtainStyledAttributes.getInt(com.google.android.gms.base.R.styleable.SignInButton_colorScheme, 2);
|
|
obtainStyledAttributes.recycle();
|
|
setStyle(this.zaa, this.zab);
|
|
} catch (Throwable th) {
|
|
obtainStyledAttributes.recycle();
|
|
throw th;
|
|
}
|
|
}
|
|
}
|