В моем приложении Firebase используется вход в Google, а не вход в Gmail.Я видел маленькую красную кнопку «Войти по электронной почте» здесь , но не смог найти макет, который показывает, как его кодировать.Моя активность при входе в систему выглядит следующим образом:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
// Views
findViewById(R.id.signInButton).setOnClickListener(this);
findViewById(R.id.emailSignInButton).setOnClickListener(this);
// Configure Google Sign In
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
}
и вот Activity_login:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/app_logo"
android:layout_alignParentTop="true"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:src="@drawable/logo"/>
<TextView
android:id="@+id/welcome"
android:layout_below="@+id/app_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_centerHorizontal="true"
android:text="@string/welcome"
android:visibility="invisible"
android:textSize="20sp"
android:textStyle="bold" />
<ProgressBar
android:id="@+id/progressBar"
style="@style/Widget.AppCompat.ProgressBar"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<com.google.android.gms.common.SignInButton
android:id="@+id/signInButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:visibility="visible" />
<Button
android:id="@+id/emailSignInButton"
android:layout_below="@+id/signInButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/email_signin"
android:layout_centerInParent="true" />
</RelativeLayout>
</LinearLayout>
Я хочу заменить тег Button чем-то, что будет отображать ту же кнопку, что и при использовании AuthUI.IdpConfig.EmailBuilder (). строить ().Я не хочу использовать подход, приведенный на странице, на которую я ссылался выше, так как она не только нарушает лучшие принципы (объявляет пользовательский интерфейс в XML, а не кодирует его внутри строки), но также требует значительных изменений в коде, который уже работает.