Beispiel #1
0
 protected void setupNavigationView(NavigationView navigationView)
 {
     drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
     if (navigationView != null)
     {
         navigationView.NavigationItemSelected += (sender, e) => {
             e.MenuItem.SetChecked (true);
             drawerLayout.CloseDrawers ();
         };
     }
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            var config = ImageLoaderConfiguration.CreateDefault(ApplicationContext);
            // Initialize ImageLoader with configuration.
            ImageLoader.Instance.Init(config);

            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);

            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);
            navigationView.NavigationItemSelected += (sender, e) =>
            {

                if (previousItem != null)
                    previousItem.SetChecked(false);

                navigationView.SetCheckedItem(e.MenuItem.ItemId);

                previousItem = e.MenuItem;

                switch (e.MenuItem.ItemId)
                {
                    case Resource.Id.nav_home:
                        ListItemClicked(0);
                        break;
                    case Resource.Id.nav_friends:
                        ListItemClicked(1);
                        break;
                    case Resource.Id.nav_profile:
                        ListItemClicked(2);
                        break;
                }



                drawerLayout.CloseDrawers();
            };

            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                ListItemClicked(0);
                navigationView.SetCheckedItem(Resource.Id.nav_home);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            drawerLayout = this.FindViewById<DrawerLayout>(Resource.Id.drawer_layout);

            //Set hamburger items menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);

            //setup navigation view
            navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);

            //handle navigation
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                if (previousItem != null)
                    previousItem.SetChecked(false);

                navigationView.SetCheckedItem(e.MenuItem.ItemId);

                previousItem = e.MenuItem;

                switch (e.MenuItem.ItemId)
                {
                    case Resource.Id.nav_home_1:
                        ListItemClicked(0);
                        break;
                    case Resource.Id.nav_home_2:
                        ListItemClicked(1);
                        break;
                }


                drawerLayout.CloseDrawers();
            };


            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                navigationView.SetCheckedItem(Resource.Id.nav_home_1);
                ListItemClicked(0);
            }
        }
Beispiel #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.dash_layout);
            var toolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.toolbar);
            SetSupportActionBar (toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled (true);
            SupportActionBar.SetHomeAsUpIndicator (Resource.Drawable.ic_menu);

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

            navigationView.NavigationItemSelected += (sender, e) => {
                e.MenuItem.SetChecked (true);
                drawerlayout.CloseDrawers ();
            };
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

#if !XTC
            InitializeHockeyApp();
#endif
            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);

            //Set hamburger items menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);

            //setup navigation view
            navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);

            //handle navigation
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);

                ListItemClicked(e.MenuItem.ItemId);


                SupportActionBar.Title = e.MenuItem.ItemId == Resource.Id.menu_profile
                    ? Settings.Current.UserFirstName
                    : e.MenuItem.TitleFormatted.ToString();

                drawerLayout.CloseDrawers();
            };

            if (Intent.GetBooleanExtra("tracking", false))
            {
                ListItemClicked(Resource.Id.menu_current_trip);
                SupportActionBar.Title = "Current Trip";
                return;
            }

            //if first time you will want to go ahead and click first item.
            if (bundle == null)
            {
                ListItemClicked(Resource.Id.menu_current_trip);
                SupportActionBar.Title = "Current Trip";
            }
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            var dbPath = Path.Combine(path, "counters.db3");
            DatabaseHelper.CreateDatabase(dbPath);

            await ViewModelLocator.Counters.LoadCountersAsync();

            _drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);

            //Set hamburger items menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);

            //setup navigation view
            _navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);

            //handle navigation
            _navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);

                switch (e.MenuItem.ItemId)
                {
                    case Resource.Id.nav_counters:
                        ListItemClicked(0);
                        break;
                    case Resource.Id.nav_about:
                        ListItemClicked(1);
                        break;
                }
                
                _drawerLayout.CloseDrawers();
            };


            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                ListItemClicked(0);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            drawerLayout = this.FindViewById<DrawerLayout>(Resource.Id.drawer_layout);

            //Set hamburger items menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);

            //setup navigation view
            navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);

            //handle navigation
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);

                switch (e.MenuItem.ItemId)
                {
                    case Resource.Id.nav_home_1:
                        ListItemClicked(0);
                        break;
                    case Resource.Id.nav_home_2:
                        ListItemClicked(1);
                        break;
                }

                Snackbar.Make(drawerLayout, "You selected: " + e.MenuItem.TitleFormatted, Snackbar.LengthLong)
                    .Show();

                drawerLayout.CloseDrawers();
            };

            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                ListItemClicked(0);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Xamarin.Insights.Initialize (BO.Insights.ApiKey, this);
            base.OnCreate (savedInstanceState);

            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);

            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);

            navigationView.NavigationItemSelected += (sender, e) => {
                e.MenuItem.SetChecked(true);

                switch (e.MenuItem.ItemId)
                {
                    case Resource.Id.nav_Resultados:
                        ListItemClicked(0);
                        break;
                    case Resource.Id.nav_CrearGrupo:
                        ListItemClicked(1);
                        break;
                    case Resource.Id.nav_MisGrupos:
                        ListItemClicked(2);
                        break;
                    case Resource.Id.nav_estadisticas:
                        ListItemClicked(3);
                        break;
                }
                drawerLayout.CloseDrawers();
            };

            // 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);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);

            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);




            navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);

                switch (e.MenuItem.ItemId)
                {
                    case Resource.Id.nav_home:
                        ListItemClicked(0);
                        break;
                    case Resource.Id.nav_profile:
                        ListItemClicked(2);
                        break;
                }

				

                drawerLayout.CloseDrawers();
            };

           



            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                ListItemClicked(0);
            }

            OnNewIntent(Intent);


        }
Beispiel #10
0
        /// <summary>
        /// Navigations the view navigation item selected.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        void NavigationView_NavigationItemSelected(object sender, NavigationView.NavigationItemSelectedEventArgs e)
        {
            var ft = FragmentManager.BeginTransaction();

            switch (e.MenuItem.ItemId)
            {
            case (Resource.Id.nav_aries):
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.HomeLayout, new HoroscopoFragment(1));
                ft.Commit();
                break;

            case (Resource.Id.nav_tauro):
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.HomeLayout, new HoroscopoFragment(2));
                ft.Commit();
                break;

            case (Resource.Id.nav_geminis):
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.HomeLayout, new HoroscopoFragment(3));
                ft.Commit();
                break;

            case (Resource.Id.nav_cancer):
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.HomeLayout, new HoroscopoFragment(4));
                ft.Commit();
                break;

            case (Resource.Id.nav_leo):
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.HomeLayout, new HoroscopoFragment(5));
                ft.Commit();
                break;

            case (Resource.Id.nav_virgo):
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.HomeLayout, new HoroscopoFragment(6));
                ft.Commit();
                break;

            case (Resource.Id.nav_libra):
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.HomeLayout, new HoroscopoFragment(7));
                ft.Commit();
                break;

            case (Resource.Id.nav_escorpion):
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.HomeLayout, new HoroscopoFragment(8));
                ft.Commit();
                break;

            case (Resource.Id.nav_sagitario):
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.HomeLayout, new HoroscopoFragment(9));
                ft.Commit();
                break;

            case (Resource.Id.nav_capricornio):
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.HomeLayout, new HoroscopoFragment(10));
                ft.Commit();
                break;

            case (Resource.Id.nav_acuario):
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.HomeLayout, new HoroscopoFragment(11));
                ft.Commit();
                break;

            case (Resource.Id.nav_piscis):
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.HomeLayout, new HoroscopoFragment(12));
                ft.Commit();
                break;
            }
            // Close drawer
            drawerLayout.CloseDrawers();
        }
Beispiel #11
0
        ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\
        private void NavigationView_NavigationItemSelected(object sender, NavigationView.NavigationItemSelectedEventArgs e)
        {
            switch (e.MenuItem.ItemId)
            {
            case (Resource.Id.nav_stat_compare):
                StartActivity(typeof(CompareStat));
                Finish();
                break;

            case (Resource.Id.nav_stat_info):
                StartActivity(typeof(InfoStat));
                Finish();
                break;

            case (Resource.Id.nav_avia_info):
                StartActivity(typeof(InfoPlane));
                Finish();
                break;

            case (Resource.Id.nav_avia_compare):
                StartActivity(typeof(ComparePlane));
                Finish();
                break;

            case (Resource.Id.nav_avia_thebest):
                StartActivity(typeof(TheBestPlane));
                Finish();
                break;

            case (Resource.Id.nav_army_info):
                StartActivity(typeof(InfoTank));
                Finish();
                break;

            case (Resource.Id.nav_army_compare):
                StartActivity(typeof(CompareTank));
                Finish();
                break;

            case (Resource.Id.nav_army_thebest):
                StartActivity(typeof(TheBestTank));
                Finish();
                break;

            case (Resource.Id.nav_heli_info):
                StartActivity(typeof(InfoHeli));
                Finish();
                break;

            case (Resource.Id.nav_heli_compare):
                StartActivity(typeof(CompareHeli));
                Finish();
                break;

            case (Resource.Id.nav_heli_thebest):
                StartActivity(typeof(TheBestHeli));
                Finish();
                break;

            case (Resource.Id.nav_navy_info):
                StartActivity(typeof(InfoShip));
                Finish();
                break;

            case (Resource.Id.nav_navy_compare):
                StartActivity(typeof(CompareShip));
                Finish();
                break;

            case (Resource.Id.nav_navy_thebest):
                StartActivity(typeof(TheBestShip));
                Finish();
                break;

            case (Resource.Id.nav_dedoHerzer):
                StartActivity(typeof(Dedoherzer));
                Finish();
                break;

            case (Resource.Id.nav_memes):
                StartActivity(typeof(Memes));
                Finish();
                break;

            case (Resource.Id.nav_feedback):
                StartActivity(typeof(Feedback));
                Finish();
                break;
            }
            drawerLayout.CloseDrawers();
        }
Beispiel #12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            //initialize the toolbar
            SetSupportActionBar(Toolbar);
            Toolbar.Title = _viewTitle;

            _dataManager = DataManager.GetInstance();
            _dataBundle  = new Bundle();
            //get current logged in user
            var currentUser = ParseUser.CurrentUser;

            _drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);


            //Set hamburger items menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);

            //setup navigation view
            _navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            // View h = FindViewById(Resource.Id.menu_edit);

            //handle navigation
            _navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);
                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_home:
                    ListItemClicked(0);
                    break;

                case Resource.Id.nav_user_profile:
                    ListItemClicked(1);
                    break;

                case Resource.Id.nav_user_inventory:
                    ListItemClicked(2);
                    break;

                case Resource.Id.nav_user_requests:
                    ListItemClicked(3);
                    break;

                case Resource.Id.nav_user_settings:
                    ListItemClicked(4);
                    break;

                case Resource.Id.nav_help:
                    ListItemClicked(5);
                    break;

                case Resource.Id.nav_signout:
                    ListItemClicked(6);
                    break;
                }


                //Snackbar.Make(_drawerLayout, "You selected: " + e.MenuItem.TitleFormatted, Snackbar.LengthLong).Show();

                //lets put the data in the bundle we created
                //we will pass this bundlle to all needed activities
                _username = currentUser.Username;
                _dataBundle.PutString("username", currentUser.Username); //add the username
                _dataBundle.PutString("userid", currentUser.ObjectId);

                _drawerLayout.CloseDrawers();
            };



            //set the build number in the menu
            var buildMenu = _navigationView.Menu.FindItem(Resource.Id.app_build);

            buildMenu.SetTitle(string.Format("Version {0}", HelperClass.BuildNumber));

            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                ListItemClicked(0);
            }
        }
Beispiel #13
0
 public override void InvalidateOptionsMenu()
 {
     base.InvalidateOptionsMenu();
     _drawer.CloseDrawers();
 }
