예제 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.PasswardEdit);

            builder  = new AlertDialog.Builder(this);
            code     = FindViewById <EditText>(Resource.Id.SettingPswEditCode);
            psw      = FindViewById <EditText>(Resource.Id.SettingEditPassword);
            confirm  = FindViewById <EditText>(Resource.Id.SettingEditConfirm);
            submit   = FindViewById <Button>(Resource.Id.SettingbtnSubmitPsw);
            sendCode = FindViewById <Button>(Resource.Id.SettingPswBtnSendcode);
            layout   = FindViewById <LinearLayout>(Resource.Id.SettingPswLayout);
            PhoneNum = FindViewById <TextView>(Resource.Id.PasswordTextPhoneNum);

            ISharedPreferences LoginSP = GetSharedPreferences("LoginData", FileCreationMode.Private);

            PhoneNum.Text = LoginSP.GetString("PhoneNum", null);

            submit.Click += delegate
            {
                if ((code.Text == "") || (psw.Text == "") || (confirm.Text == ""))
                {
                    Toast.MakeText(this, "请输入完整的修改信息!", ToastLength.Short).Show();
                }
                else if ((psw.Text != confirm.Text))
                {
                    Toast.MakeText(this, "两次输入的密码不一致!", ToastLength.Short).Show();
                }
                else if (code.Text != "123456")
                {
                    Toast.MakeText(this, "验证码错误!", ToastLength.Short).Show();
                }
                else
                {
                    string res = PasswordEditData.Post("http://115.159.145.115/PasswordEdit.php", psw.Text, PhoneNum.Text);
                    if (res == "Success")
                    {
                        builder.SetTitle("修改成功");
                        builder.SetMessage("请重新登录!");
                        builder.SetPositiveButton("确认", OK);
                        builder.SetCancelable(false);
                        builder.Show();
                    }
                }
            };
            sendCode.Click += delegate
            {
                MyCount mc = new MyCount(this, 60000, 1000);
                mc.Start();
            };
            layout.Click += delegate
            {
                Android.Views.InputMethods.InputMethodManager imm = (Android.Views.InputMethods.InputMethodManager)GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(code.WindowToken, 0);
                imm.HideSoftInputFromWindow(psw.WindowToken, 0);
                imm.HideSoftInputFromWindow(confirm.WindowToken, 0);
            };
        }
예제 #2
0
//        void EditTextTouchUp(object sender, View.TouchEventArgs e)
//        {
//            //          if (MotionEventActions.Up == e.Event.Action ) {  disallow text edit ?
//            switch (e.Event.Action & MotionEventActions.Mask)
//            {
//                case MotionEventActions.Up:
//                    if (TransDetAdapter.lastFocusedControl != null)
//                        TransDetAdapter.lastFocusedControl.SetBackgroundResource(Resource.Drawable.my_edit_text_background_normal);
//                    TransDetAdapter.lastFocusedControl = (EditText)sender;
//                    TransDetAdapter.lastFocusedControl.SetBackgroundResource(Resource.Drawable.my_edit_text_background_focused);
//                    TransDetAdapter.lastFocusedControl.RequestFocus();
//
//                    EditText yourEditText = (EditText)sender;
//                    Android.Views.InputMethods.InputMethodManager imm = (Android.Views.InputMethods.InputMethodManager)context.GetSystemService(Android.Content.Context.InputMethodService);
//                    imm.ShowSoftInput(yourEditText, Android.Views.InputMethods.ShowFlags.Implicit);
//                    break;
//            }
//        }
        #region IOnTouchListener implementation

        public bool OnTouch(View v, MotionEvent e)
        {
            switch (e.Action & MotionEventActions.Mask)
            {
            case MotionEventActions.Up:
                if (TransDetAdapter.lastFocusedControl != null)
                {
                    TransDetAdapter.lastFocusedControl.SetBackgroundResource(Resource.Drawable.my_edit_text_background_normal);
                }
                TransDetAdapter.lastFocusedControl = (EditText)v;
                TransDetAdapter.lastFocusedControl.SetBackgroundResource(Resource.Drawable.my_edit_text_background_focused);
                TransDetAdapter.lastFocusedControl.RequestFocus();

                EditText yourEditText = (EditText)v;
                Android.Views.InputMethods.InputMethodManager imm = (Android.Views.InputMethods.InputMethodManager)context.GetSystemService(Android.Content.Context.InputMethodService);
                imm.ShowSoftInput(yourEditText, Android.Views.InputMethods.ShowFlags.Forced);
                if (lastFocusedControl != null)
                {
                    lastFocusedControl.PostDelayed(new Action(() => { lastFocusedControl.SelectAll(); }), 100);
                }
                break;
            }

            //_gestureDetector.OnTouchEvent(e);
            return(true);
        }
