Ejemplo n.º 1
0
        void InitUI()
        {
            mDrawerLayout = FindViewById<DrawerLayout> (Resource.Id.drawerLayout);
            mDrawerList = FindViewById<ListView> (Resource.Id.sliderMenu);

            var adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, operations);
            mDrawerList.Adapter = adapter;

            ActionBar.SetDisplayHomeAsUpEnabled (true);
            ActionBar.SetHomeButtonEnabled (true);

            mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
                Resource.Drawable.ic_drawer, //nav menu toggle icon
                Resource.String.app_name, // nav drawer open - description for accessibility
                Resource.String.app_name // nav drawer close - description for accessibility
            );

            mDrawerLayout.DrawerClosed += (sender, e) => {
                ActionBar.Title = Resources.GetString(Resource.String.app_name);
                InvalidateOptionsMenu();
            };

            mDrawerLayout.DrawerOpened += (sender, e) => {
                ActionBar.Title = Resources.GetString(Resource.String.app_name);
                InvalidateOptionsMenu();
            };

            mDrawerLayout.SetDrawerListener(mDrawerToggle);

            //FragmentManager.BeginTransaction ().Replace (Resource.Id.container, new ServiceFragment ()).Commit ();
            //FragmentManager.BeginTransaction ().Replace (Resource.Id.container, new LinearFragment ()).Commit ();
            FragmentManager.BeginTransaction ().Replace (Resource.Id.container, new EditTextSampleFragment ()).Commit ();
        }
 public NavigationDrawerToggle(AppCompatActivity host, DrawerLayout drawerLayout, int openedResource, int closedResource) 
     : base(host, drawerLayout, openedResource, closedResource)
 {
     mHostActivity = host;
     mOpenedResource = openedResource;
     mClosedResource = closedResource;
 }
        //public List<DrawerItem> items;
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create your application here
            SetContentView (Resource.Layout.activity_drawer_welcomeLayout);
            try
            {
                mDrawerLayout = FindViewById<DrawerLayout> (Resource.Id.myDrawer_layout);
                mLeftDrawer = FindViewById<ListView> (Resource.Id.leftListView);

                mDrawerToggle = new myActionBarDrawerToggle (this, mDrawerLayout, Resource.Drawable.ic_drawer, Resource.String.open_drawer, Resource.String.close_drawer);

                mLeftDrawer.Adapter=new MenuListAdapter(this);
                this.mLeftDrawer.ItemClick += (sender, e) => SelectItem(e.Position);

                mDrawerLayout.SetDrawerListener (mDrawerToggle);

                ActionBar.SetDisplayHomeAsUpEnabled (true);
                ActionBar.SetHomeButtonEnabled (true);
                ActionBar.SetDisplayShowTitleEnabled (true);
            }
            catch (Exception ex) {
                var toast = Toast.MakeText (this, ex.Message ,ToastLength.Short);
                toast.Show ();
            }
        }
Ejemplo n.º 4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource.
            SetContentView(Resource.Layout.Main);
            _DrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawerMain);

            // Set the toolbar
            _Toolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar);

            _DrawerToggle = new HelpsAppCompatDrawerToggle(this, _DrawerLayout, Resource.String.menuTitle, _CurrentViewTitle);
            _DrawerLayout.SetDrawerListener(_DrawerToggle);

            // Set up action bar
            SetUpSupportActionBar(bundle);
            
            _DrawerToggle.SyncState();

            // Set up the menu layout.
            SetUpMenu();
            
            //Fetch booking data
            FetchBookingData();

        }
Ejemplo n.º 5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            int calcNo = Intent.GetIntExtra("CalculationType",-1);

            SetContentView (Resource.Layout.PercentDrawer);

            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawerLayout);
            drawerLayout.SetBackgroundColor(Android.Graphics.Color.AntiqueWhite);
            ColorDrawable colorDrawable = new ColorDrawable (Color.Black);
            this.ActionBar.SetBackgroundDrawable (colorDrawable);

            drawerToggle = new ActionBarDrawerToggle (this, drawerLayout, Resource.String.DrawerOpenDescription, Resource.String.DrawerCloseDescription);

            drawerLayout.SetDrawerListener (drawerToggle);

            drawerListView = FindViewById<ListView> (Resource.Id.drawerListView);
            drawerListView.Adapter = new ArrayAdapter<string> (this, Android.Resource.Layout.SimpleListItem1, calculationTitles);
            drawerListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => OnMenuItemClick(e.Position);
            drawerListView.SetItemChecked (calcNo, true);
            OnMenuItemClick (calcNo);

            ActionBar.SetDisplayHomeAsUpEnabled (true);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.CreateEmployee);

            _supporttoolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.ToolBar);
            _drawer = FindViewById<DrawerLayout>(Resource.Id.DrawerLayout);
            _navigationview = FindViewById<NavigationView>(Resource.Id.nav_view);
            ToolbarCreator toolbarCreator = new ToolbarCreator();
            toolbarCreator.setupToolbar(_supporttoolbar, _drawer, _navigationview, Resource.String.createemployee, this);

            BtnCreateEmployee = FindViewById<Button>(Resource.Id.ButtonCreateEmployee);        
            EditTextFirstName = FindViewById<EditText>(Resource.Id.EditTextFirstName);
            EditTextLastName = FindViewById<EditText>(Resource.Id.EditTextLastName);
            EditTextEmployeeID = FindViewById<EditText>(Resource.Id.EditTextEmployeeID);
            EditTextEmail = FindViewById<EditText>(Resource.Id.EditTextEmail);
            SpinnerDepartment = FindViewById<Spinner>(Resource.Id.SpinnerDepartment);
            SpinnerPrivledge = FindViewById<Spinner>(Resource.Id.SpinnerPrivledgeLevel);
            Color color = new Color(ContextCompat.GetColor(this, Resource.Color.black)); 
            SpinnerDepartment.Background.SetColorFilter(color,PorterDuff.Mode.SrcAtop);
            SpinnerPrivledge.Background.SetColorFilter(color, PorterDuff.Mode.SrcAtop);

            BtnCreateEmployee.Click += async delegate
            {
                BtnCreateEmployee.Enabled = false;
                await createEmployee();
                BtnCreateEmployee.Enabled = true;
            };
        }
