首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FirebaseUI登录方向

FirebaseUI登录方向
EN

Stack Overflow用户
提问于 2017-01-12 07:25:43
回答 1查看 779关注 0票数 3

我使用FirebaseUI登录。无论我尝试什么,我都不能使登录屏幕保持在纵向模式。我在这里做错什么了?我怀疑这是“宣言”里的什么东西。

有趣的是,飞溅的屏幕仍然在肖像,并进入景观模式后,直接。我找不到错误了,请帮帮忙。

代码语言:javascript
复制
<?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>

FirebaseLoginTheme

代码语言:javascript
复制
   <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>

我的SignInActivty

公共类SignInActivity扩展AppCompatActivity {

代码语言:javascript
复制
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);
}
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-02-01 12:09:44

根据 Github和 one的说法,在FirebaseUI上设置方向是不可能的。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41607336

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档