protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

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

			toolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.app_bar);
			toolbar.SetBackgroundColor (Color.ParseColor ("#F44336"));
			//toolbar.SetNavigationIcon (Resource.Drawable.ic_next);
			//toolbar.
			//toolbar.SetNavigationOnClickListener ();

			mainTitle = FindViewById<TextView> (Resource.Id.tvMSMDLMainTitle);
			mainTitle.Text = Intent.GetStringExtra ("PMDTitle");

			infoDetails = FindViewById<WebView> (Resource.Id.wvMSMDLDetails);
			infoDetails.Settings.JavaScriptEnabled = true;
			infoDetails.LoadDataWithBaseURL ("", 
				Intent.GetStringExtra ("PMDContent"), 
				"text/html", 
				"UTF-8", "");
			infoDetails.Settings.BuiltInZoomControls = true;

			SetSupportActionBar (toolbar);
			SupportActionBar.SetDisplayHomeAsUpEnabled (true);
		}
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var ignore = base.OnCreateView(inflater, container, savedInstanceState);

            var view = this.BindingInflate(FragmentId, null);

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

                _drawerToggle = new MvxActionBarDrawerToggle(
                    Activity,                               // host Activity
                    ((MainActivity)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
                );

                ((MainActivity)Activity).DrawerLayout.SetDrawerListener(_drawerToggle);
            }

            return view;
        }
        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();

        }
Beispiel #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.Stores);

            mToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(mToolbar);
            SupportActionBar.Title = "Stores";
            SupportActionBar.Elevation = 15;
            SupportActionBar.SetHomeButtonEnabled (true);
            SupportActionBar.SetDisplayHomeAsUpEnabled (true);

            list.Add (new store (1, "The Container Store", "B Hills"));
            list.Add(new store(2, "Macy's", "Lakdi ka pool"));
            list.Add(new store(3, "Walmart", "J Hills"));
            list.Add(new store(4, "Target Stores", "Panjagutta"));
            list.Add(new store(5, "Bob's Store", "Ameerpeet"));
            list.Add(new store(6, "P Stores", "Somajiguda"));

            ListView list_store = FindViewById<ListView> (Resource.Id.list_stores);

            list_store.Adapter = new adapter_store(this, list);

            list_store.ItemClick += OnListItemClick;
        }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

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

			WebServices.MSPBTRootObject pbtList = GetPBTList ();

			pbtListArray = new List<string> ();
			pbtListIDArray = new List<string> ();

			foreach (var pbtListExtract in pbtList.pbt) {
				pbtListArray.Add (pbtListExtract.School.name);
				pbtListIDArray.Add (pbtListExtract.School.id);
			}

			listView = FindViewById<ListView>(Resource.Id.lvMSCMLPBTLpbt);
			listItems = new List<WebServices.MSPBTRootObject>();
			listView.Adapter = new ArrayAdapter(this, Resource.Layout.MySoal_SimpleListItemModified, pbtListArray);
			listView.ChoiceMode = ChoiceMode.Multiple;

			toolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.app_bar);
			toolbar.SetBackgroundColor (Color.ParseColor ("#F44336"));
			SetSupportActionBar (toolbar);

			btnMSCMLPBTLSubmit = FindViewById<Button> (Resource.Id.btnMSCMLPBTLSubmit);

			btnMSCMLPBTLSubmit.Click += SetToAddress;

		}
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

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

			toolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.app_bar);
			toolbar.SetBackgroundColor (Color.ParseColor ("#F8A015"));
			//toolbar.SetNavigationIcon (Resource.Drawable.ic_arrow_up);
			SetSupportActionBar (toolbar);
			SupportActionBar.SetDisplayHomeAsUpEnabled (true);

			string getArticleTitle = Intent.GetStringExtra ("ArticleTitle");
			string getArticleContent = Intent.GetStringExtra ("ArticleContent");

			mainTitle = FindViewById<TextView> (Resource.Id.tvMSADLMainTitle);
			mainTitle.Text = getArticleTitle.ToString();

			infoDetails = FindViewById<WebView> (Resource.Id.wvMSADLDetails);
			infoDetails.Settings.JavaScriptEnabled = true;
			infoDetails.LoadDataWithBaseURL ("", 
				getArticleContent.ToString(), 
				"text/html", 
				"UTF-8", "");


		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.products);

            mToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(mToolbar);
            SupportActionBar.Title = "Inventory";
            SupportActionBar.Elevation = 15;
            SupportActionBar.SetHomeButtonEnabled (true);
            SupportActionBar.SetDisplayHomeAsUpEnabled (true);

            list.Add(new addp(1, "Jaggery"));
            list.Add(new addp(2, "Moong Daal"));
            list.Add(new addp(3, "Rava"));
            list.Add(new addp(4, "Rice"));
            list.Add(new addp(5, "Sugar"));
            list.Add(new addp(6, "Tamarind"));
            list.Add(new addp(7, "Tomato"));
            list.Add(new addp(8, "Urad Daal"));
            list.Add(new addp(9, "Red Chillies"));
            list.Add(new addp(10, "Besan"));

            ListView list_add = FindViewById<ListView> (Resource.Id.list_add);

            list_add.Adapter = new adapter_p(this, list);

            list_add.ItemClick += OnListItemClick;
        }
        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();
        }
Beispiel #9
0
		//Choosing coffee
		//List<string> coffee, size, milk;
		//ExpandableListView coffeeLv;
		//ExpandableListAdapter coffeeAdapter;

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.Order);

			supportToolbar = this.FindViewById<SupportToolbar> (Resource.Layout.order_menu);
			SetSupportActionBar (supportToolbar);
			SupportActionBar.SetHomeButtonEnabled(true);
			SupportActionBar.SetDisplayHomeAsUpEnabled (true);
			SupportActionBar.SetDisplayShowTitleEnabled (true);
			SupportActionBar.Title = "TapTap Coffee";

			//make sure you have a dismiss button or something for devices
			orderDialog = new Android.Support.V7.App.AlertDialog.Builder (this);
			orderDialog.SetTitle ("Woah There!");
			orderDialog.SetMessage ("You forgot to fill in every field.");
			orderDialog.SetPositiveButton ("Thanks!", delegate {
				
			});

			//Implement  variable pricing...

			//coffeeData = new Dictionary<string, List<string>> ();
			//GetCoffeeData ();
			//coffeeDataHeaders = new List<string> (coffeeData.Keys);

			//coffeeAdapter = new ExpandableListAdapter (this, coffeeData, coffeeDataHeaders);

			cafeFragment = new CafeFragment (TempStorage.Cafes, new CafeAdapter (this, TempStorage.Cafes));
			FragmentManager.BeginTransaction ().Replace (Resource.Id.frame_action, cafeFragment).Commit ();

		}
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

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

			Button btnAMExit = (Button)FindViewById (Resource.Id.btnAMExit);

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

			SetSupportActionBar (toolbar);

			TextView tvAMVerInfo = (TextView)FindViewById (Resource.Id.tvAMVerInfo);
			TextView tvAMBuildNumberInfo = (TextView)FindViewById (Resource.Id.tvAMBuildNumberinfo);

			PackageInfo pacMan = PackageManager.GetPackageInfo (PackageName, 0);

			string setVerInfo = string.Format ("Version {0}",pacMan.VersionName);
			tvAMVerInfo.Text = setVerInfo;

			//System.DateTime dtDateTime = new DateTime(1970,1,1,0,0,0,0,System.DateTimeKind.Utc);
			//dtDateTime = dtDateTime.AddSeconds( pacMan.LastUpdateTime ).ToLocalTime();

			string setBuildNumberInfo = string.Format ("(Build Number {0}, {1})",pacMan.VersionCode,pacMan.LastUpdateTime);
			tvAMBuildNumberInfo.Text = setBuildNumberInfo;

			btnAMExit.Click += delegate {

				this.Finish();

			};
		}
        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;
            };
        }
Beispiel #12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.Groceries);

            mToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(mToolbar);
            SupportActionBar.Title = "Groceries";
            SupportActionBar.Elevation = 15;
            SupportActionBar.SetHomeButtonEnabled (true);
            SupportActionBar.SetDisplayHomeAsUpEnabled (true);

            list.Add (new groc (1, "Jaggery", "Found at 5 Stores"));
            list.Add(new groc(2, "Moong Daal", "Found at 8 Stores"));
            list.Add(new groc(3, "Rava", "Found at 3 Stores"));
            list.Add(new groc(4, "Rice", "Found at 5 Stores"));
            list.Add(new groc(5, "Sugar", "Found at 8 Stores"));
            list.Add(new groc(6, "Tamarind", "Found at 7 Stores"));
            list.Add(new groc(7, "Tomato", "Found at 8 Stores"));
            list.Add(new groc(8, "Urad Daal", "Found at 6 Stores"));
            list.Add(new groc(9, "Red Chillies", "Found at 5 Stores"));
            list.Add(new groc(10, "Besan", "Found at 10 Stores"));

            ListView list_groc = FindViewById<ListView> (Resource.Id.list_groc);

            list_groc.Adapter = new adapter_groc(this, list);

            list_groc.ItemClick += OnListItemClick;
        }
Beispiel #13
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 OnCreateActivity (Bundle state)
        {
            base.OnCreateActivity (state);

            SetContentView (Resource.Layout.MainDrawerActivity);

            MainToolbar = FindViewById<Toolbar> (Resource.Id.MainToolbar);
            DrawerListView = FindViewById<ListView> (Resource.Id.DrawerListView);
            DrawerUserView = LayoutInflater.Inflate (Resource.Layout.MainDrawerListHeader, null);
            DrawerUserName = DrawerUserView.FindViewById<TextView> (Resource.Id.TitleTextView);
            DrawerImage = DrawerUserView.FindViewById<ProfileImageView> (Resource.Id.IconProfileImageView);
            DrawerListView.AddHeaderView (DrawerUserView);
            DrawerListView.Adapter = drawerAdapter = new DrawerListAdapter ();
            DrawerListView.ItemClick += OnDrawerListViewItemClick;

            var authManager = ServiceContainer.Resolve<AuthManager> ();
            authManager.PropertyChanged += OnUserChangedEvent;

            DrawerLayout = FindViewById<DrawerLayout> (Resource.Id.DrawerLayout);
            DrawerToggle = new ActionBarDrawerToggle (this, DrawerLayout, MainToolbar, Resource.String.EntryName, Resource.String.EntryName);

            DrawerLayout.SetDrawerShadow (Resource.Drawable.drawershadow, (int)GravityFlags.Start);
            DrawerLayout.SetDrawerListener (DrawerToggle);

            Timer.OnCreate (this);

            var lp = new Android.Support.V7.App.ActionBar.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, (int)GravityFlags.Right);

            MainToolbar.SetNavigationIcon (Resource.Drawable.ic_menu_black_24dp);
            SetSupportActionBar (MainToolbar);
            SupportActionBar.SetTitle (Resource.String.MainDrawerTimer);
            SupportActionBar.SetCustomView (Timer.Root, lp);
            SupportActionBar.SetDisplayShowCustomEnabled (true);

            var bus = ServiceContainer.Resolve<MessageBus> ();
            drawerSyncStarted = bus.Subscribe<SyncStartedMessage> (SyncStarted);
            drawerSyncFinished = bus.Subscribe<SyncFinishedMessage> (SyncFinished);

            DrawerSyncView = FindViewById<FrameLayout> (Resource.Id.DrawerSyncStatus);

            syncRetryButton = DrawerSyncView.FindViewById<ImageButton> (Resource.Id.SyncRetryButton);
            syncRetryButton.Click += OnSyncRetryClick;

            syncStatusText = DrawerSyncView.FindViewById<TextView> (Resource.Id.SyncStatusText);

            if (state == null) {
                OpenPage (DrawerListAdapter.TimerPageId);
            } else {
                // Restore page stack
                pageStack.Clear ();
                var arr = state.GetIntArray (PageStackExtra);
                if (arr != null) {
                    pageStack.AddRange (arr);
                }
            }

            // Make sure that the user will see newest data when they start the activity
            ServiceContainer.Resolve<ISyncManager> ().Run ();
        }
		void GetReferences ()
		{
			_contributors = FindViewById<LinearLayout> (Resource.Id.contributors);

			_toolBar = FindViewById<V7Toolbar> (Resource.Id.MainToolbar);

			_howToCollaborate = FindViewById<TextView> (Resource.Id.howtocollaborate);
		}
        public ToolbarHandler(AppCompatActivity host, V7Toolbar toolbar, bool hasNavigation = true)
        {
            host.SetSupportActionBar(toolbar);

            host.SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            if (hasNavigation) {
                host.SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_title_menu);
            }
        }
        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();
            }

            
        }
        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);
            };

        }
		void GetViewReferences ()
		{
			_toolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.toolbar);

			_pager = FindViewById<ViewPager> (Resource.Id.pager);

			_tabs = FindViewById<PagerSlidingTabStrip> (Resource.Id.tabs);

			_startAppButton = FindViewById<Button>(Resource.Id.done);
		}
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            switch (IoC.UserInfo.Employee.PrivledgeLevel)
            {
                case "Admin":
                    {
                        SetContentView(Resource.Layout.Calendar_Admin);
                        eventItemAdapter = new EventItemAdapter();
                        recipientListItemAdapter = new RecipientListItemAdapter();
                        break;
                    }
                case "Moderator":
                    {
                        SetContentView(Resource.Layout.Calendar_Moderator);
                        eventItemAdapter = new EventItemAdapter();
                        recipientListItemAdapter = new RecipientListItemAdapter();
                        break;
                    }
                default:
                    {
                        SetContentView(Resource.Layout.Calendar_User);
                        eventItemAdapter = new EventItemAdapter();
                        recipientListItemAdapter = new RecipientListItemAdapter();
                        break;
                    }
            }

            _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.calendar_view, this);

            var nextYear = DateTime.Now.AddYears(1);
            var lastYear = DateTime.Now.AddYears(-1);
            calendar = FindViewById<CalendarPickerView>(Resource.Id.calendar_view);
            calendar.Init(lastYear, nextYear)
                .WithSelectedDate(DateTime.Now)
                .InMode(CalendarPickerView.SelectionMode.Single);

            await RefreshView();
            myEventList = recipientListItemAdapter.getEventsByEmployeeID(IoC.UserInfo.EmployeeID, eventItemAdapter);
            myEventList = filterEvents();

            setHighlightDates(calendar);

            calendar.DateSelected += delegate
            {
                IoC.selectedDate = calendar.SelectedDate;
                Intent intent = new Intent(this, typeof(CalendarListActivity));
                StartActivity(intent);
            };
        }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

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

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

			SetSupportActionBar (toolbar);
			SupportActionBar.SetDisplayShowTitleEnabled (true);
		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Notification);

            // Set the toolbar
            _Toolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar);
            SetSupportActionBar(_Toolbar);
            SupportActionBar.Title = GetString(Resource.String.notificationTitle);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
        }
