Back to project page ScoponeDaPolso.
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.
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(); } }