public async void LoadMapLayout() { await System.Threading.Tasks.Task.Run(() => { this.RunOnUiThread(() => { if (CheckConnection.IsInternet()) { GetPlaceInfo(Name, LatLon.Split(",")[0], LatLon.Split(",")[1]); foodiPlaces = GetPlaces(); placeAdapter = new FoodiPlaceAdapter(foodiPlaces, this); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false); radLvFoodiPlaces.SetLayoutManager(linearLayoutManager); radLvFoodiPlaces.SetAdapter(placeAdapter); FoodiPlacesClickListenner foodiPlacesClickListenner = new FoodiPlacesClickListenner(this, placeAdapter); radLvFoodiPlaces.AddItemClickListener(foodiPlacesClickListenner); mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map); mapFragment.GetMapAsync(this); DisplayCustomRatingBar(ratingBar); } else { Toast.MakeText(this, "No Internet Connected!", ToastLength.Long).Show(); } }); }); }
void InitViews() { toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.TbMain); radListView = FindViewById <RadListView>(Resource.Id.radListView); fabMain = FindViewById <FloatingActionButton>(Resource.Id.fab_main); fabAccount1 = FindViewById <FloatingActionButton>(Resource.Id.fab_account1); fabAccount2 = FindViewById <FloatingActionButton>(Resource.Id.fab_account2); bgFabMenu = FindViewById <View>(Resource.Id.bg_fab_menu); lnProgressBar = FindViewById <LinearLayout>(Resource.Id.lnProgressBar); districts = new List <DistrictItem>(); dsList = new List <District>(); db.CreateTable <DistrictItem>(); if (CheckConnection.IsInternet()) { GetData(); } else { dsList = getDistricts(); districtAdapter = new ExCityAdapter(dsList, this); radListView.SetAdapter(districtAdapter); } dsList = getDistricts(); districtAdapter = new ExCityAdapter(dsList, this); radListView.SetAdapter(districtAdapter); DistrictClickListener districtClickListener = new DistrictClickListener(this, districtAdapter); radListView.AddItemClickListener(districtClickListener); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); radListView.SetLayoutManager(linearLayoutManager); SetSupportActionBar(toolbar); SupportActionBar.Title = "Foodi"; }