예제 #3
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            Android.Views.InputMethods.InputMethodManager inputMethodManager = (Android.Views.InputMethods.InputMethodManager) this.GetSystemService(MainActivity.InputMethodService);
            inputMethodManager.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, 0);
            if (drawerToggle.OnOptionsItemSelected(item))
            {
                return(true);
            }
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                drawerLayout.OpenDrawer(GravityCompat.Start);
                return(true);
            }
#if SCREENSHOT
            if (item != null && item.TitleFormatted != null)
            {
                if (AppResources.TakeAPicture == item.TitleFormatted.ToString())
                {
                    Task.Run(() =>
                    {
                        RunOnUiThread(() =>
                        {
                            if (!ScreenshotVM.InScreenshot)
                            {
                                //ScreenshotVM.CaptureScreens(Navigate.screenshotScreen);
                            }
                        });
                    });
                }
            }
#endif
            return(base.OnOptionsItemSelected(item));
        }
예제 #4
0
 public override void OnBackPressed()
 {
     try {
         if (EditMode)
         {
             addInputDialog = listEntryEdit.FindViewById <EditText>(Resource.Id.addInputDialog);
             if (addInputDialog.Text.Length == 0)
             {
                 confirmDelete();
                 //GrabAdIntertitials();
             }
             else
             {
                 Android.Views.InputMethods.InputMethodManager inputMethodManager = (Android.Views.InputMethods.InputMethodManager) this.GetSystemService(MainActivity.InputMethodService);
                 inputMethodManager.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, 0);
                 Finish();
                 //GrabAdIntertitials();
             }
         }
         else
         {
             base.OnBackPressed();
         }
     } catch (Exception ex) { LittleWatson.ReportException(ex); }
 }
예제 #5
0
 private void HideKeyboard()
 {
     try
     {
         Android.Views.InputMethods.InputMethodManager inputMethodManager = Application.GetSystemService(Context.InputMethodService) as Android.Views.InputMethods.InputMethodManager;
         inputMethodManager.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, Android.Views.InputMethods.HideSoftInputFlags.None);
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.Print("Error- " + ex.Message);
     }
 }
예제 #6
0
        /// <summary>
        /// Button Oublier mot de passe
        /// </summary>
        private void ForgetPasswordClick(object sender, EventArgs e)
        {
            if (!ForgetPasswordEditText.Text.IsEmail())
            {
                ForgetPasswordEditText.Error = Resources.GetString(Resource.String.createAccount_errorEmail);
                return;
            }
            RunOnUiThread(async() =>
            {
                //Hide Keyboard
                Android.Views.InputMethods.InputMethodManager imm = (Android.Views.InputMethods.InputMethodManager)GetSystemService(InputMethodService);
                imm.HideSoftInputFromWindow(Connect.WindowToken, 0);

                LoadingLayout.Visibility = ViewStates.Visible;
                await App.Locator.Login.ForgetPassword(ForgetPasswordEditText.Text);
                LoadingLayout.Visibility = ViewStates.Gone;
            });
        }
예제 #7
0
        private void EditTextTouchUp(object sender, View.TouchEventArgs e)
        {
//			if (MotionEventActions.Up == e.Event.Action ) {  disallow text edit ?
            switch (e.Event.Action & MotionEventActions.Mask)
            {
            case MotionEventActions.Up:
                if (TransDetAdapter.lastFocusedControl != null)
                {
                    TransDetAdapter.lastFocusedControl.SetBackgroundResource(Resource.Drawable.my_edit_text_background_normal);
                }
                TransDetAdapter.lastFocusedControl = (EditText)sender;
                TransDetAdapter.lastFocusedControl.SetBackgroundResource(Resource.Drawable.my_edit_text_background_focused);
                TransDetAdapter.lastFocusedControl.RequestFocus();

                EditText yourEditText = (EditText)sender;
                Android.Views.InputMethods.InputMethodManager imm = (Android.Views.InputMethods.InputMethodManager)context.GetSystemService(Android.Content.Context.InputMethodService);
                imm.ShowSoftInput(yourEditText, Android.Views.InputMethods.ShowFlags.Implicit);
                break;
            }
        }
