如何根据GoogleApiClient状态显示登录界面

时间:2014-11-11 18:40:25

标签: android google-plus google-api-client

作为基础我使用本教程https://developers.google.com/+/mobile/android/sign-in - 在我的应用程序活动继承的Abstract BaseActivity中实现。

如果用户未登录,我想显示登录界面。逻辑当前位于从onConnectionFailed调用的方法中,如下所示:

@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
    if (!mIntentInProgress) {
        // Store the ConnectionResult so that we can use it later when the user clicks
        // 'sign-in'.
        mConnectionResult = connectionResult;

        if (mSignInClicked) {
            // The user has already clicked 'sign-in' so we attempt to resolve all
            // errors until the user is signed in, or they cancel.
            resolveSignInError();
        } else {
            showLogin();
        }
    }
}

显示登录界面的最佳方法是什么?

我应该使用ViewGroup / Layout还是在片段中封装登录界面和逻辑?

0 个答案:

没有答案
相关问题