Beispiel #23
0
			protected override void OnCreate (Bundle bundle)
			{
				base.OnCreate (bundle);

				SetContentView (Resource.Layout.Order);

				supportToolbar = FindViewById<SupportToolbar> (Resource.Layout.action_menu);
				SetSupportActionBar (supportToolbar);
				SupportActionBar.SetHomeButtonEnabled(true);
				SupportActionBar.SetDisplayHomeAsUpEnabled (true);
				SupportActionBar.SetDisplayShowTitleEnabled (true);
			}
Beispiel #24
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            //Set toolbar
            mToolBar = FindViewById<SupportToolbar>(Resource.Id.toolbar);
            SetSupportActionBar(mToolBar);

            // Create a timer with a 10sec interval.
            locationTimer = new Timer(10000);

            // Hook up the Elapsed event for the timer. 
            locationTimer.Elapsed += OnTimedEvent;

            //If not there, copy database to device before any database operations
            CopyDatabase();

            //Setup components
            viewSetup();

            //Left Nav draw and click handler setup
            left_drawer = FindViewById<ListView>(Resource.Id.left_drawer);
            drawer_layout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            left_drawer.ItemClick += left_drawer_ItemClick;

            //Get Latitude and Longitude passed from 'splash screen' GPS read or 'new location' activity
            currentLat = Intent.GetStringExtra("Lat");
            currentLong = Intent.GetStringExtra("Long");

            //If Lat was passed as "NoProvider", use the last current location, read from database
            if (currentLat == "NoProvider")
            {   //read latitude and longitude from data base
                readDatabaseLocations();
                //current location is always the first on in the table
                currentLat = locationsList[0].latitude;
                currentLong = locationsList[0].longitude;
            }
            else  //Otherwise write current location to database and then read back for display
            {
                //Write into database new current location
                writeDatabaseLocation();
                //Read all locations for populating menu
                readDatabaseLocations();
            }
            
            //Set location list in Left Nav drawer
            SetLocationButtons();

            //Get weather data from API
            getAPIData();
        }
 private void initInstances()
 { 
     drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
     //底部悬浮按钮
     fabBtn = FindViewById<FloatingActionButton>(Resource.Id.fabBtn);
     fabBtn.SetOnClickListener(this);
     //v7的actionbar
     toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
     toolbar.SetTitleTextColor(Color.White);
     SetSupportActionBar(toolbar);
     //v7 ActionBar的返回按钮
     SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
     SupportActionBar.SetDisplayHomeAsUpEnabled(true);
 }
        //private WorkshopBooking _WorkshopBooking;
        //private string studentId;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            //Check request type and set appropriate variables
            SetVariables();

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

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

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            // Set up the TextViews
            _Title = FindViewById<TextView>(Resource.Id.detailTitle);
            _Date = FindViewById<TextView>(Resource.Id.detailDate);
            _Location = FindViewById<TextView>(Resource.Id.detailLocation);
            _Tutor = FindViewById<TextView>(Resource.Id.detailTutor);
            _Type = FindViewById<TextView>(Resource.Id.detailType);
            _Description = FindViewById<TextView>(Resource.Id.detailDescription);

            _Full = FindViewById<ProgressBar>(Resource.Id.fullBar);

            _DisplayBar = FindViewById<LinearLayout>(Resource.Id.filledLayout);
            _DisplayBar.Visibility = ViewStates.Gone;

            _Booked = FindViewById<LinearLayout>(Resource.Id.bookedButtons);
            _Booked.Visibility = ViewStates.Gone;

            _NotBooked = FindViewById<LinearLayout>(Resource.Id.notBookedButtons);
            _NotBooked.Visibility = ViewStates.Gone;

            // Send an intent that tells the activity if the session is booked by the student or not.
            if (_Booking != null)
            {
                SetBookingView();
            }
            //else if(_WorkshopBooking !=null)
            //{
              //  SetBookingView();
            //}
            else // _workshop != null
            {
                SetWorkshopView();
            }
        }
Beispiel #27
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.about_activity);
            mToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(mToolbar);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.Title = GetString(Resource.String.AboutTitle);
            layoutAbout = FindViewById<LinearLayout>(Resource.Id.layoutAboutSecondary);
            app = (GlobalApp)ApplicationContext;
            lbVersion = FindViewById<TextView>(Resource.Id.lbVersion);
            lbRelaseName = FindViewById<TextView>(Resource.Id.lbRelaseName);
            lbAndroidSerial = FindViewById<TextView>(Resource.Id.lbAndroidSerial);
            lbAndroidId = FindViewById<TextView>(Resource.Id.lbAndroidId);
            lbAndroidVersion = FindViewById<TextView>(Resource.Id.lbAndroidVersion);
            lbManufacturer = FindViewById<TextView>(Resource.Id.lbManufacturer);
            lbDeviceModel = FindViewById<TextView>(Resource.Id.lbDeviceModel);
            //lbMac = FindViewById<TextView>(Resource.Id.lbMac);
            lbAdvertisingId = FindViewById<TextView>(Resource.Id.lbAdvertisingId);
            btnCoins = FindViewById<Button>(Resource.Id.btnCoins);
            btnCoins.Click += (sender, e) =>
            Dialogs.BuildDialog(this, "Info", GetString(Resource.String.coins_explanation), (args, ed) =>
                {
                }, null, null, Android.Resource.String.Ok, 0, 0).Show();
            lbRelaseName.Text += ":  " + app.ReleaseName;
            try
            {
                PackageManager manager = this.PackageManager;
                PackageInfo info = manager.GetPackageInfo(this.PackageName, 0);
                lbVersion.Text += ":  " + info.VersionName;
            }
            catch (Exception)
            {
                Log.Debug(TAG, "Failed to obtain current application version name and version code");
            }

            DeviceInfo.ObtainInfo(this);

            lbAndroidSerial.Text += ":  " + DeviceInfo.AndroidSerial;
            lbAndroidId.Text += ":  " + DeviceInfo.AndroidID;
            lbAndroidVersion.Text += ":  " + DeviceInfo.AndroidVersion;
            lbManufacturer.Text += ":  " + DeviceInfo.Manufacturer;
            lbDeviceModel.Text += ":  " + DeviceInfo.DeviceModel;
            //lbMac.Text += ":  " + DeviceInfo.MacAddress;

            var id = await GetAdvertisingId();
            lbAdvertisingId.Text += ":  " + id;
        }
Beispiel #28
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.Home);

			supportToolbar = FindViewById<SupportToolbar> (Resource.Layout.action_menu);
			SetSupportActionBar (supportToolbar);
			SupportActionBar.SetHomeButtonEnabled(true);
			SupportActionBar.SetDisplayHomeAsUpEnabled (true);
			SupportActionBar.SetDisplayShowTitleEnabled (true);
			SupportActionBar.Title = "TapTap Coffee";

			controls = GetDrawerOptions ();
			changingFragment = FindViewById<FrameLayout> (Resource.Id.variable_frlayout);
		}
Beispiel #29
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the mangeEvents layout resource
            SetContentView(Resource.Layout.ToolBar);

            topToolBar = FindViewById<SupportToolbar>(Resource.Id.toptoolbar);
            SetSupportActionBar(topToolBar);
            SupportActionBar.Title = "";
            bottomToolBar = FindViewById<SupportToolbar>(Resource.Id.bottomtoolbar);
            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            rightDrawer = FindViewById<ListView>(Resource.Id.right_drawer);

            createEventFragment = new Fragments.CreateEvent();
            //inspectEventFragment = new Fragments.InspectEvent();
            inspectSearchFragment = new Fragments.InspectSearch();
            manageEventsFragment = new Fragments.ManageEvents();
            myUserFragment = new Fragments.MyUser();
            searchEventsFragment = new Fragments.SearchEvents();

            stackFragments = new Stack<SupportFragment>();

            var trans = SupportFragmentManager.BeginTransaction();
            trans.Add(Resource.Id.fragmentContainer, manageEventsFragment, "ManageEvents");
            trans.Commit();

            currentFragment = manageEventsFragment;

            rightDataSet = new List<string>();
            rightDataSet.Add("Account");
            rightDataSet.Add("Settings");
            rightDataSet.Add("Log-off");

            rightAdapter = new ArrayAdapter<string>(this, Resource.Layout.list_white_text, rightDataSet);
            rightDrawer.Adapter = rightAdapter;

            rightDrawer.ItemClick += RightDrawer_ItemClick;

            var manageEventsButton = FindViewById<ImageButton>(Resource.Id.action_manage_events);
            manageEventsButton.Click += ManageEventsButton_Click;

            //var addEventsButton = FindViewById<ImageButton>(Resource.Id.action_add_event);
            //addEventsButton.Click += AddEventsButton_Click;

            var findEventsButton = FindViewById<ImageButton>(Resource.Id.action_find_events);
            findEventsButton.Click += FindEventsButton_Click;
        }