Ejemplo n.º 7
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Create your application here

			SetContentView (Resource.Layout.show_details);

			toolbar = FindViewById<Toolbar> (Resource.Id.toolbar);
			//Toolbar will now take on default actionbar characteristics
			SetSupportActionBar (toolbar);
			SupportActionBar.Title = "Show Details";
			SupportActionBar.SetHomeAsUpIndicator (Resource.Drawable.ic_menu);
			SupportActionBar.SetDisplayHomeAsUpEnabled (true);


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

			var navigationView = FindViewById<NavigationView> (Resource.Id.nav_view);
			if (navigationView != null) {
				setupDrawerContent (navigationView);
			}
		
			myTextView = FindViewById<TextView> (Resource.Id.tvForID);
			//myTextView.Text = Intent.GetStringExtra ("TVDBID");

			var myDownloadTask = downloadURL ();

		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            fragmentManager = FragmentManager;
            //fragmentManager.AddOnBackStackChangedListener(this);

            registerFragments(bundle);
            SetContentView(Resource.Layout.activity_home);

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

            toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
            if (toolbar != null)
            {
                SetSupportActionBar(toolbar);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);

                drawerToggle = new MvxActionBarDrawerToggle(
                    this,                  /* host Activity */
                    drawerLayout,         /* DrawerLayout object */
                    toolbar,  /* nav drawer icon to replace 'Up' caret */
                    Resource.String.drawer_open,  /* "open drawer" description */
                    Resource.String.drawer_close  /* "close drawer" description */
                );

                drawerLayout.SetDrawerListener(drawerToggle);
            }

            ViewModel.ShowMenu ();
        }
 public MyActionBarDrawToggle(ActionBarActivity host, DrawerLayout drawerLayout, int openedResource, int closedResource)
     : base(host,drawerLayout,openedResource,closedResource)
 {
     mHostActivity = host;
     mOpenedResource = openedResource;
     mClosedResource = closedResource;
 }
Ejemplo n.º 10
0
		protected override void OnCreate (Bundle savedInstanceState)
		{ 
 
			base.OnCreate (savedInstanceState);   
			SetContentView (Resource.Layout.Main);
			drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout); 

			// Init toolbar
			var toolbar = FindViewById<Toolbar>(Resource.Id.app_bar);
			SetSupportActionBar(toolbar);
			SupportActionBar.SetTitle (Resource.String.app_name);
			SupportActionBar.SetDisplayHomeAsUpEnabled(true);
			SupportActionBar.SetDisplayShowHomeEnabled(true);

			// Attach item selected handler to navigation view
			var navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);
			navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;

			// Create ActionBarDrawerToggle button and add it to the toolbar
			var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.open_drawer, Resource.String.close_drawer);
			drawerLayout.SetDrawerListener(drawerToggle);
			drawerToggle.SyncState();

			//load default home screen
			var ft= FragmentManager.BeginTransaction ();
			ft.AddToBackStack (null);
			ft.Add (Resource.Id.HomeFrameLayout, new HomeFragment ());
			ft.Commit ();  
		}
 public HelpsAppCompatDrawerToggle(AppCompatActivity host, DrawerLayout drawerLayout, int openedResource, int closedResource)
     : base(host, drawerLayout, openedResource, closedResource)
 {
     _HostActivity = host;
     _OpenedResource = openedResource;
     _ClosedResource = closedResource;
 }
Ejemplo n.º 12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

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

            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 ("Stores");
            mLeftDataSet.Add ("Groceries");
            mLeftAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, mLeftDataSet);
            mLeftDrawer.Adapter = mLeftAdapter;
            mLeftDrawer.ItemClick += DrawerListOnItemCLick;
            mDrawerToggle = new MyActionBarDrawerToggle(
                this,							//Host Activity
                mDrawerLayout,					//DrawerLayout
                Resource.String.openDrawer,		//Opened Message
                Resource.String.closeDrawer		//Closed Message
            );

            mDrawerLayout.SetDrawerListener(mDrawerToggle);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(true);
            mDrawerToggle.SyncState();
        }
Ejemplo n.º 13
0
		protected override void OnCreate(Bundle bundle)
		{
			base.OnCreate(bundle);

			setup();

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

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

			drawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow, GravityCompat.Start);
			drawerList.SetLayoutManager(new LinearLayoutManager(this));
			adapter = new MenuAdapter();
			drawerList.SetAdapter(adapter);

			// enable ActionBar app icon to behave as action to toggle nav drawer
			this.ActionBar.SetDisplayHomeAsUpEnabled(true);
			this.ActionBar.SetHomeButtonEnabled(true);
			this.ActionBar.Title = "Test";
			drawerToggle = new MainDrawerToggle(this, drawerLayout,
				Resource.Drawable.ic_drawer,
				Resource.String.drawer_open,
				Resource.String.drawer_close);

			drawerLayout.AddDrawerListener(drawerToggle);

			drawerLayout.CloseDrawer(drawerList);
			vm.NavigatedTo(null);
		}
Ejemplo n.º 14
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            locationManager = GetSystemService(Context.LocationService) as LocationManager;

            //set the user current location
            setlocation();

            //setup the map
            SetupMap();


            //set left drawer staff
            leftDrawerLayaout = FindViewById<DrawerLayout>(Resource.Id.myDrawer);
            leftDrawer = FindViewById<ListView>(Resource.Id.leftListView);

            //get users 
            populateUsersOnDrawer();

            leftDrawerToggle = new ActionBarDrawerToggle(this, leftDrawerLayaout, Resource.Drawable.menu, Resource.String.drawer_open, Resource.String.drawer_close);
            leftDrawerLayaout.SetDrawerListener(leftDrawerToggle);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);
            ActionBar.SetDisplayShowTitleEnabled(true);
           
            //start message service 
            StartService(new Intent(this, typeof(MsgApiService)));

        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Set our view from the "main" layout resource.
            SetContentView(Resource.Layout.Main);

            // Check if we're using a layout with a navigation drawer. If yes, set it up.
            this.drawerLayout = this.FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            if (this.drawerLayout != null)
            {
                this.drawerMenu = this.FindViewById<FrameLayout>(Resource.Id.mainContainer);
                this.ActionBar.SetDisplayHomeAsUpEnabled(true);
                this.ActionBar.SetHomeButtonEnabled(true);
                this.drawerToggle = new ActionBarDrawerToggle(this, this.drawerLayout, Resource.Drawable.ic_drawer_light, Resource.String.DrawerOpen, Resource.String.DrawerClose);
                this.drawerLayout.SetDrawerListener(this.drawerToggle);
                this.drawerLayout.OpenDrawer (this.drawerMenu);
            }

            // Populate the menu with a fragment. This can either be the full screen (phone), the left part (10 inch tablet)
            // or the content of the navigation drawer (7 inch tablet).
            var fragment = new CountryListFragment();
            var transaction = this.FragmentManager.BeginTransaction();

            transaction.Replace(Resource.Id.mainContainer, fragment);
            transaction.Commit();
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.DrawerLayout);

            mActionBar = createActionBarHelper ();
            mActionBar.init ();

            items = new string[] { "Vegetables","Fruits","Flower Buds","Legumes","Bulbs","Tubers" };

            mDrawerList =FindViewById<ListView> (Resource.Id.left_drawer);
            mTextView =FindViewById <TextView> (Resource.Id.content_text_DrawerLayout);

            mDrawerList.Adapter = new ArrayAdapter<string>(this,Android.Resource.Layout.SimpleListItem1, items);
            mDrawerList.ItemClick += OnDrawerLIstItemClick;

            mDrawerLayout = (DrawerLayout)FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            mDrawerLayout.DrawerOpened += HandleDrawerOpened;
            mDrawerLayout.DrawerClosed += HandleDrawerClosed;

            // ActionBarDrawerToggle provides convenient helpers for tying together the
            // prescribed interactions between a top-level sliding drawer and the action bar.
            mDrawerToggle = new ActionBarDrawerToggle (this,
                                                       mDrawerLayout,
                                                       Resource.Drawable.ic_drawer,
                                                       Resource.String.drawer_open,
                                                       Resource.String.drawer_close);
        }
