Android Open Source - ScoponeDaPolso Login Fragment






From Project

Back to project page ScoponeDaPolso.

License

The source code is released under:

GNU General Public License

If you think the Android project ScoponeDaPolso listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.gdg.bari.scopone.fragment;
//from   ww w .  j av a  2  s .  c  om
import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.example.games.basegameutils.BaseGameUtils;

import org.gdg.bari.scopone.activity.MobileMainActivity;
import org.gdg.bari.scopone.R;
import org.gdg.bari.scopone.util.GoogleApiClientManager;
import org.gdg.bari.scopone.util.LogUtil;


public class LoginFragment extends Fragment implements View.OnClickListener {

    private static final String TAG = LoginFragment.class.getSimpleName();

    private SignInButton signInButton;
    private MobileMainActivity mActivity;

        // Client used to interact with Google APIs
    private GoogleApiClient mGoogleApiClient;

    @Override
    public void onAttach(Activity activity) {

        super.onAttach(activity);

        mActivity = (MobileMainActivity) activity;

        // Get the Google API Client instance
        mGoogleApiClient = GoogleApiClientManager.getInstance(mActivity);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        Log.d(TAG,  TAG + " onCreateView() method");

        View v = inflater.inflate(R.layout.fragment_login, container, false);

        signInButton = (SignInButton) v.findViewById(R.id.sign_in_button);
        signInButton.setOnClickListener(this);

        return v;
    }

    @Override
    public void onClick(View v) {

        LogUtil.d(TAG, TAG + " onClick() method");

        // Check to see the developer who's running this sample code read the instructions :-)
        // NOTE: this check is here only because this is a sample! Don't include this
        // check in your actual production app.
        if (!BaseGameUtils.verifySampleSetup(mActivity, R.string.app_id)) {
            LogUtil.w(TAG, "*** Warning: setup problems detected. Sign in may not work!");
        }

/*        mActivity.mSignInClicked = true;
        mActivity.mTurnBasedMatch = null;
        mActivity.mGoogleApiClient.connect();*/

        mActivity.setSignInClicked(true);

        mGoogleApiClient.connect();
    }
}




Java Source Code List

com.google.example.games.basegameutils.BaseGameActivity.java
com.google.example.games.basegameutils.BaseGameUtils.java
com.google.example.games.basegameutils.GameHelperUtils.java
com.google.example.games.basegameutils.GameHelper.java
com.mariux.teleport.lib.ApplicationTest.java
com.mariux.teleport.lib.TeleportClient.java
com.mariux.teleport.lib.TeleportService.java
org.gdg.bari.entities.ApplicationTest.java
org.gdg.bari.entities.Card.java
org.gdg.bari.entities.Constants.java
org.gdg.bari.entities.Deck.java
org.gdg.bari.entities.Score.java
org.gdg.bari.entities.TableTurn.java
org.gdg.bari.entities.Table.java
org.gdg.bari.entities.TeleportClientManager.java
org.gdg.bari.scopone.ApplicationTest.java
org.gdg.bari.scopone.activity.MobileGameActivity.java
org.gdg.bari.scopone.activity.MobileMainActivity.java
org.gdg.bari.scopone.activity.WearConfirmationActivity.java
org.gdg.bari.scopone.activity.WearMainActivity.java
org.gdg.bari.scopone.fragment.CardListFragment.java
org.gdg.bari.scopone.fragment.GameFragment.java
org.gdg.bari.scopone.fragment.LoginFragment.java
org.gdg.bari.scopone.fragment.MenuFragment.java
org.gdg.bari.scopone.service.MobileTeleportService.java
org.gdg.bari.scopone.services.WearTeleportService.java
org.gdg.bari.scopone.util.GoogleApiClientManager.java
org.gdg.bari.scopone.util.LogUtil.java