Beispiel #1
0
        public void selectItem(int item)
        {
            switch (item)
            {
            //item - item on the drawer list on left side
            case 0:
                Toast.MakeText(ApplicationContext, "Naciśnięto Settings", ToastLength.Long).Show();
                mDrawerLayout.CloseDrawer(mLeftDrawer);
                ShowFragment(mSettingFragment);
                break;

            case 1:
                Toast.MakeText(ApplicationContext, "Naciśnięto Logout ", ToastLength.Long).Show();
                //function to logout
                //change activity to sing in / sing up activity
                LogInModule lg = new LogInModule();
                lg.setFalseRemeberMe();                                 //set RememberMe to false - autoLogin to NoAutoLogin

                Intent intent = new Intent(this, typeof(MainActivity)); // i tutaj trzeba dodać że jak się wylogowuje to wpisuje w plik LogInData.xml false wtedy będzie sie mogło wrzucić okno do logowania
                this.StartActivity(intent);
                this.Finish();
                break;

            default:
                Toast.MakeText(ApplicationContext, "Naciśnięto coś z poza!", ToastLength.Long).Show();
                break;
            }
            //Toast.MakeText(ApplicationContext, "Naciśnięto", ToastLength.Long).Show();
        }
Beispiel #2
0
        private void client_UploadValuesCompleted2(object sender, UploadValuesCompletedEventArgs e)
        {
            //lDialog.View.FindFocus();
            //color to sign wrong wrote filed
            Color colorWrong   = Color.ParseColor("#FFCDD2");           //red
            Color colorGood    = Color.ParseColor("#ffffff");           //white
            Color colorAllGood = Color.ParseColor("#64FFDA");           //Green

            try
            {
                //login
                EditText    mtxtusername = signInDialog.View.FindViewById <EditText>(Resource.Id.txtLogin);
                EditText    mtxtpassword = signInDialog.View.FindViewById <EditText>(Resource.Id.txtPassowrd);
                RadioButton rbRememberMe = signInDialog.View.FindViewById <RadioButton>(Resource.Id.rb_rememberMe);

                string result = System.Text.Encoding.UTF8.GetString(e.Result);

                if (result.Contains("Wrong data") && mtxtpassword.Length() < 1)
                {
                    //nie działa czemu ?:(
                    Toast.MakeText(ApplicationContext, GetString(Resource.String.AllfieldsmustBefilledIn), ToastLength.Long).Show();
                    mtxtusername.SetBackgroundColor(colorWrong);
                    mtxtpassword.SetBackgroundColor(colorWrong);
                }
                else if (result.Contains("Wrong data") && !(mtxtpassword.Length() > 1))
                {
                    Toast.MakeText(ApplicationContext, GetString(Resource.String.AllfieldsmustBefilledIn), ToastLength.Long).Show();
                    mtxtusername.SetBackgroundColor(colorWrong);
                    mtxtpassword.SetBackgroundColor(colorWrong);
                }
                else
                {
                    mtxtusername.SetBackgroundColor(colorGood);
                    mtxtpassword.SetBackgroundColor(colorGood);
                }
                if (result.Contains("Success"))
                {
                    Toast.MakeText(ApplicationContext, GetString(Resource.String.logInSuccess), ToastLength.Long).Show();
                    mtxtusername.SetBackgroundColor(colorAllGood);
                    mtxtpassword.SetBackgroundColor(colorAllGood);

                    mProgressBar.Visibility = Android.Views.ViewStates.Visible;
                    LogInModule lg = new LogInModule();
                    lg.AddUserParams(mtxtusername.ToString(), mtxtpassword.ToString(), rbRememberMe.Checked);
                    lg.saveLoginData();
                    //don't knwo why colors not set at #64FFDA after all good field
                    Thread.Sleep(1000);
                    signInDialog.Dismiss();
                    Thread thread = new Thread(logInSuccessProcess);
                    thread.Start();
                }
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.ToString());
            }
        }
Beispiel #3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.Home, container, false);

            LogInModule lg = new LogInModule();
            TextView    _userNameTXTVIEW = view.FindViewById <TextView>(Resource.Id.nav_userNameHome);

            _userNameTXTVIEW.Text = lg.GetUserName();

            return(view);
        }
Beispiel #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            SupportToolbar toolBar = FindViewById <SupportToolbar>(Resource.Id.toolBar);


            mLocationMap = new LocationMap();
            mOSMMap      = new BaseOSMMap();
            mHome        = new Home();

            mapWithLabel   = new SampleWithMinimapItemizedOverlayWithFocus();
            mStackFragment = new Stack <SupportFragment>();
            var trans = SupportFragmentManager.BeginTransaction();

            trans.Add(Resource.Id.fragmentContainer, mLocationMap, "mainPage");
            trans.Add(Resource.Id.fragmentContainer, mOSMMap, "OSMMAP");
            trans.Add(Resource.Id.fragmentContainer, mapWithLabel, "MapWithLabel");
            trans.Add(Resource.Id.fragmentContainer, mHome, "Home");
            trans.Hide(mLocationMap);
            trans.Hide(mOSMMap);
            trans.Hide(mapWithLabel);
            trans.Commit();
            mCurrentFragment = mHome;//mMainPage;


            SetSupportActionBar(toolBar);

            SupportActionBar ab = SupportActionBar;

            ab.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            ab.SetDisplayHomeAsUpEnabled(true);

            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);


            if (navigationView != null)
            {
                SetUpDrawerContent(navigationView);
            }
            LogInModule lg               = new LogInModule();
            View        header           = navigationView.GetHeaderView(0);
            TextView    _userNameTXTVIEW = header.FindViewById <TextView>(Resource.Id.nav_userName);

            /*View view=navigationView.inflateHeaderView(R.layout.nav_header_main);*/
            _userNameTXTVIEW.Text = lg.GetUserName();
        }