Ejemplo n.º 17
0
		protected override void OnCreate (Android.OS.Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);
			SetContentView (Resource.Layout.Main);
			Toolbar = FindViewById<Toolbar> (Resource.Id.toolbar);
			drawerLayout = FindViewById<DrawerLayout> (Resource.Id.drawer_layout);
			if (Toolbar != null) {
				SetSupportActionBar (Toolbar);
				SupportActionBar.SetDisplayHomeAsUpEnabled (true);
				SupportActionBar.SetHomeButtonEnabled (true);
			}

			var navigationDrawer = this.FindViewById<NavigationView> (Resource.Id.nav_view);
			navigationDrawer.NavigationItemSelected += Nv_NavigationItemSelected;

			// animating menu
			actionBarToggle = new ActionBarDrawerToggle (
				this, 
				drawerLayout, 
				Resource.String.openDrawer,
				Resource.String.closeDrawer
			);



			drawerLayout.SetDrawerListener (actionBarToggle);
			actionBarToggle.SyncState ();
			DoFirstRun (savedInstanceState);
		}
        protected override void OnCreate(Bundle savedInstanceState)
        {
            _logging.WriteLine(Lib.Logging.MessageType.Information, "Starting application in MainActivity OnCreate method");
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            SetContentView(Resource.Layout.Main);
            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawerLayout);

            drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, Resource.String.DrawerOpenDescription, Resource.String.DrawerCloseDescription);

            drawerLayout.SetDrawerListener(drawerToggle);
            ActionBar.SetIcon(Android.Resource.Color.Transparent);
            ActionBar.SetDisplayHomeAsUpEnabled(true);

            drawerListView = FindViewById<ListView>(Resource.Id.drawerListView);
            menuAdapter = new MenuAdapter (this);
            drawerListView.Adapter = menuAdapter;
            drawerListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => OnMenuItemClick(e.Position);
            var aboutFrag = menuAdapter.MenuItems.FirstOrDefault(x => x.Manager.GetType() == typeof(AboutFragment));
            var aboutPos = menuAdapter.MenuItems.IndexOf (aboutFrag);
            drawerListView.SetItemChecked(aboutPos, true);	// Highlight the About Fragment at startup
            OnMenuItemClick(aboutPos);                     // Load About Fragment at startup
        }
Ejemplo n.º 19
0
		public MainDrawerToggle (ActionBarActivity host, DrawerLayout drawerLayout, int openedResource, int closedResource) 
			: base(host, drawerLayout, openedResource, closedResource)
		{
			_hostActivity = host;
			_openedResource = openedResource;
			_closedResource = closedResource;
		}
Ejemplo n.º 20
0
 public ActionBarDrawerToggle(AppCompatActivity host, DrawerLayout drawerLayout, int openedResource, int closedResource)
     : base(host, drawerLayout, openedResource, closedResource)
 {
     _activity = host;
     _openedResource = openedResource;
     _closedResource = closedResource;
 }
Ejemplo n.º 21
0
        protected override void OnCreate(Bundle savedInstanceState) 
        {
            base.OnCreate (savedInstanceState);

            SetContentView (Resource.Layout.activity_main);

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

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

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

            var navigationView = FindViewById<NavigationView> (Resource.Id.nav_view);
            if (navigationView != null)
                setupDrawerContent(navigationView);

            var viewPager = FindViewById<Android.Support.V4.View.ViewPager> (Resource.Id.viewpager);
            if (viewPager != null)
                setupViewPager(viewPager);

            var fab = FindViewById<FloatingActionButton> (Resource.Id.fab);
            fab.Click += (sender, e) => {
                Snackbar.Make (fab, "Here's a snackbar!", Snackbar.LengthLong).SetAction ("Action",
                    new ClickListener (v => {
                        Console.WriteLine ("Action handler");
                    })).Show ();
            };

            var tabLayout = FindViewById<TabLayout> (Resource.Id.tabs);
            tabLayout.SetupWithViewPager (viewPager);
        }
Ejemplo n.º 22
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            
            //SupportFragmentManager.PopBackStackImmediate(null, (int)PopBackStackFlags.Inclusive);
            SetContentView(Resource.Layout.page_home_view);

            _title = _drawerTitle = Title;
            _drawer = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);

            _drawerList = FindViewById<MvxListView>(Resource.Id.left_drawer);

            
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true); 
            SupportActionBar.SetBackgroundDrawable(Resources.GetDrawable(Resource.Color.s_main_green));
            SupportActionBar.SetLogo(Resource.Drawable.logo_white);
            
            

            if (_drawer != null)
            {

                _drawer.SetDrawerShadow(Resource.Drawable.drawer_shadow_dark, (int)GravityFlags.Start);

                //DrawerToggle is the animation that happens with the indicator next to the
                //ActionBar icon. You can choose not to use this.
                _drawerToggle = new MyActionBarDrawerToggle(this, _drawer,
                    Resource.Drawable.ic_navigation_drawer,
                    Resource.String.drawer_open,
                    Resource.String.drawer_close);

                _drawerToggle.DrawerClosed += delegate
                {
                    
                    Title = _title;
                    SupportInvalidateOptionsMenu();                };

                _drawerToggle.DrawerOpened += delegate
                {
                   
                    SupportActionBar.Title = _drawerTitle;
                    SupportInvalidateOptionsMenu();

                    // Close open soft keyboard when drawer opens.
                    var inputManager = (InputMethodManager)GetSystemService(InputMethodService);
                    inputManager.HideSoftInputFromWindow(Window.DecorView.WindowToken, 0);
                };

                _drawer.SetDrawerListener(_drawerToggle);
            }

            RegisterForDetailsRequests();

            if (null == savedInstanceState)
            {
                ViewModel.SelectMenuItemCommand.Execute(ViewModel.MenuItems[0]);
            }
        }
