public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);
            view = inflater.Inflate(Resource.Layout.subCategoriesFragment, null);
            expListView = view.FindViewById<ExpandableListView>(Resource.Id.myExpandableListview);
            position = Arguments.GetInt("position");
            int id = DataRepository.TopCategories[position].Id;

            expListView.SetAdapter(new MyExpandableListAdapter(Activity,id));
            return view;
        }
Пример #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(Resource.Layout.MainTaskListFragment, container, false);

            View header = Activity.LayoutInflater.Inflate(Resource.Layout.MainTaskListHeader, null);
            mainList = view.FindViewById<ExpandableListView>(Resource.Id.mainActivitiesList);
            mainList.AddHeaderView(header, null, false);
            mainList.SetAdapter(new ScenarioListAdapter(Activity,
                AppData.Session.Categories.ToArray()));
            mainList.ChildClick += mainList_ChildClick;

            // When the pull to refresh is activated, pull new data from the server and refresh the list with the new data
            refresher = view.FindViewById<SwipeRefreshLayout>(Resource.Id.refresher);
            refresher.Refresh += async delegate
            {
                if (!AndroidUtils.IsConnected())
                {
                    AndroidUtils.OfflineAlert(Activity);
                    refresher.Refreshing = false;
                    return;
                }

                await ServerData.FetchCategories();
                refresher.Refreshing = false;

                ((ScenarioListAdapter) mainList.ExpandableListAdapter).Categories = AppData.Session.Categories.ToArray();
                Activity.RunOnUiThread(
                    () => ((ScenarioListAdapter) mainList.ExpandableListAdapter).NotifyDataSetChanged());
            };

            // If there's only one category, it makes sense to expand it by default
            if (AppData.Session.Categories.Count == 1)
            {
                mainList.ExpandGroup(0, true);
            }

            practiceBtn = header.FindViewById<Button>(Resource.Id.practiceAreaBtn);
            practiceBtn.Click += practiceButton_Click;
            return view;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            SetContentView (Resource.Layout.Checklist);

            InitializeActionBar (SupportActionBar);

            ActionBarTitle.Text = "Totemisatie checklist";

            sharedPrefs = GetSharedPreferences("checklist", FileCreationMode.Private);
            var ser = sharedPrefs.GetString("states", "empty");
            List<List<bool>> states;
            if(!ser.Equals("empty"))
                states = JsonSerializer.DeserializeFromString<List<List<bool>>>(ser);
            else
                states = null;

            expand = FindViewById<ExpandableListView>(Resource.Id.expand);

            InitializeExpandableListView ();
            expandAdapater = new ExpendListAdapter(this, dictGroup, states);
            expand.SetAdapter(expandAdapater);
        }
Пример #4
0
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			View v = inflater.Inflate (Resource.Layout.ChooseCoffee, null);

			favChecked = false;

			v.FindViewById<ImageView> (Resource.Id.chosen_logo).SetBackgroundResource (TempStorage.ChosenLogo);
			coffeeLv = v.FindViewById<ExpandableListView> (Android.Resource.Id.List);
			payButton = v.FindViewById<Button> (Resource.Id.btnPay);

			payButton.Click += delegate {
				ProcessPayments();
			};

			coffeeAdapter = new ExpandableListAdapter (this.Activity, CoffeeData);

			coffeeLv.SetAdapter(coffeeAdapter);
			coffeeLv.SetOnChildClickListener (this);

			//don't forget!
			price = "4.50";

			return v;
		}
