Example #1
0
        private void LoadStats()
        {
            var viewModel = myViewModel.CurrentStatisticViewModel;

            viewModel.SetAttacks();

            statShot.FindViewById <TextView>(Resource.Id.headerText).Text = "Doelpunten / schoten";
            statShot.FindViewById <TextView>(Resource.Id.statText).Text   = viewModel.GoalCount + " / " + viewModel.ShotCount;
            double percentageGoal = (Convert.ToDouble(viewModel.GoalCount) / viewModel.ShotCount) * 100;

            statShot.FindViewById <TextView>(Resource.Id.statDetailText).Text = string.Format("{0}%", percentageGoal);

            statRebound.FindViewById <TextView>(Resource.Id.headerText).Text = "aanvallende / verdedigende rebounds";
            statRebound.FindViewById <TextView>(Resource.Id.statText).Text   = viewModel.ReboundCount + " / " + viewModel.DevensiveReboundCount;

            statInterception.FindViewById <TextView>(Resource.Id.headerText).Text = "Onderscheppingen / balverlies";
            statInterception.FindViewById <TextView>(Resource.Id.statText).Text   = viewModel.InterceptionCount + " / " + viewModel.TurnoverCount;

            statShotclock.FindViewById <TextView>(Resource.Id.headerText).Text = "Schotklok overschrijding";
            statShotclock.FindViewById <TextView>(Resource.Id.statText).Text   = viewModel.ShotClokcOverrideCount.ToString();

            statConcededShot.FindViewById <TextView>(Resource.Id.headerText).Text = "Doelpunten / schoten tegen";
            statConcededShot.FindViewById <TextView>(Resource.Id.statText).Text   = viewModel.ConcededGoalCount + " / " + viewModel.ConcededShotCount;

            statAttackCount.FindViewById <TextView>(Resource.Id.headerText).Text = "Aantal aanvallen";
            statAttackCount.FindViewById <TextView>(Resource.Id.statText).Text   = viewModel.AttackCount.ToString();


            plotView.Model = myViewModel.CurrentStatisticViewModel.PlotModel;
        }
        public override void OnBindViewHolder(Android.Support.V7.Widget.RecyclerView.ViewHolder holder, int position)
        {
            ViewHolder viewHolder = holder as ViewHolder;
            CardView   cardView   = viewHolder.CardView;

            TextView roomTitleTextView = cardView.FindViewById <TextView>(Resource.Id.room_title_text_view);

            roomTitleTextView.Text = roomTitles[position];

            ImageView timeImageView = cardView.FindViewById <ImageView>(Resource.Id.time_image_view);

            timeImageView.SetImageResource(Resource.Drawable.stopwatch);
            timeImageView.ContentDescription = timeOfRoomCleaning[position];

            TextView timeTextView = cardView.FindViewById <TextView>(Resource.Id.time_text_view);

            timeTextView.Text = timeOfRoomCleaning[position];

            ImageView cleannessImageView = cardView.FindViewById <ImageView>(Resource.Id.cleanness_image_view);

            cleannessImageView.SetImageResource(Resource.Drawable.performance);
            cleannessImageView.ContentDescription = cleanness[position];

            TextView cleannessTextView = cardView.FindViewById <TextView>(Resource.Id.cleanness_text_view);

            cleannessTextView.Text = cleanness[position];
        }