Ejemplo n.º 23
0
        void SetReferences()
        {
            _toolbar = FindViewById<Toolbar> (Resource.Id.my_awesome_toolbar);

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

            _navigationView = FindViewById<NavigationView> (Resource.Id.nav_view);
        }
Ejemplo n.º 24
0
 public MyDrawerToggle(AppCompatActivity host, DrawerLayout drawerLayout, int openedResource, int closedResource,ISharedPreferences pref)
     : base(host, drawerLayout, openedResource, closedResource)
 {
     _mHostActivity = host;
     _mOpenedResource = openedResource;
     _mClosedResource = closedResource;
     _pref = pref;
 }
        private void initView()
        {
            //MainActivity的布局文件中的主要控件初始化
            mToolbar = FindViewById<Toolbar>(Resource.Id.tool_bar);
            mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            mNavigationView = FindViewById<NavigationView>(Resource.Id.navigation_view);
            mTabLayout = FindViewById<TabLayout>(Resource.Id.tab_layout);
            mViewPager = FindViewById<ViewPager>(Resource.Id.view_pager);
            mTabLayout.Post(() =>
            {
                ShowTipMask();

            });


            mTabLayout.TabMode = TabLayout.ModeFixed;//固定
            // mTabLayout.TabMode = TabLayout.ModeScrollable;//滚动
            mTabLayout.TabGravity = TabLayout.GravityFill;//标签填充栏
            //mTabLayout.TabGravity = TabLayout.GravityCenter;//固定在中间
            //初始化ToolBar
            SetSupportActionBar(mToolbar);
            Android.Support.V7.App.ActionBar actionBar = SupportActionBar;
            actionBar.SetHomeAsUpIndicator(Android.Resource.Drawable.IcDialogAlert);
            actionBar.SetDisplayHomeAsUpEnabled(true);
            //对NavigationView添加item的监听事件
            mNavigationView.SetNavigationItemSelectedListener(naviListener);
            //开启应用默认打开DrawerLayout
            // mDrawerLayout.OpenDrawer(mNavigationView);

            //初始化TabLayout的title数据集
            List<Java.Lang.String> titles = new List<Java.Lang.String>();
            Java.Lang.String detail = new Java.Lang.String("我的活动");
            Java.Lang.String share = new Java.Lang.String("招募活动");
            Java.Lang.String agenda = new Java.Lang.String("缺席活动");
            Java.Lang.String other = new Java.Lang.String("其他活动");
            titles.Add(detail);
            titles.Add(share);
            titles.Add(agenda);
            titles.Add(other);
            //初始化TabLayout的title
            mTabLayout.AddTab(mTabLayout.NewTab().SetText(titles[0]));
            mTabLayout.AddTab(mTabLayout.NewTab().SetText(titles[1]));
            mTabLayout.AddTab(mTabLayout.NewTab().SetText(titles[2]));
            mTabLayout.AddTab(mTabLayout.NewTab().SetText(titles[3]));
            //初始化ViewPager的数据集
            List<Android.Support.V4.App.Fragment> fragments = new List<Android.Support.V4.App.Fragment>();
            fragments.Add(new InfoDetailsFragment());
            fragments.Add(new ShareFragment());
            fragments.Add(new AgendaFragment());
            fragments.Add(new AgendaFragment());
            //创建ViewPager的adapter
            FragmentAdapter adapter = new FragmentAdapter(SupportFragmentManager, fragments, titles);
            mViewPager.Adapter = adapter;
            //千万别忘了,关联TabLayout与ViewPager
            //同时也要覆写PagerAdapter的getPageTitle方法,否则Tab没有title
            mTabLayout.SetupWithViewPager(mViewPager);
            mTabLayout.SetTabsFromPagerAdapter(adapter);
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            switch (IoC.UserInfo.Employee.PrivledgeLevel)
            {
                case "Admin":
                    {
                        SetContentView(Resource.Layout.EventDeletion_Admin);
                        eventItemAdapter = new EventItemAdapter(this, Resource.Layout.EventDeletion_Admin);
                        break;
                    }
                case "Moderator":
                    {
                        SetContentView(Resource.Layout.EventDeletion_Moderator);
                        eventItemAdapter = new EventItemAdapter(this, Resource.Layout.EventDeletion_Moderator);
                        break;
                    }
            }

            eventDeleter = new EventDeleter();
            deletionListView = FindViewById<ListView>(Resource.Id.listDeletion);
            DeleteEventsBtn = FindViewById<Button>(Resource.Id.DeleteEventsBtn);

            await RefreshView();
            FindViewById(Resource.Id.loadingPanel).Visibility = ViewStates.Gone;

            _supporttoolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.ToolBar);
            _drawer = FindViewById<DrawerLayout>(Resource.Id.DrawerLayout);
            _navigationview = FindViewById<NavigationView>(Resource.Id.nav_view);
            ToolbarCreator toolbarCreator = new ToolbarCreator();
            toolbarCreator.setupToolbar(_supporttoolbar, _drawer, _navigationview, Resource.String.event_deletion, this);

            if (IoC.UserInfo.Employee.PrivledgeLevel == "Admin")
            {
                myEventList = eventItemAdapter.getAllEventsNotDeleted(); 
            }
            else
            {
                myEventList = eventItemAdapter.getEventsByEmployeeID();
            }

            sortByDate(myEventList);
            //Plug in my adapter
            myCheckBoxAdapter = new CheckBoxAdapter(this,myEventList);
            deletionListView.Adapter = myCheckBoxAdapter;
            RegisterForContextMenu(deletionListView);

            DeleteEventsBtn.Click += delegate
            {
                checkedEvents = ((CheckBoxAdapter)deletionListView.Adapter).getCheckedList();
                deleteEvents(deletionListView.Adapter.Count);
            };

        }