Beispiel #14
0
        // Method om de navigatie UI op te zetten
        private void SetUpNavigation(Bundle bundle)
        {
            mToolbar      = FindViewById <SupportToolbar>(Resource.Id.toolbar);
            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            mLeftDrawer   = FindViewById <ListView>(Resource.Id.left_drawer);

            mLeftDrawer.Tag = 0;

            SetSupportActionBar(mToolbar);

            mLeftDataSet = new List <string>();
            mLeftDataSet.Add("Run");
            mLeftDataSet.Add("History");
            mLeftAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, mLeftDataSet);

            mLeftDrawer.Adapter = mLeftAdapter;

            mLeftDrawer.ItemClick += (sender, e) =>
            {
                Log.Info("itemclick", e.ToString());
                Log.Info("itemclick", sender.ToString());

                switch (e.Position)
                {
                case 0:
                    ShowFragment(mapFragment);
                    mDrawerLayout.CloseDrawers();

                    break;

                case 1:
                    ShowFragment(historyFragment);
                    mDrawerLayout.CloseDrawers();
                    break;
                }
            };


            mDrawerToggle = new MyActionBarDrawerToggle(
                this,                           //Host Activity
                mDrawerLayout,                  //DrawerLayout
                Resource.String.openDrawer,     //Opened Message
                Resource.String.closeDrawer     //Closed Message
                );

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            mDrawerLayout.SetDrawerListener(mDrawerToggle);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(false);
            mDrawerToggle.SyncState();

            if (bundle != null)
            {
                if (bundle.GetString("DrawerState") == "Opened")
                {
                    SupportActionBar.SetTitle(Resource.String.openDrawer);
                }

                else
                {
                    SupportActionBar.SetTitle(Resource.String.closeDrawer);
                }
            }

            else
            {
                //This is the first the time the activity is ran
                SupportActionBar.SetTitle(Resource.String.closeDrawer);
            }
        }
Beispiel #15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            //notificacion hubs
            if (Intent.Extras != null)
            {
                foreach (var key in Intent.Extras.KeySet())
                {
                    if (key != null)
                    {
                        var value = Intent.Extras.GetString(key);
                        Log.Debug(TAG, "Key: {0} Value: {1}", key, value);
                    }
                }
            }
            //Thread.Sleep(1000);
            SetContentView(Resource.Layout.activity_main);

            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            if (toolbar != null)
            {
                SetSupportActionBar(toolbar);
                //Thread.Sleep(2000);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetHomeButtonEnabled(true);
            }

            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            //Set hamburger items menu


            //aqui tenes que cambiarlo por ic_menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);

            //setup navigation view
            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            //handle navigation
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                if (previousItem != null)
                {
                    previousItem.SetChecked(false);
                }

                navigationView.SetCheckedItem(e.MenuItem.ItemId);

                previousItem = e.MenuItem;

                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_camera:
                    ListItemClicked(0);
                    break;

                case Resource.Id.nav_gallery:
                    ListItemClicked(1);
                    break;

                case Resource.Id.nav_slideshow:
                    ListItemClicked(2);
                    break;
                    //case Resource.Id.nav_home_4:
                    //    ListItemClicked(3);
                    //    break;
                    //case Resource.Id.nav_home_5:
                    //    ListItemClicked(4);
                    //    break;
                    //case Resource.Id.nav_home_6:
                    //    ListItemClicked(5);
                    //    break;
                    //case Resource.Id.nav_home_7:
                    //    ListItemClicked(6);
                    //    break;
                }


                drawerLayout.CloseDrawers();
            };


            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                navigationView.SetCheckedItem(Resource.Id.nav_camera);
                ListItemClicked(0);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            userType = Intent.GetStringExtra("Type");
            // Gets the type of the user ie Student or Landlord
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.main);
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            if (toolbar != null)
            {
                SetSupportActionBar(toolbar);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetHomeButtonEnabled(true);
            }

            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            // Creates the navigation bar for the program and sets it

            //Set hamburger items menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);

            //setup navigation view
            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);


            //handle navigation
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                if (previousItem != null)
                {
                    previousItem.SetChecked(false);
                }

                navigationView.SetCheckedItem(e.MenuItem.ItemId);

                previousItem = e.MenuItem;

                // Switches the result on what button is clicked on in the nav bar
                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_home_1:
                    ListItemClicked(0);
                    break;

                case Resource.Id.nav_properties:
                    Intent map = new Intent(this, typeof(DisplayMap));
                    StartActivity(map);
                    Finish();
                    //ListItemClicked(1);
                    break;

                case Resource.Id.nav_search:
                    ListItemClicked(2);
                    break;

                case Resource.Id.nav_profile:
                    ListItemClicked(3);
                    break;

                case Resource.Id.nav_extra1:
                    ListItemClicked(4);
                    break;

                case Resource.Id.nav_extra2:
                    ListItemClicked(5);
                    break;

                case Resource.Id.nav_logout:
                    Intent i = new Intent(this, typeof(Login));
                    StartActivity(i);
                    Finish();
                    break;
                }


                drawerLayout.CloseDrawers();
            };

            if (userType == "Landlord")
            {
                IMenuItem item1 = navigationView.Menu.FindItem(Resource.Id.nav_extra1);
                item1.SetTitle("Add Property");
                IMenuItem item2 = navigationView.Menu.FindItem(Resource.Id.nav_extra2);
                item2.SetTitle("My Properties");
                // If the user type is Landlord, it sets the two extra features to these options
            }
            else
            {
                IMenuItem item1 = navigationView.Menu.FindItem(Resource.Id.nav_extra1);
                item1.SetTitle("Favourite Properties");
                IMenuItem item2 = navigationView.Menu.FindItem(Resource.Id.nav_extra2);
                item2.SetTitle("My Reviews");
                // If you're a student the options are different
            }

            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                markerTitle = Intent.GetStringExtra("accomTitle");
                // Gets the marker title from the string
                if (markerTitle != null)
                // The marker is null if you havent clicked a marker on the Map page
                {
                    ListItemClicked(6);
                    // This takes you to the property page from the marker you have clicked on
                }
                else
                {
                    navigationView.SetCheckedItem(Resource.Id.nav_home_1);
                    ListItemClicked(0);
                    // Takes you to the home page which for us is the student or landlord dashboard
                }
            }
        }
Beispiel #17
0
        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);
            Intent          intent;
            SupportFragment newFragment = new Hub();
            var             trans       = SupportFragmentManager.BeginTransaction();

            trans.Add(Resource.Id.flContent, newFragment, "Hub");
            trans.Commit();


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

            View            navheader = navigationView.GetHeaderView(0);
            CircleImageView iv        = (CircleImageView)navheader.FindViewById(Resource.Id.imageCustomerIcon);

            iv.Click += delegate
            {
                intent = new Intent(this, typeof(Profile));
                OverridePendingTransition(Resource.Animation.animRight, Resource.Animation.animRight2);
                this.StartActivity(intent);
            };

            await LoadAccount();

            navigationView.NavigationItemSelected += (sender, e) =>
            {
                SupportFragment frag;
                e.MenuItem.SetChecked(true);
                switch (e.MenuItem.ItemId)
                {
                case (Resource.Id.nav_hub):

                    frag        = (SupportFragment)SupportFragmentManager.FindFragmentByTag("Hub");
                    newFragment = new Hub();
                    trans       = SupportFragmentManager.BeginTransaction();
                    trans.Replace(Resource.Id.flContent, newFragment, "Hub");
                    if (frag == null)
                    {
                        trans.AddToBackStack("Hub");
                    }
                    trans.Commit();
                    OverridePendingTransition(Resource.Animation.animRight, Resource.Animation.animRight2);
                    break;

                case (Resource.Id.nav_tournament):
                    frag        = (SupportFragment)SupportFragmentManager.FindFragmentByTag("Turnieje");
                    newFragment = new Tournament(null, null, null, null, null);
                    trans       = SupportFragmentManager.BeginTransaction();
                    trans.Replace(Resource.Id.flContent, newFragment, "Turnieje");
                    if (frag == null)
                    {
                        trans.AddToBackStack("Turnieje");
                    }
                    trans.Commit();
                    OverridePendingTransition(Resource.Animation.animRight, Resource.Animation.animRight2);
                    break;

                case (Resource.Id.nav_quickgame):
                    frag        = (SupportFragment)SupportFragmentManager.FindFragmentByTag("Szybka gra");
                    newFragment = new Quickgame();
                    trans       = SupportFragmentManager.BeginTransaction();
                    trans.Replace(Resource.Id.flContent, newFragment, "Szybka gra");
                    if (frag == null)
                    {
                        trans.AddToBackStack("Szybka gra");
                    }
                    trans.Commit();
                    OverridePendingTransition(Resource.Animation.animRight, Resource.Animation.animRight2);
                    break;

                case (Resource.Id.nav_findplayers):
                    frag        = (SupportFragment)SupportFragmentManager.FindFragmentByTag("Znajdz gracza");
                    newFragment = new Findplayers();
                    trans       = SupportFragmentManager.BeginTransaction();
                    trans.Replace(Resource.Id.flContent, newFragment, "Znajdz gracza");
                    if (frag == null)
                    {
                        trans.AddToBackStack("Znajdz gracza");
                    }
                    trans.Commit();
                    OverridePendingTransition(Resource.Animation.animRight, Resource.Animation.animRight2);
                    break;

                case (Resource.Id.nav_friends):
                    frag        = (SupportFragment)SupportFragmentManager.FindFragmentByTag("Znajomi");
                    newFragment = new FriendList();
                    trans       = SupportFragmentManager.BeginTransaction();
                    trans.Replace(Resource.Id.flContent, newFragment, "Znajomi");
                    if (frag == null)
                    {
                        trans.AddToBackStack("Znajomi");
                    }
                    trans.Commit();
                    OverridePendingTransition(Resource.Animation.animRight, Resource.Animation.animRight2);
                    break;

                case (Resource.Id.nav_profile):
                    intent = new Intent(this, typeof(Profile));
                    OverridePendingTransition(Resource.Animation.animRight, Resource.Animation.animRight2);
                    this.StartActivity(intent);


                    break;

                case (Resource.Id.nav_addQuickgame):
                    intent = new Intent(this, typeof(AddQuickgame));
                    OverridePendingTransition(Resource.Animation.animRight, Resource.Animation.animRight2);
                    this.StartActivity(intent);

                    break;

                default:
                    break;
                }

                mDrawerLayout.CloseDrawers();
            };

            pref = ((AppCompatActivity)this).GetSharedPreferences(Notyfication, FileCreationMode.Private);
            string noty = pref.GetString("Notification", "");

            if (noty == "yes")
            {
                pref = ((AppCompatActivity)this).GetSharedPreferences(runActivity, FileCreationMode.Private);
                bool run = pref.GetBoolean("MainActivity", false);
                if (run)
                {
                    Intent notint = new Intent(this, typeof(MainActivity));
                    notint.SetFlags(ActivityFlags.ClearTop);
                    notint.SetFlags(ActivityFlags.NewTask);
                    const int     pendingIntentId = 0;
                    PendingIntent pendingIntent   = PendingIntent.GetActivity(this, pendingIntentId, notint, PendingIntentFlags.OneShot);
                    var           notification    = new Notification.Builder(this);
                    notification.SetContentIntent(pendingIntent);
                    notification.SetContentText("Zaproszenie do gry");
                    notification.SetContentTitle("GameHub");
                    notification.SetSmallIcon(Resource.Drawable.Icon4);
                    notification.SetAutoCancel(true);
                    notification.SetDefaults(NotificationDefaults.Sound | NotificationDefaults.Vibrate);
                    NotificationManager NotManager = (NotificationManager)GetSystemService(Context.NotificationService);
                    NotManager.Notify(0, notification.Build());
                }
                else
                {
                }
            }
        }