Beispiel #5
0
        protected override void OnCreate(Bundle bundle)
        {
            Intent intent = new Intent(this, typeof(mainView));

            base.OnCreate(bundle);
            LogInModule lg = new LogInModule();

            if (lg.checkAutoLogin()) // jeżeli tutaj przeczytam w pliku LogInData XML że jest true dla remenber me to się loguje i wbijam prosto do mainView/ jeżeli nie to okno startowe.
            {
                this.StartActivity(intent);
                this.Finish();
            }
            else
            {
                // Set our view from the "main" layout resource
                SetContentView(Resource.Layout.Main);

                mBtnSignUp   = FindViewById <Button>(Resource.Id.btnSignUp);
                mBtnSignIn   = FindViewById <Button>(Resource.Id.btnSignIn);
                mProgressBar = FindViewById <ProgressBar>(Resource.Id.progressBar1);

                mBtnSignUp.Click += (object sender, EventArgs args) =>
                {
                    //Pull up dialog
                    FragmentTransaction transaction = FragmentManager.BeginTransaction();
                    signUpDialog = new dialog_SignUp();

                    signUpDialog.Show(transaction, "dialog fragment");
                    signUpDialog.mOnSignUpComplete += singUpDialog_mOnSingUpComplete;
                };
                mBtnSignIn.Click += (object sender, EventArgs args) =>
                {
                    FragmentTransaction transaction = FragmentManager.BeginTransaction();
                    signInDialog = new dialog_sign_in();

                    signInDialog.Show(transaction, "dialog fragment");
                    signInDialog.mOnSignInComplete += singInDialog_mOnSingInComplete;
                };
            }
        }
Beispiel #6
0
        void singInDialog_mOnSingInComplete(object sender, OnSignInEvenArgs e)
        {
            EditText    mtxtusername = signInDialog.View.FindViewById <EditText>(Resource.Id.txtLogin);
            EditText    mtxtpassword = signInDialog.View.FindViewById <EditText>(Resource.Id.txtPassowrd);
            RadioButton rbRememberMe = signInDialog.View.FindViewById <RadioButton>(Resource.Id.rb_rememberMe);

            LogInModule lg = new LogInModule();

            lg.AddUserParams(mtxtusername.Text.ToString(), mtxtpassword.Text.ToString(), rbRememberMe.Checked);
            //login

            string txtpasswd = mtxtpassword.Text;
            string txtname   = mtxtusername.Text;

            // set color if someting wrong
            if (txtname.Count() < 1 && txtpasswd.Count() < 1)
            {
                mtxtusername.SetBackgroundColor(lg.colorWrong);
                mtxtpassword.SetBackgroundColor(lg.colorWrong);
                Toast.MakeText(ApplicationContext, GetString(Resource.String.AllfieldsmustBefilledIn), ToastLength.Long).Show();
            }
            else if (txtname.Count() < 1)
            {
                mtxtusername.SetBackgroundColor(lg.colorWrong);
                mtxtpassword.SetBackgroundColor(lg.colorGood);
                Toast.MakeText(ApplicationContext, GetString(Resource.String.NeedLogin), ToastLength.Long).Show();
            }
            else if (txtpasswd.Count() < 1)
            {
                mtxtpassword.SetBackgroundColor(lg.colorWrong);
                mtxtusername.SetBackgroundColor(lg.colorGood);
                Toast.MakeText(ApplicationContext, GetString(Resource.String.NeedPassword), ToastLength.Long).Show();
            }
            else
            {
                mtxtusername.SetBackgroundColor(lg.colorGood);
                mtxtpassword.SetBackgroundColor(lg.colorGood);
                logiInRequest(txtname, txtpasswd);
            }
        }
Beispiel #7
0
        private void SetUpDrawerContent(NavigationView navigationView)
        {
            navigationView.BringToFront();
            LogInModule lg = new LogInModule();

            navigationView.NavigationItemSelected += (object sender, NavigationView.NavigationItemSelectedEventArgs e) =>
            {
                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_home:
                    ShowFragment(mHome);
                    mDrawerLayout.CloseDrawers();
                    break;

                case Resource.Id.nav_map:
                    ShowFragment(mapWithLabel);
                    mDrawerLayout.CloseDrawers();
                    break;

                case Resource.Id.nav_logOut:
                    lg.setFalseRemeberMe();                                 //set RememberMe to false - autoLogin to NoAutoLogin
                    Intent intent = new Intent(this, typeof(MainActivity)); // i tutaj trzeba dodać że jak się wylogowuje to wpisuje w plik LogInData.xml false wtedy będzie sie mogło wrzucić okno do logowania
                    this.StartActivity(intent);
                    this.Finish();
                    break;

                case Resource.Id.nav_set:
                    ShowFragment(mLocationMap);
                    mDrawerLayout.CloseDrawers();
                    break;

                default:
                    mDrawerLayout.CloseDrawers();
                    break;
                }
                e.MenuItem.SetChecked(true);
            };
        }