Ejemplo n.º 27
0
    protected override void OnCreate(Bundle savedInstanceState)
    {
      base.OnCreate(savedInstanceState);
      SetContentView(Resource.Layout.main);

      sections = Resources.GetTextArray(Resource.Array.drawer_sections);

      currentSectionTitle = drawerTitle = Title;

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

      drawerListView.Adapter = new ArrayAdapter<string>(this, Resource.Layout.item_menu, sections);

      drawerListView.ItemClick += (sender, args) => ListItemClicked(args.Position);


      drawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow_dark, (int)GravityFlags.Start);



      //DrawerToggle is the animation that happens with the indicator next to the actionbar
      drawerToggle = new DrawerToggle(this, drawerLayout,
                                                Resource.Drawable.ic_drawer_light,
                                                Resource.String.drawer_open,
                                                Resource.String.drawer_close);

      //Display the current fragments title and update the options menu
      drawerToggle.DrawerClosed += (o, args) =>
      {
        ActionBar.Title = currentSectionTitle;
        InvalidateOptionsMenu();
      };

      //Display the drawer title and update the options menu
      drawerToggle.DrawerOpened += (o, args) =>
      {
        ActionBar.Title = drawerTitle;
        InvalidateOptionsMenu();
      };

      //Set the drawer lister to be the toggle.
      drawerLayout.SetDrawerListener(drawerToggle);



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


      ActionBar.SetDisplayHomeAsUpEnabled(true);
      ActionBar.SetHomeButtonEnabled(true);
    }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.details_show_activity);

            _toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
            //Toolbar will now take on default actionbar characteristics
            SetSupportActionBar(_toolbar);
            //SupportActionBar._title = "";
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);


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

            _selectedSeason = Intent.GetIntExtra("seasonPosition", 0);

            var navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);
            if (navigationView != null)
            {
                SetupDrawerContent(navigationView);
            }

            //Set up names in Nav view, maybe need to extend base activity to hold navigation view

            //var navHeader= LayoutInflater.Inflate(Resource.Layout.nav_header, navigationView);
            //var textViewInNav = navHeader.FindViewById<TextView>(Resource.Id.username);
            //textViewInNav.Text = ParseUser.CurrentUser.Email;


            _myShow = new TVShow();
            _myTextView = FindViewById<TextView>(Resource.Id.tvForID);

            var bClickCounter = FindViewById<Button>(Resource.Id.bClickCounter);
            bClickCounter.Click += delegate(object sender, EventArgs args)
            {
                GetParseEpisodeObject();
            };


            if (bundle != null)
            {
                _myShow = new TVShow();
                _myShow = JsonConvert.DeserializeObject<TVShow>(bundle.GetString("showSerialized"));

                SetUpTitle();
                SetUpBothFragments();

            }
            else
            {
                 myDownloadTask = PopulateSeasonsAndSetUpFragments();
            }

            
        }
        private MainActivityBinding(Activity activity, int layoutId)
        {
            activity.SetContentView(layoutId);
            toolbar = activity.FindViewById<Toolbar>(Resource.Id.toolbar);
            drawer  = activity.FindViewById<DrawerLayout>(Resource.Id.drawer);
            navView = activity.FindViewById<NavigationView>(Resource.Id.nav_view);

            var decorView = activity.Window.DecorView;
            Root = (ViewGroup) decorView.FindViewById(global::Android.Resource.Id.Content);
        }
 public MyActionBarDrawerToggle(Activity activity,
                                DrawerLayout drawerLayout,
                                int openDrawerContentDescRes,
                                int closeDrawerContentDescRes)
     : base(activity,
           drawerLayout,
           openDrawerContentDescRes,
           closeDrawerContentDescRes)
 {
 }
Ejemplo n.º 31
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.activity_main);

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

            SupportActionBar.Elevation = 0;
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            drawerToggle = new MvxActionBarDrawerToggle(
                this,                           // host Activity
                drawerLayout,                   // drawerLayout object
                //toolbar,                        // nav drawer icon to replace 'Up' caret
                Resource.String.drawer_open,    // "open drawer" description
                Resource.String.drawer_close    // "close drawer" description
                );

            drawerToggle.DrawerOpened += (sender, e) => HideSoftKeyboard();
            drawerLayout.AddDrawerListener(drawerToggle);
        }
Ejemplo n.º 32
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.Przelew);
     Imie           = (EditText)FindViewById(Resource.Id.imie);
     nazwisko       = (EditText)FindViewById(Resource.Id.Nazwisko);
     nrkonta        = (EditText)FindViewById(Resource.Id.nrkonta);
     kwota          = (EditText)FindViewById(Resource.Id.Kwota);
     wykonajprzelew = (Button)FindViewById(Resource.Id.przelewprzycisk);
     mDrawerLayout  = (DrawerLayout)FindViewById(Resource.Id.toolbar_drawer);
     mtoggle        = new ActionBarDrawerToggle(this, mDrawerLayout, Resource.String.open, Resource.String.close);
     mDrawerLayout.AddDrawerListener(mtoggle);
     mtoggle.SyncState();
     wykonajprzelew.Click += (s, e) =>
     {
         dodImie     = Imie.Text;
         dodnazwisko = nazwisko.Text;
         dodnrkonta  = nrkonta.Text;
         dodkwota    = kwota.Text;
     };
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            drawerLayout = FindViewById <DrawerLayout> (Resource.Id.drawer_layout);
            drawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow, (int)GravityFlags.Start);
            drawerList         = FindViewById <ListView> (Resource.Id.flyout);
            drawerList.Adapter = new ArrayAdapter <string> (this, Resource.Layout.drawer_list_item, sections);


            drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, Resource.String.drawer_open, Resource.String.drawer_close);

            drawerLayout.SetDrawerListener(drawerToggle);

            drawerList.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => ListItemClicked(e.Position);
            ListItemClicked(0);

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
        }
Ejemplo n.º 34
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.activity_main);

            this._dialogService          = Mvx.Resolve <IDialogService>();
            _dialogService.NotificateIt += _dialogService_NotificateIt;

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


            if (bundle == null)
            {
                ViewModel.ShowMenu();
            }


            //Test3
            /// Java.Lang.Thread.DefaultUncaughtExceptionHandler = new ExceptHandler();
        }
        protected void SetMenuInfo()
        {
            var toolbar = FindViewById <MyCustomToolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(false);
            SupportActionBar.SetHomeButtonEnabled(true);

            toolbar.SetNavigationIcon(Resource.Drawable.navi_icon);
            toolbar.SetTitle(Resource.String.ApplicationName);
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            navigationView.NavigationItemSelected += (sender, e) => {
                e.MenuItem.SetChecked(true);
                drawerLayout.CloseDrawers();
                // DrawLayout에서 자동으로 OnOptionsItemSelected 함수를 호출해주지 않아서 명시적으로 호출해준다.
                OnOptionsItemSelected(e.MenuItem);
            };
        }
Ejemplo n.º 36
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

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

            drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, Resource.String.DrawerOpenDescription, Resource.String.DrawerCloseDescription);

            drawerLayout.AddDrawerListener(drawerToggle);

            ActionBar.SetDisplayHomeAsUpEnabled(true);



            drawerListView            = FindViewById <ListView>(Resource.Id.listView);
            drawerListView.Adapter    = new ArrayAdapter <string>(this, Resource.Layout.ListViewMenuRow, Resource.Id.menuRowTextView, titles);
            drawerListView.ItemClick += (s, e) => OnMenuClick(e.Position);
            drawerListView.SetItemChecked(0, true);
            OnMenuClick(0);
        }