Beispiel #18
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Instantiate the photo album:
            mPhotoAlbum = new PhotoAlbum();

            // Set our view from the "main" layout resource:
            SetContentView(Resource.Layout.Main);
            interstitialAds = new InterstitialAd(this);
            mAdView         = FindViewById <AdView>(Resource.Id.adView);
            var adRequest = new AdRequest.Builder().Build();

            mAdView.LoadAd(adRequest);

            interstitialAds.AdUnitId = "ca-app-pub-1120846610061033/5377390906";
            // loading test ad using adrequest
            interstitialAds.LoadAd(adRequest);

            interstitialAds.AdListener = new AdListener(this);


            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = "BEST TIPSTARS";

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

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


            myfab = FindViewById <FloatingActionButton>(Resource.Id.fab);


            // Get our RecyclerView layout:
            mRecyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);

            //............................................................
            // Layout Manager Setup:

            // Use the built-in linear layout manager:
            mLayoutManager = new LinearLayoutManager(this);


            // Or use the built-in grid layout manager (two horizontal rows):
            // mLayoutManager = new GridLayoutManager
            //        (this, 2, GridLayoutManager.Horizontal, false);

            // Plug the layout manager into the RecyclerView:
            mRecyclerView.SetLayoutManager(mLayoutManager);

            myswipeRefresh = FindViewById <SwipeRefreshLayout>(Resource.Id.refresher);
            myswipeRefresh.SetColorScheme(Resource.Color.Red, Resource.Color.Orange,
                                          Resource.Color.Yellow, Resource.Color.Green,
                                          Resource.Color.Blue, Resource.Color.Indigo,
                                          Resource.Color.Violet);
            myswipeRefresh.Refresh += MyswipeRefresh_Refresh;

            //............................................................
            // Adapter Setup:

            // Create an adapter for the RecyclerView, and pass it the
            // data set (the photo album) to manage:
            mAdapter = new PhotoAlbumAdapter(mPhotoAlbum);

            // Register the item click handler (below) with the adapter:
            mAdapter.ItemClick += OnItemClick;

            // Plug the adapter into the RecyclerView:
            mRecyclerView.SetAdapter(mAdapter);

            navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);
                Intent intent = null;
                switch (e.MenuItem.ItemId)
                {
                case
                    Resource.Id.nav_about:
                    intent = new Intent(this, typeof(About));
                    break;

                case
                    Resource.Id.nav_share:
                    intent = new Intent(Intent.ActionSend);
                    intent.SetType("text/plain");
                    intent.PutExtra(Intent.ExtraText, "https://play.google.com/store/apps/details?id=com.hamsempire.bestpredictions");
                    break;
                }
                if (intent != null)
                {
                    StartActivity(intent);
                }
                drawerLayout.CloseDrawers();
            };


            myfab.Click += async delegate(object sender, EventArgs e)
            {
                myswipeRefresh.Refreshing = true;
                await Task.Delay(5000);

                myswipeRefresh.Refreshing = false;
            };
        }
Beispiel #19
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.main);
            SendNotification();
            #region toolbar and navigation bar
            #region TOP TOOLBAR
            //TopToolbar
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            if (toolbar != null)
            {
                SetSupportActionBar(toolbar);
                SupportActionBar.Title = "Home";
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetHomeButtonEnabled(true);
            }
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            //Set hamburger items menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            //setup navigation view
            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            //mUsernameInfo = FindViewById<TextView>(Resource.Id.textDrawerUsername);
            //mUsernameInfo.Text = LoginPageActivity.StaticUserClass.Username;
            //handle navigation
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                if (previousItem != null)
                {
                    previousItem.SetChecked(false);
                }

                navigationView.SetCheckedItem(e.MenuItem.ItemId);

                previousItem = e.MenuItem;

                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_home_1:
                    SupportActionBar.Title = "Home";
                    ListItemClicked(0);
                    break;

                case Resource.Id.nav_home_2:
                    SupportActionBar.Title = "Manage Locations";
                    ListItemClicked(1);
                    break;

                case Resource.Id.nav_home_additems:
                    SupportActionBar.Title = "Add Items";
                    ListItemClicked(2);
                    break;

                case Resource.Id.nav_home_storages:
                    SupportActionBar.Title = "Manage Storages";
                    ListItemClicked(3);
                    break;

                case Resource.Id.nav_home_categories:
                    SupportActionBar.Title = "Manage Categories";
                    ListItemClicked(4);
                    break;

                case Resource.Id.nav_home_products:
                    SupportActionBar.Title = "Manage Products";
                    ListItemClicked(5);
                    break;

                case Resource.Id.nav_home_shoplist:
                    SupportActionBar.Title = "Manage ShopList";
                    ListItemClicked(6);
                    break;

                case Resource.Id.nav_home_summary:
                    SupportActionBar.Title = " Summary";
                    ListItemClicked(7);
                    break;
                }


                drawerLayout.CloseDrawers();
            };
            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                navigationView.SetCheckedItem(Resource.Id.nav_home_1);
                ListItemClicked(0);
            }
            #endregion
            #endregion
        }
Beispiel #20
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.main_layout);
            rnd     = new System.Random();
            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetTitle(Resource.String.Projects);
            SetSupportActionBar(toolbar);

            //Enable support action bar to display hamburger
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu_white_18dp);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

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

            LayoutInflater inflater = (LayoutInflater)this.GetSystemService(Context.LayoutInflaterService);
            View           v        = inflater.Inflate(Resource.Layout.drawer_header, null);

            TVUserFullName = v.FindViewById <TextView>(Resource.Id.user_full_name);
            TVUserFullName.SetBackgroundColor(Android.Graphics.Color.Argb(200, rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255)));

            TVUserFullName.Text = RedMineManager.currUser.firstname + " " + RedMineManager.currUser.lastname ?? "Firstname Lastname";
            navigationView.AddHeaderView(v);
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);
                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_my_issues:
                    Intent i0 = new Intent(this, typeof(IssueActivity.IssueActivity));
                    i0.PutExtra("Kind", "My Issues");
                    StartActivity(i0);
                    break;

                case Resource.Id.nav_projects:
                    if (RedMineManager.currUser.status == 1)
                    {
                        Intent i4 = new Intent(this, typeof(MainActivity));
                        StartActivity(i4);
                    }
                    else
                    {
                        Toast.MakeText(this, Resources.GetString(Resource.String.PermissionError), ToastLength.Short).Show();
                    }
                    break;

                case Resource.Id.settings:
                    Intent i = new Intent(this, typeof(SettingsActivity.SettingsActivity));
                    i.PutExtra("Domen", RedMineManager.client.BaseUrl.ToString());
                    StartActivity(i);
                    break;

                case Resource.Id.administration:
                    if (RedMineManager.currUser.status == 1)
                    {
                        Intent i2 = new Intent(this, typeof(VerifiedUserActivity));
                        StartActivity(i2);
                    }
                    else
                    {
                        Toast.MakeText(this, Resources.GetString(Resource.String.PermissionError), ToastLength.Short).Show();
                    }
                    break;

                case Resource.Id.log_out:
                    LoginActivity.CredentialsStore.Delete();
                    Intent i3 = new Intent(this, typeof(LoginActivity.LoginActivity));
                    Finish();
                    StartActivity(i3);
                    break;

                case Resource.Id.exit:
                    Finish();
                    break;
                }
                drawerLayout.CloseDrawers();
            };

            LinearLayout LLControls = FindViewById <LinearLayout>(Resource.Id.right_controls);
            Thread       load       = new Thread(() =>
            {
                LVProjects = FindViewById <ExpandableListView>(Resource.Id.list_projects);
                SetData();
                RunOnUiThread(() =>
                {
                    ImageView BNewProject = new ImageView(this);
                    BNewProject.SetImageResource(Resource.Drawable.ic_add_white_18dp);
                    if (RedMineManager.currUser.status != 1)
                    {
                        BNewProject.Visibility = ViewStates.Gone;
                    }
                    LLControls.AddView(BNewProject);
                    BNewProject.Click += delegate
                    {
                        Intent i = new Intent(this, typeof(NewProjectActivity));
                        i.PutExtra("IsNew", true);
                        StartActivityForResult(i, 0);
                    };

                    LVProjects.GroupClick += (object sender, ExpandableListView.GroupClickEventArgs e) =>
                    {
                        if (mAdapter.GetChildrenCount(e.GroupPosition) == 0)
                        {
                            Intent i = new Intent(this, typeof(OneProjectActivity));
                            i.PutExtra("Kind", "Project Issues");
                            i.PutExtra("ProjectId", (int)mAdapter.GetGroup(e.GroupPosition));
                            StartActivity(i);
                        }
                        else
                        if (!LVProjects.IsGroupExpanded(e.GroupPosition))
                        {
                            LVProjects.ExpandGroup(e.GroupPosition);
                        }
                        else
                        {
                            LVProjects.CollapseGroup(e.GroupPosition);
                        }
                    };

                    LVProjects.ChildClick += (object sender, ExpandableListView.ChildClickEventArgs e) =>
                    {
                        Intent i = new Intent(this, typeof(OneProjectActivity));
                        i.PutExtra("Kind", "Project Issues");
                        i.PutExtra("ProjectId", (int)mAdapter.GetChild(e.GroupPosition, e.ChildPosition));
                        StartActivity(i);
                    };
                });
            });

            load.Start();

            SwipeRefreshLayout refresh = FindViewById <SwipeRefreshLayout>(Resource.Id.swipe_refresh);

            refresh.SetDistanceToTriggerSync(50);
            refresh.SetColorSchemeResources(Resource.Color.colorAccent, Resource.Color.colorPrimary);
            refresh.Refresh += delegate
            {
                Thread t = new Thread(() =>
                {
                    SetData();
                    RunOnUiThread(() =>
                    {
                        Recreate();
                        refresh.Refreshing = false;
                    });
                });
                t.Start();
            };
        }
        private void SetupNavigationDrawer()
        {
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            if (toolbar != null)
            {
                SetSupportActionBar(toolbar);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetHomeButtonEnabled(true);
            }

            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            //Set hamburger items menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);

            //setup navigation view
            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            //handle navigation
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                if (previousItem != null)
                {
                    previousItem.SetChecked(false);
                }

                navigationView.SetCheckedItem(e.MenuItem.ItemId);

                previousItem = e.MenuItem;

                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_home:
                    ListItemClicked(0);
                    break;

                case Resource.Id.nav_restaurants:
                    ListItemClicked(1);
                    break;

                case Resource.Id.nav_menu:
                    ListItemClicked(2);
                    break;

                case Resource.Id.nav_login:
                    ListItemClicked(3);
                    break;

                case Resource.Id.nav_register:
                    ListItemClicked(4);
                    break;

                case Resource.Id.nav_account_details:
                    ListItemClicked(5);
                    break;

                case Resource.Id.nav_account_bookings:
                    ListItemClicked(6);
                    break;

                case Resource.Id.nav_logout:
                    ListItemClicked(7);
                    break;

                case Resource.Id.nav_exit:
                    ListItemClicked(8);
                    break;
                }

                drawerLayout.CloseDrawers();
            };
        }
Beispiel #22
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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


            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            //For showing back button
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(false);
            //setting Hamburger icon Here
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.cancel);
            //Getting Drawer Layout declared in UI and handling closing and open events
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            drawerLayout.DrawerOpened += DrawerLayout_DrawerOpened;
            drawerLayout.DrawerClosed += DrawerLayout_DrawerClosed;
            navigationView             = FindViewById <NavigationView>(Resource.Id.nav_view);
            toggle = new Android.Support.V7.App.ActionBarDrawerToggle
                     (
                this,
                drawerLayout,
                Resource.String.str_drawer_open,
                Resource.String.str_drawer_close
                     );
            drawerLayout.AddDrawerListener(toggle);
            //Synchronize the state of the drawer indicator/affordance with the linked DrawerLayout
            toggle.SyncState();
            //Handling click events on Menu items
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                if (previousItem != null)
                {
                    previousItem.SetChecked(false);
                }

                navigationView.SetCheckedItem(e.MenuItem.ItemId);

                previousItem = e.MenuItem;

                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_calander:
                    ListItemClicked(0);
                    break;

                case Resource.Id.nav_reservation:
                    ListItemClicked(1);
                    break;

                case Resource.Id.nav_logout:
                    ListItemClicked(2);
                    break;
                }


                drawerLayout.CloseDrawers();
            };

            var headerView = navigationView.GetHeaderView(0);

            txtName  = headerView.FindViewById <TextView>(Resource.Id.navheader_name);
            txtEmail = headerView.FindViewById <TextView>(Resource.Id.navheader_email);


            getUserData();

            initCalanderView();
        }