Beispiel #30
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(LayoutResource);
            tToolbar = FindViewById<Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(tToolbar);
            SupportActionBar.Title = "ERoad Test";
            //Time Interval to update UI
            countTimer = new System.Timers.Timer(Constant.TimeInterval);
            countTimer.AutoReset = true;
            countTimer.Elapsed += (sender, e) =>
            {
                RefreshSyncUI();
            };
            countTimer.Start();
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            CurrentPlatform.Init();

            // Create your application here
            base.SetContentView(PlanYourJourney.Resource.Layout.Arrangement_layout);

            _imageView = (ImageView)base.FindViewById(PlanYourJourney.Resource.Id.arrangement_picture);

            _id = Intent.GetStringExtra("Id");


            try
            {
                if (_id != "")
                {
                    _argArrangement = await((MainApplication)this.Application).arrangementTable.LookupAsync(_id);
                }
                else
                {
                    throw new ArgumentException();
                }
            }
            catch (Exception e)
            {
                Toast.MakeText(this, e.ToString(), ToastLength.Short).Show();
                _argArrangement = new Arrangement
                {
                    Id                = "",
                    Title             = "",
                    Date              = DateTime.MinValue,
                    Location          = "",
                    ImageResourcePath = null,
                    Contents          = "",
                    Author            = ""
                };
                _toolbar.Enabled = false;
            }

            _toolbar = FindViewById <Toolbar>(PlanYourJourney.Resource.Id.toolbar);
            //Toolbar will now take on default actionbar characteristics
            SetSupportActionBar(_toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.Title = _argArrangement.Title;

            FindViewById <TextView>(Resource.Id.arrangement_name_2).Text = _argArrangement.Title;
            FindViewById <TextView>(Resource.Id.arrangement_name).Text   = _argArrangement.Title;
            FindViewById <TextView>(Resource.Id.arrangement_place).Text  = _argArrangement.Location;
            FindViewById <TextView>(PlanYourJourney.Resource.Id.arrangement_notes).Text  = _argArrangement.Contents;
            FindViewById <TextView>(PlanYourJourney.Resource.Id.arrangement_author).Text = _argArrangement.Author;
            var date = _argArrangement.Date;

            FindViewById <TextView>(PlanYourJourney.Resource.Id.date).Text = _argArrangement.Date.ToString("dd-MM-yyy");
            var favs = ((MainApplication)Application).FavoriteRepository.GetAllFavorites();

            _favorite = false;
            foreach (var i in favs)
            {
                if (_argArrangement.Id == i.ToString())
                {
                    _favorite = true;
                    break;
                }
            }
            //_favorite = MainActivity.Favorites.Contains(_argArrangement.Id);
            if (_favorite)
            {
                InvalidateOptionsMenu();
            }

            SetImage(_argArrangement.ImageResourcePath);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                ISharedPreferences       sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(this);
                ISharedPreferencesEditor editorDevis       = sharedPreferences.Edit();

                base.OnCreate(savedInstanceState);

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

                SetSupportActionBar(toolbar);
                //SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                //SupportActionBar.SetHomeButtonEnabled(true);
                toolbar.SetTitleTextColor(Android.Graphics.Color.Rgb(0, 250, 154));
                toolbar.SetBackgroundColor(Android.Graphics.Color.Rgb(27, 49, 71));
                toolbar.Title = "Information Bancaire";

                nombanque = FindViewById <EditText>(Resource.Id.textInputEditTextNombanque);
                Bic       = FindViewById <EditText>(Resource.Id.textInputEditTextBIC);
                IBAN      = FindViewById <EditText>(Resource.Id.textInputEditTextIBAN);

                ad1 = FindViewById <AdView>(Resource.Id.adView1banqe);
                ad2 = FindViewById <AdView>(Resource.Id.adView2banqe);

                devisespinner = FindViewById <Spinner>(Resource.Id.spinnerDevis);

                var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.Devise, Android.Resource.Layout.SimpleSpinnerItem);
                adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

                devisespinner.Adapter       = adapter;
                devisespinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
                buttonsuivantbanque         = FindViewById <Button>(Resource.Id.buttonsuivantbbanque);

                var btnp = FindViewById <Button>(Resource.Id.buttonPrecedant);


                nombanque.Text = sharedPreferences.GetString("Nombanque", "");
                Bic.Text       = sharedPreferences.GetString("Bic", "");
                IBAN.Text      = sharedPreferences.GetString("IBAN", "");

                int d = adapter.GetPosition(sharedPreferences.GetString("Devis", ""));

                devisespinner.SetSelection(d);
                btnp.Click += delegate
                {
                    Intent intent = new Intent(this, typeof(CreationClient1));
                    editorDevis.PutString("Nom", sharedPreferences.GetString("Nom", ""));
                    editorDevis.PutString("Email", sharedPreferences.GetString("Email", ""));
                    editorDevis.PutString("Tel", sharedPreferences.GetString("Tel", ""));
                    editorDevis.PutString("Adresse", sharedPreferences.GetString("Adresse", ""));
                    editorDevis.PutString("CodePostal", sharedPreferences.GetString("CodePostal", ""));
                    editorDevis.PutString("Ville", sharedPreferences.GetString("Ville", ""));
                    editorDevis.PutString("Pays", sharedPreferences.GetString("Pays", ""));

                    editorDevis.PutString("Nombanque", nombanque.Text);
                    editorDevis.PutString("Bic", Bic.Text);
                    editorDevis.PutString("IBAN", IBAN.Text);
                    editorDevis.PutString("Devise", toast);
                    editorDevis.Apply();
                    StartActivity(intent);
                };

                buttonsuivantbanque.Click += delegate
                {
                    editorDevis.PutString("Nom", sharedPreferences.GetString("Nom", ""));
                    editorDevis.PutString("Email", sharedPreferences.GetString("Email", ""));
                    editorDevis.PutString("Tel", sharedPreferences.GetString("Tel", ""));
                    editorDevis.PutString("Adresse", sharedPreferences.GetString("Adresse", ""));
                    editorDevis.PutString("CodePostal", sharedPreferences.GetString("CodePostal", ""));
                    editorDevis.PutString("Ville", sharedPreferences.GetString("Ville", ""));
                    editorDevis.PutString("Pays", sharedPreferences.GetString("Pays", ""));

                    editorDevis.PutString("Nombanque", nombanque.Text);
                    editorDevis.PutString("Bic", Bic.Text);
                    editorDevis.PutString("IBAN", IBAN.Text);
                    editorDevis.PutString("Devise", toast);
                    editorDevis.Apply();

                    Intent intent = new Intent(this, typeof(CreationClient3));

                    StartActivity(intent);
                };
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, ex.Message, ToastLength.Long).Show();
            }

            // Create your application here
        }
Beispiel #33
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

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

            if (ShouldUseExoPlayer)
            {
                var exoPlayer = new ExoPlayerAudioImplementation(((MediaManagerImplementation)CrossMediaManager.Current).MediaSessionManager);
                CrossMediaManager.Current.AudioPlayer = exoPlayer;
            }

            CrossMediaManager.Current.AudioPlayer.RequestHeaders = new Dictionary <string, string> {
                { "Test", "1234" }
            };

            var previous = FindViewById <ImageButton>(Resource.Id.btnPrevious);

            previous.Click += async(sender, args) =>
            {
                await PlaybackController.PlayPreviousOrSeekToStart();
            };

            var playpause = FindViewById <ToggleButton>(Resource.Id.btnPlayPause);

            playpause.Click += async(sender, args) =>
            {
                await PlaybackController.PlayPause();
            };

            var next = FindViewById <ImageButton>(Resource.Id.btnNext);

            next.Click += async(sender, args) =>
            {
                await PlaybackController.PlayNext();
            };

            var position = FindViewById <TextView>(Resource.Id.textview_position);
            var duration = FindViewById <TextView>(Resource.Id.textview_duration);
            var seekbar  = FindViewById <SeekBar>(Resource.Id.player_seekbar);

            seekbar.ProgressChanged += (sender, args) =>
            {
                if (args.FromUser)
                {
                    PlaybackController.SeekTo(args.Progress);
                }
            };

            ViewModel.MediaPlayer.PlayingChanged += (sender, e) =>

            {
                RunOnUiThread(() =>
                {
                    try
                    {
                        seekbar.Max      = Convert.ToInt32(e.Duration.TotalSeconds);
                        seekbar.Progress = Convert.ToInt32(Math.Floor(e.Position.TotalSeconds));

                        position.Text = $"{e.Position.Minutes:00}:{e.Position.Seconds:00}";
                        duration.Text = $"{e.Duration.Minutes:00}:{e.Duration.Seconds:00}";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"Exception : PlayingChanged: {ex.Message}");
                    }
                });
            };

            ViewModel.MediaPlayer.BufferingChanged += (sender, args) =>
            {
                RunOnUiThread(() =>
                {
                    try
                    {
                        Console.WriteLine($"BufferingChanged: {args.BufferedTime.TotalSeconds}");
                        seekbar.SecondaryProgress = Convert.ToInt32(args.BufferedTime.TotalSeconds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"Exception : BufferingChanged: {ex.Message}");
                    }
                });
            };


            ViewModel.MediaPlayer.StatusChanged += (sender, e) =>
            {
                Console.WriteLine($"StausChanged {e.Status}");
                RunOnUiThread(() =>
                {
                    try
                    {
                        playpause.Checked = e.Status == MediaPlayerStatus.Playing || e.Status == MediaPlayerStatus.Loading ||
                                            e.Status == MediaPlayerStatus.Buffering;
                        if (e.Status == MediaPlayerStatus.Stopped || e.Status == MediaPlayerStatus.Failed || e.Status == MediaPlayerStatus.Loading)
                        {
                            seekbar.Progress          = 0;
                            seekbar.SecondaryProgress = 0;
                            position.Text             = "00:00";
                            duration.Text             = "00:00";
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"Exception : StausChanged: {ex.Message}");
                    }
                });
            };

            ViewModel.MediaPlayer.MediaFailed += (sender, e) =>
            {
                try
                {
                    Console.WriteLine($"Media failed => {e.Description}");
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Exception : MediaFailed: {ex.Message}");
                }
            };

            ViewModel.MediaPlayer.MediaFileFailed += (sender, e) =>
            {
                try
                {
                    Console.WriteLine($"Media file ({e.File.Url}) failed: Message => {e.MediaExeption.Message}");
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Exception : MediaFileFailed: {ex.Message}");
                }
            };

            var title    = FindViewById <TextView>(Resource.Id.textview_title);
            var subtitle = FindViewById <TextView>(Resource.Id.textview_subtitle);

            ViewModel.MediaPlayer.MediaFileChanged += (sender, args) =>
            {
                try
                {
                    Console.WriteLine($"File changed: {args.File.Metadata.Title}");
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Exception : MediaFileChanged: {ex.Message}");
                }

                RunOnUiThread(() =>
                {
                    try
                    {
                        if (args.File.Url == ViewModel.Queue.Current.Url)
                        {
                            title.Text    = args.File.Metadata.Title;
                            subtitle.Text = args.File.Metadata.Artist;
                            var cover     = FindViewById <ImageView>(Resource.Id.imageview_cover);
                            cover.SetImageBitmap(args.File.Metadata.AlbumArt as Bitmap);
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"Exception : MediaFileChangedUI: {ex.Message}");
                    }
                });
            };

            ViewModel.Init();
        }
Beispiel #34
0
        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);

            FindViewById <Button>(Resource.Id.tv_open).Click += async(sender, e) =>
            {
                await Task.Run(() =>
                {
                    SendTCP(49); //0
                    Thread.Sleep(100);
                    SendTCP(51); //3
                });
            };
            FindViewById <Button>(Resource.Id.tv_change_input).Click += async(sender, e) =>
            {
                await Task.Run(() =>
                {
                    SendTCP(50); //2
                });
            };
            FindViewById <Button>(Resource.Id.tv_enter).Click += async(sender, e) =>
            {
                await Task.Run(() =>
                {
                    SendTCP(57); //9
                });
            };
            FindViewById <Button>(Resource.Id.volume_up).Click += async(sender, e) =>
            {
                await Task.Run(() =>
                {
                    SendTCP(52); //4
                });
            };
            FindViewById <Button>(Resource.Id.volume_down).Click += async(sender, e) =>
            {
                await Task.Run(() =>
                {
                    SendTCP(53); //5
                });
            };
            FindViewById <Button>(Resource.Id.switch_1).Click += async(sender, e) =>
            {
                await Task.Run(() =>
                {
                    SendTCP(54); //6
                });
            };
            FindViewById <Button>(Resource.Id.switch_2).Click += async(sender, e) =>
            {
                await Task.Run(() =>
                {
                    SendTCP(55); //7
                });
            };
            FindViewById <Button>(Resource.Id.switch_3).Click += async(sender, e) =>
            {
                await Task.Run(() =>
                {
                    SendTCP(56); //8
                });
            };
        }
 private void GetReferences()
 {
     _fabAdd       = FindViewById <FloatingActionButton>(Resource.Id.fabAddReminder);
     _toolbar      = FindViewById <Toolbar>(Resource.Id.toolbar);
     _toolBarTitle = FindViewById <TextView>(Resource.Id.toolbarTitle);
 }