예제 #8
0
        private void SetData(View rootView)
        {
            SearchManager searchManager = (SearchManager)Activity.GetSystemService(Android.Content.Context.SearchService);

            _searchView = rootView.FindViewById <SearchView>(Resource.Id.search);
            _searchView.SetSearchableInfo(searchManager.GetSearchableInfo(Activity.ComponentName));

            _searchView.SetIconifiedByDefault(false);
            _searchView.SetOnQueryTextListener(this);
            _searchView.SetOnCloseListener(this);
            _searchView.ClearFocus();

            Android.Views.InputMethods.InputMethodManager mgr = (Android.Views.InputMethods.InputMethodManager)Activity.GetSystemService(Android.Content.Context.InputMethodService);
            mgr.HideSoftInputFromWindow(_searchView.WindowToken, 0);
            SimpleSelectorItem[] items = (ParcableTest.Dialogs.SimpleSelectorItem[])Arguments.GetParcelableArray(ITEMS);

            _lvSelector = (ListView)rootView.FindViewById(Resource.Id.lvSelector);
            SimpleSelectorListAdapter adapter = new SimpleSelectorListAdapter(Activity, items.ToList());

            _lvSelector.Adapter = adapter;
        }
예제 #9
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            Bundle   bundle = this.Arguments;
            DateTime date   = Arguments.GetString("date").ToDateTime();

            Period = (Period)Enum.Parse(typeof(Period), Arguments.GetString("period"));
            view   = inflater.Inflate(Resource.Layout.fragment_today_card, container, false);
            vm     = new PeriodVM(date, Period, true);

            var binding = DataContext <PeriodVM> .FromView(view);

            binding.VM = vm;

            if (binding.Bindings.Count == 0)
            {
                binding.Add(Resource.Id.layout_time_calories, x => x.TimeOrTotalVisibility);
                binding.Add(Resource.Id.text_totalCalories1, x => x.TotalVisibility);
                binding.Add(Resource.Id.text_totalCalories2, x => x.TotalVisibility);
                binding.Add(Resource.Id.text_totalCalories1, x => x.TotalText);
                binding.Add(Resource.Id.text_totalCalories2, x => x.TotalValue);
                binding.Add(Resource.Id.button_pick_time, x => x.Time);
                binding.Add(Resource.Id.button_pick_time, x => x.TimeVisibility);
                binding.Add(Resource.Id.button_pick_time, (x) =>
                {
                    DateTime current;
                    if (!DateTime.TryParse(x.Time, out current))
                    {
                        current = DateTime.Now;
                    }
                    var tpd = new Android.App.TimePickerDialog(Activity,
                                                               (s, e) => { x.Time = DateTime.Now.SetTime(e.HourOfDay, e.Minute, 0).ToShortTimeString(); }
                                                               , current.Hour, current.Minute, true);
                    tpd.Show();
                });
                binding.Add(Resource.Id.editText_Notes, x => x.Note);
                binding.Add(Resource.Id.layout_notes, x => x.NoteVisibility);
                binding.Add(Resource.Id.btn_delete, x => { x.Note = null; });
            }

            recycler                 = view.FindViewById <RecyclerView>(Resource.Id.recycler);
            editText                 = view.FindViewById <EditText>(Resource.Id.editText_Notes);
            advertisement            = view.FindViewById <LinearLayout>(Resource.Id.advertisement);
            linearLayoutTimeCalories = view.FindViewById <LinearLayout>(Resource.Id.layout_time_calories);
            editNotes                = view.FindViewById <LinearLayout>(Resource.Id.inputNotes);
            ImageView cross = view.FindViewById <ImageView>(Resource.Id.btn_delete);

            textTotalCalories   = view.FindViewById <TextView>(Resource.Id.text_totalCalories);
            buttonSetTime       = view.FindViewById <Button>(Resource.Id.button_pick_time);
            textNotes           = view.FindViewById <TextView>(Resource.Id.text_today_notes);
            layoutNotesSection  = view.FindViewById <LinearLayout>(Resource.Id.layout_note_section);
            emptyScreenImage    = view.FindViewById <ImageView>(Resource.Id.empty_screen);
            getStarted          = view.FindViewById <TextView>(Resource.Id.get_started);
            getStartedText      = view.FindViewById <TextView>(Resource.Id.get_started_text);
            text_totalCalories2 = view.FindViewById <TextView>(Resource.Id.text_totalCalories2);
            UpdateEmptyVisibility();

            cross.Click += async delegate
            {
                Android.Views.InputMethods.InputMethodManager inputManager = (Android.Views.InputMethods.InputMethodManager)inflater.Context.GetSystemService(Context.InputMethodService);
                inputManager.HideSoftInputFromWindow(cross.WindowToken, 0);
            };
            setupRecycler();

            this.HasOptionsMenu = true;