Beispiel #23
0
        public void onDrawerOptionClicked(View view)
        {
            switch (view.Id)
            {
            case Resource.Id.drawer_option_load:
                if (CropImage.IsExplicitCameraPermissionRequired(this))
                {
                    RequestPermissions(new string[] { Manifest.Permission.Camera }, CropImage.CameraCapturePermissionsRequestCode);
                }
                else
                {
                    CropImage.StartPickImageActivity(this);
                }
                mDrawerLayout.CloseDrawers();
                break;

            case Resource.Id.drawer_option_oval:
                setMainFragmentByPreset(CropDemoPreset.CIRCULAR);
                mDrawerLayout.CloseDrawers();
                break;

            case Resource.Id.drawer_option_rect:
                setMainFragmentByPreset(CropDemoPreset.RECT);
                mDrawerLayout.CloseDrawers();
                break;

            case Resource.Id.drawer_option_customized_overlay:
                setMainFragmentByPreset(CropDemoPreset.CUSTOMIZED_OVERLAY);
                mDrawerLayout.CloseDrawers();
                break;

            case Resource.Id.drawer_option_min_max_override:
                setMainFragmentByPreset(CropDemoPreset.MIN_MAX_OVERRIDE);
                mDrawerLayout.CloseDrawers();
                break;

            case Resource.Id.drawer_option_scale_center:
                setMainFragmentByPreset(CropDemoPreset.SCALE_CENTER_INSIDE);
                mDrawerLayout.CloseDrawers();
                break;

            case Resource.Id.drawer_option_toggle_scale:
                mCropImageViewOptions.scaleType = mCropImageViewOptions.scaleType == CropImageView.ScaleType.FitCenter
                            ? CropImageView.ScaleType.CenterInside : mCropImageViewOptions.scaleType == CropImageView.ScaleType.CenterInside
                            ? CropImageView.ScaleType.Center : mCropImageViewOptions.scaleType == CropImageView.ScaleType.Center
                            ? CropImageView.ScaleType.CenterCrop : CropImageView.ScaleType.FitCenter;
                mCurrentFragment.setCropImageViewOptions(mCropImageViewOptions);
                updateDrawerTogglesByOptions(mCropImageViewOptions);
                break;

            case Resource.Id.drawer_option_toggle_shape:
                mCropImageViewOptions.cropShape = mCropImageViewOptions.cropShape == CropImageView.CropShape.Rectangle
                            ? CropImageView.CropShape.Oval : CropImageView.CropShape.Rectangle;
                mCurrentFragment.setCropImageViewOptions(mCropImageViewOptions);
                updateDrawerTogglesByOptions(mCropImageViewOptions);
                break;

            case Resource.Id.drawer_option_toggle_guidelines:
                mCropImageViewOptions.guidelines = mCropImageViewOptions.guidelines == CropImageView.Guidelines.Off
                            ? CropImageView.Guidelines.On : mCropImageViewOptions.guidelines == CropImageView.Guidelines.On
                            ? CropImageView.Guidelines.OnTouch : CropImageView.Guidelines.Off;
                mCurrentFragment.setCropImageViewOptions(mCropImageViewOptions);
                updateDrawerTogglesByOptions(mCropImageViewOptions);
                break;

            case Resource.Id.drawer_option_toggle_aspect_ratio:
                if (!mCropImageViewOptions.fixAspectRatio)
                {
                    mCropImageViewOptions.fixAspectRatio = true;
                    mCropImageViewOptions.aspectRatio    = new Android.Util.Pair(1, 1);
                }
                else
                {
                    if ((int)mCropImageViewOptions.aspectRatio.First == 1 && (int)mCropImageViewOptions.aspectRatio.Second == 1)
                    {
                        mCropImageViewOptions.aspectRatio = new Android.Util.Pair(4, 3);
                    }
                    else if ((int)mCropImageViewOptions.aspectRatio.First == 4 && (int)mCropImageViewOptions.aspectRatio.Second == 3)
                    {
                        mCropImageViewOptions.aspectRatio = new Android.Util.Pair(16, 9);
                    }
                    else if ((int)mCropImageViewOptions.aspectRatio.First == 16 && (int)mCropImageViewOptions.aspectRatio.Second == 9)
                    {
                        mCropImageViewOptions.aspectRatio = new Android.Util.Pair(9, 16);
                    }
                    else
                    {
                        mCropImageViewOptions.fixAspectRatio = false;
                    }
                }
                mCurrentFragment.setCropImageViewOptions(mCropImageViewOptions);
                updateDrawerTogglesByOptions(mCropImageViewOptions);
                break;

            case Resource.Id.drawer_option_toggle_auto_zoom:
                mCropImageViewOptions.autoZoomEnabled = !mCropImageViewOptions.autoZoomEnabled;
                mCurrentFragment.setCropImageViewOptions(mCropImageViewOptions);
                updateDrawerTogglesByOptions(mCropImageViewOptions);
                break;

            case Resource.Id.drawer_option_toggle_max_zoom:
                mCropImageViewOptions.maxZoomLevel = mCropImageViewOptions.maxZoomLevel == 4 ? 8
                            : mCropImageViewOptions.maxZoomLevel == 8 ? 2 : 4;
                mCurrentFragment.setCropImageViewOptions(mCropImageViewOptions);
                updateDrawerTogglesByOptions(mCropImageViewOptions);
                break;

            case Resource.Id.drawer_option_set_initial_crop_rect:
                mCurrentFragment.setInitialCropRect();
                mDrawerLayout.CloseDrawers();
                break;

            case Resource.Id.drawer_option_reset_crop_rect:
                mCurrentFragment.resetCropRect();
                mDrawerLayout.CloseDrawers();
                break;

            case Resource.Id.drawer_option_toggle_show_overlay:
                mCropImageViewOptions.showCropOverlay = !mCropImageViewOptions.showCropOverlay;
                mCurrentFragment.setCropImageViewOptions(mCropImageViewOptions);
                updateDrawerTogglesByOptions(mCropImageViewOptions);
                break;

            case Resource.Id.drawer_option_toggle_show_progress_bar:
                mCropImageViewOptions.showProgressBar = !mCropImageViewOptions.showProgressBar;
                mCurrentFragment.setCropImageViewOptions(mCropImageViewOptions);
                updateDrawerTogglesByOptions(mCropImageViewOptions);
                break;

            default:
                Toast.MakeText(this, "Unknown drawer option clicked", ToastLength.Long).Show();
                break;
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            presenter = new MainPresenter(this);
            SetContentView(Resource.Layout.main);


            var toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            if (toolbar != null)
            {
                SetSupportActionBar(toolbar);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetHomeButtonEnabled(true);
            }

            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);

            //Set hamburger items menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);

            //setup navigation view
            navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);

            //handle navigation
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                if (previousItem != null)
                    previousItem.SetChecked(false);

                navigationView.SetCheckedItem(e.MenuItem.ItemId);

                previousItem = e.MenuItem;

                switch (e.MenuItem.ItemId)
                {
                    case Resource.Id.nav_home_1:
                        ListItemClicked(0);
                        break;
                    case Resource.Id.nav_home_2:
                        ListItemClicked(1);
                        break;
                    case Resource.Id.nav_home_3:
                        ListItemClicked(2);
                        break;
                    case Resource.Id.nav_home_4:
                        ListItemClicked(3);
                        break;
                }


                drawerLayout.CloseDrawers();
            };


            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                navigationView.SetCheckedItem(Resource.Id.nav_home_1);
                ListItemClicked(0);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            if (YoutubePlayerServerActivity.gettearinstancia() != null)
            {
                SetContentView(Resource.Layout.layoutinicio);
            }
            else
            {
                SetContentView(Resource.Layout.layoutinicioremote);
            }
            ins = this;
            ImageView botonreconocer = FindViewById <ImageView>(Resource.Id.imageView2);

            texto            = FindViewById <EditText>(Resource.Id.editText1);
            listamas         = FindViewById <RecyclerView>(Resource.Id.listamas);
            listaultimos     = FindViewById <RecyclerView>(Resource.Id.listaultimos);
            listafavoritos   = FindViewById <RecyclerView>(Resource.Id.listafavoritos);
            listasugerencias = FindViewById <RecyclerView>(Resource.Id.listasugerencias);
            List <PlaylistElement> listafake = new List <PlaylistElement>();
            var imagentipoconex = FindViewById <ImageView>(Resource.Id.tipoconexion);

            textoserver         = FindViewById <TextView>(Resource.Id.textoconexion);
            textonombreelemento = FindViewById <TextView>(Resource.Id.textoreprodactual);
            textolista          = FindViewById <TextView>(Resource.Id.textoencola);
            SetSupportActionBar(FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.my_toolbar));
            secciones = new List <LinearLayout>()
            {
                FindViewById <LinearLayout>(Resource.Id.secion1),
                FindViewById <LinearLayout>(Resource.Id.secion2),
                FindViewById <LinearLayout>(Resource.Id.secion3),
                FindViewById <LinearLayout>(Resource.Id.secion4)
            };

            foreach (var ax in secciones)
            {
                ax.Visibility = ViewStates.Gone;
            }


            SupportActionBar.Title = "Inicio";
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            itemsm = FindViewById <NavigationView>(Resource.Id.content_frame);
            sidem  = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.hambur);
            textolista.Selected          = true;
            textoserver.Selected         = true;
            textonombreelemento.Selected = true;
            if (YoutubePlayerServerActivity.gettearinstancia() != null)
            {
                isserver      = true;
                Diccfavoritos = YoutubePlayerServerActivity.gettearinstancia().listafavoritos;
                favoritos     = Diccfavoritos.Values.ToList();

                objetohistorial = YoutubePlayerServerActivity.gettearinstancia().objetohistorial;
                imagentipoconex.SetBackgroundResource(Resource.Drawable.remotecontrolbuttons);
            }
            else
            {
                isserver      = false;
                Diccfavoritos = Mainmenu.gettearinstancia().listafavoritos;
                favoritos     = Diccfavoritos.Values.ToList();
                imagentipoconex.SetBackgroundResource(Resource.Drawable.antena);
                objetohistorial = Mainmenu.gettearinstancia().objetohistorial;
            }

            if (objetohistorial == null)
            {
                objetohistorial = new History()
                {
                    Videos = new List <PlaylistElement>(),
                    Links  = new Dictionary <string, int>()
                }
            }
            ;

            if (favoritos == null)
            {
                favoritos = new List <PlaylistElement>();
            }

            if (Diccfavoritos == null)
            {
                Diccfavoritos = new Dictionary <string, PlaylistElement>();
            }



            favoritos.Reverse();
            recargarhistorial();

            new System.Threading.Thread(() =>
            {
                seteartexto();
            }).Start();



            /*    for (int i = 0; i < 20; i++)
             *  {
             *
             *      listafake.Add(new playlistelements
             *      {
             *          nombre = "klk wawawa",
             *          link = "https://www.youtube.com/watch?v=4G40N0G6lzE"
             *      });
             *  }
             */



            LinearLayoutManager enlinea = new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false);

            listamas.SetLayoutManager(enlinea);
            LinearLayoutManager enlinea2 = new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false);

            listaultimos.SetLayoutManager(enlinea2);
            LinearLayoutManager enlinea3 = new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false);

            listafavoritos.SetLayoutManager(enlinea3);
            LinearLayoutManager enlinea4 = new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false);

            listasugerencias.SetLayoutManager(enlinea4);

            adaptadorcartas adap = new adaptadorcartas(listafake, this);

            //   listafavoritos.SetAdapter(adap);
            if (YoutubePlayerServerActivity.gettearinstancia() != null)
            {
                if (System.IO.File.Exists(Constants.CachePath + "/backupplaylist.json") && !YoutubePlayerServerActivity.gettearinstancia().backupprompted)
                {
                    var snack = Snackbar.Make(FindViewById <View>(Android.Resource.Id.Content), "Desea cargar los elementos que estaba reproduciendo la vez anterior?", Snackbar.LengthIndefinite);
                    snack.SetAction("Cargar", (o) =>
                    {
                        YoutubePlayerServerActivity.gettearinstancia().loadbackupplaylist();
                        YoutubePlayerServerActivity.gettearinstancia().backupprompted = true;
                    });
                    snack.SetDuration(6000);
                    snack.Show();
                    Task.Delay(6000).ContinueWith(delegate
                    {
                        YoutubePlayerServerActivity.gettearinstancia().backupprompted = true;
                    });


                    /* new Android.Support.V7.App.AlertDialog.Builder(this)
                     * .SetTitle("Advertencia")
                     * .SetMessage("Desea cargar los elementos que estaba reproduciendo la vez anterior?")
                     * .SetPositiveButton("Si", (aa, aaa) =>
                     * {
                     * mainmenu_Offline.gettearinstancia().loadbackupplaylist();
                     * mainmenu_Offline.gettearinstancia().backupprompted = true;
                     *
                     * })
                     * .SetNegativeButton("No", (afaa, aaffa) =>
                     * {
                     *
                     * mainmenu_Offline.gettearinstancia().backupprompted = true;
                     *
                     * })
                     * .SetCancelable(false)
                     * .Create()
                     * .Show();*/
                }
                else
                {
                    YoutubePlayerServerActivity.gettearinstancia().backupprompted = true;
                }
            }

            FindViewById <CardView>(Resource.Id.cartainicio).Click += delegate
            {
                this.Finish();
            };



            texto.KeyPress += (aaxx, e) =>
            {
                if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter)
                {
                    // Code executed when the enter key is pressed down

                    new System.Threading.Thread(() =>
                    {
                        buscaryabrir(texto.Text);
                    }).Start();
                }
                else
                {
                    e.Handled = false;
                }
            };



            botonreconocer.Click += delegate
            {
                animar(botonreconocer);
                try
                {
                    var voiceIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 500);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 500);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 10000);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 1);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.Default);
                    StartActivityForResult(voiceIntent, 7);
                }
                catch (Exception)
                {
                }
            };
            itemsm.NavigationItemSelected += (sender, e) =>
            {
                switch (e.MenuItem.TitleFormatted.ToString())
                {
                case "Reproductor":
                    this.Finish();
                    break;

                case "Control remoto":
                    this.Finish();
                    break;

                case "Navegador personalizado":
                    Intent intento = new Intent(this, typeof(customsearcheract));
                    intento.PutExtra("ipadre", "localhost");
                    intento.PutExtra("color", "black");
                    StartActivity(intento);
                    break;

                case "Conectar clientes":


                    Intent intetno = new Intent(this, typeof(qrcodigoact));
                    intetno.PutExtra("ipadre", "localhost");
                    StartActivity(intetno);


                    break;

                case "Listas de reproduccion":

                    if (YoutubePlayerServerActivity.gettearinstancia() != null)
                    {
                        Intent elint = new Intent(this, typeof(menulistaoffline));
                        elint.PutExtra("ipadre", "localhost");
                        StartActivity(elint);
                    }
                    else
                    {
                        var con = Mainmenu.gettearinstancia();
                        if (con.compatible)
                        {
                            if (con.jsonlistasremotas.Trim() != "")
                            {
                                Intent intentoo = new Intent(this, typeof(Reproducirlistaact));
                                intentoo.PutExtra("ip", "localhost");
                                StartActivity(intentoo);
                            }
                            else
                            {
                                Toast.MakeText(this, "Aun no se han recibido las listas de el servidor...", ToastLength.Long).Show();
                            }
                        }
                        else
                        {
                            Toast.MakeText(this, "Su servidor no es compatible con esta version", ToastLength.Long).Show();
                        }
                    }

                    break;
                }
                e.MenuItem.SetChecked(false);
                e.MenuItem.SetChecked(false);
                sidem.CloseDrawers();
            };
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource

            SetContentView(Resource.Layout.Encrypt);
            var toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_action_nav_menu_holo_dark);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            switchForceUnicode = FindViewById<Switch>(Resource.Id.switchForceUnicode);
            switchEncodeTextEncode = FindViewById<Switch>(Resource.Id.switchEncodeTextEncode);
            var listView1 = FindViewById<ScrollView>(Resource.Id.listView1);
            listView1.Visibility = ViewStates.Gone;
            Spinner spinnerEncodeType = FindViewById<Spinner>(Resource.Id.spinnerEncodeType);
            spinnerEncodeType.Adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, EncodeType);
            spinnerEncodeType.ItemSelected += (sender, e) => {
                if (e.Position == 1) {
                    listView1.Visibility = ViewStates.Visible;
                }
                else
                {
                    listView1.Visibility = ViewStates.Gone;
                }
            };

            EditText editTextOrigin = FindViewById<EditText>(Resource.Id.editTextO);
            EditText editTextEncode = FindViewById<EditText>(Resource.Id.editTextE);

            Button butEncode = FindViewById<Button>(Resource.Id.butEncode);
            Button butDecode = FindViewById<Button>(Resource.Id.butDecode);

            butEncode.Click += (sender, e) => {
                switch (EncodeType[spinnerEncodeType.SelectedItemPosition])
                {
                    case "crmkjk":
                        editTextEncode.Text = CRMKJK.CRMKJK.EncodeEasy(editTextOrigin.Text, (switchForceUnicode.Checked ? CRMKJKState.Unicode : 0) | (switchEncodeTextEncode.Checked ? CRMKJKState.EncodeTextB64Encode : 0));
                        break;
                    case "base64":
                        if (string.IsNullOrWhiteSpace(editTextOrigin.Text)) return;
                        editTextEncode.Text = Convert.ToBase64String(Encoding.Default.GetBytes(editTextOrigin.Text));
                        break;
                    case "unicode":
                        editTextEncode.Text = editTextOrigin.Text.EscapeToUnicode();
                        break;
                    default:
                        break;
                }
            };

            butDecode.Click += (sender, e) => {
                switch (EncodeType[spinnerEncodeType.SelectedItemPosition])
                {
                    case "crmkjk":
                        try
                        {
                            editTextOrigin.Text = CRMKJK.CRMKJK.Decode(editTextEncode.Text);
                        }
                        catch (UnexpectedCRMKJKEncodeException)
                        {
                            Toast.MakeText(this, "ERROR: unexpected crmkjk encode", ToastLength.Short).Show();
                        }
                        break;
                    case "base64":
                        if (string.IsNullOrWhiteSpace(editTextEncode.Text)) return;
                        try
                        {
                            editTextOrigin.Text = Encoding.Default.GetString(Convert.FromBase64String(editTextEncode.Text));
                        }
                        catch (FormatException)
                        {
                            Toast.MakeText(this, "ERROR: unexpected base64 encode", ToastLength.Short).Show();
                        }
                        break;
                    case "unicode":
                        if (string.IsNullOrWhiteSpace(editTextEncode.Text)) return;
                        try
                        {
                            editTextOrigin.Text = editTextEncode.Text.TrapToUnicode();
                        }
                        catch (FormatException)
                        {
                            Toast.MakeText(this, "ERROR: unexpected unicode", ToastLength.Short).Show();
                        }
                        break;
                    default:
                        break;
                }
            };

            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            var navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);
            navigationView.NavigationItemSelected += (sender, e) => {
                e.MenuItem.SetChecked(true);
                //react to click here and swap fragments or navigate
                drawerLayout.CloseDrawers();
                if (e.MenuItem.ItemId == Resource.Id.nav_imgedit)
                {
                    var intent = new Intent(this, typeof(MainActivity));
                    intent.AddFlags(ActivityFlags.ClearTask);
                    intent.AddFlags(ActivityFlags.NewTask);
                    StartActivity(intent);
                }
            };
        }