Beispiel #36
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);
            homeFragment  = new HomeFragment();

            profileFragment = new ProfileFragment();
            mStackFragments = new Stack <SupportFragment>();


            mLeftDrawer.Tag = 0;


            SetSupportActionBar(mToolbar);

            mLeftDataSet = new List <string>();
            mLeftDataSet.Add("Left Item 1");
            mLeftDataSet.Add("Left Item 2");
            mLeftAdapter           = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, mLeftDataSet);
            mLeftDrawer.Adapter    = mLeftAdapter;
            mLeftDrawer.ItemClick += MenuListView_ItemClick;


            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();

            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);
            }

            Android.Support.V4.App.FragmentTransaction tx = SupportFragmentManager.BeginTransaction();

            tx.Add(Resource.Id.main, homeFragment);
            tx.Add(Resource.Id.main, profileFragment);
            tx.Hide(profileFragment);

            mCurrentFragment = homeFragment;
            tx.Commit();
        }
Beispiel #37
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("OTg5ODlAMzEzNzJlMzEyZTMwUG5ONWFZZmdORDJldFd2ZUFIM0QzVWxjWWdGSFlkWW9TMTBZTytvbElzND0=");


            ISharedPreferences       prefs  = PreferenceManager.GetDefaultSharedPreferences(Android.App.Application.Context);
            ISharedPreferencesEditor editor = prefs.Edit();

            if (prefs.GetString("locale", "") == "")
            {
                editor.PutString("locale", "en");
                editor.Apply();
            }
            string loc    = prefs.GetString("locale", "");
            var    locale = new Java.Util.Locale(loc);

            Java.Util.Locale.Default = locale;

            var config = new Android.Content.Res.Configuration {
                Locale = locale
            };

#pragma warning disable CS0618 // Type or member is obsolete
            BaseContext.Resources.UpdateConfiguration(config, metrics: BaseContext.Resources.DisplayMetrics);
#pragma warning restore CS0618 // Type or member is obsolete

            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;

            //ObservableCollection<Client> lst =  await apiClient.GetClientsListAsync();

            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);

            //Button loginSendButton = FindViewById<Button>(Resource.Id.loginSendButton);

            //loginSendButton.Click += async (s, arg) =>
            //{
            //    CredentialsViewModel credentialViewModel = new CredentialsViewModel();

            //    var loginEditText = FindViewById<EditText>(Resource.Id.loginEditText);
            //    credentialViewModel.UserName = loginEditText.Text;

            //    var passwordEditText = FindViewById<EditText>(Resource.Id.passwordEditText);
            //    credentialViewModel.Password = passwordEditText.Text;

            //    apiClient = new APIClient();

            //    string token = await apiClient.Post2Async(credentialViewModel);

            //    ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(Android.App.Application.Context);
            //    ISharedPreferencesEditor editor = prefs.Edit();
            //    editor.PutString("auth_token", token);
            //    editor.Apply();

            //    // var intent = new Intent(this, typeof(HomeActivity));
            //    //StartActivity(intent);
            //    TextView loginTextView = FindViewById<TextView>(Resource.Id.loginTextView);
            //    loginTextView.Text = token;


            //};
        }
        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);

            ImageView image       = FindViewById <ImageView>(Resource.Id.barcodeImage);
            Button    btnGenerate = FindViewById <Button>(Resource.Id.generate);

            txtMessage   = FindViewById <TextView>(Resource.Id.plain_text_input);
            spinnerValue = FindViewById <Spinner>(Resource.Id.spinner);
            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.selected_Code, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinnerValue.Adapter       = adapter;
            spinnerValue.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(SpinnerItemSelect);
            fab.Click += FabOnClick;

            btnGenerate.Click += delegate
            {
                string[] PERMISSIONS =
                {
                    "android.permission.READ_EXTERNAL_STORAGE",
                    "android.permission.WRITE_EXTERNAL_STORAGE"
                };

                var permission     = ContextCompat.CheckSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE");
                var permissionread = ContextCompat.CheckSelfPermission(this, "android.permission.READ_EXTERNAL_STORAGE");

                if (permission != Permission.Granted && permissionread != Permission.Granted)
                {
                    ActivityCompat.RequestPermissions(this, PERMISSIONS, 1);
                }

                try
                {
                    if (permission == Permission.Granted && permissionread == Permission.Granted)
                    {
                        BitMatrix bitmapMatrix = null;
                        message = txtMessage.Text.ToString();

                        switch (CodeType)
                        {
                        case "QR Code":
                            bitmapMatrix = new MultiFormatWriter().encode(message, BarcodeFormat.QR_CODE, size, size);
                            break;

                        case "PDF 417":
                            bitmapMatrix = new MultiFormatWriter().encode(message, BarcodeFormat.PDF_417, size, small_size);
                            break;

                        case "CODE 128":
                            bitmapMatrix = new MultiFormatWriter().encode(message, BarcodeFormat.CODE_128, size, small_size);
                            break;

                        case "CODE 39":
                            bitmapMatrix = new MultiFormatWriter().encode(message, BarcodeFormat.CODE_39, size, small_size);
                            break;

                        case "AZTEC":
                            bitmapMatrix = new MultiFormatWriter().encode(message, BarcodeFormat.AZTEC, size, small_size);
                            break;
                        }

                        var   width       = bitmapMatrix.Width;
                        var   height      = bitmapMatrix.Height;
                        int[] pixelsImage = new int[width * height];

                        for (int i = 0; i < height; i++)
                        {
                            for (int j = 0; j < width; j++)
                            {
                                if (bitmapMatrix[j, i])
                                {
                                    pixelsImage[i * width + j] = (int)Convert.ToInt64(0xff000000);
                                }
                                else
                                {
                                    pixelsImage[i * width + j] = (int)Convert.ToInt64(0xffffffff);
                                }
                            }
                        }

                        Bitmap bitmap = Bitmap.CreateBitmap(width, height, Bitmap.Config.Argb8888);
                        bitmap.SetPixels(pixelsImage, 0, width, 0, 0, width, height);

                        var sdpath = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
                        var path   = System.IO.Path.Combine(sdpath, "logeshbarcode.jpg");
                        var stream = new FileStream(path, FileMode.Create);
                        bitmap.Compress(Bitmap.CompressFormat.Jpeg, 100, stream);
                        stream.Close();

                        image.SetImageBitmap(bitmap);
                    }
                    else
                    {
                        Console.WriteLine("No Permission");
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Exception {ex} ");
                }
            };
        }
Beispiel #39
0
        /// <summary>
        /// Override OnCreate function
        /// </summary>
        /// <param name="savedInstanceState"></param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            // Set-up the custom toolbar as the action bar
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar); // Set toolbar as actionBar

            // Set-up the navigation drawer
            mDrawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close);

            mDrawer.AddDrawerListener(toggle);
            toggle.SyncState();

            // Set-up the navigation view
            NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.SetNavigationItemSelectedListener(this);
            navigationView.SetCheckedItem(Resource.Id.nav_casual);
            View headerView = navigationView.GetHeaderView(0);

            gestureDetector = new GestureDetector(this, new MyGestureListener(this));
            if (savedInstanceState == null)
            {
                // If no saved instance state is found, add new StatusCardFrontFragment to container
                FragmentTransaction transaction = FragmentManager.BeginTransaction();
                transaction.Add(Resource.Id.container, new StatusCardFrontFragment());
                transaction.Commit();
            }

            #region Initialization
            mProfilePic     = headerView.FindViewById <ImageView>(Resource.Id.mainProfilePic);
            mTvUername      = headerView.FindViewById <TextView>(Resource.Id.mainTxtUsername);
            mTvFullname     = headerView.FindViewById <TextView>(Resource.Id.mainTxtFullName);
            mPuzzlePanel    = FindViewById <RelativeLayout>(Resource.Id.puzzlePanel);
            sTvProgress     = FindViewById <TextView>(Resource.Id.txtPercentage);
            mLayoutProgress = FindViewById <LinearLayout>(Resource.Id.puzzlePanelLoading);
            mLayoutMessage  = FindViewById <LinearLayout>(Resource.Id.puzzlePanelMessage);
            mBtnBrowse      = FindViewById <Button>(Resource.Id.btnBrowse);
            mBtnPlay        = FindViewById <Button>(Resource.Id.btnPlay);
            navLogin        = navigationView.Menu.FindItem(Resource.Id.nav_login);
            navSignUp       = navigationView.Menu.FindItem(Resource.Id.nav_signup);
            navProfile      = navigationView.Menu.FindItem(Resource.Id.nav_profile);
            navLogout       = navigationView.Menu.FindItem(Resource.Id.nav_logout);
            navLeaderBoard  = navigationView.Menu.FindItem(Resource.Id.nav_leaderboard);
            navAchievements = navigationView.Menu.FindItem(Resource.Id.nav_achievements);
            navReports      = navigationView.Menu.FindItem(Resource.Id.nav_reports);
            navFeedback     = navigationView.Menu.FindItem(Resource.Id.nav_feedback);

            mUsername          = String.Empty;
            mProfilePic.Click += (o, e) =>
            {
                // Navigate to the Profile activity
                if (mUsername != String.Empty)
                {
                    Intent intent = new Intent(this, typeof(ProfileActivity));
                    intent.PutExtra("Username", mUsername);
                    StartActivity(intent);
                    OverridePendingTransition(Resource.Animation.slide_in_left, Resource.Animation.slide_out_right);
                }
            };

            mBtnPlay.Click   += MBtnPlay_Click;
            mBtnBrowse.Click += BtnBrowse_Click;
            EnigmaRampageAndroidLibrary.Common.ImageSwitcher.OnPuzzleComplete += ImageSwitcher_OnPuzzleComplete;
            EnigmaRampageAndroidLibrary.Common.ImageSwitcher.OnSwapComplete   += ImageSwitcher_OnSwapComplete;
            MyEventHandler.OnLoginComplete  += MyEventHandler_OnLoginComplete;
            MyEventHandler.OnDeleteComplete += MyEventHandler_OnDeleteComplete;

            mDialogFrag = new FrontPanelDialog();
            mDialogFrag.OnSignUpNavComplete += DialogFrag_OnSignUpNavComplete;
            mDialogFrag.OnLoginNavComplete  += DialogFrag_OnLoginNavComplete;

            mPicBoxWhole = new ImageView(this);
            sCurrentLvl  = LVL_1_NUM;
            sIsFixed     = false;
            mMode        = "Casual";
            mCurrentMode = mMode;
            mStatus      = "Idle";
            mSwaps       = -1;
            mTime        = "∞";
            mStatusTimer = new Timer
            {
                Interval = 1000
            };
            mStatusTimer.Elapsed += OnTimedEvent;
            #endregion

            if (!Intent.GetBooleanExtra("LoggingStatus", false))
            {
                // Pull up Front Panel dialog
                FragmentTransaction transaction = FragmentManager.BeginTransaction();
                mDialogFrag.Show(transaction, "dialog fragment");
            }
        }
 protected override void OnPostCreate(Bundle savedInstanceState)
 {
     Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
     SetSupportActionBar(toolbar);
     base.OnPostCreate(savedInstanceState);
 }
