use of com.google.samples.apps.iosched.signin.SignInManager in project iosched by google.
the class MyIOActivity method onCreate.
// -- Lifecycle callbacks
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.myio_act);
setFullscreenLayout();
GoogleSignInOptions gso = SignInManager.getGoogleSignInOptions(BuildConfig.DEFAULT_WEB_CLIENT_ID);
mGoogleApiClient = new GoogleApiClient.Builder(this).enableAutoManage(this, this).addApi(Auth.GOOGLE_SIGN_IN_API, gso).build();
mSignInManager = new SignInManager(this, this, mGoogleApiClient);
mDatabaseReference = FirebaseDatabase.getInstance().getReference(SyncUtils.SERVER_TIME_OFFSET_PATH);
mValueEventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot snapshot) {
double offset = snapshot.getValue(Double.class);
SyncUtils.setServerTimeOffset(MyIOActivity.this, (int) offset);
}
@Override
public void onCancelled(DatabaseError error) {
LOGW(TAG, "Listener was cancelled");
}
};
}
use of com.google.samples.apps.iosched.signin.SignInManager in project iosched by google.
the class WelcomeActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
mContentFragment = getCurrentFragment(this);
// If there's no fragment to use, we're done.
if (mContentFragment == null) {
finish();
} else {
// Wire up the fragment.
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
Fragment existing = fragmentManager.findFragmentById(R.id.welcome_content);
if (existing != null) {
fragmentTransaction.remove(existing);
}
fragmentTransaction.add(R.id.welcome_content, mContentFragment);
fragmentTransaction.commit();
CollapsingToolbarLayout ctl = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
ctl.setBackgroundResource(mContentFragment.getHeaderColorRes());
ImageView logo = (ImageView) ctl.findViewById(R.id.logo);
logo.setImageResource(mContentFragment.getLogoDrawableRes());
}
GoogleSignInOptions gso = SignInManager.getGoogleSignInOptions(BuildConfig.DEFAULT_WEB_CLIENT_ID);
mGoogleApiClient = new GoogleApiClient.Builder(this).enableAutoManage(this, this).addApi(Auth.GOOGLE_SIGN_IN_API, gso).build();
mSignInManager = new SignInManager(this, this, mGoogleApiClient);
}
Aggregations