Beispiel #27
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.MapActivity);
            SetUpMap();
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            toolbar.Title = "";
            //Enable support action bar to display hamburger
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            drawerLayout        = FindViewById <DrawerLayout>(Resource.Id.drawerlayout);
            navigationView      = FindViewById <NavigationView>(Resource.Id.nav_view);
            editText            = FindViewById <EditText>(Resource.Id.search);
            editText.ImeOptions = ImeAction.Search;
            goStation           = FindViewById <Button>(Resource.Id.GoStationButton);
            goDestination       = FindViewById <Button>(Resource.Id.GoDestinationButton);
            AddButton           = FindViewById <Button>(Resource.Id.AddButton);
            goPlan     = FindViewById <Button>(Resource.Id.GoPlanButton);
            goNavigate = FindViewById <Button>(Resource.Id.GoNavigate);

            // ISharedPreferences specs = CarSpecs.specs;
            CarSpecs.specs = PreferenceManager.GetDefaultSharedPreferences(this);
            name           = CarSpecs.specs.GetString("name", null);
            range          = CarSpecs.specs.GetString("range", null);
            if (range == null & name == null)
            {
                range = "100km";
            }

            editText.EditorAction += async(sender, e) =>
            {
                if (e.ActionId == ImeAction.Search)
                {
                    //Toast.MakeText(Application.Context, editText.Text, ToastLength.Long).Show();
                    InputMethodManager inputManager = (InputMethodManager)this.GetSystemService(Context.InputMethodService);
                    inputManager.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, HideSoftInputFlags.NotAlways);
                    goStation.Visibility = ViewStates.Invisible;
                    AddButton.Visibility = ViewStates.Invisible;
                    nearest   = false;
                    waypoints = "0";
                    if (viaPointsToDestination != null)
                    {
                        viaPointsToDestination.Clear();
                    }
                    await SearchAsync(editText.Text);
                }
                else
                {
                    e.Handled = false;
                }
            };
            goStation.Click += async(sender, e) => {
                GoButtonClickedAsync();
            };

            goPlan.Click += async(sender, e) => {
                GoPlanButtonClickedAsync();
            };

            goDestination.Click += async(sender, e) => {
                GoDestinationClickedAsync();
            };

            AddButton.Click += async(sender, e) =>
            {
                AddStationToRoute();
            };

            goNavigate.Click += async(sender, e) =>
            {
                var gmmIntentUri = Android.Net.Uri.Parse("google.navigation:q=" + x + "," + y + "&mode=d");
                if (plan == false || nearest == true)
                {
                    //de la locatia actuala
                    gmmIntentUri = Android.Net.Uri.Parse("google.navigation:q=" + x + "," + y + "&mode=d");
                }
                else
                {
                    gmmIntentUri = Android.Net.Uri.Parse("google.navigation:q=" + destinationLat + "," + destinationLng + "&mode=d");
                }
                Intent mapIntent = new Intent(Intent.ActionView, gmmIntentUri);
                mapIntent.SetPackage("com.google.android.apps.maps");
                StartActivity(mapIntent);
            };

            navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);
                InputMethodManager inputManager = (InputMethodManager)this.GetSystemService(Context.InputMethodService);
                inputManager.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, HideSoftInputFlags.NotAlways);

                var menuItem = e.MenuItem;
                menuItem.SetChecked(!menuItem.IsChecked);
                drawerLayout.CloseDrawers();

                switch (menuItem.ItemId)
                {
                case Resource.Id.nav_nearest_charging_stations:

                    //Toast.MakeText(Application.Context, "nav_nearest_charging_stations selected", ToastLength.Long).Show();
                    goNavigate.Visibility = ViewStates.Invisible;
                    NearestChargingStationsAsync();
                    nearest = true;
                    break;

                case Resource.Id.nav_trips:
                    nearest = false;
                    LayoutInflater layoutInflater = LayoutInflater.From(this);
                    View           view           = layoutInflater.Inflate(Resource.Layout.user_input_dialog_box, null);
                    Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
                    alertbuilder.SetView(view);
                    var start       = view.FindViewById <EditText>(Resource.Id.editTextStart);
                    var destination = view.FindViewById <EditText>(Resource.Id.editTextDestination);
                    alertbuilder.SetCancelable(false)
                    .SetPositiveButton("Start", delegate
                    {
                        plan      = true;
                        waypoints = "0";
                        if (viaPointsToDestination != null)
                        {
                            viaPointsToDestination.Clear();
                        }
                        Plan(start.Text, destination.Text);
                    })
                    .SetNegativeButton("Cancel", delegate
                    {
                        alertbuilder.Dispose();
                    });
                    Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();
                    dialog.Show();
                    //Toast.MakeText(Application.Context, "nav_trips selected", ToastLength.Long).Show();
                    break;

                case Resource.Id.nav_my_cars:

                    StartActivity(typeof(CarSpecs));
                    break;

                case Resource.Id.nav_logout:

                    this.FinishAffinity();
                    break;

                default:

                    Toast.MakeText(Application.Context, "Something Wrong", ToastLength.Long).Show();
                    break;
                }
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            RequestPermissions();
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.main);

            SaveSettings settings = new SaveSettings();

            settings.Load();
            Port     = settings.port;
            IPAdress = settings.IPAdress;

            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            if (toolbar != null)
            {
                SetSupportActionBar(toolbar);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetHomeButtonEnabled(true);
            }

            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            //Set hamburger items menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);

            //setup navigation view
            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            //handle navigation
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                if (previousItem != null)
                {
                    previousItem.SetChecked(false);
                }

                navigationView.SetCheckedItem(e.MenuItem.ItemId);

                previousItem = e.MenuItem;

                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_home:
                    ListItemClicked(0);
                    break;

                case Resource.Id.nav_fan_control:
                    ListItemClicked(1);
                    break;

                case Resource.Id.nav_settings:
                    ListItemClicked(2);
                    break;

                case Resource.Id.nav_credits:
                    ListItemClicked(3);
                    break;
                }


                drawerLayout.CloseDrawers();
            };


            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                navigationView.SetCheckedItem(Resource.Id.nav_home);
                ListItemClicked(0);
            }
        }