Example #3
0
        private void MyViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            myGameStatus.Text = myViewModel.Game.Status;
            bool updateAll = e.PropertyName.Equals("UpdateAll");

            if (e.PropertyName.Equals(nameof(myViewModel.CurrentFunction)) || updateAll)
            {
                statButtonLayout.FindViewById <TextView>(Resource.Id.headerButtonText).Text = myViewModel.CurrentFunction.GetDescription();
                string turnoverText = myViewModel.CurrentFunction == EZoneFunction.Attack ? "Balverlies" : "Onderschepping";
                statButtonLayout.FindViewById <Button>(Resource.Id.turnoverButton).Text = turnoverText;
            }
            if (e.PropertyName.Equals(nameof(myViewModel.HomeScore)) || updateAll)
            {
                myHomeScoreTextView.Text = myViewModel.HomeScore.ToString();
            }
            if (e.PropertyName.Equals(nameof(myViewModel.AwayScore)) || updateAll)
            {
                myAwayScoreTextView.Text = myViewModel.AwayScore.ToString();
            }
            if (e.PropertyName.Equals("Shot") || updateAll)
            {
                cardViewLeft.FindViewById <TextView>(Resource.Id.headerText).Text = "Schoten";
                cardViewLeft.FindViewById <TextView>(Resource.Id.statText).Text   = myViewModel.GetShotCount().ToString();

                cardViewRight.FindViewById <TextView>(Resource.Id.headerText).Text = "Rebounds";
                cardViewRight.FindViewById <TextView>(Resource.Id.statText).Text   = myViewModel.GetReboundCount().ToString();
            }
            if (e.PropertyName.Equals(nameof(myViewModel.CurrentPlayers)) || updateAll)
            {
                myCurrentPlayersLayout.AddViews(myViewModel.GetPlayers());
            }
        }
Example #4
0
 public ViewHolder(CardView itemView) : base(itemView)
 {
     container      = itemView;
     imageView      = itemView.FindViewById <ImageView>(Resource.Id.galleryCardImageView);
     userLoginView  = itemView.FindViewById <TextView>(Resource.Id.galleryCardUserLogin);
     numImagesView  = itemView.FindViewById <TextView>(Resource.Id.galleryCardNumImages);
     latestTimeView = itemView.FindViewById <TextView>(Resource.Id.galleryCardLatest);
 }