Beispiel #41
0
 public MyActionBarDrawerToggle(AppCompatActivity host, DrawerLayout drawerLayout, Toolbar toolbar, int openedResource, int closedResource)
     : base(host, drawerLayout, toolbar, openedResource, closedResource)
 {
     _HostActivity = host;
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

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

            if (mediaPlayerServiceConnection == null)
            {
                InitilizeMedia();
            }

            var previous = FindViewById <ImageButton>(Resource.Id.btnPrevious);

            previous.Click += async(sender, args) => {
                if (binder.GetMediaPlayerService().mediaPlayer != null)
                {
                    await binder.GetMediaPlayerService().PlayPrevious();
                }
            };

            var playpause = FindViewById <Button>(Resource.Id.btnPlayPause);

            playpause.Click += async(sender, args) => {
                if (binder.GetMediaPlayerService().mediaPlayer != null && binder.GetMediaPlayerService().MediaPlayerState == PlaybackStateCompat.StatePlaying)
                {
                    await binder.GetMediaPlayerService().Pause();
                }
                else
                {
                    await binder.GetMediaPlayerService().Play();
                }
            };

            var next = FindViewById <ImageButton>(Resource.Id.btnNext);

            next.Click += async(sender, args) => {
                if (binder.GetMediaPlayerService().mediaPlayer != null)
                {
                    await binder.GetMediaPlayerService().PlayNext();
                }
            };

            var position = FindViewById <TextView>(Resource.Id.textview_position);
            var duration = FindViewById <TextView>(Resource.Id.textview_duration);
            var seekbar  = FindViewById <SeekBar>(Resource.Id.player_seekbar);

            Playing += (object sender, EventArgs e) => {
                seekbar.Max      = binder.GetMediaPlayerService().Duration;
                seekbar.Progress = binder.GetMediaPlayerService().Position;

                position.Text = GetFormattedTime(binder.GetMediaPlayerService().Position);
                duration.Text = GetFormattedTime(binder.GetMediaPlayerService().Duration);
            };

            Buffering += (object sender, EventArgs e) => {
                seekbar.SecondaryProgress = binder.GetMediaPlayerService().Buffered;
            };

            CoverReloaded += (object sender, EventArgs e) => {
                var cover = FindViewById <ImageView>(Resource.Id.imageview_cover);
                cover.SetImageBitmap(binder.GetMediaPlayerService().Cover as Bitmap);
            };

            var title    = FindViewById <TextView>(Resource.Id.textview_title);
            var subtitle = FindViewById <TextView>(Resource.Id.textview_subtitle);

            StatusChanged += (object sender, EventArgs e) => {
                var metadata = binder.GetMediaPlayerService().mediaControllerCompat.Metadata;
                if (metadata != null)
                {
                    RunOnUiThread(() => {
                        title.Text         = metadata.GetString(MediaMetadata.MetadataKeyTitle);
                        subtitle.Text      = metadata.GetString(MediaMetadata.MetadataKeyArtist);
                        playpause.Selected = binder.GetMediaPlayerService().mediaControllerCompat.PlaybackState.State == PlaybackStateCompat.StatePlaying;
                    });
                }
            };
        }
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            AToolbar bar = _toolbar;

            // make sure bar stays on top of everything
            bar.BringToFront();

            base.OnLayout(changed, l, t, r, b);

            int barHeight = ActionBarHeight();

            if (Element.IsSet(BarHeightProperty))
            {
                barHeight = Element.OnThisPlatform().GetBarHeight();
            }

            if (barHeight != _lastActionBarHeight && _lastActionBarHeight > 0)
            {
                ResetToolbar();
                bar = _toolbar;
            }
            _lastActionBarHeight = barHeight;

            bar.Measure(MeasureSpecFactory.MakeMeasureSpec(r - l, MeasureSpecMode.Exactly), MeasureSpecFactory.MakeMeasureSpec(barHeight, MeasureSpecMode.Exactly));

            var barOffset       = ToolbarVisible ? barHeight : 0;
            int containerHeight = b - t - ContainerTopPadding - barOffset - ContainerBottomPadding;

            PageController.ContainerArea = new Rectangle(0, 0, Context.FromPixels(r - l), Context.FromPixels(containerHeight));

            // Potential for optimization here, the exact conditions by which you don't need to do this are complex
            // and the cost of doing when it's not needed is moderate to low since the layout will short circuit pretty fast
            Element.ForceLayout();

            bool toolbarLayoutCompleted = false;

            for (var i = 0; i < ChildCount; i++)
            {
                AView child = GetChildAt(i);

                Page childPage = (child as PageContainer)?.Child?.Element as Page;

                if (childPage == null)
                {
                    return;
                }

                // We need to base the layout of both the child and the bar on the presence of the NavBar on the child Page itself.
                // If we layout the bar based on ToolbarVisible, we get a white bar flashing at the top of the screen.
                // If we layout the child based on ToolbarVisible, we get a white bar flashing at the bottom of the screen.
                bool childHasNavBar = NavigationPage.GetHasNavigationBar(childPage);

                if (childHasNavBar)
                {
                    bar.Layout(0, 0, r - l, barHeight);
                    child.Layout(0, barHeight + ContainerTopPadding, r, b - ContainerBottomPadding);
                }
                else
                {
                    bar.Layout(0, -1000, r, barHeight - 1000);
                    child.Layout(0, ContainerTopPadding, r, b - ContainerBottomPadding);
                }
                toolbarLayoutCompleted = true;
            }

            // Making the layout of the toolbar dependant on having a child Page could potentially mean that the toolbar is not laid out.
            // We'll do one more check to make sure it isn't missed.
            if (!toolbarLayoutCompleted)
            {
                if (ToolbarVisible)
                {
                    bar.Layout(0, 0, r - l, barHeight);
                }
                else
                {
                    bar.Layout(0, -1000, r, barHeight - 1000);
                }
            }
        }
        protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                _disposed = true;

                if (_titleViewRenderer != null)
                {
                    Android.Platform.ClearRenderer(_titleViewRenderer.View);
                    _titleViewRenderer.Dispose();
                    _titleViewRenderer = null;
                }

                _toolbar.RemoveView(_titleView);
                _titleView?.Dispose();
                _titleView = null;

                _toolbar.RemoveView(_titleIconView);
                _titleIconView?.Dispose();
                _titleIconView = null;

                _imageSource = null;

                if (_toolbarTracker != null)
                {
                    _toolbarTracker.CollectionChanged -= ToolbarTrackerOnCollectionChanged;
                    _toolbarTracker.Target             = null;
                    _toolbarTracker = null;
                }

                if (_toolbar != null)
                {
                    _toolbar.SetNavigationOnClickListener(null);
                    _toolbar.Dispose();
                    _toolbar = null;
                }

                if (_drawerLayout != null && _drawerListener != null)
                {
                    _drawerLayout.RemoveDrawerListener(_drawerListener);
                }

                if (_drawerListener != null)
                {
                    _drawerListener.Dispose();
                    _drawerListener = null;
                }

                if (_drawerToggle != null)
                {
                    _drawerToggle.Dispose();
                    _drawerToggle = null;
                }

                if (_backgroundDrawable != null)
                {
                    _backgroundDrawable.Dispose();
                    _backgroundDrawable = null;
                }

                Current = null;

                // We dispose the child renderers after cleaning up everything related to DrawerLayout in case
                // one of the children is a MasterDetailPage (which may dispose of the DrawerLayout).
                if (Element != null)
                {
                    foreach (Element element in PageController.InternalChildren)
                    {
                        var child = element as VisualElement;
                        if (child == null)
                        {
                            continue;
                        }

                        IVisualElementRenderer renderer = Android.Platform.GetRenderer(child);
                        renderer?.Dispose();
                    }

                    var navController = NavigationPageController;

                    navController.PushRequested             -= OnPushed;
                    navController.PopRequested              -= OnPopped;
                    navController.PopToRootRequested        -= OnPoppedToRoot;
                    navController.InsertPageBeforeRequested -= OnInsertPageBeforeRequested;
                    navController.RemovePageRequested       -= OnRemovePageRequested;
                }

                Device.Info.PropertyChanged -= DeviceInfoPropertyChanged;

                // API only exists on newer android YAY
                if ((int)Build.VERSION.SdkInt >= 17)
                {
                    FragmentManager fm = FragmentManager;

                    if (!fm.IsDestroyed)
                    {
                        FragmentTransaction trans = fm.BeginTransactionEx();
                        foreach (Fragment fragment in _fragmentStack)
                        {
                            trans.RemoveEx(fragment);
                        }
                        trans.CommitAllowingStateLossEx();
                        fm.ExecutePendingTransactionsEx();
                    }
                }
            }

            base.Dispose(disposing);
        }
