private Intent getInteractivePostIntent(PlusClient plusClient) { // Create an interactive post with the "VIEW_ITEM" label. This will // create an enhanced share dialog when the post is shared on Google+. // When the user clicks on the deep link, ParseDeepLinkActivity will // immediately parse the deep link, and route to the appropriate resource. String action = "/?view=true"; Android.Net.Uri callToActionUrl = Android.Net.Uri.Parse(GetString(R.Strings.plus_example_deep_link_url) + action); String callToActionDeepLinkId = GetString(R.Strings.plus_example_deep_link_id) + action; // Create an interactive post builder. PlusShare.Builder builder = new PlusShare.Builder(this, plusClient); // Set call-to-action metadata. builder.AddCallToAction(LABEL_VIEW_ITEM, callToActionUrl, callToActionDeepLinkId); // Set the target url (for desktop use). builder.SetContentUrl(Android.Net.Uri.Parse(GetString(R.Strings.plus_example_deep_link_url))); // Set the target deep-link ID (for mobile use). builder.SetContentDeepLinkId(GetString(R.Strings.plus_example_deep_link_id), null, null, null); // Set the pre-filled message. builder.SetText(mEditSendText.GetText().ToString()); return(builder.GetIntent()); }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Retain instance to avoid reconnecting on rotate. This means that onDestroy and onCreate // will not be called on configuration changes. SetRetainInstance(true); mHandler = new PlusClientFragmentHandler(this); // Create the PlusClient. PlusClient.Builder plusClientBuilder = new PlusClient.Builder(GetActivity().GetApplicationContext(), this, this); String[] visibleActivities = GetArguments().GetStringArray(ARG_VISIBLE_ACTIVITIES); if (visibleActivities != null && visibleActivities.Length > 0) { plusClientBuilder.SetVisibleActivities(visibleActivities); } mPlusClient = plusClientBuilder.Build(); if (savedInstanceState == null) { mRequestCode = INVALID_REQUEST_CODE; } else { mRequestCode = savedInstanceState.GetInt(STATE_REQUEST_CODE, INVALID_REQUEST_CODE); } }
public void OnSignedIn(PlusClient plusClient) { if (!mSharing) { // The share button hasn't been clicked yet. return; } // Reset sharing so future calls to onSignedIn don't start a share. mSharing = false; int errorCode = GooglePlusUtil.CheckGooglePlusApp(this); if (errorCode == GooglePlusUtil.SUCCESS) { StartActivityForResult(getInteractivePostIntent(plusClient), REQUEST_CODE_INTERACTIVE_POST); } else { // Prompt the user to install the Google+ app. GooglePlusErrorDialogFragment .Create(errorCode, REQUEST_CODE_RESOLVE_GOOGLE_PLUS_ERROR) .Show(GetSupportFragmentManager(), TAG_ERROR_DIALOG_FRAGMENT); } }
// Called when the {@link com.google.android.gms.plus.PlusClient} has been connected // successfully. public void OnSignedIn(PlusClient plusClient) { int deleteCount = mPendingDeletion.Size(); for (int i = 0; i < deleteCount; i++) { plusClient.RemoveMoment(mPendingDeletion.Get(i).GetId()); } mPendingDeletion.Clear(); plusClient.LoadMoments(this); }
public void OnSignedIn(PlusClient plusClient) { mMomentListView.SetAdapter(mListAdapter); if (!mPendingMoments.IsEmpty()) { // Write all moments that were written while the client was disconnected. foreach (IMoment pendingMoment in mPendingMoments) { plusClient.WriteMoment(pendingMoment); Toast.MakeText(this, GetString(R.Strings.plus_write_moment_status), Toast.LENGTH_SHORT).Show(); } } mPendingMoments.Clear(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); imageLoader = new ImageLoader(this); progressDialog = new ProgressDialog(this); progressDialog.Indeterminate = true; progressDialog.SetMessage("Connecting"); plusClient = new PlusClient.Builder(this, this, this).Build(); googleLoginButton = FindViewById <SignInButton> (Resource.Id.sign_in_button); plusOneButton = FindViewById <PlusOneButton> (Resource.Id.plus_one_button); var logoutButton = FindViewById <Button> (Resource.Id.logout_button); logoutButton.Click += (sender, e) => { if (!plusClient.IsConnected || plusClient.IsConnecting) { return; } plusClient.RevokeAccessAndDisconnect(this); }; googleLoginButton.Click += (sender, e) => { if (plusClient.IsConnected || plusClient.IsConnecting) { return; } progressDialog.Show(); if (connectionResult == null) { plusClient.Connect(); } else { ResolveLogin(connectionResult); } }; plusClient.RegisterConnectionCallbacks(this); plusClient.IsConnectionFailedListenerRegistered(this); }
public void OnSignedIn(PlusClient plusClient) { mSignInStatus.SetText(GetString(R.Strings.signed_in_status)); // We can now obtain the signed-in user's profile information. IPerson currentPerson = plusClient.GetCurrentPerson(); if (currentPerson != null) { String greeting = GetString(R.Strings.greeting_status, currentPerson.GetDisplayName()); mSignInStatus.SetText(greeting); } else { resetAccountState(); } }
public void OnSignedIn(PlusClient plusClient) { mSignInStatus.SetText(GetString(R.Strings.signed_in_status)); // We can now obtain the signed-in user's profile information. IPerson currentPerson = plusClient.GetCurrentPerson(); if (currentPerson != null) { String greeting = GetString(R.Strings.greeting_status, currentPerson.GetDisplayName()); mSignInStatus.SetText(greeting); } else { resetAccountState(); } }
public void Setup(GameHelperListener listener, int clientsToUse) { this.listener = listener; requestClients = clientsToUse; List <string> scopesList = new List <string>(); if (0 != (clientsToUse & CLIENT_GAMES)) { scopesList.Add(Scopes.Games); } if (0 != (clientsToUse & CLIENT_PLUS)) { scopesList.Add(Scopes.PlusLogin); } if (0 != (clientsToUse & CLIENT_APPSTATE)) { scopesList.Add(Scopes.AppState); } if (0 != (clientsToUse & CLIENT_GAMES)) { gamesClient = new GamesClient.Builder(activity, this, this) .SetGravityForPopups((int)(GravityFlags.Top | GravityFlags.CenterHorizontal)) .SetScopes(scopesList.ToArray()) .Create(); } if (0 != (clientsToUse & CLIENT_PLUS)) { plusCient = new PlusClient.Builder(activity, this, this) .SetScopes(scopesList.ToArray()) .Build(); } if (0 != (clientsToUse & CLIENT_APPSTATE)) { appStateClient = new AppStateClient.Builder(activity, this, this) .SetScopes(scopesList.ToArray()) .Create(); } }
override protected void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(R.Layout.plus_one_activity); // The +1 button does not require scopes. mPlusClient = new PlusClient.Builder(this, this, this) .ClearScopes() .Build(); // The PlusOneButton can be configured in code, but in this example we // have set the parameters in the layout. // Example: // mPlusOneSmallButton.setAnnotation(PlusOneButton.ANNOTATION_INLINE); // mPlusOneSmallButton.setSize(PlusOneButton.SIZE_MEDIUM); mPlusOneSmallButton = (PlusOneButton)FindViewById(R.Id.plus_one_small_button); mPlusOneMediumButton = (PlusOneButton)FindViewById(R.Id.plus_one_medium_button); mPlusOneTallButton = (PlusOneButton)FindViewById(R.Id.plus_one_tall_button); mPlusOneStandardButton = (PlusOneButton)FindViewById(R.Id.plus_one_standard_button); mPlusOneStandardButtonWithAnnotation = (PlusOneButton)FindViewById(R.Id.plus_one_standard_ann_button); }
override protected void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(R.Layout.plus_one_activity); // The +1 button does not require scopes. mPlusClient = new PlusClient.Builder(this, this, this) .ClearScopes() .Build(); // The PlusOneButton can be configured in code, but in this example we // have set the parameters in the layout. // Example: // mPlusOneSmallButton.setAnnotation(PlusOneButton.ANNOTATION_INLINE); // mPlusOneSmallButton.setSize(PlusOneButton.SIZE_MEDIUM); mPlusOneSmallButton = (PlusOneButton)FindViewById(R.Id.plus_one_small_button); mPlusOneMediumButton = (PlusOneButton)FindViewById(R.Id.plus_one_medium_button); mPlusOneTallButton = (PlusOneButton)FindViewById(R.Id.plus_one_tall_button); mPlusOneStandardButton = (PlusOneButton)FindViewById(R.Id.plus_one_standard_button); mPlusOneStandardButtonWithAnnotation = (PlusOneButton)FindViewById(R.Id.plus_one_standard_ann_button); }
public void OnSignedIn(PlusClient plusClient) { if (!mSharing) { // The share button hasn't been clicked yet. return; } // Reset sharing so future calls to onSignedIn don't start a share. mSharing = false; int errorCode = GooglePlusUtil.CheckGooglePlusApp(this); if (errorCode == GooglePlusUtil.SUCCESS) { StartActivityForResult(getInteractivePostIntent(plusClient), REQUEST_CODE_INTERACTIVE_POST); } else { // Prompt the user to install the Google+ app. GooglePlusErrorDialogFragment .Create(errorCode, REQUEST_CODE_RESOLVE_GOOGLE_PLUS_ERROR) .Show(GetSupportFragmentManager(), TAG_ERROR_DIALOG_FRAGMENT); } }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Retain instance to avoid reconnecting on rotate. This means that onDestroy and onCreate // will not be called on configuration changes. SetRetainInstance(true); mHandler = new PlusClientFragmentHandler(this); // Create the PlusClient. PlusClient.Builder plusClientBuilder = new PlusClient.Builder(GetActivity().GetApplicationContext(), this, this); String[] visibleActivities = GetArguments().GetStringArray(ARG_VISIBLE_ACTIVITIES); if (visibleActivities != null && visibleActivities.Length > 0) { plusClientBuilder.SetVisibleActivities(visibleActivities); } mPlusClient = plusClientBuilder.Build(); if (savedInstanceState == null) { mRequestCode = INVALID_REQUEST_CODE; } else { mRequestCode = savedInstanceState.GetInt(STATE_REQUEST_CODE, INVALID_REQUEST_CODE); } }
private Intent getInteractivePostIntent(PlusClient plusClient) { // Create an interactive post with the "VIEW_ITEM" label. This will // create an enhanced share dialog when the post is shared on Google+. // When the user clicks on the deep link, ParseDeepLinkActivity will // immediately parse the deep link, and route to the appropriate resource. String action = "/?view=true"; Android.Net.Uri callToActionUrl = Android.Net.Uri.Parse(GetString(R.Strings.plus_example_deep_link_url) + action); String callToActionDeepLinkId = GetString(R.Strings.plus_example_deep_link_id) + action; // Create an interactive post builder. PlusShare.Builder builder = new PlusShare.Builder(this, plusClient); // Set call-to-action metadata. builder.AddCallToAction(LABEL_VIEW_ITEM, callToActionUrl, callToActionDeepLinkId); // Set the target url (for desktop use). builder.SetContentUrl(Android.Net.Uri.Parse(GetString(R.Strings.plus_example_deep_link_url))); // Set the target deep-link ID (for mobile use). builder.SetContentDeepLinkId(GetString(R.Strings.plus_example_deep_link_id), null, null, null); // Set the pre-filled message. builder.SetText(mEditSendText.GetText().ToString()); return builder.GetIntent(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); imageLoader = new ImageLoader (this); progressDialog = new ProgressDialog (this); progressDialog.Indeterminate = true; progressDialog.SetMessage ("Connecting"); plusClient = new PlusClient.Builder(this, this, this).Build(); googleLoginButton = FindViewById<SignInButton> (Resource.Id.sign_in_button); plusOneButton = FindViewById<PlusOneButton> (Resource.Id.plus_one_button); var logoutButton = FindViewById<Button> (Resource.Id.logout_button); logoutButton.Click += (sender, e) => { if(!plusClient.IsConnected || plusClient.IsConnecting) return; plusClient.RevokeAccessAndDisconnect(this); }; googleLoginButton.Click += (sender, e) => { if(plusClient.IsConnected || plusClient.IsConnecting) return; progressDialog.Show(); if (connectionResult == null) { plusClient.Connect(); } else{ ResolveLogin(connectionResult); } }; plusClient.RegisterConnectionCallbacks (this); plusClient.IsConnectionFailedListenerRegistered (this); }
// Called when PlusClient has been connected public void OnSignedIn(PlusClient plusClient) { plusClient.LoadPeople(this, IPerson_ICollectionConstants.VISIBLE, IPerson_IOrderByConstants.ALPHABETICAL, 10, null); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Login); Console.WriteLine("LoginActivity"); ImageView logo = FindViewById <ImageView> (Resource.Id.ActionBarLogo); logo.Visibility = ViewStates.Invisible; ImageView menu = FindViewById <ImageView> (Resource.Id.ActionBarMenu); menu.Visibility = ViewStates.Invisible; TextView title = FindViewById <TextView> (Resource.Id.ActionBarTitle); title.Text = "Login"; Button back = FindViewById <Button> (Resource.Id.ActionBarBack); back.Click += delegate { Finish(); }; EditText email = FindViewById <EditText> (Resource.Id.Email); EditText password = FindViewById <EditText> (Resource.Id.Password); email.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => { }; password.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => { }; ImageButton facebook = FindViewById <ImageButton> (Resource.Id.loginViaFacebook); facebook.Click += delegate { var webAuth = new Intent(this, typeof(FBWebViewAuthActivity)); webAuth.PutExtra("AppId", AppId); webAuth.PutExtra("ExtendedPermissions", ExtendedPermissions); StartActivityForResult(webAuth, 0); }; ImageButton googlePlus = FindViewById <ImageButton> (Resource.Id.loginViaGoogle); plusClient = new PlusClient.Builder(this, this, this).Build(); plusClient.RegisterConnectionCallbacks(this); plusClient.IsConnectionFailedListenerRegistered(this); googlePlus.Click += (object sender, EventArgs e) => { if (plusClient.IsConnected || plusClient.IsConnecting) { return; } if (connectionResult == null) { plusClient.Connect(); } else { resolveGoogleLogin(connectionResult); } }; main = new Intent(this, typeof(MainTabActivity)); Button login = FindViewById <Button> (Resource.Id.loginButton); login.Click += delegate { Globals.DeleteProfileId(); var request = new RestRequest(); request.RequestFinished += (object sender, RequestEndedArgs e) => { RunOnUiThread(delegate { var id = (string)JsonConvert.DeserializeObject(e.Result, typeof(string)); Globals.SaveProfileId(id); StartActivity(main); }); }; request.Send(RequestConfig.Login, "POST", new LoginModel { Email = email.Text.Trim(), Password = password.Text.Trim(), RememberMe = true }); }; Button forgotPass = FindViewById <Button> (Resource.Id.forgotPassButton); var forgotPassActivity = new Intent(this, typeof(ForgotPassActivity)); forgotPass.Click += delegate { StartActivity(forgotPassActivity); }; }
public void Setup(GameHelperListener listener, int clientsToUse) { this.listener = listener; requestClients = clientsToUse; List<string> scopesList = new List<string>(); if (0 != (clientsToUse & CLIENT_GAMES)) { scopesList.Add(Scopes.Games); } if (0 != (clientsToUse & CLIENT_PLUS)) { scopesList.Add(Scopes.PlusLogin); } if (0 != (clientsToUse & CLIENT_APPSTATE)) { scopesList.Add(Scopes.AppState); } if (0 != (clientsToUse & CLIENT_GAMES)) { gamesClient = new GamesClient.Builder(activity, this, this) .SetGravityForPopups((int)(GravityFlags.Top | GravityFlags.CenterHorizontal)) .SetScopes(scopesList.ToArray()) .Create(); } if (0 != (clientsToUse & CLIENT_PLUS)) { plusCient = new PlusClient.Builder(activity, this, this) .SetScopes(scopesList.ToArray()) .Build(); } if (0 != (clientsToUse & CLIENT_APPSTATE)) { appStateClient = new AppStateClient.Builder(activity, this, this) .SetScopes(scopesList.ToArray()) .Create(); } }
// Called when PlusClient has been connected public void OnSignedIn(PlusClient plusClient) { plusClient.LoadPeople(this, IPerson_ICollectionConstants.VISIBLE, IPerson_IOrderByConstants.ALPHABETICAL, 10, null); }