protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); _flurryClient = new FlurryClient(); AppInfo._badgesCount = 0; AppInfo._subcategCount = 0; AppInfo._bonusesCount = 0; if (File.Exists(@"/data/data/ru.hintsolutions.itsbeta/data.txt")) { LoginWebActivity.isPlayerExist = true; LoginWebActivity.isAppBadgeEarned = true; AppInfo._user.Fullname = File.ReadAllLines(@"/data/data/ru.hintsolutions.itsbeta/data.txt")[0]; AppInfo._user.BirthDate = File.ReadAllLines(@"/data/data/ru.hintsolutions.itsbeta/data.txt")[1]; AppInfo._user.FacebookUserID = File.ReadAllLines(@"/data/data/ru.hintsolutions.itsbeta/data.txt")[2]; AppInfo._user.ItsBetaUserId = File.ReadAllLines(@"/data/data/ru.hintsolutions.itsbeta/data.txt")[3]; AppInfo._user.City = File.ReadAllLines(@"/data/data/ru.hintsolutions.itsbeta/data.txt")[4]; Finish(); StartActivity(typeof(FirstBadgeActivity)); } else { SetContentView(Resource.Layout.splashactivitylayout); _freezeTimer = new Timer(); _freezeTimer.Interval = 1500; _freezeTimer.Start(); _freezeTimer.Elapsed += new ElapsedEventHandler(timer_Elapsed); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); _flurryClient = new FlurryClient(); AppInfo._display = WindowManager.DefaultDisplay; AppInfo.IsLocaleRu = false; var locale = Java.Util.Locale.Default.DisplayLanguage; if (locale == "русский") { AppInfo.IsLocaleRu = true; } AppInfo._badgesCount = 0; AppInfo._subcategCount = 0; AppInfo._bonusesCount = 0; Vibrator vibe = (Vibrator)this.GetSystemService(Context.VibratorService); SetContentView(Resource.Layout.loginactivitylayout); buttonClickAnimation = AnimationUtils.LoadAnimation(this, Android.Resource.Animation.FadeIn); ImageButton loginButton = FindViewById <ImageButton>(Resource.Id.login); TextView signUpTextView = FindViewById <TextView>(Resource.Id.signUpTextView); TextView signInTextView = FindViewById <TextView>(Resource.Id.login_signinTextView); TextView centerTextView = FindViewById <TextView>(Resource.Id.login_centerTextView); if (!AppInfo.IsLocaleRu) { signUpTextView.Text = "About project"; signInTextView.Text = " Sign in with"; centerTextView.Text = "Collect all your achievements"; } //login_centerTextView signUpTextView.Click += delegate { Intent browserIntent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("http://itsbeta.com/")); StartActivity(browserIntent); }; loginButton.Click += delegate { loginButton.StartAnimation(buttonClickAnimation); vibe.Vibrate(50); Finish(); StartActivity(typeof(LoginWebActivity)); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); _flurryClient = new FlurryClient(); AppInfo._display = WindowManager.DefaultDisplay; AppInfo.IsLocaleRu = false; var locale = Java.Util.Locale.Default.DisplayLanguage; if (locale == "русский") { AppInfo.IsLocaleRu = true; } AppInfo._badgesCount = 0; AppInfo._subcategCount = 0; AppInfo._bonusesCount = 0; Vibrator vibe = (Vibrator)this.GetSystemService(Context.VibratorService); SetContentView(Resource.Layout.loginactivitylayout); buttonClickAnimation = AnimationUtils.LoadAnimation(this, Android.Resource.Animation.FadeIn); ImageButton loginButton = FindViewById<ImageButton>(Resource.Id.login); TextView signUpTextView = FindViewById<TextView>(Resource.Id.signUpTextView); TextView signInTextView = FindViewById<TextView>(Resource.Id.login_signinTextView); TextView centerTextView = FindViewById<TextView>(Resource.Id.login_centerTextView); if (!AppInfo.IsLocaleRu) { signUpTextView.Text = "About project"; signInTextView.Text = " Sign in with"; centerTextView.Text = "Collect all your achievements"; } //login_centerTextView signUpTextView.Click += delegate { Intent browserIntent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("http://itsbeta.com/")); StartActivity(browserIntent); }; loginButton.Click += delegate { loginButton.StartAnimation(buttonClickAnimation); vibe.Vibrate(50); Finish(); StartActivity(typeof(LoginWebActivity)); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); _flurryClient = new FlurryClient(); _context = this; _loginError = new TextView(this); SetContentView(Resource.Layout.loginweblayout); _endlogin = new TextView(this); //_messageDialogBuilder = new AlertDialog.Builder(this); _loginWebView = FindViewById <WebView>(Resource.Id.loginWebView); _loginWebView.Settings.SavePassword = false; //_loginWebView.Settings.JavaScriptEnabled = true; _loginWebView.Settings.PluginsEnabled = true; _loginWebView.Settings.JavaScriptCanOpenWindowsAutomatically = true; _loginWebView.SaveEnabled = false; _loginWebView.SetWebViewClient(new ItsbetaLoginWebViewClient(this)); _loginWebView.SetWebChromeClient(new ItsbetaLoginWebViewChromeClient()); // "https://www.facebook.com/dialog/oauth?response_type=token&display=popup&client_id={0}&redirect_uri={1}&scope={2}", _loginWebView.LoadUrl(String.Format( "https://m.facebook.com/dialog/oauth/?response_type=token&" + "client_id={0}" + "&redirect_uri={1}" + "&scope={2}", //"https://www.facebook.com/dialog/oauth/?response_type=token&display=popup&client_id={0}&redirect_uri={1}&scope={2}", AppInfo._fbAppId, AppInfo._loginRedirectUri, AppInfo._fbScope)); RelativeLayout progressDialogRelativeLayout = new RelativeLayout(this); LayoutInflater progressDialoglayoutInflater = (LayoutInflater)BaseContext.GetSystemService(LayoutInflaterService); View progressDialogView = progressDialoglayoutInflater.Inflate(Resource.Layout.progressdialoglayout, null); _progressDialogMessage = (TextView)progressDialogView.FindViewById(Resource.Id.progressDialogMessageTextView); progressDialogRelativeLayout.AddView(progressDialogView); _progressDialog = new ProgressDialog(this, Resource.Style.FullHeightDialog); _progressDialog.Show(); _progressDialog.SetContentView(progressDialogRelativeLayout); _progressDialog.Dismiss(); _progressDialog.Show(); _progressDialog.SetCanceledOnTouchOutside(false); ///// RelativeLayout errorDialogRelativeLayout = new RelativeLayout(this); LayoutInflater errorDialoglayoutInflater = (LayoutInflater)BaseContext.GetSystemService(LayoutInflaterService); View errorDialogView = errorDialoglayoutInflater.Inflate(Resource.Layout.wrongcodedialoglayout, null); _errorDialogReadyButton = (Button)errorDialogView.FindViewById(Resource.Id.readyButton); _errorDialogTitle = (TextView)errorDialogView.FindViewById(Resource.Id.textView1); _errorDialogMessage = (TextView)errorDialogView.FindViewById(Resource.Id.textView2); errorDialogRelativeLayout.AddView(errorDialogView); _errorDialog = new Dialog(this, Resource.Style.FullHeightDialog); _errorDialog.SetTitle(""); _errorDialog.SetContentView(errorDialogRelativeLayout); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// _endlogin.TextChanged += delegate //здесь инициализировать все необходимое перед запуском... { Finish(); StartActivity(typeof(FirstBadgeActivity)); }; _loginError.TextChanged += delegate { Finish(); StartActivity(typeof(LoginActivity)); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); buttonClickAnimation = AnimationUtils.LoadAnimation(this, global::Android.Resource.Animation.FadeIn); SetContentView(Resource.Layout.profilescreenactivitylayout); TextView profileTitle = FindViewById <TextView>(Resource.Id.profilescr_profiletextView); _flurryClient = new FlurryClient(); RelativeLayout exitDialogRelativeLayout = new RelativeLayout(this); LayoutInflater exitDialoglayoutInflater = (LayoutInflater)BaseContext.GetSystemService(LayoutInflaterService); View exitDialogView = exitDialoglayoutInflater.Inflate(Resource.Layout.exitdialoglayout, null); Button exitDialogCancelButton = (Button)exitDialogView.FindViewById(Resource.Id.cancelButton); Button exitDialogReadyButton = (Button)exitDialogView.FindViewById(Resource.Id.readyButton); TextView exitTitleTextView = (TextView)exitDialogView.FindViewById(Resource.Id.textView1); TextView exitDialogDescrTextView = (TextView)exitDialogView.FindViewById(Resource.Id.textView2); exitDialogRelativeLayout.AddView(exitDialogView); Dialog exitDialog = new Dialog(this, Resource.Style.FullHeightDialog); exitDialog.SetTitle(""); exitDialog.SetContentView(exitDialogRelativeLayout); _context = this; Typeface font = Typeface.CreateFromAsset(this.Assets, "Roboto-Light.ttf"); ImageButton logoutImageButton = FindViewById <ImageButton>(Resource.Id.profilescr_NavBar_LogoutImageButton); Button logoutButtonFake = FindViewById <Button>(Resource.Id.profilescr_logiutbuttonfake); Vibrator vibe = (Vibrator)_context.GetSystemService(Context.VibratorService); logoutButtonFake.Click += delegate { logoutImageButton.StartAnimation(buttonClickAnimation); vibe.Vibrate(50); exitDialog.Show(); }; exitDialogCancelButton.Click += delegate { exitDialog.Dismiss(); vibe.Vibrate(50); }; exitDialogReadyButton.Click += delegate { vibe.Vibrate(150); CookieSyncManager.CreateInstance(this); CookieManager cookieManager = CookieManager.Instance; cookieManager.RemoveAllCookie(); File.Delete(@"/data/data/ru.hintsolutions.itsbeta/data.txt"); itsbeta.achievements.LoginWebActivity.ItsbetaLoginWebViewClient.loadPreviousState = false; MainScreenActivity._isLogout = true; Finish(); }; TextView userFullname = FindViewById <TextView>(Resource.Id.profilescr_usernameTextView); TextView userData = FindViewById <TextView>(Resource.Id.profilescr_userAgelocTextView); TextView statText = FindViewById <TextView>(Resource.Id.profilescr_statTextView); TextView allBadgesTextView = FindViewById <TextView>(Resource.Id.profilescr_allBadgesTextView); TextView bonusesTextView = FindViewById <TextView>(Resource.Id.textView2); TextView subCategoriesTextView = FindViewById <TextView>(Resource.Id.textView3); //profilescr_allBadgesTextView TextView badgesCount = FindViewById <TextView>(Resource.Id.profilescr_allbadgescountTextView); TextView bonusesCount = FindViewById <TextView>(Resource.Id.profilescr_bonusCountTextView); TextView subCategoriesCount = FindViewById <TextView>(Resource.Id.profilescr_subcategCountTextView); statText.SetTypeface(font, TypefaceStyle.Normal); userFullname.SetTypeface(font, TypefaceStyle.Normal); allBadgesTextView.SetTypeface(font, TypefaceStyle.Normal); bonusesTextView.SetTypeface(font, TypefaceStyle.Normal); subCategoriesTextView.SetTypeface(font, TypefaceStyle.Normal); userFullname.Text = AppInfo._user.Fullname; userData.Text = GetUserAge(AppInfo._user.BirthDate) + ", " + AppInfo._user.City; if (!AppInfo.IsLocaleRu) { exitDialogCancelButton.Text = "Cancel"; exitDialogReadyButton.Text = "Yes"; exitTitleTextView.Text = "Confirm"; exitDialogDescrTextView.Text = "Do you really want to exit from current profile?"; profileTitle.Text = "PROFILE"; statText.Text = "Statistic"; allBadgesTextView.Text = "All Badges:"; bonusesTextView.Text = "Bonuses:"; subCategoriesTextView.Text = "Subcategories:"; } badgesCount.Text = AppInfo._badgesCount.ToString(); bonusesCount.Text = AppInfo._bonusesCount.ToString(); subCategoriesCount.Text = AppInfo._subcategCount.ToString(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); _flurryClient = new FlurryClient(); if (Java.Util.Locale.Default.DisplayLanguage == "русский") { AppInfo.IsLocaleRu = true; } else { AppInfo.IsLocaleRu = false; } _robotoLightFont = Typeface.CreateFromAsset(this.Assets, "Roboto-Light.ttf"); _vibe = (Vibrator)this.GetSystemService(Context.VibratorService); _messageDialogBuilder = new AlertDialog.Builder(this); //Считываем пользовательские данные if (!File.Exists(@"/data/data/ru.hintsolutions.itsbeta/data.txt")) { List <string> config = new List <string>(); config.Add(AppInfo._user.Fullname); config.Add(AppInfo._user.BirthDate); config.Add(AppInfo._user.FacebookUserID); config.Add(AppInfo._user.ItsBetaUserId); config.Add(AppInfo._user.City); config.Add(AppInfo._fbAccessToken); File.WriteAllLines(@"/data/data/ru.hintsolutions.itsbeta/data.txt", config.ToArray(), Encoding.UTF8); } //Binding на xmlразметку SetContentView(Resource.Layout.firstbadgeactivityloadinglayout); //Инициализируем костомный прогресс диалог _progressDialogRelativeLayout = new RelativeLayout(this); _baseLayoutInflater = (LayoutInflater)BaseContext.GetSystemService(LayoutInflaterService); _progressDialogView = _baseLayoutInflater.Inflate(Resource.Layout.progressdialoglayout, null); _progressDialogMessage = (TextView)_progressDialogView.FindViewById(Resource.Id.progressDialogMessageTextView); _progressDialogRelativeLayout.AddView(_progressDialogView); _progressDialog = new ProgressDialog(this, Resource.Style.FullHeightDialog); _progressDialog.Show(); _progressDialog.SetContentView(_progressDialogRelativeLayout); _progressDialog.Dismiss(); _progressDialog.SetCanceledOnTouchOutside(false); _progressDialogMessage.Text = "Загрузка данных..."; if (!AppInfo.IsLocaleRu) { _progressDialogMessage.Text = "Loading Data..."; } _progressDialog.Show(); //Запуск параллельного потока для выполнения основных действий _asyncInitThreadStart = new ThreadStart(AsyncInitCallback); _asyncInitThread = new Thread(_asyncInitThreadStart); _asyncInitThread.Start(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); _flurryClient = new FlurryClient(); _context = this; SetContentView(Resource.Layout.secondscreenactivitylayout); _font = Typeface.CreateFromAsset(this.Assets, "Roboto-Light.ttf"); _achievementsListView = (ListView)FindViewById(Resource.Id.secondscr_listView); _refreshProjectsAndAchTextView = new TextView(this); _vibe = (Vibrator)this.GetSystemService(Context.VibratorService); _badgesCountDisplay = FindViewById <TextView>(Resource.Id.NavBar_AchievesCountTextView); //WrongCodeDialog RelativeLayout wrongCodeDialogRelativeLayout = new RelativeLayout(this); LayoutInflater wrongCodeDialoglayoutInflater = (LayoutInflater)BaseContext.GetSystemService(LayoutInflaterService); View wrongCodeDialogView = wrongCodeDialoglayoutInflater.Inflate(Resource.Layout.wrongcodedialoglayout, null); _wrongCodeDialogReadyButton = (Button)wrongCodeDialogView.FindViewById(Resource.Id.readyButton); _wrongCodeDialogTitle = (TextView)wrongCodeDialogView.FindViewById(Resource.Id.textView1); _wrongCodeDialogMessage = (TextView)wrongCodeDialogView.FindViewById(Resource.Id.textView2); wrongCodeDialogRelativeLayout.AddView(wrongCodeDialogView); _wrongCodeDialog = new Dialog(this, Resource.Style.FullHeightDialog); _wrongCodeDialog.SetTitle(""); _wrongCodeDialog.SetContentView(wrongCodeDialogRelativeLayout); _wrongCodeDialogReadyButton.Click += delegate { _wrongCodeDialog.Dismiss(); }; // //ProgressDialog RelativeLayout progressDialogRelativeLayout = new RelativeLayout(this); LayoutInflater progressDialoglayoutInflater = (LayoutInflater)BaseContext.GetSystemService(LayoutInflaterService); View progressDialogView = progressDialoglayoutInflater.Inflate(Resource.Layout.progressdialoglayout, null); _progressDialogMessage = (TextView)progressDialogView.FindViewById(Resource.Id.progressDialogMessageTextView); progressDialogRelativeLayout.AddView(progressDialogView); _progressDialog = new ProgressDialog(this, Resource.Style.FullHeightDialog); _progressDialog.Show(); _progressDialog.SetContentView(progressDialogRelativeLayout); _progressDialog.Dismiss(); _progressDialog.SetCanceledOnTouchOutside(false); // ImageButton profileImageButton = FindViewById <ImageButton>(Resource.Id.secondscr_NavBar_ProfileScreenImageButton); ImageButton profileImageButtonFake = FindViewById <ImageButton>(Resource.Id.secondscr_NavBar_ProfileScreenImageButtonFake); ImageButton refreshImageButton = FindViewById <ImageButton>(Resource.Id.secondscr_NavBar_RefreshImageButton); ImageButton refreshImageButtonFake = FindViewById <ImageButton>(Resource.Id.secondscr_NavBar_RefreshImageButtonFake); _badgesCountDisplay.Text = AppInfo._badgesCount.ToString(); profileImageButtonFake.Click += delegate { if (!_badgePopupWindow.IsShowing) { _vibe.Vibrate(50); profileImageButton.StartAnimation(_buttonClickAnimation); StartActivity(typeof(ProfileActivity)); } }; refreshImageButtonFake.Click += delegate { if (!_badgePopupWindow.IsShowing) { _vibe.Vibrate(50); if (AppInfo.IsLocaleRu) { _progressDialogMessage.Text = "ќбновление..."; } else { _progressDialogMessage.Text = "Refreshing..."; } _progressDialog.Show(); refreshImageButton.StartAnimation(_buttonClickAnimation); OnBadgeListRefresh(); } }; //............................................................................. _refreshAchTextView = new TextView(this); _badgePopupWindow = new PopupWindow(this); _vibe = (Vibrator)this.GetSystemService(Context.VibratorService); _inactiveListButton = FindViewById <Button>(Resource.Id.secondscr_inactiveListButton); _inactiveAllButton = FindViewById <Button>(Resource.Id.secondscr_inactiveAllButton); _inactiveAllButton.Visibility = ViewStates.Gone; _inactiveListButton.Visibility = ViewStates.Gone; _buttonClickAnimation = AnimationUtils.LoadAnimation(this, global::Android.Resource.Animation.FadeIn); _fadeoutClickAnimation = AnimationUtils.LoadAnimation(this, global::Android.Resource.Animation.FadeOut); _categoryViewRelativeLayout = FindViewById <RelativeLayout>(Resource.Id.secondscr_categrowrelativeLayout); _subcategoryViewRelativeLayout = FindViewById <RelativeLayout>(Resource.Id.secondscr_projectsrelativeLayout); GetCategoryView(); GetProjectsView(); GetAchievementsView(); GetActivationDialog(); _refreshProjectsAndAchTextView.TextChanged += new EventHandler <Android.Text.TextChangedEventArgs>(_refreshProjectsAndAchTextView_TextChanged); _refreshAchTextView.TextChanged += new EventHandler <Android.Text.TextChangedEventArgs>(_refreshAchTextView_TextChanged); _subcategoryViewRelativeLayout.Click += new EventHandler(_subcategoryViewRelativeLayout_Click); _inactiveListButton.Click += new EventHandler(_inactiveListButton_Click); _inactiveAllButton.Click += new EventHandler(_inactiveAllButton_Click); _achievementsListView.ItemClick += new EventHandler <AdapterView.ItemClickEventArgs>(achievementsListView_ItemClick); _categoriesListView.ItemClick += new EventHandler <AdapterView.ItemClickEventArgs>(_categoriesListView_ItemClick); _subcategoriesListView.ItemClick += new EventHandler <AdapterView.ItemClickEventArgs>(_subcategoriesListView_ItemClick); _categoryViewRelativeLayout.Click += new EventHandler(_categoryViewRelativeLayout_Click); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); _flurryClient = new FlurryClient(); _context = this; _loginError = new TextView(this); SetContentView(Resource.Layout.loginweblayout); _endlogin = new TextView(this); //_messageDialogBuilder = new AlertDialog.Builder(this); _loginWebView = FindViewById<WebView>(Resource.Id.loginWebView); _loginWebView.Settings.SavePassword = false; //_loginWebView.Settings.JavaScriptEnabled = true; _loginWebView.Settings.PluginsEnabled = true; _loginWebView.Settings.JavaScriptCanOpenWindowsAutomatically = true; _loginWebView.SaveEnabled = false; _loginWebView.SetWebViewClient(new ItsbetaLoginWebViewClient(this)); _loginWebView.SetWebChromeClient(new ItsbetaLoginWebViewChromeClient()); // "https://www.facebook.com/dialog/oauth?response_type=token&display=popup&client_id={0}&redirect_uri={1}&scope={2}", _loginWebView.LoadUrl(String.Format( "https://m.facebook.com/dialog/oauth/?response_type=token&" + "client_id={0}"+ "&redirect_uri={1}" + "&scope={2}", //"https://www.facebook.com/dialog/oauth/?response_type=token&display=popup&client_id={0}&redirect_uri={1}&scope={2}", AppInfo._fbAppId, AppInfo._loginRedirectUri, AppInfo._fbScope)); RelativeLayout progressDialogRelativeLayout = new RelativeLayout(this); LayoutInflater progressDialoglayoutInflater = (LayoutInflater)BaseContext.GetSystemService(LayoutInflaterService); View progressDialogView = progressDialoglayoutInflater.Inflate(Resource.Layout.progressdialoglayout, null); _progressDialogMessage = (TextView)progressDialogView.FindViewById(Resource.Id.progressDialogMessageTextView); progressDialogRelativeLayout.AddView(progressDialogView); _progressDialog = new ProgressDialog(this, Resource.Style.FullHeightDialog); _progressDialog.Show(); _progressDialog.SetContentView(progressDialogRelativeLayout); _progressDialog.Dismiss(); _progressDialog.Show(); _progressDialog.SetCanceledOnTouchOutside(false); ///// RelativeLayout errorDialogRelativeLayout = new RelativeLayout(this); LayoutInflater errorDialoglayoutInflater = (LayoutInflater)BaseContext.GetSystemService(LayoutInflaterService); View errorDialogView = errorDialoglayoutInflater.Inflate(Resource.Layout.wrongcodedialoglayout, null); _errorDialogReadyButton = (Button)errorDialogView.FindViewById(Resource.Id.readyButton); _errorDialogTitle = (TextView)errorDialogView.FindViewById(Resource.Id.textView1); _errorDialogMessage = (TextView)errorDialogView.FindViewById(Resource.Id.textView2); errorDialogRelativeLayout.AddView(errorDialogView); _errorDialog = new Dialog(this, Resource.Style.FullHeightDialog); _errorDialog.SetTitle(""); _errorDialog.SetContentView(errorDialogRelativeLayout); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// _endlogin.TextChanged += delegate //здесь инициализировать все необходимое перед запуском... { Finish(); StartActivity(typeof(FirstBadgeActivity)); }; _loginError.TextChanged += delegate { Finish(); StartActivity(typeof(LoginActivity)); }; }