#if DEBUG
            AndroidDebug.SetViewBorders(view);
#endif


            return(view);
        }
예제 #10
0
        private void TabIndex()
        {
            Advp = FindViewById <ViewPager>(Resource.Id.viewpager);

            Scan           = FindViewById <ImageView>(Resource.Id.TabIndeximScan);
            Search         = FindViewById <ImageView>(Resource.Id.TabIndeximSearch);
            Type1          = FindViewById <ImageView>(Resource.Id.type1);
            Type2          = FindViewById <ImageView>(Resource.Id.type2);
            Type3          = FindViewById <ImageView>(Resource.Id.type3);
            Type4          = FindViewById <ImageView>(Resource.Id.type4);
            Type5          = FindViewById <ImageView>(Resource.Id.type5);
            Type6          = FindViewById <ImageView>(Resource.Id.type6);
            Type7          = FindViewById <ImageView>(Resource.Id.type7);
            Type8          = FindViewById <ImageView>(Resource.Id.type8);
            Type9          = FindViewById <ImageView>(Resource.Id.type9);
            TabIndexLayout = FindViewById <LinearLayout>(Resource.Id.TabIndexLayout);
            searchEdit     = FindViewById <EditText>(Resource.Id.TabIndexEditSearch);

            Scan.SetImageResource(Resource.Drawable.IconScan);
            Search.SetImageResource(Resource.Drawable.IconSearch);

            Type1.SetImageResource(Resource.Drawable.IndexIcon_1);
            Type2.SetImageResource(Resource.Drawable.IndexIcon_8);
            Type3.SetImageResource(Resource.Drawable.IndexIcon_7);
            Type4.SetImageResource(Resource.Drawable.IndexIcon_5);
            Type5.SetImageResource(Resource.Drawable.IndexIcon_9);
            Type6.SetImageResource(Resource.Drawable.IndexIcon_2);
            Type7.SetImageResource(Resource.Drawable.IndexIcon_4);
            Type8.SetImageResource(Resource.Drawable.IndexIcon_3);
            Type9.SetImageResource(Resource.Drawable.IndexIcon_6);

            View             v1, v2, v3;
            List <View>      viewList;
            ViewPagerAdapter AdvpAdapter;
            var li = LayoutInflater.From(this);

            v1       = li.Inflate(Resource.Layout.ViewPager_1, null);
            v2       = li.Inflate(Resource.Layout.ViewPager_2, null);
            v3       = li.Inflate(Resource.Layout.ViewPager_3, null);
            viewList = new List <View>();
            viewList.Add(v1);
            viewList.Add(v2);
            viewList.Add(v3);
            ad1 = v1.FindViewById <ImageView>(Resource.Id.Vpimage_1);
            ad2 = v2.FindViewById <ImageView>(Resource.Id.Vpimage_2);
            ad3 = v3.FindViewById <ImageView>(Resource.Id.Vpimage_3);
            Picasso.With(this).Load("http://115.159.145.115/ads/ad1.png").Into(ad1);
            Picasso.With(this).Load("http://115.159.145.115/ads/ad2.png").Into(ad2);
            Picasso.With(this).Load("http://115.159.145.115/ads/ad3.png").Into(ad3);
            AdvpAdapter  = new ViewPagerAdapter(viewList);
            Advp.Adapter = AdvpAdapter;

            MobileBarcodeScanner.Initialize(Application);
            scanner = new MobileBarcodeScanner();

            Button flashButton;
            View   zxingOverlay;

            Scan.Click += async delegate {
                scanner.UseCustomOverlay = true;

                //Inflate our custom overlay from a resource layout
                zxingOverlay = LayoutInflater.FromContext(this).Inflate(Resource.Layout.Scanning, null);

                //Find the button from our resource layout and wire up the click event
                flashButton        = zxingOverlay.FindViewById <Button>(Resource.Id.buttonZxingFlash);
                flashButton.Click += (sender, e) => scanner.ToggleTorch();

                //Set our custom overlay
                scanner.CustomOverlay = zxingOverlay;

                //Start scanning!
                var result = await scanner.Scan();

                HandleScanResult(result);
            };
            Search.Click += delegate
            {
                if (searchEdit.Text != "")
                {
                    Intent ActBookList = new Intent(this, typeof(BookListView));
                    Bundle bundle      = new Bundle();
                    ActBookList.PutExtra("SearchInfo", searchEdit.Text);
                    ActBookList.PutExtras(bundle);
                    StartActivity(ActBookList);
                }
            };

            Type1.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "计算机");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type2.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "文学");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type3.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "社会科学");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type4.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "历史");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type5.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "文化");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type6.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "教材");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type7.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "科普");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type8.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "经济");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type9.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "其他");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };

            TabIndexLayout.Click += delegate
            {
                Android.Views.InputMethods.InputMethodManager imm = (Android.Views.InputMethods.InputMethodManager)GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(searchEdit.WindowToken, 0);
            };
        }