Example #5
0
        private void DisplayBanner(string titleString, string subTitleString, string iconName)
        {
            int resID = Resources.GetIdentifier(iconName.Replace(".png", ""), "drawable", this.Context.PackageName);

            try{
                var title    = innerView.FindViewById(Resource.Id.text_banner_title) as TextView;
                var subtitle = innerView.FindViewById(Resource.Id.text_banner_subtitle) as TextView;
                var image    = innerView.FindViewById(Resource.Id.image_banner) as ImageView;

                title.Text    = titleString;
                subtitle.Text = subTitleString;
                image.SetImageResource(resID);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            var wm   = Context.GetSystemService(Context.WindowService).JavaCast <IWindowManager>();
            var prms = new WindowManagerLayoutParams(WindowManagerLayoutParams.WrapContent, WindowManagerLayoutParams.WrapContent, WindowManagerTypes.ApplicationPanel,
                                                     WindowManagerFlags.NotFocusable | WindowManagerFlags.WatchOutsideTouch | WindowManagerFlags.LayoutNoLimits,
                                                     Android.Graphics.Format.Translucent);

            prms.Gravity = GravityFlags.Top | GravityFlags.CenterHorizontal;

            try
            {
                wm.AddView(this, prms);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            gestureListener.SwipeTop   += HandleBannerSwipeTop;
            gestureListener.SwipeLeft  += HandleBannerSwipeLeft;
            gestureListener.SwipeRight += HandleBannerSwipeRight;
            timer.Elapsed += HandleBannerTimeout;
            this.Click    += HandleBannerClick;

            var inAnim = AnimationUtils.LoadAnimation(Context, Resource.Animation.slide_in_top);

            inAnim.Duration      = 300;
            inAnim.AnimationEnd += InAnimationEnd;
            innerView.Visibility = ViewStates.Visible;
            innerView.StartAnimation(inAnim);

            timer.Stop();
            timer.Start();
        }
Example #6
0
        private void Init()
        {
            this.Clickable = true;

            timer           = new System.Timers.Timer(BannerTimeout);
            gestureDetector = new Android.Support.V4.View.GestureDetectorCompat(Context, gestureListener = new SwipeGestureListener());

            innerView = new CardView(Context);
            innerView.UseCompatPadding = true;

            Android.Support.V4.View.ViewCompat.SetElevation(innerView, 4.DpToPx());
            innerView.Radius = 8.DpToPx();

            var w = Android.App.Application.Context.Resources.DisplayMetrics.WidthPixels - 120;

            using (var prms = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent))
            {
                prms.Width = w;
                prms.SetMargins(10.DpToPx(), 40.DpToPx(), 10.DpToPx(), 0);
                this.AddView(innerView, prms);
            }


            var inflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService);

            inflater.Inflate(Resource.Layout.banner_notification, innerView);


            Typeface tfMedium = Typeface.CreateFromAsset(Android.App.Application.Context.Assets, "Poppins-Medium.ttf");
            Typeface tfNormal = Typeface.CreateFromAsset(Android.App.Application.Context.Assets, "Poppins-Regular.ttf");


            try{
                var title = innerView.FindViewById(Resource.Id.text_banner_title) as TextView;
                title.SetTypeface(tfMedium, TypefaceStyle.Normal);
                title.SetTextSize(Android.Util.ComplexUnitType.Dip, 14);

                var subtitle = innerView.FindViewById(Resource.Id.text_banner_subtitle) as TextView;
                subtitle.SetTypeface(tfNormal, TypefaceStyle.Normal);
                subtitle.SetTextSize(Android.Util.ComplexUnitType.Dip, 12);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            innerView.Visibility = ViewStates.Gone;
        }
        public override void OnBindViewHolder(Android.Support.V7.Widget.RecyclerView.ViewHolder holder, int position)
        {
            ViewHolder viewHolder = holder as ViewHolder;

            CardView  cardView  = viewHolder.CardView;
            ImageView imageView = cardView.FindViewById <ImageView>(Resource.Id.info_image);
            Drawable  drawable  = cardView.Resources.GetDrawable(imageIds[position]);

            imageView.SetImageDrawable(drawable);
            imageView.ContentDescription = captions[position];
            TextView mainTextView = cardView.FindViewById <TextView>(Resource.Id.main_text);

            mainTextView.Text = captions[position];
            TextView infoTextView = cardView.FindViewById <TextView>(Resource.Id.info_text);

            infoTextView.Text = descriptions[position];
            infoTextView.SetTextColor(new Android.Graphics.Color(189, 189, 189));
        }
Example #8
0
        public override View GetChildView(int groupPosition, int childPosition, bool isLastChild, View convertView, ViewGroup parent)
        {
            PlayerStatisticViewModel item = mydata[groupPosition];

            item.SetAttacks();
            View view = convertView;

            if (view == null)
            {
                view = myContext.LayoutInflater.Inflate(Resource.Layout.base_statistic_layout, null);
            }
            PlotView plotView         = view.FindViewById <PlotView>(Resource.Id.plotView1);
            CardView statShot         = view.FindViewById <CardView>(Resource.Id.statShot);
            CardView statRebound      = view.FindViewById <CardView>(Resource.Id.statRebound);
            CardView statInterception = view.FindViewById <CardView>(Resource.Id.statInterceptions);
            CardView statShotclock    = view.FindViewById <CardView>(Resource.Id.statShotClock);
            CardView statConcededShot = view.FindViewById <CardView>(Resource.Id.statConcededShot);
            CardView statAttackCount  = view.FindViewById <CardView>(Resource.Id.statAttackCount);

            statShotclock.Visibility = ViewStates.Gone;

            statShot.FindViewById <TextView>(Resource.Id.headerText).Text = "Doelpunten / Schoten";
            statShot.FindViewById <TextView>(Resource.Id.statText).Text   = item.GoalCount + " / " + item.ShotCount;
            double percentageGoal = (Convert.ToDouble(item.GoalCount) / item.ShotCount) * 100;

            statShot.FindViewById <TextView>(Resource.Id.statDetailText).Text = string.Format("{0}%", percentageGoal);

            statRebound.FindViewById <TextView>(Resource.Id.headerText).Text = "Aanvallende rebounds";
            statRebound.FindViewById <TextView>(Resource.Id.statText).Text   = item.ReboundCount.ToString();

            statInterception.FindViewById <TextView>(Resource.Id.headerText).Text = "Onderscheppingen / Balverlies";
            statInterception.FindViewById <TextView>(Resource.Id.statText).Text   = item.InterceptionCount + " / " + item.TurnoverCount;

            statConcededShot.FindViewById <TextView>(Resource.Id.headerText).Text = "Doelpunten / schoten tegen";
            statConcededShot.FindViewById <TextView>(Resource.Id.statText).Text   = item.ConcededGoalCount + " / " + item.ConcededShotCount;


            statAttackCount.FindViewById <TextView>(Resource.Id.headerText).Text = "Assists";
            statAttackCount.FindViewById <TextView>(Resource.Id.statText).Text   = item.AssistCount.ToString();


            plotView.Model = item.PlotModel;
            return(view);
        }
Example #9
0
        public SpinnerViewHolder(CardView cardView, Action <int> listener, Action <object, AdapterView.ItemSelectedEventArgs> spinnerItemSelected)
            : base(cardView)
        {
            CardView = cardView;

            cardView.Click += (sender, e) => listener(base.LayoutPosition);

            Spinner = cardView.FindViewById <Spinner>(Resource.Id.room_spinner);
            Spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinnerItemSelected);
        }