Ejemplo n.º 37
0
        public void SetUpUI()
        {
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);
            toolbar.SetBackgroundColor(ColorCode.TeamColor(GameModel.Player.Team.ID));

            drawerLayout   = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            statusText     = FindViewById <TextView>(Resource.Id.textBelowMap);
            tagButton      = FindViewById <Button>(Resource.Id.claimButton);
            locationButton = FindViewById <Button>(Resource.Id.clientCameraLocationbtn);

            ActionBar.SetHomeAsUpIndicator(Resource.Mipmap.ic_dehaze_white_24dp);
            ActionBar.SetDisplayHomeAsUpEnabled(true);

            drawerLayout.DrawerStateChanged += DrawerLayout_DrawerStateChanged;

            tagButton.Click      += TagButton_Click;
            locationButton.Click += LocationButton_Click;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

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

            fab.Click += FabOnClick;

            DrawerLayout          drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close);

            drawer.AddDrawerListener(toggle);
            toggle.SyncState();

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

            navigationView.SetNavigationItemSelectedListener(this);
        }
Ejemplo n.º 39
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);


            DrawerLayout          drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close);

            drawer.AddDrawerListener(toggle);
            toggle.SyncState();

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

            navigationView.SetNavigationItemSelectedListener(this);

            SupportFragmentManager.BeginTransaction().Replace(Resource.Id.fragment_container, new RemoteFragment()).Commit();
        }
Ejemplo n.º 40
0
        public override void SetContentView(int layoutResID)
        {
            _view = (DrawerLayout)LayoutInflater.Inflate(Resource.Layout.BaseActivity, null);
            var activityContainer = _view.FindViewById <FrameLayout>(Resource.Id.activity_content);

            LayoutInflater.Inflate(layoutResID, activityContainer, true);
            base.SetContentView(_view);

            _toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(_toolbar);
            SupportActionBar.SetTitle(_titleName);

            var drawerToggle = new ActionBarDrawerToggle
                                   (this, _view, _toolbar, Resource.String.nav_open, Resource.String.nav_close);

            _view.AddDrawerListener(drawerToggle);
            drawerToggle.SyncState();

            _navigationView = FindViewById <NavigationView>(Resource.Id.navigation_view);
            _navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;
        }
Ejemplo n.º 41
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);


            // TODO: add your code here
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawerLayout);

            drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, Resource.String.DrawerOpenDescription, Resource.String.DrawerCloseDescription);
            drawerLayout.SetDrawerListener(drawerToggle);

            ActionBar.SetDisplayHomeAsUpEnabled(true);


            drawerListView            = FindViewById <ListView>(Resource.Id.drawerListView);
            drawerListView.Adapter    = new ArrayAdapter <string>(this, Resource.Layout.ListViewMenuRow, Resource.Id.menuRowTextView, titles);
            drawerListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => OnMenuItemClick(e.Position);
            drawerListView.SetItemChecked(0, true); // Highlight the first item at startup
            OnMenuItemClick(0);                     // Load Fragment 0 at startup
        }
Ejemplo n.º 42
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            this.SetContentView(Resource.Layout.activity_home);

            this._applicationToolbar = this.FindViewById <Toolbar>(Resource.Id.applicationToolbar);
            this._drawerLayout       = this.FindViewById <DrawerLayout>(Resource.Id.drawerLayout);
            this._navigationView     = this.FindViewById <NavigationView>(Resource.Id.navigationView);

            this.SetSupportActionBar(this._applicationToolbar);
            this.SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_navigation_menu);
            this.SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            this._navigationView.NavigationItemSelected += this.NavigationViewOnNavigationItemSelected;

            if (bundle == null)
            {
                this.ShowAllExchangeRatesFragment();
            }
        }
Ejemplo n.º 43
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            //FindViewById<Android.Widget.TextView>(Resource.Id.username).Text =
            Android.Widget.Toast.MakeText(this, Intent.GetStringExtra("Nombre"), Android.Widget.ToastLength.Long).Show();


            navigationView.NavigationItemSelected         += NavigationItemSelected_Click;
            CrossConnectivity.Current.ConnectivityChanged += Current_ConnectivityChange;

            if (savedInstanceState == null)
            {
                navigationView.SetCheckedItem(Resource.Id.nav_home);
            }

            ListItemClicked(0);
        }
Ejemplo n.º 44
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            this.SetContentView(Resource.Layout.HomePage);

            // Definimos el Drawer
            Drawer = FindViewById <DrawerLayout>(Resource.Id.drawerlayout);

            // Definimos el menú del Drawer
            navigationView = this.FindViewById <NavigationView>(Resource.Id.navigation_view);
            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;

            if (bundle == null)
            {
                var itemCalendario = navigationView.Menu.FindItem(Resource.Id.nav_calendario);
                itemCalendario.SetChecked(true);
                itemCalendario.SetCheckable(true);
                menuPrevio = itemCalendario;
                ViewModel.GotoCalendarioCommand.Execute(null);
            }
        }
Ejemplo n.º 45
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.InDevelop);
            ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id._app_bar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetTitle(Resource.String.app_name);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;;;
            var drawerToogle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.open_drawer, Resource.String.close_drawer);

            drawerLayout.AddDrawerListener(drawerToogle);
            drawerToogle.SyncState();
            ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\
        }
Ejemplo n.º 46
0
        protected override void OnPostCreate()
        {
            base.OnPostCreate();

            // Initialize UI
            drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close);

            drawer.SetDrawerListener(toggle);
            toggle.SyncState();

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

            for (int i = 0; i < navigationView.Menu.Size(); i++)
            {
                IMenuItem menuItem = navigationView.Menu.GetItem(i);
                menuItem.SetChecked(menuItem.ItemId == NavigationItemId);
            }
        }
Ejemplo n.º 47
0
        //  private bool flag = true;
        public override void OnBackPressed()
        {
            //  int counter = 0;
            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            if (drawer.IsDrawerOpen(GravityCompat.Start))
            {
            }

            else
            {
                int count = SupportFragmentManager.BackStackEntryCount;

                if (count == 0)
                {
                    //
                    drawer.CloseDrawer(GravityCompat.Start);

                    Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(this);
                    alert.SetTitle("Logout");
                    alert.SetMessage("Do you want to Exit ?");
                    alert.SetPositiveButton(("Yes"), (sender, args) =>
                    {
                        base.OnBackPressed();
                        // Toast.MakeText(this, "You have successfully Exit", ToastLength.Long).Show();
                    });

                    alert.SetNegativeButton(("No"), (sender, args) =>
                    {
                    });

                    Dialog dialog = alert.Create();
                    dialog.Show();
                }
                else
                {
                    SupportFragmentManager.PopBackStack();
                }
            }
        }