Beispiel #45
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            SetContentView(Resource.Layout.activity_fruit);


            var mylinearLayout = FindViewById <LinearLayout>(Resource.Id.my_linearLayout);

            //var linearLayout = GetItemLinearLayout();
            //linearLayout.SetBackgroundColor(Color.Blue);


            FieldServer fieldServer = new FieldServer();
            var         list        = fieldServer.GetFields();

            foreach (var item in list)
            {
                var linearLayout = GetItemLinearLayout();
                linearLayout.SetBackgroundResource(Resource.Drawable.border);

                var textView = GetItemTextView(3);
                var editView = GetItemEditText(1);

                //textView.SetBackgroundResource(Resource.Drawable.border);
                //editView.SetBackgroundResource(Resource.Drawable.border);

                textView.Text    = item.Name;
                editView.Text    = item.Name + "_" + item.Key;
                editView.Enabled = false;


                linearLayout.AddView(textView);
                linearLayout.AddView(editView);

                editTexts.Add(editView);
                mylinearLayout.AddView(linearLayout);
            }



            var fruitName    = Intent.GetStringExtra(FRUIT_NAME);
            var fruitImageId = Intent.GetIntExtra(FRUIT_IMAGE_ID, 0);

            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.tool_bar);
            CollapsingToolbarLayout collapsingToolbar = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar);
            //ImageView fruitImageView = FindViewById<ImageView>(Resource.Id.fruit_image_view);
            TextView fruitContentText = FindViewById <TextView>(Resource.Id.fruit_content_text);

            //toolbar.Title = fruitName;
            SetSupportActionBar(toolbar);


            // 添加返回键
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            //collapsingToolbar.SetCollapsedTitleTextAppearance(Resource.Style.CollapsedAppBar);
            //collapsingToolbar.SetExpandedTitleTextAppearance(Resource.Style.CollapsedAppBar);
            collapsingToolbar.SetTitle(fruitName);

            //Glide.With(this).Load(fruitImageId).Into(fruitImageView);
            //Glide.With(this).AsBitmap().Load("").Into(fruitImageView);
            fruitContentText.Text = fruitName;//Add500(fruitName);


            var imageViewer = FindViewById <ViewPager>(Resource.Id.image_pager);

            imageViewer.Adapter = new ImageSliderAdapter(this, new List <string>()
            {
                "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590552625990&di=8088736bfaac32f8808861d97edf6d70&imgtype=0&src=http%3A%2F%2Fimg.pconline.com.cn%2Fimages%2Fupload%2Fupc%2Ftx%2Fwallpaper%2F1208%2F15%2Fc0%2F12924355_1344999165562.jpg",
                "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590552625990&di=2af594f5495d6f2fc3eb19e023ae0914&imgtype=0&src=http%3A%2F%2Fpic.baike.soso.com%2Fp%2F20131221%2F20131221152446-229545202.jpg",
                "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590552625989&di=07248ec9129a47b044881e5df9524d1f&imgtype=0&src=http%3A%2F%2Fattach.bbs.miui.com%2Fforum%2F201308%2F24%2F162824zuojehbb2u4kbula.jpg"
            });



            var enableEdits = FindViewById <FloatingActionButton>(Resource.Id.enable_edit);

            enableEdits.Click += delegate
            {
                editTexts.ForEach(f =>
                {
                    f.Enabled = !f.Enabled;
                });
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.RestaurantProfileLayout);

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

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

            ImageView imageView = FindViewById <ImageView>(Resource.Id.imageView);

            TextView textview1 = FindViewById <TextView>(Resource.Id.textView1);

            TextView textview2 = FindViewById <TextView>(Resource.Id.textView2);

            TextView textview3 = FindViewById <TextView>(Resource.Id.textView3);

            ratingBar = FindViewById <RatingBar>(Resource.Id.ratingBar1);

            tabLayout = FindViewById <Android.Support.Design.Widget.TabLayout>(Resource.Id.tabLayout);

            saveButton = FindViewById <ImageButton>(Resource.Id.imageButton1);

            viewPager = FindViewById <ViewPager>(Resource.Id.viewPager);


            var restaurantInfo = JsonConvert.DeserializeObject <Post>(Intent.GetStringExtra("RestaurantInfo"));

            var imageBitmap = ImageHelper.GetImageBitmapFromUrl(restaurantInfo.MainPhoto1);

            imageView.SetImageBitmap(imageBitmap);


            textview1.Text = restaurantInfo.RestaurantName;

            if (restaurantInfo.Cost == "1")
            {
                textview2.Text = "£";
            }
            else if (restaurantInfo.Cost == "2")
            {
                textview2.Text = "££";
            }
            else if (restaurantInfo.Cost == "3")
            {
                textview2.Text = "£££";
            }

            if (restaurantInfo.Cuisines == null && restaurantInfo.Categories == null)
            {
                textview3.Text = "";
            }
            else if (restaurantInfo.Cuisines != null && restaurantInfo.Categories == null)
            {
                textview3.Text = restaurantInfo.Cuisines;
            }
            else if (restaurantInfo.Cuisines == null && restaurantInfo.Categories != null)
            {
                textview3.Text = restaurantInfo.Categories;
            }
            else if (restaurantInfo.Cuisines != null && restaurantInfo.Categories != null)
            {
                textview3.Text = restaurantInfo.Cuisines + " " + restaurantInfo.Categories;
            }

            ID = restaurantInfo.ID;

            saveButton.Click += saveButtonClick;

            ratingBar.RatingBarChange += ratingClick;

            SetSupportActionBar(toolbarNav);
            SetupViewPager(viewPager);

            tabLayout.SetupWithViewPager(viewPager);

            viewPager.AddOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));

            checkIfUserHasSavedRestaurant(ID);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            tripItem = JsonConvert.DeserializeObject <TripItem>(Intent.GetStringExtra("Trip"));
            try
            {
                flag = JsonConvert.DeserializeObject <bool>(Intent.GetStringExtra("Flag"));
            }
            catch
            {
                flag = false;
            }

            payments    = new ObservableCollection <PaymentItem>();
            friends     = new ObservableCollection <UserItem>();
            countedAlgo = new ObservableCollection <string>();

            history = new ObservableCollection <HistoryItem>();
            GetAll();

            SetContentView(Resource.Layout.TripLayout);

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

            textViewName        = FindViewById <TextView>(Resource.Id.textViewName);
            textViewStartDate   = FindViewById <TextView>(Resource.Id.textViewStartDate);
            textViewEndDate     = FindViewById <TextView>(Resource.Id.textViewEndDate);
            textViewDescription = FindViewById <TextView>(Resource.Id.textViewDescription);
            buttonPayments      = FindViewById <Button>(Resource.Id.buttonPayments);
            buttonFriends       = FindViewById <Button>(Resource.Id.buttonFriends);
            buttonHistory       = FindViewById <Button>(Resource.Id.buttonHistory);
            buttonSummary       = FindViewById <Button>(Resource.Id.buttonSummary);
            listView            = FindViewById <ListView>(Resource.Id.listView1);
            listView.ItemClick += ListViewClick;

            textViewName.Text      += tripItem.Name;
            textViewStartDate.Text += tripItem.StartDate.ToShortDateString();
            textViewEndDate.Text   += tripItem.EndDate.ToShortDateString();
            if (tripItem.Description != string.Empty)
            {
                textViewDescription.Text += tripItem.Description;
            }
            else
            {
                textViewDescription.Visibility = ViewStates.Invisible;
            }

            ButtonClicked("payments");

            buttonPayments.Click += delegate
            {
                type = "payments";
                ButtonClicked("payments");
            };

            buttonFriends.Click += delegate
            {
                type = "friends";
                ButtonClicked("friends");
            };

            buttonHistory.Click += delegate
            {
                type = "history";
                ButtonClicked("history");
            };

            buttonSummary.Click += delegate
            {
                type = "summary";
                ButtonClicked("summary");
            };
            var swipeContainer = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeContainer);

            swipeContainer.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloOrangeLight, Android.Resource.Color.HoloRedLight);
            swipeContainer.Refresh += SwipeContainer_Refresh;
        }
Beispiel #48
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();
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            OverridePendingTransition(Android.Resource.Animation.FadeIn, Android.Resource.Animation.FadeOut);
            SetContentView(Resource.Layout.DatabaseAddLayout);

            idListener = new NewDatabaseIdListener(this);
            database   = FirebaseDatabase.Instance;
            databasesSchemaReference = database.GetReferenceFromUrl(Intent.GetStringExtra("databasesSchema"));

            imageSize = Resources.GetDimension(Resource.Dimension.workplace_image_size);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbarMain);
            if (null != toolbar)
            {
                SetSupportActionBar(toolbar);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                //SupportActionBar.SetTitle(Resource.String.add_new_database_string);
            }

            RelativeLayout layout = FindViewById <RelativeLayout>(Resource.Id.relativeLayoutAddEmptyDatabase);

            layout.SetOnClickListener(this);

            imagePicker = FindViewById <LinearLayout>(Resource.Id.linearLayoutImagePicker);
            colorPicker = FindViewById <LinearLayout>(Resource.Id.linearlayoutColorPicker);

            newName = FindViewById <EditText>(Resource.Id.editTextName);

            foreach (Color c in DatabaseController.colors)
            {
                ImageView newView = new ImageView(this)
                {
                    Id = Resource.Id.linearlayoutColorPicker
                };
                newView.SetOnClickListener(this);
                newView.SetImageResource(Resource.Drawable.icons_checkmark);
                newView.SetBackgroundColor(c);
                newView.SetColorFilter(c);
                colorPicker.AddView(newView);
            }
            selectedcolor = 0;
            selectedColor = (ImageView)colorPicker.GetChildAt(0);
            selectedColor.SetColorFilter(Color.White);

            foreach (int res in DatabaseController.imageResources)
            {
                ImageView newView = new ImageView(this)
                {
                    Id = Resource.Id.linearLayoutImagePicker
                };

                newView.SetImageResource(res);
                int padding = (int)imageSize / 8;
                newView.SetPadding(padding, padding, padding, padding);

                newView.SetMaxHeight((int)imageSize);
                newView.SetMaxWidth((int)imageSize);
                newView.SetMinimumHeight((int)imageSize);
                newView.SetMinimumHeight((int)imageSize);

                newView.SetScaleType(ImageView.ScaleType.FitXy);

                newView.SetOnClickListener(this);
                imagePicker.AddView(newView);
            }
            selectedDrawable = (ImageView)imagePicker.GetChildAt(0);
            GradientDrawable backgroundShape = new GradientDrawable();

            backgroundShape.SetColor(DatabaseController.colors[selectedcolor].ToArgb());

            backgroundShape.SetCornerRadius(imageSize / 8);

            selectedDrawable.Background = backgroundShape;
            selectedDrawable.SetColorFilter(Color.White);

            Window.SetSoftInputMode(SoftInput.StateVisible);

            databasesSchemaReference.Child("new_database_id").AddValueEventListener(idListener);
        }
        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);

            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);

            MobileBarcodeScanner.Initialize(Application);

            Agent = "Скай";
            FindViewById <ImageView>(Resource.Id.imageView1).SetImageResource(Resource.Drawable.Sky);

            var button = FindViewById <ImageButton>(Resource.Id.fab);

            button.Click += async delegate
            {
                var scanner = new MobileBarcodeScanner();
                var result  = await scanner.Scan();

                /*К сожалению qr код не может правильно передать зашифрованное сообщение
                 * string enctyptedIp = result.Text;
                 * string IpKey = enctyptedIp.Substring(enctyptedIp.Length - 28);
                 * enctyptedIp = enctyptedIp.Substring(0, enctyptedIp.Length - 28);
                 * LFSR IpProtection = new LFSR();
                 *
                 * IpProtection.EnterKey(IpKey);
                 * string dectyptedIp = IpProtection.Decrypt(enctyptedIp);
                 */
                if (result == null)
                {
                    return;
                }

                string ip = result.Text;

                string[] randStrs = { "fdytrtfv", "dcdsvsd", "sdasxcwfw", "jult,", "ascsdcr", "yujtytr", "ecl,", "i;remcd", "mkfwec", "sa;xlz," };
                string   LastName = Agent;
                string   mess     = "";
                Random   rnd      = new Random();
                for (int i = 0; i < randStrs.Length; i++)
                {
                    if (i == 7)
                    {
                        mess += LastName;
                    }
                    else
                    {
                        mess += randStrs[rnd.Next(randStrs.Length)];
                    }
                    mess += ":";
                }
                LFSR   messProtection = new LFSR();
                string key            = messProtection.GenerateKey();
                string enctyptedMess  = messProtection.Encrypt(mess);

                /*
                 * messProtection.EnterKey(key);
                 * string dectyptedMess = messProtection.Decrypt(enctyptedMess);
                 */
                new Tcp_S_R.Tcp_S_R(ip).SendMessage(enctyptedMess);
                new Tcp_S_R.Tcp_S_R(ip).SendMessage(enctyptedMess.Length.ToString());
                new Tcp_S_R.Tcp_S_R(ip).SendMessage(key);
                new Tcp_S_R.Tcp_S_R(ip).SendMessage(key.Length.ToString());
            };
        }