Example #10
0
        public ViewHolderCardTaskExtended(CardView cardView, Action <int> listener, Action <int> actionTextViewListener)
            : base(cardView)
        {
            MainTextView    = cardView.FindViewById <TextView>(Resource.Id.main_text_view);
            FirstImageView  = cardView.FindViewById <ImageView>(Resource.Id.first_image_view);
            FirstTextView   = cardView.FindViewById <TextView>(Resource.Id.first_text_view);
            SecondImageView = cardView.FindViewById <ImageView>(Resource.Id.second_image_view);
            SecondTextView  = cardView.FindViewById <TextView>(Resource.Id.second_text_view);
            ThirdTextView   = cardView.FindViewById <TextView>(Resource.Id.third_text_view);
            LineView        = cardView.FindViewById <View>(Resource.Id.line_view);
            ForthTextView   = cardView.FindViewById <TextView>(Resource.Id.forth_text_view);
            ActionTextView  = cardView.FindViewById <TextView>(Resource.Id.action_text_view);


            cardView.Click       += (sender, e) => listener(base.LayoutPosition);
            ActionTextView.Click += (sender, e) => actionTextViewListener(base.LayoutPosition);
        }
        void UpdateNumberofCoins(string symbol, decimal numberofCoins)
        {
            if (symbol == null)
            {
                return;
            }

            CardView cardView = cardViewDict[symbol];

            System.Diagnostics.Debug.WriteLine("Update # of coins - symbol: {0}, numberOfcoins {1}", symbol, numberofCoins);

            var numberofCoinsView = cardView.FindViewById <TextView>(CARDVIEW_NUMBER_OF_COINS_TEXT_VIEW_ID);

            numberofCoinsView.Text = System.Convert.ToString(numberofCoins);
        }
        void UpdateCardView(string symbol, double price, double change, double changePct, DateTime lastUpdate)
        {
            if (symbol == null)
            {
                return;
            }

            string priceStr = GetPriceStr(change, changePct);

            CardView cardView = cardViewDict[symbol];

            var textView = cardView.FindViewById <TextView>(CARDVIEW_PRICE_TEXT_VIEW_ID);

            textView.Text = price.ToString("C");
            textView.SetTextColor(change > 0 ? Color.ParseColor("#4CAF50") : Color.Red);

            var timetxtView = cardView.FindViewById <TextView>(CARDVIEW_LAST_UPDATE_TEXT_VIEW_ID);

            timetxtView.Text = lastUpdate.ToString();

            var priceChgView = cardView.FindViewById <TextView>(CARDVIEW_CHANGE_TEXT_VIEW_ID);

            priceChgView.Text = priceStr;
            priceChgView.SetTextColor(change > 0 ? Color.ParseColor("#4CAF50") : Color.Red);

            var     numberofCoinsView = cardView.FindViewById <TextView>(CARDVIEW_NUMBER_OF_COINS_TEXT_VIEW_ID);
            decimal numberOfCoins     = System.Convert.ToDecimal(numberofCoinsView.Text);

            var     valueView = cardView.FindViewById <TextView>(CARDVIEW_VALUE_TEXT_VIEW_ID);
            decimal value     = numberOfCoins * (decimal)price;

            valueView.Text = value.ToString("C");

            if (!symbolValues.TryAdd(symbol, value))
            {
                symbolValues[symbol] = value;
            }

            ImageView imageView = cardView.FindViewById <ImageView>(CARDVIEW_IMAGE_UP_DOWN_ID);

            imageView.SetImageResource(change > 0 ? Resource.Drawable.ic_arrow_drop_up_green_500_18dp :
                                       Resource.Drawable.ic_arrow_drop_down_red_500_18dp);
        }
        public override void OnBindViewHolder(Android.Support.V7.Widget.RecyclerView.ViewHolder holder, int position)
        {
            ViewHolder viewHolder = holder as ViewHolder;

            CardView  cardView      = viewHolder.CardView;
            ImageView mainImageView = cardView.FindViewById <ImageView>(Resource.Id.info_image);
            Drawable  drawable      = cardView.Resources.GetDrawable(imageIds[position]);

            mainImageView.SetImageDrawable(drawable);
            mainImageView.ContentDescription = captions[position];
            TextView titleTextView = cardView.FindViewById <TextView>(Resource.Id.room_title_textview);

            titleTextView.Text = captions[position];


            //ImageView iconImage = cardView.FindViewById<ImageView>(Resource.Id.info_icon);
            //iconImage.SetImageResource(Resource.Drawable.ic_edit);
            //iconImage.ContentDescription = captions[position];
            //iconImage.RequestLayout();
            //iconImage.LayoutParameters.Height = Convert.ToInt16(titleTextView.TextSize);
            //iconImage.SetColorFilter(new Android.Graphics.Color(context.GetColor(Resource.Color.colorAction)));

            TextView actionTextView1 = cardView.FindViewById <TextView>(Resource.Id.action1_textview);

            actionTextView1.Text   = actionText[0];
            actionTextView1.Click += Action1_Click;

            TextView actionTextView2 = cardView.FindViewById <TextView>(Resource.Id.action2_textview);

            actionTextView2.Text   = actionText[1];
            actionTextView2.Click += Action2_Click;

            View view = cardView.FindViewById <View>(Resource.Id.line_view);

            view.SetBackgroundColor(new Android.Graphics.Color(224, 224, 224));

            TextView infoTextView = cardView.FindViewById <TextView>(Resource.Id.info_text);

            infoTextView.Text = context.GetString(Resource.String.info_text_for_room_title);
            infoTextView.SetTextColor(new Android.Graphics.Color(189, 189, 189));
        }