예제 #11
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.Register);

            register  = FindViewById <Button>(Resource.Id.regBtnRegister);
            sendCode  = FindViewById <Button>(Resource.Id.regBtnSendcode);
            number    = FindViewById <EditText>(Resource.Id.regEditNumber);
            code      = FindViewById <EditText>(Resource.Id.regEditCode);
            psw       = FindViewById <EditText>(Resource.Id.regEditPassword);
            confirm   = FindViewById <EditText>(Resource.Id.regEditConfirm);
            regLayout = FindViewById <LinearLayout>(Resource.Id.regLayout);
            title     = FindViewById <ImageView>(Resource.Id.TitleReg);

            title.SetImageResource(Resource.Drawable.Cover);

            register.Click += delegate
            {
                if ((number.Text == "") || (code.Text == "") || (psw.Text == "") || (confirm.Text == ""))
                {
                    Toast.MakeText(this, "请输入完整的注册信息!", ToastLength.Short).Show();
                }
                else if (number.Text.Length != 11 || !Regex.IsMatch(number.Text, @"^[+-]?\d*$"))
                {
                    Toast.MakeText(this, "手机号码格式不正确", ToastLength.Short).Show();
                }
                else if ((psw.Text != confirm.Text))
                {
                    Toast.MakeText(this, "两次输入的密码不一致!", ToastLength.Short).Show();
                }
                else if (code.Text != "123456")
                {
                    Toast.MakeText(this, "验证码错误!", ToastLength.Short).Show();
                }
                else
                {
                    string res = RegisterData.Post("http://115.159.145.115/Register.php/", number.Text, psw.Text);
                    if (res == "0")
                    {
                        Toast.MakeText(this, "该号码已被注册!", ToastLength.Short).Show();
                    }
                    else if (res == "1")
                    {
                        Intent ActSuccess = new Intent(this, typeof(RegisterSuccess));
                        StartActivity(ActSuccess);
                    }
                }
            };
            sendCode.Click += delegate
            {
                MyCount mc = new MyCount(this, 60000, 1000);
                mc.Start();
            };
            regLayout.Click += delegate
            {
                Android.Views.InputMethods.InputMethodManager imm = (Android.Views.InputMethods.InputMethodManager)GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(number.WindowToken, 0);
                imm.HideSoftInputFromWindow(code.WindowToken, 0);
                imm.HideSoftInputFromWindow(psw.WindowToken, 0);
                imm.HideSoftInputFromWindow(confirm.WindowToken, 0);
            };
        }