Пример #5
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);
			mDrawerLayout = FindViewById<DrawerLayout> (Resource.Id.myDrawer);
			progressBar = FindViewById<ProgressBar> (Resource.Id.loadingProgressBar);
			leftDrawerLinearLayoutId = (LinearLayout)FindViewById (Resource.Id.left_drawer);
			azureAdap = new ArrayAdapter<string> (this, Android.Resource.Layout.SimpleListItem1);
		
			//Start Expandable
			mListExView = FindViewById<ExpandableListView> (Resource.Id.expandListView);

			tempListView = FindViewById<ListView> (Resource.Id.lstViewTemp);
			//setMasterParent ();
			//setChild ();

			adapter = new myListViewAdap (NewParentItems);
			adapter.setInflater ((LayoutInflater)GetSystemService (Context.LayoutInflaterService), this);
			mListExView.SetAdapter (adapter);
			//End Expandable

			mDrawerToggle = new ActionBarDrawerToggle (this, mDrawerLayout, Resource.Drawable.ic_navigation_drawer, Resource.String.open_drawer, Resource.String.close_drawer);


			mDrawerLayout.SetDrawerListener (mDrawerToggle);
			ActionBar.SetDisplayHomeAsUpEnabled (true);
			ActionBar.SetHomeButtonEnabled (true);
			ActionBar.SetDisplayShowTitleEnabled (true);
           
			//Declaration of Image button and other buttons
			ImageButton imgBtnPlus = (ImageButton)FindViewById (Resource.Id.buttonNewPanel);  
			Button btnCancel = (Button)FindViewById (Resource.Id.CancelPanel);
			Button btnSavePanel = (Button)FindViewById (Resource.Id.SavePanel);
			TableRow tRowSaveCancel = (TableRow)FindViewById (Resource.Id.tRowSaveCancel);    //Row of save Button
			EditText txtidofNewPanel = (EditText)(FindViewById (Resource.Id.txtOfNewPanel));
			spinMasterPanel = FindViewById<Spinner> (Resource.Id.spinnerExistingMasterPanel);


			//Code to add default value in the spinner
			First = new List<string> ();
			First.Add ("Select Parent Panel");
			spinnerArrayAdapter = new ArrayAdapter<string> (this, Android.Resource.Layout.SimpleSpinnerItem, First);
			spinnerArrayAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
			spinMasterPanel.Adapter = spinnerArrayAdapter;
			//End


			appendSpinner (spinMasterPanel, parentItems, spinnerArrayAdapter, First); //Calling spinner to append more parent.



			imgBtnPlus.Click += (object sender, EventArgs e) => {
				if (SetTag == 1) {
					imgBtnPlus.SetImageResource (Resource.Drawable.Multsign);
					txtidofNewPanel.Visibility = ViewStates.Visible;
					tRowSaveCancel.Visibility = ViewStates.Visible;
					spinMasterPanel.Visibility = ViewStates.Visible;
					SetTag = 0;

				} else if (SetTag == 0) {
					imgBtnPlus.SetImageResource (Resource.Drawable.plussign);

					txtidofNewPanel.Visibility = ViewStates.Gone;
					tRowSaveCancel.Visibility = ViewStates.Gone;
					spinMasterPanel.Visibility = ViewStates.Gone;
					SetTag = 1;
				}
			};

			btnCancel.Click += delegate {

				imgBtnPlus.SetImageResource (Resource.Drawable.plussign);
				tRowSaveCancel.Visibility = ViewStates.Gone;
				txtidofNewPanel.Visibility = ViewStates.Gone;
				spinMasterPanel.Visibility = ViewStates.Gone;

			};


			#region SavePanelCLickActivity

			btnSavePanel.Click += (object sender, EventArgs e) => {
				
				imgBtnPlus.SetImageResource (Resource.Drawable.plussign);
				tRowSaveCancel.Visibility = ViewStates.Gone;
				txtidofNewPanel.Visibility = ViewStates.Gone;
				spinMasterPanel.Visibility = ViewStates.Gone;
				string newPanelText = txtidofNewPanel.Text.Trim ();

				if (newPanelText != "") {
					string spinnerItem = spinMasterPanel.SelectedItem.ToString ();   // Selected item in the spinner

					if (spinnerItem != "Select Parent Panel") {
						child = new List<string> ();
						child.Add (newPanelText);

						if (NewParentItems.ContainsKey (spinnerItem)) {
							NewParentItems [spinnerItem].AddRange (child);
							dictPanelItemsForMail [spinnerItem].AddRange (child);
							
						} else {
                            
							NewParentItems [spinnerItem] = child;
							dictPanelItemsForMail [spinnerItem] = child;

						}


					} else {
						
						child = new List<string> ();
						NewParentItems [newPanelText] = child;
						dictPanelItemsForMail [newPanelText] = child;
						appendSpinner (spinMasterPanel, newListForSpin, spinnerArrayAdapter, First);
					}

					child = new List<string> ();
					childItems.Add (child);
					myListViewAdap adapterNew = new myListViewAdap (NewParentItems);
					adapterNew.setInflater ((LayoutInflater)GetSystemService (Context.LayoutInflaterService), this);
					mListExView.SetAdapter (adapter);									//Inflate Expandable Adapter
							
					txtidofNewPanel.Text = "";
					InputMethodManager inputmanager = (InputMethodManager)GetSystemService (Context.InputMethodService);
					inputmanager.HideSoftInputFromWindow (txtidofNewPanel.WindowToken, HideSoftInputFlags.None);		// To hide the keyboard

					spinMasterPanel.SetSelection (0, true);
				}
			};

			#endregion SavePanelActivityEnd


			// Code to hide keyboard on spinner touch
			spinMasterPanel.Touch += (object sender, View.TouchEventArgs e) => {

				InputMethodManager inputmanager = (InputMethodManager)GetSystemService (Context.InputMethodService);
				inputmanager.HideSoftInputFromWindow (spinMasterPanel.WindowToken, HideSoftInputFlags.None);	
				spinMasterPanel.PerformClick ();
			};


			// code to handle ChildClick Event
			mListExView.ChildClick += mListExView_ChildClick;

			connectMaster (1);
	
		}
            public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
            {
                try
                {
                    View view;

                    Int32 lastExpandedPosition = -1;

                    CreateExpandableListData ();

                    if (position == 0) //Current Booking tab
                    {
                        view = LayoutInflater.From (container.Context).Inflate (Resource.Layout.CurrentBookingLayout, container, false);
                        container.AddView (view);

                        flCurrentBookings = container.FindViewById<FrameLayout> (Resource.Id.flCurrentBookings);
                        flNoCurrentBookings = container.FindViewById<FrameLayout> (Resource.Id.flNoCurrentBookings);
                        elvCurrentBookings = container.FindViewById<ExpandableListView> (Resource.Id.elvCurrentBookings);

                        if (dictGroupCurr.Count > 0)
                        {
                            flNoCurrentBookings.Visibility = ViewStates.Gone;
                            flCurrentBookings.Visibility = ViewStates.Visible;

                            elvCurrentBookings.SetAdapter (new ExpandViewBookingAdapter (parent, dictGroupCurr));

                            elvCurrentBookings.ChildClick += delegate(object sender, ExpandableListView.ChildClickEventArgs e) {
                                string itmGroup = lstKeysCurr [e.GroupPosition];
                                WorkshopBooking itmChild = dictGroupCurr [itmGroup];
                            };

                            elvCurrentBookings.GroupExpand += delegate(object sender, ExpandableListView.GroupExpandEventArgs e) {
                                if (lastExpandedPosition != -1 && e.GroupPosition != lastExpandedPosition) {
                                    elvCurrentBookings.CollapseGroup (lastExpandedPosition);
                                }

                                lastExpandedPosition = e.GroupPosition;
                            };
                        }
                        else
                        {
                            flNoCurrentBookings.Visibility = ViewStates.Visible;
                            flCurrentBookings.Visibility = ViewStates.Gone;
                        }
                    }
                    else //Past Bookings
                    {
                        view = LayoutInflater.From (container.Context).Inflate (Resource.Layout.PastBookings, container, false);
                        container.AddView (view);

                        flPastBookings = container.FindViewById<FrameLayout> (Resource.Id.flPastBookings);
                        flNoPastBookings = container.FindViewById<FrameLayout> (Resource.Id.flNoPastBookings);
                        elvPastBookings = container.FindViewById<ExpandableListView> (Resource.Id.elvPastBookings);

                        if (dictGroupPast.Count > 0)
                        {
                            flNoPastBookings.Visibility = ViewStates.Gone;
                            flPastBookings.Visibility = ViewStates.Visible;
                            elvPastBookings.SetAdapter (new ExpandViewBookingAdapter (parent, dictGroupPast));

                            elvPastBookings.ChildClick += delegate(object sender, ExpandableListView.ChildClickEventArgs e) {
                                string itmGroup = lstKeysPast [e.GroupPosition];
                                WorkshopBooking itmChild = dictGroupPast [itmGroup];
                            };

                            elvPastBookings.GroupExpand += delegate(object sender, ExpandableListView.GroupExpandEventArgs e) {
                                if (lastExpandedPosition != -1 && e.GroupPosition != lastExpandedPosition) {
                                    elvPastBookings.CollapseGroup (lastExpandedPosition);
                                }

                                lastExpandedPosition = e.GroupPosition;
                            };
                        }
                        else
                        {
                            flNoPastBookings.Visibility = ViewStates.Visible;
                            flPastBookings.Visibility = ViewStates.Gone;
                        }
                    }

                    return view;
                }
                catch (Exception e)
                {
                    ErrorHandling.LogError (e, container.Context);
                    return -1;
                }
            }
		protected async override void OnCreate (Bundle bundle)
		{
			try
			{
				base.OnCreate (bundle);
				SetContentView (Resource.Layout.MakeBookingSesh);

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

				if (ProgressDialogLogin == null)
				{
					ProgressDialogLogin = ProgressDialog.Show(this, "", "Loading...");
				}

				string WorkshopSetId = Intent.GetStringExtra("WorkshopSetId");
				_WorkshopSessions = await RESTClass.GetWorkshopSessions("?workshopSetId=" + WorkshopSetId);

				CreateExpandableListData();

				elvExListBox = FindViewById<ExpandableListView> (Resource.Id.elvExListBox);
				elvExListBox.SetAdapter (new ExpandListSessionAdapter (this, dictGroup));

				if (ProgressDialogLogin != null)
				{
					ProgressDialogLogin.Dismiss();
					ProgressDialogLogin = null;
				}

				elvExListBox.ChildClick += delegate(object sender, ExpandableListView.ChildClickEventArgs e) {
					string itmGroup = lstKeys [e.GroupPosition];
					WorkshopSessions itmChild = dictGroup [itmGroup];
				};

				elvExListBox.GroupExpand += delegate(object sender, ExpandableListView.GroupExpandEventArgs e) {
					if (lastExpandedPosition != -1 && e.GroupPosition != lastExpandedPosition)
					{
						elvExListBox.CollapseGroup(lastExpandedPosition);
					}

					lastExpandedPosition = e.GroupPosition;
				};

//				Button btnViewDetails = FindViewById<Button>(Resource.Id.btnViewDetails);
//				btnViewDetails.Click += delegate {
//					StartActivity(new Intent(this, typeof(MakeBookingListActivity)));
//				};
			}
			catch (Exception e) 
			{
				ErrorHandling.LogError (e, this);
			}
			finally 
			{
				if (ProgressDialogLogin != null)
				{
					ProgressDialogLogin.Dismiss();
					ProgressDialogLogin = null;
				}
			}
		}