Example #14
0
 private void SetCardStatistics(CardView view, string headerText, string statText, string statDetailText)
 {
     view.FindViewById <TextView>(Resource.Id.headerText).Text     = headerText;
     view.FindViewById <TextView>(Resource.Id.statText).Text       = statText;
     view.FindViewById <TextView>(Resource.Id.statDetailText).Text = statDetailText;
 }
Example #15
0
        private void CreateView(RoomData Room)
        {
            Week = TimeTools.计算当前周(((MainActivity)Context).conditions.Time);
            RelativeLayout day;
            int            CourseCount = 0;

            foreach (var Course in Room.Coursedates)
            {
                switch (Course.NewCourseTime.星期)
                {
                case DayOfWeek.Monday: day = (RelativeLayout)dialogView.FindViewById(Resource.Id.monday); break;

                case DayOfWeek.Tuesday: day = (RelativeLayout)dialogView.FindViewById(Resource.Id.tuesday); break;

                case DayOfWeek.Wednesday: day = (RelativeLayout)dialogView.FindViewById(Resource.Id.wednesday); break;

                case DayOfWeek.Thursday: day = (RelativeLayout)dialogView.FindViewById(Resource.Id.thursday); break;

                case DayOfWeek.Friday: day = (RelativeLayout)dialogView.FindViewById(Resource.Id.friday); break;

                case DayOfWeek.Saturday: day = (RelativeLayout)dialogView.FindViewById(Resource.Id.saturday); break;

                case DayOfWeek.Sunday: day = (RelativeLayout)dialogView.FindViewById(Resource.Id.weekday); break;

                default: day = (RelativeLayout)dialogView.FindViewById(Resource.Id.weekday); break;
                }
                for (var count = 0; count < day.ChildCount; count++)
                {
                    var V = day.GetChildAt(count);
                    var 节 = (PxToDp((int)V.GetY()) + 10) / CardHeight + 1;
                    if (节 == Course.NewCourseTime.节[0])//重合
                    {
                        #region 把这节课添加到这个卡片里面
                        V.Tag += "/" + CourseCount;
                        #endregion
                        #region 设定显示的卡片
                        #endregion
                        goto cc;
                    }
                }
                CardView view = (CardView)LayoutInflater.From(Context).Inflate(Resource.Layout.Detail_CourseCard, null);                                                                                        //加载单个课程布局
                view.SetY(DpToPx(CardHeight) * (Course.NewCourseTime.节[0] - 1));                                                                                                                                //设置开始高度,即第几节课开始
                LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (Course.NewCourseTime.节.Last() - Course.NewCourseTime.节.First() + 1) * DpToPx(CardHeight) - 2); //设置布局高度,即跨多少节课
                view.LayoutParameters = p;
                TextView text = view.FindViewById <TextView>(Resource.Id.text_view);
                text.Text = Course.CourseName + "\n" + Course.TeacherName; //显示课程名
                if (Coursedata.是否在课程周数内(Course.NewCourseTime, Week))
                {
                    view.SetCardBackgroundColor(Android.Graphics.Color.ParseColor("#6495ED"));
                }
                view.Tag    = CourseCount.ToString();
                view.Click += (object sender, EventArgs e) =>
                {
                    string[] ClassTag = ((CardView)sender).Tag.ToString().Split("/");
                    if (ClassTag.Length > 1)
                    {
                        var      Tag = int.Parse(ClassTag[1]);
                        TextView T   = view.FindViewById <TextView>(Resource.Id.text_view);
                        T.Text = NowRoom.Coursedates[Tag].CourseName + "\n" + NowRoom.Coursedates[Tag].TeacherName + "\n" + NowRoom.Coursedates[Tag].CourseTime;
                        var FirstTag = ClassTag[0];
                        for (var count = 0; count < ClassTag.Length - 1; count++)
                        {
                            ClassTag[count] = ClassTag[count + 1];
                        }
                        ClassTag[ClassTag.Length - 1] = FirstTag;
                        string NewTag = string.Empty;
                        foreach (var t in ClassTag)
                        {
                            NewTag += t + "/";
                        }
                        ((CardView)sender).Tag = NewTag.Substring(0, NewTag.Length - 1);
                    }
                };
                day.AddView(view);
                cc : CourseCount++;
            }
        }
