public void OnGroupExpand(object sender, global::Android.Widget.ExpandableListView.GroupExpandEventArgs e) { if (e.GroupPosition != _previousGroup) { _navDrawerListview.CollapseGroup(_previousGroup); } _previousGroup = e.GroupPosition; }
void ClickEvents() { _expListView.ChildClick += delegate(object sender, ExpandableListView.ChildClickEventArgs e) { Toast.MakeText(this, SizeRepository.ListSize[e.GroupPosition].MakananDetails[e.ChildPosition].ToString(), ToastLength.Short).Show(); }; _expListView.GroupCollapse += delegate(object sender, ExpandableListView.GroupCollapseEventArgs e) { var i = e.GroupPosition; if (i == -1) { return; } Toast.MakeText(this, SizeRepository.ListSize[i].ToString(), ToastLength.Short).Show(); }; _expListView.GroupExpand += delegate(object sender, ExpandableListView.GroupExpandEventArgs e) { int previousGroup = -1; if (e.GroupPosition != previousGroup) { _expListView.CollapseGroup(previousGroup); } var i = e.GroupPosition; if (i == -1) { return; } Toast.MakeText(this, SizeRepository.ListSize[i].ToString(), ToastLength.Short).Show(); }; }
void FnClickEvents() { //Listening to child item selection expListView.ChildClick += delegate(object sender, ExpandableListView.ChildClickEventArgs e) { // Toast.MakeText(this, "child clicked", ToastLength.Short).Show(); StartActivity(typeof(PointListActivity)); }; //Listening to group expand //modified so that on selection of one group other opened group has been closed expListView.GroupExpand += delegate(object sender, ExpandableListView.GroupExpandEventArgs e) { if (e.GroupPosition != previousGroup) { expListView.CollapseGroup(previousGroup); } previousGroup = e.GroupPosition; }; //Listening to group collapse expListView.GroupCollapse += delegate(object sender, ExpandableListView.GroupCollapseEventArgs e) { Toast.MakeText(this, "group collapsed", ToastLength.Short).Show(); }; }
/// <summary> /// Called when the collapse state of a group has changed. /// If the group is an ArtistAlbum then check whether or not the parent Artist should be shown as expanded or collapsed /// </summary> /// <param name="parent"></param> /// <param name="groupPosition"></param> protected override void GroupCollapseStateChanged(ExpandableListView parent, int groupPosition) { if (Groups[groupPosition] is ArtistAlbum artistAlbum) { // Find the Artist associated with this ArtistAlbum int artistPosition = FindArtistPosition(groupPosition); // If the ArtistAlbum is now expanded then check if all the other ArtistAlbums are also expanded // If the ArtistAlbum is now collapsed then collapse the Artist if (parent.IsGroupExpanded(groupPosition) == true) { // Need to check all of the ArtistAlbum entries associated with the Artist. If they are all expanded then expand the Artist as well if (CheckAllArtistAlbums(artistPosition, (artistAlbumIndex) => parent.IsGroupExpanded(artistAlbumIndex)) == true) { // Add this to the record of which groups are expanded adapterModel.ExpandedGroups.Add(artistPosition); // Now expand the group parent.ExpandGroup(artistPosition); } } else { // If the parent is expanded then collapse it if (parent.IsGroupExpanded(artistPosition) == true) { adapterModel.ExpandedGroups.Remove(artistPosition); // Now collapse the group parent.CollapseGroup(artistPosition); } } } }
void FnClickEvents() { //Listening to child item selection string result = String.Empty; expListView.ChildClick += delegate(object sender, ExpandableListView.ChildClickEventArgs e) { ViewModel.PierLocation = listAdapter.GetChild(e.GroupPosition, e.ChildPosition).ToString(); ViewModel.ShowPierScanCommand.Execute(); }; //Listening to group expand //modified so that on selection of one group other opened group has been closed expListView.GroupExpand += delegate(object sender, ExpandableListView.GroupExpandEventArgs e) { if (e.GroupPosition != previousGroup) { expListView.CollapseGroup(previousGroup); } previousGroup = e.GroupPosition; }; //Listening to group collapse expListView.GroupCollapse += delegate(object sender, ExpandableListView.GroupCollapseEventArgs e) { //Toast.MakeText(this, "group collapsed", ToastLength.Short).Show(); }; }
public void OnAnimationEnd(Animation animation) { _adapter.StopAnimation(_groupPosition); _listView.CollapseGroup(_groupPosition); _adapter.NotifyDataSetChanged(); _info.DummyHeight = -1; _dummyView.Tag = AnimatedExpandableListAdapter.STATE_IDLE; }
public override void OnGroupExpanded(int groupPosition) { if (groupPosition != previousGroup) { listView.CollapseGroup(previousGroup); } previousGroup = groupPosition; }
public bool OnChildClick(ExpandableListView parent, View clickedView, int groupPosition, int childPosition, long id) { if (this.ListData[groupPosition].children[childPosition] != null) { parent.CollapseGroup(groupPosition); OnBackPressed(); } return(false); }
void ExpListView_GroupExpand(object sender, ExpandableListView.GroupExpandEventArgs e) { //Collapse any open groups if (_expandedGroup != -1 && _expandedGroup != e.GroupPosition) { _expListView.CollapseGroup(_expandedGroup); } _expandedGroup = e.GroupPosition; }
protected async override void OnCreate(Bundle bundle) { try { base.OnCreate(bundle); SetContentView(Resource.Layout.MakeBookingSesh); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); //progressDialog = ProgressDialog.Show(this, "", "Loading..."); string WorkshopSetId = Intent.GetStringExtra("WorkshopSetId"); _WorkshopSessions = await RESTClass.GetWorkshopSessions("?workshopSetId=" + WorkshopSetId); CreateExpendableListData(); ExpandableListView elvExListBox = FindViewById <ExpandableListView> (Resource.Id.elvExListBox); elvExListBox.SetAdapter(new ExpandListSessionAdapter(this, dictGroup)); 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 { // progressDialog.Dismiss(); // progressDialog.Dispose (); } }
void FnClickEvents() { //Listening to child item selection //lvCartItemList.ChildClick += delegate (object sender, ExpandableListView.ChildClickEventArgs e) { // Toast.MakeText(this, "child clicked", ToastLength.Short).Show(); //}; //Listening to group expand //modified so that on selection of one group other opened group has been closed lvCartItemList.GroupExpand += delegate(object sender, ExpandableListView.GroupExpandEventArgs e) { if (e.GroupPosition != previousGroup) { lvCartItemList.CollapseGroup(previousGroup); } previousGroup = e.GroupPosition; GlobalVariables.mIsAllCollapsed = false; }; //Listening to group collapse lvCartItemList.GroupCollapse += delegate(object sender, ExpandableListView.GroupCollapseEventArgs e) { GlobalVariables.mIsAllCollapsed = true; }; }
void FnClickEvents() { expListView.ChildClick += delegate(object sender, ExpandableListView.ChildClickEventArgs e) { Toast.MakeText(this, "child clicked", ToastLength.Short).Show(); }; expListView.GroupExpand += delegate(object sender, ExpandableListView.GroupExpandEventArgs e) { if (e.GroupPosition != previousGroup) { expListView.CollapseGroup(previousGroup); } previousGroup = e.GroupPosition; }; expListView.GroupCollapse += delegate(object sender, ExpandableListView.GroupCollapseEventArgs e) { Toast.MakeText(this, "group collapsed", ToastLength.Short).Show(); }; }
void FnClickEvents() { // Listening to child item selection expListView.ChildClick += delegate(object sender, ExpandableListView.ChildClickEventArgs e) { // Navigate to child (device detail view) Intent intent = new Intent(this, typeof(DeviceDetailViewActivity)); List <string> ChildList = new List <string>(); string clickedChild = ""; if (listDataChild.TryGetValue(listDataHeader[previousGroup], out ChildList)) { clickedChild = ChildList[e.ChildPosition]; } List <Device> AllDevices = new List <Device>(); foreach (Room _room in Rooms) { foreach (Device _device in _room.Devices) { AllDevices.Add(_device); } } Device DeviceObject = AllDevices.Find(f => f.Name.Equals(clickedChild)); string DeviceJson = JsonConvert.SerializeObject(DeviceObject); intent.PutExtra("device", DeviceJson); intent.PutExtra("room", listDataHeader[previousGroup]); intent.PutExtra("rooms", JsonConvert.SerializeObject(Rooms)); this.StartActivity(intent); }; //Listening to group expand //modified so that on selection of one group other opened group has been closed expListView.GroupExpand += delegate(object sender, ExpandableListView.GroupExpandEventArgs e) { if (e.GroupPosition != previousGroup) { expListView.CollapseGroup(previousGroup); } previousGroup = e.GroupPosition; }; //Listening to group collapse expListView.GroupCollapse += delegate(object sender, ExpandableListView.GroupCollapseEventArgs e) { // Toast.MakeText(this, "group collapsed", ToastLength.Short).Show(); }; }
public void OnAnimationEnd(Animation animation) { if (info.expanding && state != AnimatedExpandableListAdapter.STATE_EXPANDING) { adaptor.StopAnimation(groupPosition); adaptor.NotifyDataSetChanged(); dummyView.Tag = AnimatedExpandableListAdapter.STATE_IDLE; } else if (!info.expanding && state != AnimatedExpandableListAdapter.STATE_COLLAPSING) { adaptor.StopAnimation(groupPosition); listView.CollapseGroup(groupPosition); adaptor.NotifyDataSetChanged(); info.dummyHeight = -1; dummyView.Tag = AnimatedExpandableListAdapter.STATE_IDLE; } }
public override View GetGroupView(int groupPosition, bool isExpanded, View convertView, ViewGroup parent) { HeaderItemHolder headerHolder; View header = convertView; ExpandableListView menuExpandableListView = (ExpandableListView)parent; if (header == null) { header = _context.LayoutInflater.Inflate(Resource.Layout.CustomMenuHeaderRow, null); headerHolder = new HeaderItemHolder(header.FindViewById <ImageView>(Resource.Id.MenuHeader_ImageView), header.FindViewById <TextView>(Resource.Id.MenuHeader_TextView), header.FindViewById <ImageView>(Resource.Id.MenuHeaderIndicator_ImageView)); header.Tag = headerHolder; } else { headerHolder = (HeaderItemHolder)header.Tag; } if (groupPosition < _menuictionary.Keys.Count) { headerHolder.MenuHeaderIndicator_ImageView.Touch += (s, e) => { switch (_menuictionary.ElementAt(groupPosition).Key.Expanded) { case true: menuExpandableListView.CollapseGroup(groupPosition); _menuictionary.ElementAt(groupPosition).Key.Expanded = false; headerHolder.MenuHeaderIndicator_ImageView.SetImageResource(Resource.Drawable.ic_down); break; case false: menuExpandableListView.ExpandGroup(groupPosition); _menuictionary.ElementAt(groupPosition).Key.Expanded = true; headerHolder.MenuHeaderIndicator_ImageView.SetImageResource(Resource.Drawable.ic_up); break; default: break; } }; } return(header); }
void FnClickEvents() { string result = String.Empty; expListView.ChildClick += delegate(object sender, ExpandableListView.ChildClickEventArgs e) { ViewModel.PierLocation = listAdapter.GetChild(e.GroupPosition, e.ChildPosition).ToString(); ViewModel.ShowPierScanCommand.Execute(); }; expListView.GroupExpand += delegate(object sender, ExpandableListView.GroupExpandEventArgs e) { if (e.GroupPosition != previousGroup) { expListView.CollapseGroup(previousGroup); } previousGroup = e.GroupPosition; }; expListView.GroupCollapse += delegate(object sender, ExpandableListView.GroupCollapseEventArgs e) { }; }
private void Collapse() { try { if (_activitiesWeek != null) { for (var a = 0; a < GlobalData.ActivitiesForWeek.Count; a++) { _activitiesWeek.CollapseGroup(a); } } } catch (Exception e) { Log.Error(TAG, "Collapse: Exception - " + e.Message); if (GlobalData.ShowErrorDialog) { ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorActivitiesCollapse), "ActivitiesActivity.Collapse"); } } }
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.Search); List <string> WorkshopList; List <WorkshopSets> WrkSets; EditText txtsearch = FindViewById <EditText>(Resource.Id.txtsearch); Spinner searchWorkshop = FindViewById <Spinner>(Resource.Id.ddpworkshop); ExpandableListView ddpSearchList = FindViewById <ExpandableListView> (Resource.Id.ddpSearch); ImageButton btnsearch = FindViewById <ImageButton>(Resource.Id.imgsearch); ListView workshoplist = FindViewById <ListView>(Resource.Id.lvlWorkShops); string search; WorkshopList = new List <string>(); WorkshopList.Add("Session"); WorkshopList.Add("Workshop"); WorkshopList.Add("Programs"); ArrayAdapter <String> adapter = new ArrayAdapter <String>(this, Android.Resource.Layout.SimpleDropDownItem1Line, WorkshopList); searchWorkshop.Adapter = adapter; btnsearch.Click += async delegate { try { search = txtsearch.Text; string searchBy; searchBy = searchWorkshop.SelectedItem.ToString(); progressDialog = ProgressDialog.Show(this, "", "Searching..."); if (searchBy == "Session") { //string WorkshopSetId = Intent.GetStringExtra(search); _WorkshopSessions = await RESTClass.GetWorkshopSessions("?workshopSetId=" + search); //_WorkshopSessions = await RESTClass.GetWorkshopSessions("?topic=" + WorkshopSetId + "&active=true&etc."); } else if (searchBy == "Workshop") { WrkSets = await RESTClass.GetWorkshopList("?active=true"); taskList = new Adapters.SearchAdapter(this, WrkSets); workshoplist.Adapter = taskList; // lvWorkShops.Adapter = taskList; // new AlertDialog.Builder (this) // .SetMessage(taskList.GetId(0)) // .SetTitle("Application Error") // .Show(); } else if (searchBy == "Programs") { //await Ge } dictGroup.Clear(); CreateExpendableListData(); ddpSearchList.SetAdapter(new ExpandListSessionAdapter(this, dictGroup)); } catch (Exception e) { ErrorHandling.LogError(e, this); } finally { progressDialog.Dismiss(); progressDialog.Dispose(); } }; ddpSearchList.ChildClick += delegate(object sender, ExpandableListView.ChildClickEventArgs e) { try { string itmGroup = lstKeys [e.GroupPosition]; WorkshopSessions itmChild = dictGroup [itmGroup]; } catch (Exception Ex) { ErrorHandling.LogError(Ex, this); } }; ddpSearchList.GroupExpand += delegate(object sender, ExpandableListView.GroupExpandEventArgs e) { if (lastExpandedPosition != -1 && e.GroupPosition != lastExpandedPosition) { ddpSearchList.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 { // progressDialog.Dismiss(); // progressDialog.Dispose (); } }
public bool OnChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { //Make a second selection, it adds that into the listitem... headers = new List <string>(CoffeeData.Keys); List <string> defaultHeaders = new List <string> (); defaultHeaders.Add("Coffee"); defaultHeaders.Add("Size"); defaultHeaders.Add("Milk"); string currentKey = headers [groupPosition]; List <string> values = CoffeeData [currentKey]; string fixedKey; int cutOff = currentKey.IndexOf(":"); string newGroupText = ""; if (cutOff > 0) { fixedKey = currentKey.Substring(0, cutOff); newGroupText = string.Empty; newGroupText = string.Concat(fixedKey, ": ", v.FindViewById <TextView> (Resource.Id.txtItemContent).Text); } else { original = string.Empty; if (groupPosition == 0) { original = "Coffee"; } else if (groupPosition == 1) { original = "Milk"; } else if (groupPosition == 2) { original = "Size"; } newGroupText = string.Concat(original, ": ", v.FindViewById <TextView> (Resource.Id.txtItemContent).Text); } headers [groupPosition] = newGroupText; CoffeeData.Remove(currentKey); CoffeeData.Add(headers [groupPosition], values); coffeeLv.CollapseGroup(groupPosition); coffeeAdapter.UpdateData(CoffeeData); if (groupPosition == 0) { TempStorage.Coffee = v.FindViewById <TextView> (Resource.Id.txtItemContent).Text; } else if (groupPosition == 1) { TempStorage.Milk = v.FindViewById <TextView> (Resource.Id.txtItemContent).Text; } else if (groupPosition == 2) { TempStorage.Size = v.FindViewById <TextView> (Resource.Id.txtItemContent).Text; } if (headers [0] != "Coffee" && headers [1] != "Milk" && headers [2] != "Size") { favourite.SetVisible(true); } return(true); }
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(); }; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.NearbyConnection, container, false); AvalibleDeviceslistview = (ExpandableListView)view.FindViewById(Resource.Id.Nearby_Devices1); AvalibleDeviceslistview.SetAdapter(MainActivity.Adapter); switchScan = view.FindViewById <Switch>(Resource.Id.switchScan); switchBroad = view.FindViewById <Switch>(Resource.Id.switchBroadcast); M_SERVICE = (MainActivity)Activity; RegisterForContextMenu(AvalibleDeviceslistview); switchScan.CheckedChange += delegate(object sender, CompoundButton.CheckedChangeEventArgs e) { if (e.IsChecked) { Toast.MakeText((Activity), " Starting Scanning ", ToastLength.Short).Show(); ScanOption.Builder discBuilder = new ScanOption.Builder(); Policy policy = Policy.PolicyStar; discBuilder.SetPolicy(policy); MainActivity.mDiscoveryEngine.StartScan(MainActivity.MyServiceID, new ScanCallBack((MainActivity)Activity), discBuilder.Build()).AddOnSuccessListener(new TaskListener(Activity.ApplicationContext, "StartScanning")).AddOnFailureListener(new TaskListener(Activity.ApplicationContext, "StartScanning")); Log.Debug(MainActivity.TAG, "ScanOption.Builder : Policy :" + policy.ToString()); } else { Toast.MakeText(Activity.ApplicationContext, " Stopping Scanning ", ToastLength.Short).Show(); MainActivity.mDiscoveryEngine.StopScan(); } }; switchBroad.CheckedChange += delegate(object sender, CompoundButton.CheckedChangeEventArgs e) { if (e.IsChecked) { Toast.MakeText((Activity), " Starting Broadcasting ", ToastLength.Short).Show(); BroadcastOption.Builder advBuilder = new BroadcastOption.Builder(); Policy policy = Policy.PolicyStar; advBuilder.SetPolicy(policy); MainActivity.mDiscoveryEngine.StartBroadcasting(MainActivity.MyEndPoint, MainActivity.MyServiceID, new ConnCallBack((MainActivity)Activity), advBuilder.Build()).AddOnSuccessListener(new TaskListener(Activity.ApplicationContext, "StartBroadcasting")).AddOnFailureListener(new TaskListener(Activity.ApplicationContext, "StartBroadcasting")); Log.Debug(MainActivity.TAG, "BroadcastOption.Builder : Policy :" + policy.ToString()); } else { Toast.MakeText(Activity.ApplicationContext, " Stopping Broadcasting ", ToastLength.Short).Show(); MainActivity.mDiscoveryEngine.StopBroadcasting(); } }; AvalibleDeviceslistview.GroupClick += delegate(object sender, ExpandableListView.GroupClickEventArgs e) { if (!MainActivity.AvaliableDevicesList.ElementAt(e.GroupPosition).Status) { MainActivity.InitiateConnection(MainActivity.AvaliableDevicesList.ElementAt(e.GroupPosition)); } else if (AvalibleDeviceslistview.IsGroupExpanded(e.GroupPosition)) { AvalibleDeviceslistview.CollapseGroup(e.GroupPosition); } else { AvalibleDeviceslistview.ExpandGroup(e.GroupPosition); } }; return(view); }