protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.GetConnectedContacts); db = wowZapp.LaffOutOut.Singleton.dbm; isFind = base.Intent.GetBooleanExtra("isfind", true); selectedContacts = new List<Contact>(); searchResults = new List<Contact>(); contacts = new List<Contact>(); if (ContactsUtil.contacts == null) ContactsUtil.contacts = new List<ContactDB>(); search = FindViewById<EditText>(Resource.Id.editSearch); Button cont = FindViewById<Button>(Resource.Id.btnGetConnectedContinue); scroller = FindViewById<ScrollView>(Resource.Id.scrollViewContainer); listContainer = FindViewById<LinearLayout>(Resource.Id.linearListContainer); context = scroller.Context; TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader); ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewUserHeader); RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1); ImageHelper.setupTopPanel(btns, header, relLayout, header.Context); Header.headertext = Application.Context.Resources.GetString(Resource.String.getconnectedTitle); Header.fontsize = 36f; ImageHelper.fontSizeInfo(header.Context); header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize); header.Text = Header.headertext; int netType = base.Intent.GetIntExtra("type", 0); switch (netType) { case 1: this.networkType = AccountOAuth.OAuthTypes.Google; if (string.IsNullOrEmpty(AndroidData.GooglePlusAccessToken)) { this.Provider = new LGooglePlusManager(LOLConstants.GooglePlusConsumerKey, LOLConstants.GooglePlusConsumerSecret, new HttpHelper()); gg = false; } else { this.Provider = new LGooglePlusManager(LOLConstants.GooglePlusConsumerKey, LOLConstants.GooglePlusConsumerSecret, AndroidData.GooglePlusAccessToken, AndroidData.GooglePlusRefreshToken, AndroidData.GoogleAccessTokenExpiration, new HttpHelper()); gg = true; } break; case 2: this.networkType = AccountOAuth.OAuthTypes.LinkedIn; if (string.IsNullOrEmpty(AndroidData.LinkedInAccessToken)) { this.Provider = new LLinkedInManager(LOLConstants.LinkedInConsumerKey, LOLConstants.LinkedInConsumerSecret, string.Empty, string.Empty); gl = false; } else { this.Provider = new LLinkedInManager(LOLConstants.LinkedInConsumerKey, LOLConstants.LinkedInConsumerSecret, AndroidData.LinkedInAccessToken, AndroidData.LinkedInAccessTokenSecret); gl = true; } break; case 3: this.networkType = AccountOAuth.OAuthTypes.FaceBook; if (string.IsNullOrEmpty(AndroidData.FacebookAccessToken)) { gf = false; this.Provider = new LFacebookManager(LOLConstants.FacebookAPIKey, LOLConstants.FacebookAppSecret); } else { this.Provider = new LFacebookManager(LOLConstants.FacebookAPIKey, LOLConstants.FacebookAppSecret, AndroidData.FacebookAccessToken, AndroidData.FacebookAccessTokenExpiration); gf = true; } break; } System.Threading.Tasks.Task.Factory.StartNew(() => SetDataSources()); cont.Click += (object s, EventArgs e) => { cont_Click(); }; search.Clickable = true; search.TextChanged += delegate { #if DEBUG System.Diagnostics.Debug.WriteLine("Text changed - now is {0}", search.Text); #endif FilterContacts(); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.PhotoAlbumNames); ImageView btns = FindViewById<ImageView> (Resource.Id.imgNewUserHeader); TextView header = FindViewById<TextView> (Resource.Id.txtFirstScreenHeader); RelativeLayout relLayout = FindViewById<RelativeLayout> (Resource.Id.relativeLayout1); ImageHelper.setupTopPanel (btns, header, relLayout, header.Context); Header.headertext = Application.Context.Resources.GetString (Resource.String.photoalbumAlbumsTitle); Header.fontsize = 36f; ImageHelper.fontSizeInfo (header.Context); header.SetTextSize (Android.Util.ComplexUnitType.Dip, Header.fontsize); header.Text = Header.headertext; listWrapper = FindViewById<LinearLayout> (Resource.Id.linearListWrapper); context = listWrapper.Context; bool media = base.Intent.GetBooleanExtra ("media", false); mediaType = media == true ? MediaPickType.Video : MediaPickType.StillImage; int socialNetwork = base.Intent.GetIntExtra ("network", -1); // socialnetworks - same as in get contacts.... switch (socialNetwork) { case 1: providerType = AccountOAuth.OAuthTypes.Google; if (string.IsNullOrEmpty (AndroidData.GooglePlusAccessToken)) { this.Provider = new LGooglePlusManager (LOLConstants.GooglePlusConsumerKey, LOLConstants.GooglePlusConsumerSecret, new HttpHelper ()); gg = false; } else { this.Provider = new LGooglePlusManager (LOLConstants.GooglePlusConsumerKey, LOLConstants.GooglePlusConsumerSecret, AndroidData.GooglePlusAccessToken, AndroidData.GooglePlusRefreshToken, AndroidData.GoogleAccessTokenExpiration, new HttpHelper ()); gg = true; } break; case 2: providerType = AccountOAuth.OAuthTypes.LinkedIn; if (string.IsNullOrEmpty (AndroidData.LinkedInAccessToken)) { this.Provider = new LLinkedInManager (LOLConstants.LinkedInConsumerKey, LOLConstants.LinkedInConsumerSecret, string.Empty, string.Empty); gl = false; } else { this.Provider = new LLinkedInManager (LOLConstants.LinkedInConsumerKey, LOLConstants.LinkedInConsumerSecret, AndroidData.LinkedInAccessToken, AndroidData.LinkedInAccessTokenSecret); gl = true; } break; case 3: providerType = AccountOAuth.OAuthTypes.FaceBook; if (string.IsNullOrEmpty (AndroidData.FacebookAccessToken)) { gf = false; this.Provider = new LFacebookManager (LOLConstants.FacebookAPIKey, LOLConstants.FacebookAppSecret); } else { this.Provider = new LFacebookManager (LOLConstants.FacebookAPIKey, LOLConstants.FacebookAppSecret, AndroidData.FacebookAccessToken, AndroidData.FacebookAccessTokenExpiration); gf = true; } break; } ImageButton btnHome = FindViewById<ImageButton> (Resource.Id.btnHome); ImageButton btnBack = FindViewById<ImageButton> (Resource.Id.btnBack); btnBack.Click += delegate { Finish (); }; btnHome.Click += delegate { Intent i = new Intent (this, typeof(Main.HomeActivity)); i.SetFlags (ActivityFlags.ClearTop); StartActivity (i); }; btnBack.Tag = 0; btnHome.Tag = 1; LinearLayout bottom = FindViewById<LinearLayout> (Resource.Id.bottomHolder); ImageButton[] buttons = new ImageButton[2]; buttons [0] = btnBack; buttons [1] = btnHome; ImageHelper.setupButtonsPosition (buttons, bottom, context); System.Threading.Tasks.Task.Factory.StartNew (() => SetDataSources ()); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.GetConnectedAuth); ImageButton btnBack = FindViewById<ImageButton>(Resource.Id.btnBack); TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader); ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewUserHeader); RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1); ImageHelper.setupTopPanel(btns, header, relLayout, header.Context); Context context = header.Context; Header.fontsize = 36f; int t = base.Intent.GetIntExtra("type", 0); switch (t) { case 1: this.ProviderType = AccountOAuth.OAuthTypes.FaceBook; this.Provider = new LFacebookManager(LOLConstants.FacebookAPIKey, LOLConstants.FacebookAppSecret); Header.headertext = Application.Context.GetString(Resource.String.commonFacebookHeaderView); break; case 3: this.ProviderType = AccountOAuth.OAuthTypes.LinkedIn; this.Provider = new LLinkedInManager(LOLConstants.LinkedInConsumerKey, LOLConstants.LinkedInConsumerSecret, string.Empty, string.Empty); Header.headertext = Application.Context.GetString(Resource.String.commonLinkedInHeaderView); break; case 2: this.ProviderType = AccountOAuth.OAuthTypes.Google; HttpHelper helper = new HttpHelper(); this.Provider = new LGooglePlusManager(LOLConstants.GooglePlusConsumerKey, LOLConstants.GooglePlusConsumerSecret, helper); Header.headertext = Application.Context.GetString(Resource.String.commonGooglePlusHeaderView); break; } ImageHelper.fontSizeInfo(header.Context); header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize); header.Text = Header.headertext; CookieSyncManager.CreateInstance(this); CookieSyncManager.Instance.StartSync(); string url = Provider.BrowserAuthUrl; string cookieString = "cookieName=''"; CookieManager cookieManager = CookieManager.Instance; cookieManager.SetAcceptCookie(true); cookieManager.SetCookie(url, cookieString); WebView webView = FindViewById<WebView>(Resource.Id.webView1); webView.Settings.JavaScriptEnabled = true; webView.Settings.SavePassword = true; webView.Settings.SaveFormData = true; ThreadPool.QueueUserWorkItem(delegate { RunOnUiThread(delegate { webView.LoadUrl(url); webView.SetWebViewClient(new dealWithSACWebView(this, this.ProviderType, this.Provider, btnBack)); }); //Finish(); }); //Finish(); }