Beispiel #51
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);
            mRightDrawer  = FindViewById <ListView>(Resource.Id.right_drawer);

            mLeftDrawer.Tag  = 0;
            mRightDrawer.Tag = 1;

            SetSupportActionBar(mToolbar);

            mLeftDataSet = new List <string>();
            mLeftDataSet.Add("    PARTEA PRACTICA");
            mLeftDataSet.Add("Proprietatile unui grup");
            mLeftDataSet.Add("Prop. prod. 2 grupuri");
            mLeftDataSet.Add("Izotopii grupului");
            mLeftDataSet.Add("Compunerea substitutiilor");
            mLeftDataSet.Add("Laboratorul 4");
            mLeftAdapter        = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, mLeftDataSet);
            mLeftDrawer.Adapter = mLeftAdapter;

            mRightDataSet = new List <string>();
            mRightDataSet.Add("      PARTEA TEORETICA");
            mRightDataSet.Add("Cap I");
            mRightDataSet.Add("Cap II");
            mRightDataSet.Add("Lucrari laborator ex.");
            mRightAdapter        = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, mRightDataSet);
            mRightDrawer.Adapter = mRightAdapter;

            mDrawerToggle = new MenuActionManager(
                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();

            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);
            }


            mLeftDrawer.ItemClick  += MLeftDrawer_ItemClick;
            mRightDrawer.ItemClick += MRightDrawer_ItemClick;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            var vacationViewModel   = ((AndroidApp)Application).VacationViewModel;
            var localizationService = ((AndroidApp)Application).LocalizationService;

            vacationViewModel.PropertyChanged += ViewModelOnPropertyChanged;
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Delail);

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


            Button saveButton = FindViewById <Button>(Resource.Id.saveButton);
            Button startDate  = FindViewById <Button>(Resource.Id.startDate);
            Button endDate    = FindViewById <Button>(Resource.Id.endDate);

            string vacId = Intent.GetStringExtra("Vacation");

            if (vacId == null)
            {
                _vacation                  = new Vacation();
                _vacation.Id               = new Guid();
                _vacation.Created          = DateTime.Now;
                _vacation.CreatedBy        = "Name";
                _vacation.Start            = _vacation.Created;
                _vacation.End              = _vacation.Created.AddDays(1);
                _vacation.VacationTypeId   = 1;
                _vacation.VacationStatusId = 3;
            }
            else
            {
                _vacation = vacationViewModel.FindVacation(vacId);
            }

            startDate.Text = _vacation.Start.ToString("d MMM yyyy");
            endDate.Text   = _vacation.End.ToString("d MMM yyyy");

            RadioButton approved = FindViewById <RadioButton>(Resource.Id.approved);

            approved.Text = localizationService.Localize("Open");
            RadioButton closed = FindViewById <RadioButton>(Resource.Id.closed);

            closed.Text = localizationService.Localize("Close");
            if (_vacation.VacationStatusId == 3)
            {
                approved.Checked = true;
            }
            else
            {
                closed.Checked = true;
            }
            approved.Click += (sender, e) =>
            {
                if (((RadioButton)sender).Id == Resource.Id.approved)
                {
                    _vacation.VacationStatusId = 3;
                }
                else
                {
                    _vacation.VacationStatusId = 5;
                }
            };
            closed.Click += (sender, e) =>
            {
                if (((RadioButton)sender).Id == Resource.Id.closed)
                {
                    _vacation.VacationStatusId = 5;
                }
                else
                {
                    _vacation.VacationStatusId = 3;
                }
            };


            startDate.Click += (sender, eventArgs) =>
            {
                DatePickerFragment frag = DatePickerFragment.NewInstance(delegate(DateTime time)
                {
                    _vacation.Start = time;
                    startDate.Text  = time.ToString("d MMM yyyy");
                });
                frag.Show(FragmentManager, DatePickerFragment.TAG);
            };

            endDate.Click += (sender, eventArgs) =>
            {
                DatePickerFragment frag = DatePickerFragment.NewInstance(delegate(DateTime time)
                {
                    _vacation.End = time;
                    endDate.Text  = time.ToString("d MMM yyyy");
                });
                frag.Show(FragmentManager, DatePickerFragment.TAG);
            };

            ViewPager viewPager;
            DetailFragmentStatePagerAdapter detailFragmentPagerAdapter;

            viewPager = FindViewById <ViewPager>(Resource.Id.viewPager);
            detailFragmentPagerAdapter = new DetailFragmentStatePagerAdapter(SupportFragmentManager);
            detailFragmentPagerAdapter.addFragmentView((arg1, arg2, arg3) =>
            {
                var view      = arg1.Inflate(Resource.Layout.ImageViewLayout, arg2, false);
                var imageView = view.FindViewById <ImageView>(Resource.Id.imageView);
                imageView.SetImageResource(Resource.Drawable.Icon_Request_Green);
                var vacationType  = view.FindViewById <TextView>(Resource.Id.vacationType);
                vacationType.Text = localizationService.Localize("Regular");
                return(view);
            });
            detailFragmentPagerAdapter.addFragmentView((arg1, arg2, arg3) =>
            {
                var view      = arg1.Inflate(Resource.Layout.ImageViewLayout, arg2, false);
                var imageView = view.FindViewById <ImageView>(Resource.Id.imageView);
                imageView.SetImageResource(Resource.Drawable.Icon_Request_Plum);
                var vacationType  = view.FindViewById <TextView>(Resource.Id.vacationType);
                vacationType.Text = localizationService.Localize("Sick");
                return(view);
            });
            detailFragmentPagerAdapter.addFragmentView((arg1, arg2, arg3) =>
            {
                var view      = arg1.Inflate(Resource.Layout.ImageViewLayout, arg2, false);
                var imageView = view.FindViewById <ImageView>(Resource.Id.imageView);
                imageView.SetImageResource(Resource.Drawable.Icon_Request_Gray);
                var vacationType  = view.FindViewById <TextView>(Resource.Id.vacationType);
                vacationType.Text = localizationService.Localize("Exceptional");
                return(view);
            });
            detailFragmentPagerAdapter.addFragmentView((arg1, arg2, arg3) =>
            {
                var view      = arg1.Inflate(Resource.Layout.ImageViewLayout, arg2, false);
                var imageView = view.FindViewById <ImageView>(Resource.Id.imageView);
                imageView.SetImageResource(Resource.Drawable.Icon_Request_Dark);
                var vacationType  = view.FindViewById <TextView>(Resource.Id.vacationType);
                vacationType.Text = localizationService.Localize("LeaveWithoutPay");
                return(view);
            });
            detailFragmentPagerAdapter.addFragmentView((arg1, arg2, arg3) =>
            {
                var view      = arg1.Inflate(Resource.Layout.ImageViewLayout, arg2, false);
                var imageView = view.FindViewById <ImageView>(Resource.Id.imageView);
                imageView.SetImageResource(Resource.Drawable.Icon_Request_Blue);
                var vacationType  = view.FindViewById <TextView>(Resource.Id.vacationType);
                vacationType.Text = localizationService.Localize("Overtime");
                return(view);
            });

            viewPager.Adapter = detailFragmentPagerAdapter;
            viewPager.SetCurrentItem(_vacation.VacationTypeId - 1, false);

            saveButton.Click += async(sender, a) =>
            {
                if (vacId == null)
                {
                    _vacation.VacationTypeId = viewPager.CurrentItem + 1;
                    await vacationViewModel.AddVacation(_vacation);
                }
                _vacation.VacationTypeId = viewPager.CurrentItem + 1;
                _vacation.Created        = DateTime.Now;
                Intent intent = new Intent(this, typeof(MainActivity));
                intent.PutExtra("Filter", "ALL");
                StartActivity(intent);
            };

            vacationViewModel.PropertyChanged -= ViewModelOnPropertyChanged;
        }
Beispiel #53
0
 private void SetupToolbar()
 {
     toolbarProfile = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbarProfile);
     SetSupportActionBar(toolbarProfile);
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.User_Profile);

            toolb = FindViewById <Toolbar>(Resource.Id.my_toolbar);

            SetSupportActionBar(toolb);
            spinnerView = FindViewById <Spinner>(Resource.Id.spinner1);

            spinnerView.Adapter = new ArrayAdapter
                                      (this, Android.Resource.Layout.SimpleListItem1, myCategory);

            valueFromLoginUser = Intent.GetStringExtra("userName");
            myUser             = FindViewById <TextView>(Resource.Id.welcomeuser);
            myUser.Text        = "Welcome," + valueFromLoginUser;
            // this.Title = "welcome admin";
            spinnerView.ItemSelected += MyItemSelectedMethod;

            alert = new Android.App.AlertDialog.Builder(this);

            //edit buttons
            myDB = new DBHelperClass(this);
            //alert = new Android.App.AlertDialog.Builder(this);
            mypid          = FindViewById <TextView>(Resource.Id.user_id);
            _username      = FindViewById <EditText>(Resource.Id.userNamee);
            _email         = FindViewById <EditText>(Resource.Id.userEmail);
            _contact       = FindViewById <EditText>(Resource.Id.userContact);
            _passwd        = FindViewById <EditText>(Resource.Id.userpswd);
            _confirmpasswd = FindViewById <EditText>(Resource.Id.userConfirmPswd);
            SubmitBtn      = FindViewById <Button>(Resource.Id.usersubmit);

            //disable email
            _email.Enabled = false;
            mypid.Enabled  = false;
            p_cursor       = myDB.SelectProfile(valueFromLoginUser);
            p_cursor.MoveToFirst();
            mypid.Text     = p_cursor.GetString(p_cursor.GetColumnIndexOrThrow("id"));
            _username.Text = p_cursor.GetString(p_cursor.GetColumnIndexOrThrow("names"));
            _email.Text    = valueFromLoginUser;
            _contact.Text  = p_cursor.GetString(p_cursor.GetColumnIndexOrThrow("contact"));
            _passwd.Text   = p_cursor.GetString(p_cursor.GetColumnIndexOrThrow("password"));

            _confirmpasswd.TextChanged += check_password;

            SubmitBtn.Click += delegate
            {
                string value  = _username.Text;
                string value1 = _contact.Text;
                string value2 = _passwd.Text;
                string value3 = _confirmpasswd.Text;



                System.Console.WriteLine("Text Value ---- > " + value);
                //check for empty value
                if (value.Trim().Equals("") || value.Length < 0 || value1.Trim().Equals("") || value1.Length < 0 ||
                    value2.Trim().Equals("") || value2.Length < 0 || value3.Trim().Equals("") || value3.Length < 0)
                {
                    alert.SetTitle("Error");
                    alert.SetMessage("Please Enter Valid Data");
                    alert.SetPositiveButton("OK", alertOKButton);
                    alert.SetNegativeButton("Cancel", alertOKButton);
                    Dialog myDialog = alert.Create();
                    myDialog.Show();
                }
                else
                {
                    myDB.SelectMyProfileToUpdate(mypid.Text, _username.Text, _contact.Text, _passwd.Text);
                }
            };
        }
Beispiel #55
0
        void UpdateToolbar()
        {
            if (_disposed)
            {
                return;
            }

            Context  context             = Context;
            var      activity            = (FormsAppCompatActivity)context;
            AToolbar bar                 = _toolbar;
            ActionBarDrawerToggle toggle = _drawerToggle;

            if (bar == null)
            {
                return;
            }

            bool isNavigated = ((INavigationPageController)Element).StackDepth > 1;

            bar.NavigationIcon = null;

            if (isNavigated)
            {
                if (toggle != null)
                {
                    toggle.DrawerIndicatorEnabled = false;
                    toggle.SyncState();
                }

                if (NavigationPage.GetHasBackButton(Element.CurrentPage))
                {
                    var icon = new DrawerArrowDrawable(activity.SupportActionBar.ThemedContext);
                    icon.Progress      = 1;
                    bar.NavigationIcon = icon;
                }
            }
            else
            {
                if (toggle != null)
                {
                    toggle.DrawerIndicatorEnabled = true;
                    toggle.SyncState();
                }
            }

            Color tintColor = Element.BarBackgroundColor;

            if (Forms.IsLollipopOrNewer)
            {
                if (tintColor.IsDefault)
                {
                    bar.BackgroundTintMode = null;
                }
                else
                {
                    bar.BackgroundTintMode = PorterDuff.Mode.Src;
                    bar.BackgroundTintList = ColorStateList.ValueOf(tintColor.ToAndroid());
                }
            }
            else
            {
                if (tintColor.IsDefault && _backgroundDrawable != null)
                {
                    bar.SetBackground(_backgroundDrawable);
                }
                else if (!tintColor.IsDefault)
                {
                    if (_backgroundDrawable == null)
                    {
                        _backgroundDrawable = bar.Background;
                    }
                    bar.SetBackgroundColor(tintColor.ToAndroid());
                }
            }

            Color textColor = Element.BarTextColor;

            if (!textColor.IsDefault)
            {
                bar.SetTitleTextColor(textColor.ToAndroid().ToArgb());
            }

            bar.Title = Element.CurrentPage.Title ?? "";
        }