Beispiel #29
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            var navigationView = FindViewById <NavigationView>(Resource.Id.left_navigationView);

            drawerLayout.DrawerOpened += DrawerLayout_DrawerOpened;
            drawerLayout.DrawerClosed += DrawerLayout_DrawerClosed;
            //drawerLayout.SetBackgroundResource(Resource.Drawable.loginbackground);
            //navigationView.SetItemTextAppearance(Resource.Color.loginButton);
            var toggle = new Android.Support.V7.App.ActionBarDrawerToggle
                         (
                this,
                drawerLayout,
                Resource.String.drawer_open,
                Resource.String.drawer_close
                         );

            drawerLayout.AddDrawerListener(toggle);
            toggle.SyncState();

            navigationView.NavigationItemSelected += (sender, e) =>
            {
                if (previousItem != null)
                {
                    previousItem.SetChecked(false);
                }

                navigationView.SetCheckedItem(e.MenuItem.ItemId);

                previousItem = e.MenuItem;
                MenuItemClicked(e.MenuItem.ItemId);
                drawerLayout.CloseDrawers();
            };
            navigationView.ItemIconTintList = null;
            adapter = new TabsAdapter(this, SupportFragmentManager);
            pager   = FindViewById <ViewPager>(Resource.Id.viewpager);
            var tabs = FindViewById <TabLayout>(Resource.Id.tabs);

            pager.Adapter = adapter;
            tabs.SetupWithViewPager(pager);
            pager.OffscreenPageLimit = 3;

            pager.PageSelected += (sender, args) =>
            {
                var fragment = adapter.InstantiateItem(pager, args.Position) as IFragmentVisible;

                fragment?.BecameVisible();
            };

            Toolbar.MenuItemClick += (sender, e) =>
            {
            };
            int menuId = Intent.GetIntExtra("menuId", 0);

            if (menuId != 0)
            {
                if (previousItem != null)
                {
                    previousItem.SetChecked(false);
                }

                navigationView.SetCheckedItem(menuId);
                MenuItemClicked(menuId);
                Intent.RemoveExtra("menuId");
            }
        }
Beispiel #30
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Random randomNumber = new Random();

            base.OnCreate(savedInstanceState);

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

            SetUpUI();
            SetText(randomNumber);

            myView.Click += MyView_Click;


            navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);

                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_profile:

                    break;

                case Resource.Id.nav_map:
                    StartActivity(new Intent(this, typeof(MapActivity)));

                    break;

                case Resource.Id.nav_settings:
                    this.Finish();
                    StartActivity(new Intent(this, typeof(SettingsActivity)));
                    break;

                case Resource.Id.nav_logout:
                    GameModel.Logout();
                    this.FinishAffinity();
                    StartActivity(new Intent(this, typeof(LoginActivity)));
                    break;

                default:
                    break;
                }

                drawerLayout.CloseDrawers();
            };
            // Documents folder
            string documentsPath = System.Environment.GetFolderPath(
                System.Environment.SpecialFolder.Personal);

            var filePath = System.IO.Path.Combine(documentsPath, "imagePath.png");

            if (System.IO.File.Exists(filePath))
            {
                LoadImage(filePath);
            }
            else
            {
                SetImage(myView);
            }
        }
Beispiel #31
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            App.currentactivity = this;

            drawerLayout = this.FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            //Set hamburger items menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            SupportActionBar.SetDisplayShowTitleEnabled(true);

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            //setup navigation view
            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            //handle navigation
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);

                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_home_1:
                    ListItemClicked(0);
                    break;

                case Resource.Id.nav_home_2:
                    ListItemClicked(1);
                    break;

                case Resource.Id.nav_home_3:
                    ListItemClicked(2);
                    break;

                case Resource.Id.nav_home_4:
                    ListItemClicked(3);
                    break;

                case Resource.Id.nav_home_5:
                    ListItemClicked(4);
                    break;

                case Resource.Id.nav_home_6:
                    ListItemClicked(5);
                    break;

                case Resource.Id.nav_home_7:
                    ListItemClicked(6);
                    break;
                }

                Snackbar.Make(drawerLayout, "You selected: " + e.MenuItem.TitleFormatted, Snackbar.LengthLong)
                .Show();

                drawerLayout.CloseDrawers();
            };


            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                ListItemClicked(0);
            }
        }
Beispiel #32
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            drawerLayout = this.FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            user         = this.FindViewById <TextView>(Resource.Id.us1);
            user.Text    = Intent.GetStringExtra("username");
            //Set hamburger items menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);

            //setup navigation view
            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            //handle navigation
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);

                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_home_1:
                    ListItemClicked(0);
                    break;

                case Resource.Id.nav_home_2:
                    ListItemClicked(1);
                    break;

                case Resource.Id.nav_home_3:
                    ListItemClicked(2);
                    break;

                case Resource.Id.nav_home_4:
                    ListItemClicked(3);
                    break;

                case Resource.Id.nav_home_5:
                    ListItemClicked(4);
                    break;

                case Resource.Id.nav_home_6:
                    ListItemClicked(5);
                    break;

                case Resource.Id.nav_home_7:
                    ListItemClicked(6);
                    break;

                case Resource.Id.nav_home_8:
                    ListItemClicked(7);
                    break;
                }



                drawerLayout.CloseDrawers();
            };


            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                ListItemClicked(0);
            }
        }
Beispiel #33
0
 internal void CloseDrawerMenu()
 {
     _drawerLayout.CloseDrawers();
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            PathLink.VendorURI         = "http://52.172.37.210:36378/api/InventoryManager/Savevendorpurchaserecord";
            PathLink.StoreURI          = "http://52.172.37.210:36378/api/stores/getstores";
            PathLink.VendorPurchaseURI = "http://52.172.37.210:36378/api/InventoryManager/GetVendorPurchaseRequests?from=";
            PathLink.StoreMinimumURI   = "http://52.172.37.210:36378/api/inventorymanager/searchinventoryitem?itm=";
            PathLink.DateURI           = "http://52.172.37.210:36378/api/purchasemanager/getpos?frmdate=";
            PathLink.UserURI           = "http://52.172.37.210:36378/api/employeemanager/validateemployee?ecode=";
            PathLink.PONumberURI       = "http://52.172.37.210:36378/api/purchasemanager/getpodetail?po=";


            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawerLayout1);

            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.drawer_open, Resource.String.drawer_close);

            drawerLayout.SetDrawerListener(drawerToggle);
            drawerToggle.SyncState();
            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            //	setupDrawerContent(navigationView); //Calling Function


            navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);

                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_UIStore:
                    ListItemClicked(0);
                    break;

                case Resource.Id.nav_UIPostVendor:
                    //	ValidateDialog();
                    ListItemClicked(1);
                    break;

                case Resource.Id.nav_UIStoreMinimum:
                    ListItemClicked(2);
                    break;

                case Resource.Id.nav_UIVendorPurchase:
                    ListItemClicked(3);
                    break;

                case Resource.Id.nav_UIRecordDate:
                    ListItemClicked(4);
                    break;

                case Resource.Id.nav_UIDetail:
                    ListItemClicked(5);
                    break;
                }
                drawerLayout.CloseDrawers();
            };

            if (savedInstanceState == null)
            {
                ListItemClicked(0);
            }
        }
Beispiel #35
0
        //Handles the NavigationView
        public void SetupDrawerContent(NavigationView navigationView)
        {
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);
                drawerLayout.CloseDrawers();
                switch (e.MenuItem.ToString())
                {
                case "Portfolio Summary":
                    timer.Stop();
                    break;

                case "Account Summary":
                    timer.Stop();
                    Intent accountSummary = new Intent(this, typeof(AccountSummaryActivity));
                    StartActivity(accountSummary);
                    break;

                case "Asset Allocation":
                    timer.Stop();
                    Intent assetAllocation = new Intent(this, typeof(AssetAllocationActivity));
                    StartActivity(assetAllocation);
                    break;

                case "Details of Transaction":
                    timer.Stop();
                    Intent detailsOfTransaction = new Intent(this, typeof(DetailsOfTransactionActivity));
                    StartActivity(detailsOfTransaction);
                    break;

                case "Profit/Loss":
                    timer.Stop();
                    Intent profitLoss = new Intent(this, typeof(ProfitLossActivity));
                    StartActivity(profitLoss);
                    break;

                case "Change Password":
                    timer.Stop();
                    Intent changePassword = new Intent(this, typeof(ChangePasswordActivity));
                    StartActivity(changePassword);
                    break;

                case "Logout":
                    Task.Run(async() =>
                    {
                        try
                        {
                            LoginResult loginResult = await MKFApp.Current.Logout();
                            this.RunOnUiThread(() => LogoutSuccessful());
                        }
                        catch (Exception exception)
                        {
                            this.RunOnUiThread(() => LogoutFailed());
                        }
                    });

                    break;

                case "Contact Us":
                    timer.Stop();
                    Intent aboutUs = new Intent(this, typeof(AboutUsActivity));
                    StartActivity(aboutUs);
                    break;

                default:
                    Snackbar.Make(linearLayout, "An Error Occured", Snackbar.LengthLong).Show();
                    break;
                }
            };
        }