Ejemplo n.º 48
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (!CommonHelperClass.FnIsGooglePlayServicesInstalled(this))
            {
                Finish();
            }

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

            SetUpGoogleMap();

            mToolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(mToolbar);

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

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

            mNavigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            mNavigationView.SetNavigationItemSelectedListener(this);

            mMenuFAB = (FloatingActionMenu)FindViewById(Resource.Id.menu);

            mMenuFAB.HideMenuButton(false);

            mMenuFAB.PostDelayed(() => mMenuFAB.ShowMenuButton(true), -200);

            mGetPositionFAB = (FloatingActionButton)FindViewById(Resource.Id.position_fab);

            mDrawRouteFAB = (FloatingActionButton)FindViewById(Resource.Id.route_fab);

            mDB = new Database(Path.Combine(mPath, mDbName));

            mListAllStations        = mDB.AllStationsLocations();
            mAllLinesId             = mDB.AllLinesID();
            mListLinesIdFromStation = new List <string>();
        }
Ejemplo n.º 49
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Attach item selected handler to navigation view
            var navigationView = FindViewById <NavigationView>(Resource.Id.left_drawer);

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;

            // Create ActionBarDrawerToggle button and add it to the toolbar
            _drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            _drawerToggle = new ActionBarDrawerToggle(this, _drawerLayout, Toolbar,
                                                      Resource.String.ApplicationName, Resource.String.ApplicationName);
            _drawerLayout.AddDrawerListener(_drawerToggle);
            _drawerToggle.SyncState();

            var prevFragment = FragmentManager.FindFragmentById(Resource.Id.content_frame);

            if (prevFragment == null)
            {
                var ft = FragmentManager.BeginTransaction();
                ft.Add(Resource.Id.content_frame, new HomeFragment());
                ft.Commit();
            }

            //Create unique Id and store in database
            var uiniqueUserIdfile = Path.Combine(Helper.InternalPath, "UniqueUserId.txt");

            if (File.Exists(uiniqueUserIdfile))
            {
                var existingGuid = File.ReadAllText(uiniqueUserIdfile);
                Driver.UniqueUserId = existingGuid;
            }
            else
            {
                var newGuid = Guid.NewGuid().ToString();
                Driver.UniqueUserId = newGuid;
                File.WriteAllText(uiniqueUserIdfile, newGuid);
            }
        }
Ejemplo n.º 50
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Bicycles);

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

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

            drawerToggle.SyncState();
            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            SetupDrawerContent(navigationView);
            navigationView.NavigationItemSelected += HomeNavigationView_NavigationItemSelected;

            sp         = FindViewById <Spinner>(Resource.Id.spinner);
            adapter    = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleDropDownItem1Line);
            sp.Adapter = adapter;

            sc = SynchronizationContext.Current;

            ChooseCat();
            sp.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(sp_ItemSelected);

            var btnShow = FindViewById <ElegantNumberButton>(Resource.Id.btnNumber);

            btnShow.Click += delegate
            {
                Toast.MakeText(this, "Choose duration of rent in days!", ToastLength.Short).Show();
            };
            btnShow.SetOnValueChangeListener(this);

            ChooseBicPerCat();

            bicycleList.ChoiceMode     = Android.Widget.ChoiceMode.Single;
            bicycleList.ItemClick     += BicycleList_ItemClick;
            bicycleList.ItemLongClick += BicycleList_ItemLongClick;
        }
Ejemplo n.º 51
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            FragmentTransaction fTransaction = FragmentManager.BeginTransaction();

            int id = item.ItemId;

            if (id == Resource.Id.nav_camera)
            {
                this.Title = "首页";
                // Handle the camera action
                //fTransaction.Replace(Resource.Id.main_frame_layout, _homeFragment).Commit();
            }
            else if (id == Resource.Id.nav_gallery)
            {
                this.Title = "我的";
                //fTransaction.Replace(Resource.Id.main_frame_layout, _mineFragment).Commit();
            }
            else if (id == Resource.Id.nav_slideshow)
            {
                this.Title = "列表";
                //fTransaction.Replace(Resource.Id.main_frame_layout, _listPageFragment).Commit();
            }
            else if (id == Resource.Id.nav_manage)
            {
                this.Title = "CardView";
                //fTransaction.Replace(Resource.Id.main_frame_layout, _recyclerViewFragment).Commit();
            }
            else if (id == Resource.Id.nav_share)
            {
            }
            else if (id == Resource.Id.nav_send)
            {
            }

            //_fTransaction.Commit();
            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            drawer.CloseDrawer(GravityCompat.Start);
            return(true);
        }
Ejemplo n.º 52
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_navigation_drawer);

            mDrawerTitle        = this.Title;
            navDrawerTitles [0] = this.Resources.GetString(Resource.String.select_device);
            navDrawerTitles [1] = this.Resources.GetString(Resource.String.settings);
            navDrawerTitles [2] = this.Resources.GetString(Resource.String.help);
            mDrawerLayout       = FindViewById <DrawerLayout> (Resource.Id.drawer_layout);
            mDrawerList         = FindViewById <RecyclerView> (Resource.Id.left_drawer);

            // set a custom shadow that overlays the main content when the drawer opens
            mDrawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow, GravityCompat.Start);
            // improve performance by indicating the list if fixed size.
            mDrawerList.HasFixedSize = true;
            mDrawerList.SetLayoutManager(new LinearLayoutManager(this));

            // set up the drawer's list view with items and click listener
            mDrawerList.SetAdapter(new FragmentAdapter(navDrawerTitles, this));
            // enable ActionBar app icon to behave as action to toggle nav drawer
            this.ActionBar.SetDisplayHomeAsUpEnabled(true);
            this.ActionBar.SetHomeButtonEnabled(true);

            // ActionBarDrawerToggle ties together the the proper interactions
            // between the sliding drawer and the action bar app icon

            mDrawerToggle = new MyActionBarDrawerToggle(this, mDrawerLayout,
                                                        Resource.Drawable.ic_drawer,
                                                        Resource.String.drawer_open,
                                                        Resource.String.drawer_close);

            mDrawerLayout.SetDrawerListener(mDrawerToggle);
            if (savedInstanceState == null)
            {
                //first launch
                selectItem(0);
                SetTitle("Trips");
            }
        }
Ejemplo n.º 53
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Intent LocationIntent = new Intent(this, typeof(LocationService));

            StartForegroundService(LocationIntent);

            SD = new SaveData();
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click     += FabOnClick;
            fab.Visibility = ViewStates.Gone;

            DrawerLayout          drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close);

            drawer.AddDrawerListener(toggle);
            toggle.SyncState();

            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            navigationView.SetNavigationItemSelectedListener(this);
            infotext = FindViewById <Android.Support.V7.Widget.AppCompatTextView>(Resource.Id.Addressinformation);

            MainLayout      = FindViewById <RelativeLayout>(Resource.Id.Maincontent);
            placesLayout    = FindViewById <LinearLayout>(Resource.Id.Places);
            placeslistview  = FindViewById <ListView>(Resource.Id.PlacesListview);
            VisitedLayout   = FindViewById <LinearLayout>(Resource.Id.VisitedPlaces);
            Visitedlistview = FindViewById <ListView>(Resource.Id.VisitedListview);


            System.Timers.Timer aTimer = new System.Timers.Timer();
            aTimer.Interval  = 60000;
            aTimer.Elapsed  += Ontimedevent;
            aTimer.AutoReset = true;
            aTimer.Enabled   = true;
            Updateinfotext();
        }
