gpt4 book ai didi

android - FirebaseUI 登录方向

转载 作者:行者123 更新时间:2023-12-02 15:25:58 27 4
gpt4 key购买 nike

我使用 FirebaseUI 进行登录。无论我如何尝试,我都无法使登录屏幕保持纵向模式。我在这里做错了什么?我怀疑这是 list 中的内容。

有趣的是,启动屏幕保持纵向模式,然后立即进入横向模式。我找不到错误,请帮忙。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.r3dm4n.abc">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".app.AppController"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/AppTheme">
<activity android:name=".activities.MainActivity">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name=".activities.SignInActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/FirebaseLoginTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

</activity>

<meta-data
android:name="com.facebook.sdk.ApplicationId"

android:value="@string/facebook_app_id" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />


<service android:name=".app.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>

<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/launch_logo" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/colorPrimaryDark" />
</service>
</application>
</manifest>

Firebase登录主题

   <style name="FirebaseLoginTheme" parent="FirebaseUI">
<item name="android:screenOrientation">portrait</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@drawable/login</item>
<item name="colorControlNormal">@color/colorWhite</item>
<item name="colorControlActivated">@color/colorWhite</item>
<item name="colorControlHighlight">@color/colorWhite</item>
<item name="android:textColor">@color/colorWhite</item>

</style>

我的登录 Activity

公共(public)类 SignInActivity 扩展了 AppCompatActivity {

public static final int RC_SIGN_IN = 1337;
private DatabaseReference mDatabase;
private FirebaseAuth mAuth;
private FirebaseAuth.AuthStateListener mAuthStateListener;
private FirebaseUser firebaseUser;
private AccessToken accessToken;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mDatabase = FirebaseDatabase.getInstance().getReference();
mDatabase.keepSynced(true);

mAuth = FirebaseAuth.getInstance();
mAuthStateListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth mAuth) {
firebaseUser = mAuth.getCurrentUser();
if (firebaseUser != null) {
//signed in
Intent intent = new Intent(SignInActivity.this, MainActivity.class);
startActivity(intent);

} else {
//signed out
startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setTheme(R.style.FirebaseLoginTheme)
.setLogo(R.drawable.firebaselogo)
.setProviders(Arrays.asList(
new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build(),
new AuthUI.IdpConfig.Builder(AuthUI.FACEBOOK_PROVIDER).build(),
new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build()))
.setIsSmartLockEnabled(false)
.build(),
RC_SIGN_IN);
}
}
};
}


protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
if (resultCode == RESULT_OK) {
startActivity(new Intent(this, MainActivity.class));
firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
accessToken = AccessToken.getCurrentAccessToken();
addToDatabase();
finish();
return;
}

// Sign in canceled
if (resultCode == RESULT_CANCELED) {
showSnackbar("Sign in is required to use this app.");
return;
}

// No network
if (resultCode == ResultCodes.RESULT_NO_NETWORK) {
showSnackbar("Conexiune internet inactiva");
return;
}
}
}


@Override
protected void onPause() {
super.onPause();
mAuth.removeAuthStateListener(mAuthStateListener);
}

@Override
protected void onResume() {
super.onResume();
mAuth.addAuthStateListener(mAuthStateListener);
}
}

最佳答案

根据this Github 帖子和 this第一,无法在 FirebaseUI 上设置方向。

关于android - FirebaseUI 登录方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41607336/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com