Beispiel #36
0
 internal void CloseDrawer()
 {
     drawerLayout.CloseDrawers();
 }
		protected override async void OnCreate (Bundle savedInstanceState) 
		{
			Log.Debug (tag, "Iniciamos!");
			//SETEAMOS EL NOMBRE DEL USUARIO

			base.OnCreate (savedInstanceState);

			Log.Debug (tag, "pasamos el oncreate base");

			//esto es exclusivamente para el gps
			gpsclass=new Bundle();

			gpsclass.PutString ("latitud", "nada");
			gpsclass.PutString ("longitud", "nada");

			Log.Debug (tag, "pasamos las longitudes");

			//end gps

			//CREAMOS EL OBJETO QUE VA A LEER/ESCRIBIR LAS PREFERENCIAS DEL USUARIO
			var prefs = this.GetSharedPreferences("RunningAssistant.preferences", FileCreationMode.Private);

			//CREAMOS EL OBJETO DEL OBJETO (lel) que va a editar las preferencias
			var editor = prefs.Edit ();

			Log.Debug (tag, "pasamos el editor");



			//AQUI ES DONDE HAY QUE VER SI HACEMOS LOGIN:

			//CHECAMOS SI YA ESTÁ EL ID DEL USUARIO GUARDADO
			if (!prefs.Contains ("id")) {
				Log.Debug (tag, "(no hay id en las prefs)");
				//Toast.MakeText (this, "Ya están guardados tus datos", ToastLength.Long).Show ();
				//StartActivity(typeof(login));
				StartActivity(typeof(login));
				Finish ();
				//Toast.MakeText (this, "No hay login", ToastLength.Long).Show();
			} else {
							
			}

			Log.Debug (tag, "pasamos la condicion home");

			SetContentView (Resource.Layout.Main);
			Log.Debug (tag, "pasamos el set content view");


			mFragment1 = new Fragment1 ();
			mFragment2 = new Fragment2 ();
			mFragment3 = new Fragment3 ();
			mFragment4 = new Fragment4 ();
			mFragment5 = new Fragment5 ();
			Log.Debug (tag, "pasamos los fragments");

			//seteamos el arg del gps
			mFragment2.Arguments = gpsclass;

			mStackFragment = new Stack<SupportFragment> ();
			Log.Debug (tag, "pasamos el stack");

			var trans = SupportFragmentManager.BeginTransaction ();
			Log.Debug (tag, "pasamos el begin transaction");
			//AQUI LE MOVI IGUAL en vez de fragment2 y mfragment2 es 1
			trans.Add (Resource.Id.fragmentContainer, mFragment1,"Fragment1");
			trans.Commit();
			Log.Debug (tag, "pasamos el commit");

			//MOVI ESTO en vez de mfragment2 es 1
			mCurrentFragment = mFragment1;

			try{
			mToolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.toolbar);
				Log.Debug (tag, "pasamos el mtoolbar igual a");
			}catch(Exception ex){
				Log.Debug (tag, "El error fue:" + ex + "ACABA ERROR");
			}

			try{
			SetSupportActionBar (mToolbar);
				Log.Debug (tag, "pasamos el set support mtoolbar");
			}catch(Exception ex){
				Log.Debug (tag, "El error del mToolbar fue:" + ex + "ACABA ERROR");

			}
			//ESTO TAMBIEN es Inicio

			try{
			SupportActionBar.Title = "Inicio";
				Log.Debug (tag, "pasamos el title igual a inicio");
			}catch(Exception ex){
				Log.Debug (tag, "El error del action bar title fue:" + ex + "ACABA ERROR");
			}

			try{
				SupportActionBar.SetHomeAsUpIndicator (Resource.Drawable.ic_menu);
			SupportActionBar.SetDisplayHomeAsUpEnabled (true);
			SupportActionBar.SetHomeButtonEnabled (true);
				Log.Debug (tag, "pasamos TODOS los support action bar");
			}
			catch(Exception ex){
				Log.Debug (tag, "El error del alguno de los suportactionbar fue:" + ex + "ACABA ERROR");
			}

			try{
			drawerLayout = FindViewById<DrawerLayout> (Resource.Id.drawer_layout);
				Log.Debug (tag, "pasamos asignar drawerlayout");
			}catch(Exception ex){
				Log.Debug (tag, "El error deasignar el drawer layout fue" + ex + "ACABA ERROR");
			}
			navigationView = FindViewById<NavigationView> (Resource.Id.nav_view);

			
			//AQUI ES DONDE CAMBIA SEGUN EL ELEMENTO DEL MENU QUE ELIJAS
			try{
			navigationView.NavigationItemSelected += (sender, e) =>
			{
				e.MenuItem.SetChecked (true);
				SupportActionBar.Title = e.MenuItem.TitleFormatted.ToString();
				drawerLayout.CloseDrawers ();
				if(e.MenuItem.TitleFormatted.ToString() == "Inicio")
				{
					ReplaceFragment (mFragment1);
				}
				else if(e.MenuItem.TitleFormatted.ToString() == "Buscar")
				{
					gpsclass.PutString ("region", "nada");
					ReplaceFragment (mFragment2);
				}
				else if(e.MenuItem.TitleFormatted.ToString() == "Últimos Negocios")
				{
					ReplaceFragment (mFragment3);
				}
				else if(e.MenuItem.TitleFormatted.ToString() == "Añadir Negocios")
				{
					//ReplaceFragment (mFragment4);
						//Toast.MakeText (this, "Próximamente...", ToastLength.Long).Show ();
						Log.Debug("Añadir Negocio","Hizo click!");
						var nuevoneg = new Intent (this, typeof(AgregarNegocio));
						/*enviarmsj.PutExtra("negocioid",idres);
						enviarmsj.PutExtra("titulo", titulores);
						enviarmsj.PutExtra("propietario",propietario);*/
						StartActivity (nuevoneg);
				}
				else if(e.MenuItem.TitleFormatted.ToString() == "Cerrar Sesión")
				{
					var Dialog = new Android.Support.V7.App.AlertDialog.Builder(this);
					Dialog.SetTitle("Cerrar Sesión");
					Dialog.SetMessage("¿Desea cerrar la sesión?");
					Dialog.SetPositiveButton("Cerrar Sesión",delegate 
						{
							editor.Clear ();
							editor.Commit();
								//aqui metemos el stringextra logout
								var salir = new Intent (this, typeof(login));
								salir.PutExtra("logout","yes");
								StartActivity (salir);
							Finish ();	
						});
					Dialog.SetNegativeButton("Cancelar",delegate {});
					Dialog.Show();
					//No hay necesidad de esto
					//SupportActionBar.Title = "PLIF";
				}
			};

				Log.Debug (tag, "pasamos navigation item selected");

			}catch(Exception ex){
				Log.Debug (tag, "El error de navigationitemselected" + ex + "ACABA ERROR");
			}


			//Todo lo que no sea del Drawer se pone abajo

			TextView UserName = FindViewById<TextView> (Resource.Id.username);

			//PONEMOS EL NOMBRE DEL USUARIO
			var nombre = prefs.GetString("nombre", null);
			UserName.Text = nombre;

			//PONEMOS LA IMAGEN DEL USUARIO

			//recuperamos la ruta de las preferencias
			string ruta = "http://plif.mx/"+prefs.GetString ("img_perfil", null);  //+prefs.GetString ("id", null)
			ImageView imagen = FindViewById<ImageView> (Resource.Id.image_circle);
			try{

				JsonValue rutapre = await plifserver.FetchWeatherAsync ("http://plif.mx/mobile/get_img_usr?id="+prefs.GetString ("id", null));
				Log.Debug ("json","SI existe la ruta");
				string extra="http://plif.mx/";
				string path = rutapre [0] ["imagen_usuarios"] ["ruta"];


				string first=path[0].ToString();

				if(first=="u" || first=="U"){
					//Toast.MakeText (Application.Context, "EMPIEZA CON U!!!", ToastLength.Long).Show ();
					path=extra+path;
				}else{
					//no hagas nada, la imagen es de google o de algun otro lado.
				}


				Log.Debug (tag, "La ruta es: "+path);
				//rutafoto=path;
				Koush.UrlImageViewHelper.SetUrlDrawable(imagen, path, Resource.Drawable.profile);
				//hayimagen="si";

				//////////////////////
			/*
				JsonValue rutapre = await plifserver.FetchWeatherAsync ("http://plif.mx/mobile/get_img_usr?id="+prefs.GetString ("id", null));
				Log.Debug ("json","SI existe la ruta");
				string path = "http://plif.mx/"+rutapre [0] ["imagen_usuarios"] ["ruta"];
				Koush.UrlImageViewHelper.SetUrlDrawable(imagen, path, Resource.Drawable.profile);*/
			}catch(Exception ex){
				Log.Debug ("json","no existe la ruta");
				imagen.SetImageResource (Resource.Drawable.profile);
			}
			
			//creamos el objeto de referencia al imageview


			//CREAMOS LA ANIMACION
			floatbounce = AnimationUtils.LoadAnimation (Application.Context, Resource.Animation.floatbounce);


			imagen.Click += (object sender, EventArgs e) => {
				drawerLayout.CloseDrawers ();
				StartActivity(typeof(profile));

			};

			UserName.Click += (sender, e) =>  
			{	
				drawerLayout.CloseDrawers ();
				StartActivity(typeof(profile));


			};

			//Todo lo que no sea del Drawer se pone arriba
		}
 private void NavigationItemSelected(object sender, NavigationView.NavigationItemSelectedEventArgs e)
 {
     FragmentHandler.Instance.LoadFragment(FragmentManager, e.MenuItem.ItemId);
     drawerLayout.CloseDrawers();
 }
        void NavigationView_NavigationItemSelected(object sender, NavigationView.NavigationItemSelectedEventArgs e)
        {
            switch (e.MenuItem.ItemId)
            {
            case (Resource.Id.nav_start):
            {
                var activity2 = new Intent(this, typeof(Activity_Start));
                StartActivity(activity2);
            }

            break;

            case (Resource.Id.nav_about):
            {
                var activity2 = new Intent(this, typeof(Activity_About));
                StartActivity(activity2);
            }

            break;

            case (Resource.Id.nav_exams):
            {
                var activity2 = new Intent(this, typeof(Activity_Exams));
                StartActivity(activity2);
            }

            break;

            case (Resource.Id.nav_times):
            {
                var activity2 = new Intent(this, typeof(Activity_Times));
                StartActivity(activity2);
            }

            break;

            case (Resource.Id.nav_mensa):
            {
                var activity2 = new Intent(this, typeof(Activity_Mensa));
                StartActivity(activity2);
            }

            break;

            case (Resource.Id.nav_links):
            {
                var activity2 = new Intent(this, typeof(Activity_Links));
                StartActivity(activity2);
            }

            break;

            case (Resource.Id.nav_news):
            {
                var activity2 = new Intent(this, typeof(Activity_News));
                StartActivity(activity2);
            }

            break;

            case (Resource.Id.nav_rooms):
            {
                var activity2 = new Intent(this, typeof(Activity_Room_Search));
                StartActivity(activity2);
            }

            break;
            }


            drawerLayout.CloseDrawers();
        }
		private void NaviView()
		{
			// 서랍 메뉴
			drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
			navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);
			navigationView.NavigationItemSelected += (sender, e) =>
			{
				e.MenuItem.SetChecked(true);
				bool ret;
				switch (e.MenuItem.ItemId) {
					case Resource.Id.nav_weld_count:
					viewPager.SetCurrentItem(1, true);
					break;
					case Resource.Id.nav_weld_condition:
					viewPager.SetCurrentItem(2, true);
					break;
					case Resource.Id.nav_storage:
					viewPager.SetCurrentItem(0, true);
					if (!StorageRefresh("/storage"))
						Show("경로 이동 실패: " + "/storage");
					break;
					case Resource.Id.nav_sdcard0:
					viewPager.SetCurrentItem(0, true);
					if (!StorageRefresh(Environment.ExternalStorageDirectory.AbsolutePath))
						Show("경로 이동 실패: " + Environment.ExternalStorageDirectory.AbsolutePath);
					break;
					case Resource.Id.nav_extsdcard:
					viewPager.SetCurrentItem(0, true);
					ret = false;
					try {
						var dir = new DirectoryInfo("/storage");
						foreach (var item in dir.GetDirectories()) {
							if (item.Name.ToLower().StartsWith("ext") || item.Name.ToLower().StartsWith("sdcard1")) {
								foreach (var subItem in item.GetFileSystemInfos()) {
									if (StorageRefresh(item.FullName)) {
										ret = true;
										break;
									}
								}
							}
						}
					} catch { }
					if (!ret)
						Show("경로 이동 실패: " + "SD 카드");
					break;
					case Resource.Id.nav_usbstorage:
					viewPager.SetCurrentItem(0, true);
					ret = false;
					try {
						var dir = new DirectoryInfo("/storage");
						foreach (var item in dir.GetDirectories()) {
							if (item.Name.ToLower().StartsWith("usb")) {
								foreach (var subItem in item.GetFileSystemInfos()) {
									if (StorageRefresh(item.FullName)) {
										ret = true;
										break;
									}
								}
							}
						}
					} catch { }
					if (!ret)
						Show("경로 이동 실패: " + "USB 저장소");
					break;
					case Resource.Id.nav_exit:
					Finish();
					break;
				}
				drawerLayout.CloseDrawers();
			};
			NaviViewHeader();
		}
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            if (!CheckInternetConnectivity())
            {
                Toast.MakeText(this, "YOU ARE OFFLINE!", ToastLength.Short).Show();
                //Finish();
                //Process.KillProcess(Android.OS.Process.MyPid());
            }
            else
            {
                if (!DataRepository.HaveData)
                {
                    var progressDialog = ProgressDialog.Show(this, "Please wait...", "Getting data...", true);
                    new Thread(new ThreadStart(delegate
                    {
                        DataRepository.GetData();
                        DataRepository.SortData();
                        RunOnUiThread(AfterDataFetching);
                        RunOnUiThread(() => progressDialog.Hide());
                    })).Start();
                }
            }

            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);

            //Set hamburger items menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);

            //setup navigation view
            navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);

            //handle navigation
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);

                switch (e.MenuItem.ItemId)
                {
                    case Resource.Id.productsMenuItem:
                        ListItemClicked(0);
                        break;
                    case Resource.Id.selectedProductsMenuItem:
                        ListItemClicked(1);
                        break;
                    case Resource.Id.aboutMenuItem:
                        ListItemClicked(2);
                        break;
                }

                drawerLayout.CloseDrawers();
            };

            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                ListItemClicked(0);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetTheme(Resource.Style.Theme_BoeingTheme);
            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MzQwMzU3QDMxMzgyZTMzMmUzMFRVeTIvbUJuNE1zR2d5bWR6eHdGdjRqR0F4RE11SHpYd1FhU24vUUhIak09");
            //int uiOptions = (int)Window.DecorView.SystemUiVisibility;
            //uiOptions = (int)SystemUiFlags.HideNavigation | (int)SystemUiFlags.Fullscreen;
            //Window.DecorView.SystemUiVisibility = (StatusBarVisibility)uiOptions;

            unityContainer = new UnityContainer();
            unityContainer.RegisterInstance <ISettingsService>("SettingsService", SettingsService.Instance());
            unityContainer.RegisterInstance <IFuelDistributionService>("FuelDistributionService", FuelDistributionService.Instance());
            unityContainer.RegisterInstance <IFuelUpliftService>("FuelUpliftService", FuelUpliftService.Instance());
            unityContainer.RegisterInstance <IFuelOrderService>("FuelOrderService", FuelOrderService.Instance());
            unityContainer.RegisterInstance <IFuelCheckDataInputService>("FuelCheckDataInputService", FuelCheckDataInputService.Instance());
            unityContainer.RegisterInstance <IFuelCheckListService>("FuelCheckListService", FuelCheckListService.Instance());
            unityContainer.RegisterInstance <IEventService>("EventService", EventService.Instance());
            unityContainer.RegisterInstance <IDatabaseService>("DatabaseService", DatabaseService.Instance(unityContainer.Resolve <ISettingsService>("SettingsService").GetLocalFilePath("fuelchecks.db")));
            unityContainer.RegisterInstance <IBaggageDistributionService>("BaggageDistributionService", BaggageDistributionService.Instance());
            unityContainer.RegisterInstance <IBrakeCoolingService>("BrakeCoolingService", BrakeCoolingService.Instance());
            unityContainer.RegisterInstance <ICircuitBreakerService>("CircuitBreakerService", CircuitBreakerService.Instance());
            eventService = unityContainer.Resolve <IEventService>("EventService");
            UnityServiceLocator unityServiceLocator = new UnityServiceLocator(unityContainer);

            ServiceLocator.SetLocatorProvider(() => unityServiceLocator);
            SetContentView(Resource.Layout.main);
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            if (toolbar != null)
            {
                SetSupportActionBar(toolbar);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetHomeButtonEnabled(true);
            }

            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            //Set hamburger items menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);

            //setup navigation view
            navigationView       = FindViewById <NavigationView>(Resource.Id.nav_view);
            bottomNavigationView = FindViewById <NavigationView>(Resource.Id.nav_view_bottom);

            //handle navigation
            navigationView.NavigationItemSelected += (sender, e) =>
            {
                //(sender as NavigationView).PerformHapticFeedback(FeedbackConstants.VirtualKey, FeedbackFlags.IgnoreGlobalSetting);
                if (previousItem != null)
                {
                    previousItem.SetChecked(false);
                }

                navigationView.SetCheckedItem(e.MenuItem.ItemId);

                previousItem = e.MenuItem;

                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_fuel_order:
                    ListItemClicked(0);
                    break;

                case Resource.Id.nav_fuel_check:
                    ListItemClicked(1);
                    break;

                case Resource.Id.nav_baggage_distribution:
                    ListItemClicked(2);
                    break;

                case Resource.Id.nav_brake_cooling:
                    ListItemClicked(3);
                    break;

                case Resource.Id.circuit_breaker:
                    ListItemClicked(4);
                    break;

                case Resource.Id.nav_checklists:
                    ListItemClicked(5);
                    break;

                case Resource.Id.nav_manouvers:
                    ListItemClicked(6);
                    break;

                case Resource.Id.nav_limitations:
                    ListItemClicked(7);
                    break;
                }
                e.MenuItem.SetChecked(true);
                if (lastMenuItem != null && lastMenuItem.ItemId != e.MenuItem.ItemId)
                {
                    lastMenuItem.SetChecked(false);
                    lastMenuItem = e.MenuItem;
                }
                drawerLayout.CloseDrawers();
            };

            bottomNavigationView.NavigationItemSelected += (sender, e) =>
            {
                if (e.MenuItem.ItemId == Resource.Id.nav_settings)
                {
                    ListItemClicked(8);
                    e.MenuItem.SetChecked(true);
                    if (lastMenuItem != null && lastMenuItem.ItemId != e.MenuItem.ItemId)
                    {
                        lastMenuItem.SetChecked(false);
                        lastMenuItem = e.MenuItem;
                    }
                }
                drawerLayout.CloseDrawers();
            };
            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                navigationView.SetCheckedItem(Resource.Id.nav_fuel_order);
                lastMenuItem = navigationView.Menu.FindItem(Resource.Id.nav_fuel_order);
                ListItemClicked(0);
            }
        }