Ejemplo n.º 54
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            AndroidX.AppCompat.Widget.Toolbar toolbar = FindViewById <AndroidX.AppCompat.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            DrawerLayout          drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close);

            drawer.AddDrawerListener(toggle);
            drawer.DrawerOpened += (sender, e) => { updateUsername(); };
            toggle.SyncState();

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

            navigationView.SetNavigationItemSelectedListener(this);

            BluetoothHelper.getPermission(BaseContext, this);
            ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.ReadExternalStorage }, 1);
            ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.WriteExternalStorage }, 1);

            TabaccoList.Init(() =>
            {
                RaterSaved.Init(() =>
                {
                    if (RaterSaved.GetRater().Name == Rater.DefaultName)
                    {
                        ShowRaterChange();
                    }
                    else
                    {
                        updateUsername();
                        ShowTabaccoHome();
                    }
                    finishedInit = true;
                });
            });
        }
        //public override bool OnCreateOptionsMenu(IMenu menu)
        //{
        //    MenuInflater.Inflate(Resource.Menu.menu_main, menu);
        //    return true;
        //}



        public bool OnNavigationItemSelected(IMenuItem item)
        {
            int id = item.ItemId;

            if (id == Resource.Id.nav_home)
            {
                var intent = new Intent(this, typeof(HomeActivity));
                StartActivity(intent);
            }
            else if (id == Resource.Id.nav_schedule)
            {
                var intent = new Intent(this, typeof(ScheduleActivity));
                StartActivity(intent);
            }
            else if (id == Resource.Id.nav_bookings)
            {
                var intent = new Intent(this, typeof(BookingActivity));
                StartActivity(intent);
            }
            else if (id == Resource.Id.nav_clients)
            {
                var intent = new Intent(this, typeof(ClientActivity));
                StartActivity(intent);
            }
            else if (id == Resource.Id.nav_logout)
            {
                ISharedPreferences       pref = Application.Context.GetSharedPreferences("UserInfor", FileCreationMode.Private);
                ISharedPreferencesEditor edit = pref.Edit();
                edit.Clear();
                edit.Apply();
                var intent = new Intent(this, typeof(LoginActivity));
                StartActivity(intent);
            }


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

            // drawer.CloseDrawer(GravityCompat.Start);
            return(true);
        }
Ejemplo n.º 56
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Main);

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

            logoimageView  = FindViewById <ImageView>(Resource.Id.menuLogo);
            headerTextView = FindViewById <TextView>(Resource.Id.HeaderText);
            // Init toolbar
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.app_bar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetTitle(Resource.String.app_name);

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);

            // Attach item selected handler to navigation view
            var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;
            AppController.Instance.NavigationController.GoToPageEvent += NavigationController_GoToPageEvent;;

            // Create ActionBarDrawerToggle button and add it to the toolbar
            drawerToggle = new MyActionBarDrawerToggle(this, drawerLayout);
            drawerLayout.AddDrawerListener(drawerToggle);
            drawerToggle.SyncState();
            createContentFragments();
            // Load default home screen
            if (savedInstanceState == null)
            {
                AppController.Instance.NavigationController.SideMenuButtonClicked(NavigationController.PagesEnum.INTRO);
            }

            Glide.With(this).Load(Resource.Drawable.hologo).Into(logoimageView);

            headerTextView.SetOnClickListener(this);
        }
Ejemplo n.º 57
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            int id = item.ItemId;

            if (id == Resource.Id.time)
            {
                header.Text = "TIME";
                mode        = 0;
            }
            else if (id == Resource.Id.provider)
            {
                header.Text = "PROVIDER";
                mode        = 1;
            }
            else if (id == Resource.Id.controler)
            {
                header.Text = "CONTROLER";
                mode        = 2;
            }
            else if (id == Resource.Id.exchanger)
            {
                header.Text = "HEAT EXCHANGER";
                mode        = 3;
            }
            else if (id == Resource.Id.b_a)
            {
                header.Text = "BUILDING A";
                mode        = 4;
            }
            else if (id == Resource.Id.b_n)
            {
                header.Text = "BUILDING B";
                mode        = 5;
            }

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

            drawer.CloseDrawer(GravityCompat.Start);
            return(true);
        }
Ejemplo n.º 58
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

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

            SetSupportActionBar(toolbar);

            // Attach item selected handler to navigation view
            var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;

            // Create ActionBarDrawerToggle button and add it to the toolbar
            var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.open_drawer, Resource.String.close_drawer);

            drawerLayout.SetDrawerListener(drawerToggle);
            drawerToggle.SyncState();
        }
Ejemplo n.º 59
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            fragment = new List <Android.Support.V4.App.Fragment>();
            fragment.Add(new FragmentHome());
            fragment.Add(new Fragment_RecepcionPaquetes());
            fragment.Add(new Fragment_InventarioPaquetes());
            fragment.Add(new fragment_TransitoPaquetes());
            fragment.Add(new fragment_ConsultaPaquetes());
            fragment.Add(new fragment_PreparacionDespacho());
            fragment.Add(new fragment_PreparacionConduce());
            fragment.Add(new Fragment_DespachoSucursal());

            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.content_frame, fragment[0])
            .Commit();

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


            DrawerLayout          drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close);

            drawer.AddDrawerListener(toggle);
            toggle.SyncState();

            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            navigationView.SetNavigationItemSelectedListener(this);

            //deshabilitar opciones dentro del menu
            //DisableItemOnMenu(0, false);

            //deshabilitar opciones dentro del submenu
            //navigationView.Menu.GetItem(5).SubMenu.GetItem(0).SetVisible(false);
        }
Ejemplo n.º 60
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Equipment);

            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            var toolbar = FindViewById<V7Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.drawer_open, Resource.String.drawer_close);
            drawerToggle.SyncState();
            navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);
            setupDrawerContent(navigationView);
            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;

            RentByUser();
            ChooseEquipmentPerCategory();

            equipmentList.ChoiceMode = Android.Widget.ChoiceMode.Multiple; //SINGLE
            equipmentList.ItemClick += EquipmentList_ItemClick;
            equipmentList.ItemLongClick += EquipmentList_ItemLongClick;
        }