Beispiel #56
0
        public async Task UpdaterAsync(CancellationToken ct, int id)
        {
            SetContentView(Resource.Layout.activity_main);
            var trans = SupportFragmentManager.BeginTransaction();

            _Loading_Fragment     = new Loading_Fragment();
            _droplet_Mainfragment = new Droplet_mainfragment();
            _Def_Fragment         = new Def_Fragment();
            _Def_First_Fragment   = new Def_First_Fragment();

            trans.Add(Resource.Id.DropletFragment, _droplet_Mainfragment, "Fragment");
            trans.Add(Resource.Id.DropletFragment, _Loading_Fragment, "Fragment");
            trans.Add(Resource.Id.DropletFragment, _Def_Fragment, "Fragment");
            trans.Add(Resource.Id.DropletFragment, _Def_First_Fragment, "Fragment");

            trans.Show(_Loading_Fragment);
            trans.Hide(_droplet_Mainfragment);
            trans.Hide(_Def_Fragment);
            trans.Hide(_Def_First_Fragment);
            trans.Commit();

            currentDropId = id;
            ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this);
            var api_key = prefs.GetString("api_key", null);


            client = new DigitalOceanClient(api_key);

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

            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();

            SwipeRefreshLayout swipe = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);

            swipe.Refresh += async(o, e) =>
            {
                trans = SupportFragmentManager.BeginTransaction();
                trans.Show(_Loading_Fragment);
                trans.Hide(_droplet_Mainfragment);
                trans.Commit();

                await UpdateNavMenu();

                if (id > 0)
                {
                    await UpdateInfo(currentDropId);
                }

                trans = SupportFragmentManager.BeginTransaction();
                trans.Hide(_Loading_Fragment);
                trans.Show(_droplet_Mainfragment);
                trans.Commit();
                swipe.Refreshing = false;
            };

            await UpdateNavMenu();

            trans = SupportFragmentManager.BeginTransaction();

            if (id == -1)
            {
                trans.Show(_Def_Fragment);
            }
            else if (id == -2)
            {
                trans.Show(_Def_First_Fragment);
            }

            trans.Hide(_Loading_Fragment);
            trans.Hide(_droplet_Mainfragment);
            trans.Commit();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Id = Intent.GetIntExtra("id", 0);
            questionPresenter = new QuestionPresenter(this);
            handler           = new Handler();

            StatusBarCompat.SetOrdinaryToolBar(this);
            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);
            toolbar.SetOnMenuItemClickListener(this);

            swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary);
            swipeRefreshLayout.SetOnRefreshListener(this);

            txtTitle     = FindViewById <TextView>(Resource.Id.txtTitle);
            imgIconName  = FindViewById <ImageView>(Resource.Id.imgIconName);
            txtUserName  = FindViewById <TextView>(Resource.Id.txtUserName);
            txtScore     = FindViewById <TextView>(Resource.Id.txtScore);
            txtDateAdded = FindViewById <TextView>(Resource.Id.txtDateAdded);
            txtGold      = FindViewById <TextView>(Resource.Id.txtGold);
            txtDealFlag  = FindViewById <TextView>(Resource.Id.txtDealFlag);
            txtTag       = FindViewById <TextView>(Resource.Id.txtTag);
            this.txtDealFlag.Selected = true;
            txtBody = FindViewById <WebView>(Resource.Id.txtBody);
            txtBody.Settings.JavaScriptEnabled        = true;
            txtBody.Settings.DomStorageEnabled        = true;
            txtBody.Settings.LoadsImagesAutomatically = true;
            txtBody.Settings.DefaultTextEncodingName  = "utf-8";
            txtBody.SetWebViewClient(BodyWebViewClient.With(this));
            txtBody.ScrollBarStyle = ScrollbarStyles.InsideOverlay;
            txtBody.Settings.SetSupportZoom(false);
            txtBody.Settings.BuiltInZoomControls = false;
            txtBody.Settings.CacheMode           = CacheModes.CacheElseNetwork;
            txtBody.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn);
            var jsInterface = new WebViewJSInterface(this);

            txtBody.AddJavascriptInterface(jsInterface, "openlistner");
            jsInterface.CallFromPageReceived += delegate(object sender, WebViewJSInterface.CallFromPageReceivedEventArgs e)
            {
                PhotoActivity.Start(this, e.Result.Split(','), e.Index);
            };
            txtDigg          = FindViewById <TextView>(Resource.Id.txtDigg);
            txtRead          = FindViewById <TextView>(Resource.Id.txtRead);
            txtBookmark      = FindViewById <TextView>(Resource.Id.txtBookmark);
            txtComments      = FindViewById <TextView>(Resource.Id.txtComments);
            txtComments.Text = Resources.GetString(Resource.String.answer);

            (txtComments.Parent as FrameLayout).Click += delegate
            {
                if (question != null && question.Qid > 0)
                {
                    QuestionAnswersActivity.Start(this, question.Qid);
                }
            };
            (txtBookmark.Parent as FrameLayout).Click += delegate
            {
                if (question != null && question.Qid > 0)
                {
                    var linkurl = "https://q.cnblogs.com/q/" + question.Qid + "/";
                    var title   = question.Title + "_²©ÎÊ_²©¿ÍÔ°";
                    BookmarkAddActivity.Start(this, linkurl, title, true);
                }
            };
            swipeRefreshLayout.Post(async() =>
            {
                await questionPresenter.GetClientQuestion(Id);
            });
            sharesWidget = new UMengSharesWidget(this);
        }
Beispiel #58
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                _disposed = true;

                var activity = (FormsAppCompatActivity)Context;

                // API only exists on newer android YAY
                if ((int)Build.VERSION.SdkInt >= 17)
                {
                    if (!activity.IsDestroyed)
                    {
                        FragmentManager     fm    = FragmentManager;
                        FragmentTransaction trans = fm.BeginTransaction();
                        foreach (Fragment fragment in _fragmentStack)
                        {
                            trans.Remove(fragment);
                        }
                        trans.CommitAllowingStateLoss();
                        fm.ExecutePendingTransactions();
                    }
                }

                if (Element != null)
                {
                    foreach (Element element in PageController.InternalChildren)
                    {
                        var child = element as VisualElement;
                        if (child == null)
                        {
                            continue;
                        }

                        IVisualElementRenderer renderer = Android.Platform.GetRenderer(child);
                        renderer?.Dispose();
                    }

                    var navController = (INavigationPageController)Element;

                    navController.PushRequested             -= OnPushed;
                    navController.PopRequested              -= OnPopped;
                    navController.PopToRootRequested        -= OnPoppedToRoot;
                    navController.InsertPageBeforeRequested -= OnInsertPageBeforeRequested;
                    navController.RemovePageRequested       -= OnRemovePageRequested;
                }

                if (_toolbarTracker != null)
                {
                    _toolbarTracker.CollectionChanged -= ToolbarTrackerOnCollectionChanged;
                    _toolbarTracker.Target             = null;
                    _toolbarTracker = null;
                }

                if (_toolbar != null)
                {
                    _toolbar.Click -= BarOnNavigationClick;
                    _toolbar.Dispose();
                    _toolbar = null;
                }

                if (_drawerLayout != null && _drawerListener != null)
                {
                    _drawerLayout.RemoveDrawerListener(_drawerListener);
                }

                _drawerToggle = null;

                Current = null;

                Device.Info.PropertyChanged -= DeviceInfoPropertyChanged;
            }

            base.Dispose(disposing);
        }
Beispiel #59
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.ActivityMain);

            bool   mMessage    = Intent.GetBooleanExtra("ismessage", false);
            string mRef        = Intent.GetStringExtra("ref");
            string mRefListMod = Intent.GetStringExtra("reflistmod");
            string mName       = Intent.GetStringExtra("name");

            //Переменные объектов активити
            mToolbar       = FindViewById <SupportToolbar>(Resource.Id.Toolbar);
            mDrawerLayout  = FindViewById <DrawerLayout>(Resource.Id.DrawerLayout);
            mLeftDrawer    = FindViewById <ListView>(Resource.Id.mainLeftDrawer);
            mRightDrawer   = FindViewById <ListView>(Resource.Id.mainRightDrawer);
            mTextViewLogin = FindViewById <TextView>(Resource.Id.mainTextViewLogin);
            mButtonLogout  = FindViewById <Button>(Resource.Id.btnLogout);

            mSwipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.mainSwipeLayout);
            mSwipeRefreshLayout.SetColorSchemeResources(Android.Resource.Color.HoloBlueBright, Android.Resource.Color.HoloBlueDark, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloRedLight);
            mSwipeRefreshLayout.Refresh += MSwipeRefreshLayout_Refresh;

            mTextViewLogin.Text = AppVariable.Variable.Login;

            mButtonLogout.Click += MButtonLogout_Click;

            //Классы фрагментов
            Fragment            = new FragmentMain();
            messagesFragment    = new FragmentMessages();
            tasksFragment       = new FragmentElements();
            directoriesFragment = new FragmentElements();
            docsFragment        = new FragmentElements();
            ReportsFragment     = new FragmentElements()
            {
                isReport = true
            };
            DataProcessorsFragment = new FragmentElements()
            {
                isReport = true
            };

            mStackFragments = new Stack <SupportFragment>();

            mLeftDrawer.Tag  = 0;
            mRightDrawer.Tag = 1;

            mToolbar.Title = mMessage ? "Сообщения" : "Главная страница";
            SetSupportActionBar(mToolbar);

            UpdateLeftDrawer();

            mLeftDrawer.ItemClick += MenuListView_ItemClick;

            mRightDataSet = new List <string>();
            mRightDataSet.Add("Справка");
            mRightDataSet.Add("О программе");

            if (AppVariable.Variable.DebugMode)
            {
                mRightDataSet.Add("Форма для тестирования");
            }

            mRightAdapter           = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, mRightDataSet);
            mRightDrawer.Adapter    = mRightAdapter;
            mRightDrawer.ItemClick += MRightDrawer_ItemClick;

            mDrawerToggle = new UIActionBarDrawerToggle(this, mDrawerLayout);

            mDrawerLayout.AddDrawerListener(mDrawerToggle);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            mDrawerToggle.SyncState();

            Android.Support.V4.App.FragmentTransaction tx = SupportFragmentManager.BeginTransaction();

            tx.Add(Resource.Id.FragmentLayout, Fragment);
            tx.Add(Resource.Id.FragmentLayout, messagesFragment);
            tx.Add(Resource.Id.FragmentLayout, tasksFragment);
            tx.Add(Resource.Id.FragmentLayout, directoriesFragment);
            tx.Add(Resource.Id.FragmentLayout, docsFragment);
            tx.Add(Resource.Id.FragmentLayout, ReportsFragment);
            tx.Add(Resource.Id.FragmentLayout, DataProcessorsFragment);
            tx.Hide(mMessage ? (SupportFragment)Fragment : (SupportFragment)messagesFragment);
            tx.Hide(tasksFragment);
            tx.Hide(directoriesFragment);
            tx.Hide(docsFragment);
            tx.Hide(ReportsFragment);
            tx.Hide(DataProcessorsFragment);

            mCurrentFragment = mMessage ? (SupportFragment)messagesFragment : (SupportFragment)Fragment;
            tx.Commit();

            if (mRef != null && mRefListMod != null)
            {
                Intent intent = new Intent(this, typeof(ActivityDataView));
                intent.PutExtra("reflistmod", mRefListMod);
                intent.PutExtra("ref", mRef);
                intent.PutExtra("name", mName);
                StartActivity(intent);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            try
            {
                if (savedInstanceState != null)
                {
                    _selectedItemIndex = savedInstanceState.GetInt("selectedItemIndex");
                    _problemID         = savedInstanceState.GetInt("problemID");
                    _problemStepID     = savedInstanceState.GetInt("problemStepID");
                    _stepText          = savedInstanceState.GetString("stepText");
                }
                else
                {
                    _problemStepID = Intent.GetIntExtra("problemStepID", -1);
                    _problemID     = Intent.GetIntExtra("problemID", -1);
                    _stepText      = Intent.GetStringExtra("problemStepText");
                }
                SetContentView(Resource.Layout.ProblemSolvingIdeasLayout);
                Log.Info(TAG, "OnCreate: Set content view successfully, problemID - " + _problemID.ToString() + ", problemStepID - " + _problemStepID.ToString() + ", problemStepText - " + _stepText);

                _toolbar = ToolbarHelper.SetupToolbar(this, Resource.Id.problemSolvingIdeasToolbar, Resource.String.ProblemSolvingIdeasToolbarTitle, Color.White);

                GetFieldComponents();

                CheckMicPermission();

                _imageLoader = ImageLoader.Instance;

                _imageLoader.LoadImage
                (
                    "drawable://" + Resource.Drawable.problemsteps,
                    new ImageLoadingListener
                    (
                        loadingComplete: (imageUri, view, loadedImage) =>
                {
                    var args = new LoadingCompleteEventArgs(imageUri, view, loadedImage);
                    ImageLoader_LoadingComplete(null, args);
                }
                    )
                );

                SetupCallbacks();

                if (_problemStepID != -1)
                {
                    _problemStepText.Text = _stepText.Trim();
                }

                if (IsProblemSolved())
                {
                    InflateResolved();
                }

                UpdateAdapter();
            }
            catch (Exception e)
            {
                Log.Error(TAG, "OnCreate: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorProblemSolvingIdeasActivityCreateView), "ProblemSolvingIdeasActivity.OnCreate");
                }
            }
        }