Beispiel #43
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            //ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            // Set our view from the "main" layout resource

            SetContentView(Resource.Layout.MainView);

            pref = PreferenceManager.GetDefaultSharedPreferences(this);

            _mToolbar = FindViewById <SupportToolbar>(Resource.Id.toolbar);

            // Inflate the "decor.xml"
            //LayoutInflater inflater = (LayoutInflater) GetSystemService(Context.LayoutInflaterService);
            //_mDrawerLayout = (DrawerLayout) inflater.Inflate(Resource.Layout.DrawerView, null); // "null" is important.

            var view1 = LayoutInflater.From(this).Inflate(Resource.Layout.DrawerView, null, false);

            // HACK: "steal" the first child of decor view
            _mDrawerLayout = view1.FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            ViewGroup decor = (ViewGroup)Window.DecorView;
            View      child = decor.GetChildAt(0);

            decor.RemoveView(child);
            _container = _mDrawerLayout.FindViewById <LinearLayout>(Resource.Id.fragmentContainer);
            var container = (FrameLayout)_mDrawerLayout.FindViewById(Resource.Id.container);              // This is the container we defined just now.

            container.AddView(child);

            // Make the drawer replace the first child
            decor.AddView(_mDrawerLayout);

            //_mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            _mLeftDrawer = _mDrawerLayout.FindViewById <ListView>(Resource.Id.left_drawer);
            DisplayMetrics displayMetrics = Resources.DisplayMetrics;

            Android.Views.ViewGroup.LayoutParams lp = (Android.Views.ViewGroup.LayoutParams)_mLeftDrawer.LayoutParameters;
            lp.Height = displayMetrics.HeightPixels;
            _mLeftDrawer.LayoutParameters = lp;
            //_mLeftDrawer.SetMinimumHeight (displayMetrics.HeightPixels+GetStatusBarHeight()+(int)(48*displayMetrics.Density));
            //mToolbar.SystemUiVisibility =
            //	(StatusBarVisibility)Android.Views.SystemUiFlags.LowProfile;

            _mToolbar.SetPadding(0, GetStatusBarHeight(), 0, 0);
            _mToolbar.LayoutParameters.Height = (int)(52 * displayMetrics.Density) + GetStatusBarHeight();
            SetSupportActionBar(_mToolbar);



            _mDrawerToggle = new MyDrawerToggle(
                this,                                                   //Host Activity
                _mDrawerLayout,                                         //DrawerLayout
                Resource.String.profile,                                //Opened Message
                Resource.String.hot_title,                              //Closed Message
                pref
                );

            _mDrawerLayout.SetDrawerListener(_mDrawerToggle);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            //SupportActionBar.NavigationMode = (int)ActionBarNavigationMode.Standard;

            _mDrawerToggle.SyncState();

            //_container = FindViewById<LinearLayout>(Resource.Id.fragmentContainer);


            _posts = new List <Post>();


            var root2 = LayoutInflater.Inflate(Resource.Layout.PostFragmentRecycleView, _container, false);

            var recyclerView = root2.FindViewById <RecyclerView>(Resource.Id.postRecycleView);

            _container.AddView(root2);
            _recyclerView = recyclerView;
            //recyclerView.HasFixedSize = true;
            //recyclerView.SetItemAnimator(new DefaultItemAnimator());
            _recyclerView.SetLayoutManager(new LinearLayoutManager(this));
            //recyclerView.AddItemDecoration(new DividerItemDecoration(Activity, DividerItemDecoration.HorizontalList));
            _recyclerView.NestedScrollingEnabled = false;

            //mEmails.Add(new Email() { Name = "tom", Subject = "Wanna hang out?", Message = "I'll be around tomorrow!!" });

            var adapter = new PostViewAdapter(_posts, _recyclerView, this);

            _adapter = adapter;
            _adapter.HasStableIds = true;

            _recyclerView.SetAdapter(_adapter);
            _recyclerView.AddOnScrollListener(new MyScrollListener());

            Task.Factory.StartNew(async() => {
                try{
                    var newPostList = new List <Post>();
                    var editor      = pref.Edit();
                    editor.PutString("CurrentPage", "0");
                    editor.PutString("CurrentChanel", Resource.Id.hotRowLayout.ToString());
                    editor.Apply();
                    await WebClient.LoadPosts(newPostList, 1);
                    _posts.AddRange(newPostList);


                    //(_RecyclerView.GetAdapter()as PostViewAdapter)._Posts.AddRange(newPostList);

                    //_RecyclerView.GetAdapter().NotifyItemRangeInserted(_RecyclerView.GetAdapter().ItemCount,newPostList.Count);
                    //recyclerView.GetAdapter().HasStableIds = true;
                    //recyclerView.GetAdapter().NotifyDataSetChanged();
                    //_RecyclerView.GetAdapter().NotifyDataSetChanged();
                    RunOnUiThread(() => {
                        _adapter.NotifyDataSetChanged();
                    });
                }
                catch (Exception ex)
                {
                    // ignored
                    Insights.Report(ex, new Dictionary <string, string> {
                        { "Message", ex.Message }
                    }, Insights.Severity.Error);
                    Toast.MakeText(this, ex.Message, ToastLength.Short).Show();
                }
            });



            _mLeftDrawer.Tag = 0;
            //mRightDrawer.Tag = 1;

            EventHandler headerClick = (object sender, EventArgs e) => {
                var layout        = (RelativeLayout)sender;
                var currentChanel = String.Empty;
                switch (layout.Id)
                {
                case Resource.Id.hotRowLayout:
                    currentChanel = Resource.Id.hotRowLayout.ToString();

                    break;

                case Resource.Id.bestRowLayout:
                    currentChanel = Resource.Id.bestRowLayout.ToString();

                    break;

                case Resource.Id.newRowLayout:
                    currentChanel = Resource.Id.newRowLayout.ToString();

                    break;

                default:
                    currentChanel = Resource.Id.hotRowLayout.ToString();
                    break;
                }
                var editor = pref.Edit();
                editor.PutString("CurrentChanel", currentChanel);
                editor.Apply();
                _mDrawerLayout.CloseDrawers();
                Reload();
            };

            int []    prgmImages    = { Resource.Drawable.ic_camera_64, Resource.Drawable.ic_star_64, Resource.Drawable.ic_comments_64, Resource.Drawable.ic_menu_64 };
            String [] prgmNameList  = { "Сообщения", "Избранное", "Моя лента", "Мои коммнтарии" };
            var       drawerAdapter = new DrawerListAdapter(this, Resource.Array.drawerListItems, Resource.Array.drawerListIcons, new DrawerListBadges {
                Feed = 0, Messages = 1
            });

            _mLeftDrawer.Adapter       = drawerAdapter;
            _mLeftDrawer.DividerHeight = 0;
            var drawerListHeader = LayoutInflater.Inflate(Resource.Layout.DrawerListHeader, null);
            var hotRowLayout     = drawerListHeader.FindViewById <RelativeLayout> (Resource.Id.hotRowLayout);
            var bestRowLayout    = drawerListHeader.FindViewById <RelativeLayout> (Resource.Id.bestRowLayout);
            var newRowLayout     = drawerListHeader.FindViewById <RelativeLayout> (Resource.Id.newRowLayout);

            hotRowLayout.Click  += headerClick;
            bestRowLayout.Click += headerClick;
            newRowLayout.Click  += headerClick;
            _mLeftDrawer.AddHeaderView(drawerListHeader, null, false);
        }
        //Pass title here in on Create???? Seems like cheap work around but could work
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.base_activity_layout);
            _Toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(_Toolbar);
            _BaseFrameLayout = FindViewById<FrameLayout>(Resource.Id.content_frame);
            _DrawerLayout = FindViewById<DrawerLayout>(Resource.Id.test_drawer_layout);

            _navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);

            UserTextView = FindViewById<TextView>(Resource.Id.headerTextView);
            UserTextView.Click += delegate
            {
                Console.WriteLine("I clicked on user");
            };
            UpdateCurrentUser();

            _navigationView.SetCheckedItem(Resource.Id.navigation_item_1);

            _navigationView.NavigationItemSelected += (sender, args) =>
            {

                if (args.MenuItem.ItemId != _currentSelectedId)
                {
                    _DrawerLayout.CloseDrawers();

                    Console.WriteLine("Menu Item clicked is " + args.MenuItem.ItemId);
                    Console.WriteLine("Item 3 ID is " +
                                      _navigationView.Menu.FindItem(Resource.Id.GoToTestSecondActivity).ItemId);


                    if (args.MenuItem.ItemId == _navigationView.Menu.FindItem(Resource.Id.GoToTestSecondActivity).ItemId)
                    {
                        StartActivity(typeof (TrakkedShowsTabActivity));
                    }

                    if (args.MenuItem.ItemId == _navigationView.Menu.FindItem(Resource.Id.GoToTrakkedShowsActivity).ItemId)
                    {
                        
                    }

                    if (args.MenuItem.ItemId == _navigationView.Menu.FindItem(Resource.Id.GoToAddShowActivity).ItemId)
                    {
                        StartActivity(typeof (AddShowActivity));
                    }
                    if (args.MenuItem.ItemId == _navigationView.Menu.FindItem(Resource.Id.GoToAddMoviesActivity).ItemId)
                    {
                        StartActivity(typeof(AddMovieActivity));
                    }
                }
                //args.MenuItem.SetChecked(true);

            };

            _navigationView.Menu.FindItem(Resource.Id.navigation_item_2).SetTitle("Logout");

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            SetTitle("BaseActivity");
        }