예제 #12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.Login);

            Button       register   = FindViewById <Button>(Resource.Id.logBtnRegister);
            Button       login      = FindViewById <Button>(Resource.Id.logBtnLogin);
            Button       forget     = FindViewById <Button>(Resource.Id.logBtnForget);
            Button       QQ         = FindViewById <Button>(Resource.Id.logBtnQQLogin);
            EditText     number     = FindViewById <EditText>(Resource.Id.logEditNumber);
            EditText     psw        = FindViewById <EditText>(Resource.Id.logEditPassword);
            LinearLayout mainLayout = FindViewById <LinearLayout>(Resource.Id.logLayout);
            ImageView    title      = FindViewById <ImageView>(Resource.Id.Title);

            title.SetImageResource(Resource.Drawable.Cover);

            register.Click += delegate
            {
                Intent ActRegister = new Intent(this, typeof(Register));
                StartActivity(ActRegister);
            };
            login.Click += delegate
            {
                if (number.Text == "")
                {
                    Toast.MakeText(this, "请输入手机号", ToastLength.Short).Show();
                }
                else if (psw.Text == "")
                {
                    Toast.MakeText(this, "请输入密码", ToastLength.Short).Show();
                }
                else
                {
                    string res;

                    res = LoginData.Post("http://115.159.145.115/Login.php/", number.Text, psw.Text);

                    if (res == "1")
                    {
                        Intent                   ActIndex = new Intent(this, typeof(Index));
                        ISharedPreferences       LoginSP  = GetSharedPreferences("LoginData", FileCreationMode.Private);
                        ISharedPreferencesEditor editor   = LoginSP.Edit();
                        editor.Clear();
                        editor.PutString("PhoneNum", number.Text);
                        editor.PutString("RealName", RealNameCheckData.Post("http://115.159.145.115/RealNameCheck.php", number.Text));
                        editor.Commit();
                        StartActivity(ActIndex);
                    }
                    else if (res == "2")
                    {
                        Intent                   Actadm  = new Intent(this, typeof(Admin));
                        ISharedPreferences       LoginSP = GetSharedPreferences("LoginData", FileCreationMode.Private);
                        ISharedPreferencesEditor editor  = LoginSP.Edit();
                        editor.Clear();
                        editor.PutString("PhoneNum", number.Text);
                        editor.Commit();
                        StartActivity(Actadm);
                    }
                    else
                    {
                        Toast.MakeText(this, "账号或密码错误!", ToastLength.Short).Show();
                    }
                }
            };
            forget.Click += delegate
            {
                Toast.MakeText(this, "此功能正在开发中", ToastLength.Short).Show();
            };
            QQ.Click += delegate
            {
                Toast.MakeText(this, "此功能正在开发中", ToastLength.Short).Show();
            };
            mainLayout.Click += delegate
            {
                Android.Views.InputMethods.InputMethodManager imm = (Android.Views.InputMethods.InputMethodManager)GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(number.WindowToken, 0);
                imm.HideSoftInputFromWindow(psw.WindowToken, 0);
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var calculate = new ClsTipCalculator();

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button>(Resource.Id.myButton);

            button.Click += delegate { button.Text = $"{count++} clicks!"; };



            //Get subTotal from layout resource and attach to event
            EditText _subTotal = FindViewById <EditText>(Resource.Id.subTotal);

            TextView _total = FindViewById <TextView>(Resource.Id.total);


            //seekbar for user generosity
            SeekBar _seek = FindViewById <SeekBar>(Resource.Id.seekBar);



            TextView _tipValue = FindViewById <TextView>(Resource.Id.tip);


            _subTotal.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => {
                if (string.IsNullOrEmpty(_subTotal.Text))
                {
                    _seek.Enabled = false;
                }
                else
                {
                    _seek.Enabled = true;
                    double _dSubTotal = double.Parse(_subTotal.Text.ToString());

                    var sub_tot = calculate.BillTotal(_dSubTotal, _generosity);

                    _total.Text = string.Format(sub_tot.ToString());
                }
            };

            _seek.ProgressChanged += (object sender, SeekBar.ProgressChangedEventArgs e) => {
                if (e.FromUser)
                {
                    _generosity    = int.Parse(e.Progress.ToString());
                    _tipValue.Text = string.Format("{0}%", e.Progress);

                    double _dSubTotal = double.Parse(_subTotal.Text.ToString());

                    var sub_tot = calculate.BillTotal(_dSubTotal, _generosity);

                    _total.Text = string.Format(sub_tot.ToString());
                }
            };



            //make return key to send or calculate tip
            _subTotal.EditorAction += (sender, e) => {
                if (e.ActionId == Android.Views.InputMethods.ImeAction.Done)
                {
                    //enable seekbar if user enters value
                    if (string.IsNullOrEmpty(_subTotal.Text))
                    {
                        _seek.Enabled = false;
                    }
                    else
                    {
                        _seek.Enabled = true;
                        double _dSubTotal = double.Parse(_subTotal.Text.ToString());

                        var sub_tot = calculate.BillTotal(_dSubTotal, _generosity);

                        _total.Text = string.Format(sub_tot.ToString());
                    }
                }
                else
                {
                    e.Handled = false;
                }
            };



            _subTotal.FocusChange += (object sender, Android.Views.View.FocusChangeEventArgs e) => {
                Android.Views.InputMethods.InputMethodManager imm = (Android.Views.InputMethods.InputMethodManager)Application.Context.GetSystemService(InputMethodService);
                imm.HideSoftInputFromWindow(_subTotal.WindowToken, 0);
            };
        }