Example #16
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Console.WriteLine("OnCreate Called");
            Window.RequestFeature(WindowFeatures.NoTitle);
            AppCenter.Start("7ac229ee-9940-46b8-becc-d2611c48b2ad", typeof(Analytics), typeof(Crashes), typeof(Push), typeof(Distribute));

            Push.SetSenderId(firebaseSenderId);
            Push.PushNotificationReceived += PushNotificationRecieved;
            currState = LastCustomNonConfigurationInstance as SaveState;
            SetContentView(Resource.Layout.Main);


            if (currState == null)
            {
                await ServiceLayer.SharedInstance.InitalizeSettings();

                for (int i = 1; i <= NumPokes; i++)
                {
                    try
                    {
                        pokeResourceMap[i] = (int)typeof(Resource.Mipmap).GetField($"p{i.ToString("d3")}").GetValue(null);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine($"poke {i} not found");
                    }
                }
                Console.WriteLine("No saved state");
            }
            else
            {
                pokeResourceMap = currState.ResourceMap;
                Console.WriteLine("saved state recalled");
            }

            lastUpdate = DateTime.UtcNow;
            if (savedInstanceState != null && savedInstanceState.ContainsKey("centerLat") && currState == null)
            {
                var cLat   = savedInstanceState.GetDouble("centerLat");
                var cLon   = savedInstanceState.GetDouble("centerLon");
                var zoom   = savedInstanceState.GetFloat("centerZoom");
                var update = savedInstanceState.GetLong("lastUpdate");
                lastUpdate = Utility.FromUnixTime(update);
                currState  = new SaveState()
                {
                    CurrentCenter = new LatLng(cLat, cLon),
                    CurrentZoom   = zoom
                };
            }

            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            progress     = FindViewById(Resource.Id.progressBar) as ProgressBar;
            if (_mapFragment == null)
            {
                CameraPosition startCam;
                if (currState == null)
                {
                    startCam = new CameraPosition(mDefaultLocation, defaultZoom, 0.0f, 0.0f); //CameraUpdateFactory.NewLatLngZoom(mDefaultLocation, defaultZoom);
                }
                else
                {
                    startCam = new CameraPosition(currState.CurrentCenter, currState.CurrentZoom, 0.0f, 0.0f);
                }
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeNormal)
                                              .InvokeZoomControlsEnabled(false)
                                              .InvokeCompassEnabled(true)
                                              .InvokeRotateGesturesEnabled(false)
                                              .InvokeCamera(startCam);

                Android.App.FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();
            }

            loginHolder = FindViewById(Resource.Id.loginHolder) as CardView;
            username    = FindViewById(Resource.Id.username) as EditText;
            if (settings.LoggedIn)
            {
                loginHolder.Visibility = ViewStates.Gone;
                _mapFragment.GetMapAsync(this);
                var imm = GetSystemService(Context.InputMethodService) as InputMethodManager;
                imm.HideSoftInputFromWindow(username.WindowToken, 0);
                if (currState == null)
                {
                    await LoadData();
                }
                else if (lastUpdate < DateTime.UtcNow.AddSeconds(-20))
                {
                    RefreshMapData(null);
                }
            }
            else
            {
                loginHolder.Visibility = ViewStates.Visible;
                password = FindViewById(Resource.Id.password) as EditText;
                username.RequestFocus();
                _mapFragment.GetMapAsync(this);
            }

            var loginButton = FindViewById(Resource.Id.signInButton) as Button;

            loginButton.Click += LoginButton_Click;
            var settingButton = FindViewById(Resource.Id.settingsButton);

            settingButton.Click += SettingButton_Click;
            var layerButton = FindViewById(Resource.Id.layerssButton);

            layerButton.Click += LayerButton_Click;
            settingsHolder     = FindViewById(Resource.Id.settingsHolder) as CardView;
            var settingsDone = settingsHolder.FindViewById(Resource.Id.settingsDoneButton);

            settingsDone.Click += SettingsDone_Click;
            var settingsInfo = settingsHolder.FindViewById(Resource.Id.settingsInfoButton);

            settingsInfo.Click += SettingsInfo_Click;


            var hideButton   = FindViewById(Resource.Id.hideButton) as Button;
            var notifyButton = FindViewById(Resource.Id.notifyButton) as Button;

            hideButton.Click   += HideButton_Click;
            notifyButton.Click += NotifyButton_Click1;


            progress.Indeterminate                = true;
            settingsListview                      = FindViewById(Resource.Id.settingsListView) as ListView;
            settingsListview.Adapter              = new SettingsAdaptor(this, pokeResourceMap);
            App.Current.LocationServiceConnected += (object sender, ServiceConnectedEventArgs e) =>
            {
                Log.Debug("MainActivity", "ServiceConnected Event Raised");
            };
            App.StartLocationService();
        }