protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Navigation); // Create an instance of Preferences which will manage the shared preferences in Android. _Preferences = new Preferences(); // Set up the navigation drawer. CreateNavigationMenu(); if (bundle == null) { // Show the Daily Planner by default. // Create an instance of the fragment. Fragment fragment = new PlannerDailyFragment(); // Use the FragmentManager to assign the fragment to the content layout. //FragmentManager fragmentManager = this.FragmentManager; FragmentManager.BeginTransaction() .Replace(Resource.Id.content, fragment) .Commit(); } }
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { loginRegFragment = new LoginRegFragment(); fragmentManager = context.FragmentManager; if (viewType == 0) { View entryView = inflater.Inflate(Resource.Layout.UserProfileRow, parent, false); return(new UserProfileExpandableGroupHolder(entryView, GroupOnClick, SettingsOnClick, editOnClick, ChooseImageOnClick, OnImageClick, FeedbackOnClick, GoToReviewsClick, AboutMeClick, context)); } else if (viewType == 1) { View sectionView = inflater.Inflate(Resource.Layout.user_profile_subcategory_entry, parent, false); return(new UserProfileExpandableItemHolder(sectionView, EditSkillOnClick)); } else { return(null); } }
public void SetFragmentItems(Android.App.FragmentManager fragmentManager, int containerResource, BottomBarFragment[] fragmentItems) { if (fragmentItems.Length > 0) { int index = 0; foreach (var fragmentItem in fragmentItems) { if (fragmentItem.Fragment == null && fragmentItem.SupportFragment != null) { throw new ArgumentException("Conflict: cannot use android.app.FragmentManager " + "to handle a android.support.v4.app.Fragment object at position " + index + ". If you want BottomBar to handle support Fragments, use getSupportFragment" + "Manager() instead of getFragmentManager()."); } index++; } } ClearItems(); _fragmentManager = fragmentManager; _fragmentContainer = containerResource; _items = fragmentItems; UpdateItems(_items); }
public TabsAdapter(Context context, FileViewPager viewPager, Android.App.FragmentManager fm) : base(fm) { mContext = context; mViewPager = viewPager; mViewPager.Adapter = (this); mViewPager.SetOnPageChangeListener(this); }
/// <summary> /// Initializes the fragments /// </summary> private void initFragment() { // Fragments fm = this.FragmentManager; mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map); locFrag = new LocationFragment(); repFrag = new ReportsFragment(); senFrag = new SensorFragment(); FragmentList = new List <Android.App.Fragment>(); FragmentList.Add(locFrag); FragmentList.Add(repFrag); FragmentList.Add(senFrag); FragmentList.Add(mapFrag); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { var reservationsViewHolder = (ReservationsViewHolder)holder; string dateNumber;//=reservations[position].start_time; dateNumber = reservations[position].date; //dateNumber.Substring(dateNumber.Length - 2); reservationsViewHolder.DateTV.Text = dateNumber.Substring(dateNumber.Length - 2) + " " + System.DateTime.Parse(dateNumber).ToString("MMMM", CultureInfo.InvariantCulture) + " " + System.DateTime.Parse(dateNumber).Year.ToString(); reservationsViewHolder.DayTV.Text = System.DateTime.Parse(dateNumber).DayOfWeek.ToString(); /*reservationsViewHolder.DateTextView.Text = "Date: " + reservations[position].date; * reservationsViewHolder.StatusTextView.Text = "Status: " + reservations[position].destination.status + " spots available";*/ // `description = experiences[position].description; fragmentManager = this._context.FragmentManager; gettingReservsForPaymentFragment = new Fragments.GettingReservsForPaymentFragment(); }
private void FlipCard() { if (_showingBack) { FragmentManager.PopBackStack(); return; } _showingBack = true; FragmentManager.BeginTransaction() .SetCustomAnimations(Resource.Animator.card_flip_right_in, Resource.Animator.card_flip_right_out, Resource.Animator.card_flip_left_in, Resource.Animator.card_flip_left_out) .Replace(Resource.Id.container, new CardBackFragment()) .AddToBackStack(null) .Commit(); _handler.Post(InvalidateOptionsMenu); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.activity_card_flip); if (bundle == null) { FragmentManager .BeginTransaction() .Add(Resource.Id.container, new CardFrontFragment()) .Commit(); } else { _showingBack = FragmentManager.BackStackEntryCount > 0; } FragmentManager.AddOnBackStackChangedListener(this); }
private void SelectItem(object sender, AdapterView.ItemClickEventArgs e) { Fragment fragment = null; switch (e.Position) { case 0: fragment = new PlannerDailyFragment(); break; case 1: fragment = new PlannerWeeklyFragment(); break; case 2: fragment = new SettingsFragment(); break; case 3: //TODO logout here if (!_Preferences.DemoMode) { // Make sure we're not running in demo mode, then logout and redirect to the login fragment. Logout(); // Destroy the local cookie. _Preferences.AuthenticationCookie = default(Cookie); fragment = new LoginFragment(); } break; } if (fragment != null) { // Load the requested fragment. FragmentManager.BeginTransaction() .Replace(Resource.Id.content, fragment) .AddToBackStack(null) .Commit(); } }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //declaring mainLayout mainLayout = FindViewById <LinearLayout>(Resource.Id.mainLayout); CalligraphyConfig.InitDefault(new CalligraphyConfig.Builder() .SetDefaultFontPath("fonts/HelveticaNeueLight") .SetFontAttrId(Resource.Attribute.fontPath) .Build()); //declaring mainLayout mainLayout = FindViewById <LinearLayout>(Resource.Id.mainLayout); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator); TextView experienceTitleTV = FindViewById <TextView>(Resource.Id.experienceTitleTV); activityIndicator.Visibility = Android.Views.ViewStates.Gone; layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); recyclerView.SetLayoutManager(layoutManager); string path = "fonts/HelveticaNeueLight.ttf"; Typeface tf = Typeface.CreateFromAsset(Assets, path); experienceTitleTV.Typeface = tf; experienceTitleTV.Text = "Search results"; //here we create DB dbr.CreateDB(); //here we create table dbr.CreateUsersTable(); //declaring path for RETRIEVING DATA string dbPath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "ormdemo.db3"); var db = new SQLiteConnection(dbPath); var user_table = db.Table <ORM.UsersDataTable>(); MainActivity.isLogined = false; //clearing table foreach (var item in user_table) { MainActivity.isLogined = true; } //left drawer mToolBar = FindViewById <SupportToolbar>(Resource.Id.toolbar); SetSupportActionBar(mToolBar); mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); mLeftDrawer = FindViewById <ListView>(Resource.Id.left_drawer); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Profile")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Experiences")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Map")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Wishlist")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Shopping Cart")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("My Experiences")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Help & Contact")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("About")); ListView leftDrawerLV = FindViewById <ListView>(Resource.Id.left_drawer); leftDrawerLV.Adapter = new Resources.LeftMenuFolder.LeftMenuAdapter(this, leftDrawerList); leftDrawerLV.ItemClick += LeftDrawerLV_ItemClick; //button to open/close Left Drawer FindViewById <Button>(Resource.Id.leftDrawerBN).Click += delegate { if (mDrawerLayout.IsDrawerOpen(mLeftDrawer)) { mDrawerLayout.CloseDrawer(mLeftDrawer); } else { mDrawerLayout.OpenDrawer(mLeftDrawer); } }; //left drawer ENDED //button to show context menu FindViewById <Button>(Resource.Id.contextMenuBn).Click += MainActivity_Click; //button to show context menu ENDED var responseSearch = JsonConvert.DeserializeObject <RootObjectSearchByWord>(Fragments.SearchFragment.content); //THIS CONSTRUCTION IS TO DISPLAY ITEMS FROM REVERSE List <Experience> tmpReverseList = new List <Experience>(); for (int i = responseSearch.experiences.Count - 1; i >= 0; i--) { tmpReverseList.Add(new Experience { id = responseSearch.experiences[i].id, title = responseSearch.experiences[i].title, description = responseSearch.experiences[i].description, owner_id = responseSearch.experiences[i].owner_id, price = responseSearch.experiences[i].price, min_capacity = responseSearch.experiences[i].min_capacity, max_capacity = responseSearch.experiences[i].max_capacity, location = responseSearch.experiences[i].location, created_at = responseSearch.experiences[i].created_at, updated_at = responseSearch.experiences[i].updated_at, price_rate = responseSearch.experiences[i].price_rate, duration = responseSearch.experiences[i].duration, duration_type = responseSearch.experiences[i].duration_type, video_url = responseSearch.experiences[i].video_url, alien_video_id = responseSearch.experiences[i].alien_video_id, video_source = responseSearch.experiences[i].video_source, has_cover = responseSearch.experiences[i].has_cover, status = responseSearch.experiences[i].status, publish_date = responseSearch.experiences[i].publish_date, meet_place_address = responseSearch.experiences[i].meet_place_address, meet_place_city = responseSearch.experiences[i].meet_place_city, meet_place_country = responseSearch.experiences[i].meet_place_country, nearby_landmarks = responseSearch.experiences[i].nearby_landmarks, must_have = responseSearch.experiences[i].must_have, instructions = responseSearch.experiences[i].instructions, approved = responseSearch.experiences[i].approved, approved_by = responseSearch.experiences[i].approved_by, approve_date = responseSearch.experiences[i].approve_date, lat = responseSearch.experiences[i].lat, lng = responseSearch.experiences[i].lng, cover_image = responseSearch.experiences[i].cover_image }); } var searchAdapter = new SearchAdapter(tmpReverseList, this); //THIS CONSTRUCTION IS TO DISPLAY ITEMS FROM REVERSE ENDED recyclerView.SetAdapter(searchAdapter); fragmentManager = this.FragmentManager; loginOrRegFragment = new Fragments.LoginOrRegistrationFragment(); searchFragment = new Fragments.SearchFragment(); loadingMapFragment = new Fragments.LoadingMyExperiencesAndGettingWishlistFrom_DB_ForMapFragment(); FindViewById <Button>(Resource.Id.searchBn).Click += delegate { searchFragment.Show(fragmentManager, "fragmentManager"); }; mainLayout.SetBackgroundResource(Resource.Drawable.NoTours); }
/** Instantiate the interface and set the context */ public GISPayBySpaceListAppInterface(Activity context, FragmentManager fragmentManager) : base(context, fragmentManager) { }
public AnimeDetailsPagerAdapter(FragmentManager fm) : base(fm) { }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(RecyclerViewSample.Resource.Layout.AddNewTour); //RecyclerViewSample.GettingCategories gc = new RecyclerViewSample.GettingCategories(); //clearing listCategoriesRoot /*RecyclerViewSample.GettingCategories.categoriesList.Clear(); * //getting categories method * gc.GetCategories();*/ ProgressBar activityIndicator = FindViewById <ProgressBar>(RecyclerViewSample.Resource.Id.activityIndicator); Button add_tour_button = FindViewById <Button>(RecyclerViewSample.Resource.Id.add_tour_button); Spinner categories_spinner = FindViewById <Spinner>(RecyclerViewSample.Resource.Id.categories_spinner); //adapter var adapter = ArrayAdapter.CreateFromResource(this, RecyclerViewSample.Resource.Array.planets_array, Android.Resource.Layout.SimpleListItem1); //ArrayAdapter adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, RecyclerViewSample.GettingCategories.categoriesList); categories_spinner.Adapter = adapter; categories_spinner.ItemSelected += Categories_spinner_ItemSelected; //FindViewById<EditText>(Resource.Id.owner_id).Text = Login.user_id.ToString(); var title = FindViewById <EditText>(RecyclerViewSample.Resource.Id.title); //var image = FindViewById<ImageView>(RecyclerViewSample.Resource.Id.myImageView); var location = FindViewById <EditText>(RecyclerViewSample.Resource.Id.location); var description = FindViewById <EditText>(RecyclerViewSample.Resource.Id.description); var price = FindViewById <EditText>(RecyclerViewSample.Resource.Id.price); var min_capacity = FindViewById <EditText>(RecyclerViewSample.Resource.Id.min_capacity); var max_capacity = FindViewById <EditText>(RecyclerViewSample.Resource.Id.max_capacity); var duration = FindViewById <EditText>(RecyclerViewSample.Resource.Id.duration); var meet_place_address = FindViewById <EditText>(RecyclerViewSample.Resource.Id.meet_place_address); var meet_place_city = FindViewById <EditText>(RecyclerViewSample.Resource.Id.meet_place_city); var chooseLocationMapBn = FindViewById <Button>(RecyclerViewSample.Resource.Id.chooseLocationMapBn); /*var lat = FindViewById<EditText>(RecyclerViewSample.Resource.Id.lat); * var lng = FindViewById<EditText>(RecyclerViewSample.Resource.Id.lng);*/ if (IdOfChosenCategory < 3) { categories_spinner.SetSelection(IdOfChosenCategory); } else if (IdOfChosenCategory > 2) { categories_spinner.SetSelection(IdOfChosenCategory - 1); } if (_title != null) { title.Text = _title; } if (_location != null) { location.Text = _location; } if (_description != null) { description.Text = _description; } if (_pricePerPerson != null) { price.Text = _pricePerPerson; } if (_minPeople != null) { min_capacity.Text = _minPeople; } if (_maxPeople != null) { max_capacity.Text = _maxPeople; } if (_duration != null) { duration.Text = _duration; } if (_city != null) { meet_place_city.Text = _city; } if (_address != null) { meet_place_address.Text = _address; } /*try * { * categories_spinner.SetSelection(_category - 1); * } * catch { }*/ /*try * { * countries.SetSelection(_country - 1); * } * catch { }*/ //uploading image //image.Click += Image_Click; //uploading image ENDED fragmentManager = this.FragmentManager; loadingMapFragment = new RecyclerViewSample.Fragments.LoadingMyExperiencesAndGettingWishlistFrom_DB_ForMapFragment_EditTour(); chooseLocationMapBn.Click += delegate { _title = title.Text; _location = location.Text; _description = description.Text; _pricePerPerson = price.Text; _minPeople = min_capacity.Text; _maxPeople = max_capacity.Text; _duration = duration.Text; _address = meet_place_address.Text; _city = meet_place_city.Text; _country = RecyclerViewSample.Login.user_country_id; _category = IdOfChosenCategory; RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.addOrEditTourIndicator = "add"; RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLatOfExp = null; RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLngOfExp = null; loadingMapFragment.Show(fragmentManager, "fragmentManager");//StartActivity(typeof(RecyclerViewSample.Activities.MapForChooseTourCoordsActivity)); }; add_tour_button.Click += async delegate { //setting prompt message empty promptMessage = ""; var client = new RestClient("http://api.xplorpal.com"); var request = new RestRequest("/experience", Method.POST); //CHECKING THE CORRECTNESS OF THE USER'S INTRODUCTION TO ALL FIELDS if (title.Text.Length < 3) { promptMessage += " Title must have at least 3 symbols.\n"; } if (location.Text.Length < 3) { promptMessage += " Location must have at least 3 symbols.\n"; } if (description.Text.Length < 30) { promptMessage += " Description length must be at least 30 symbols.\n"; } //checking if price, capacity, etc... are integer values int res; bool priceIsInt = false; priceIsInt = Int32.TryParse(price.Text, out res); if (priceIsInt == false) { promptMessage += " Price must be an integer value.\n"; } bool minCapacityIsInt = false; minCapacityIsInt = Int32.TryParse(min_capacity.Text, out res); if (minCapacityIsInt == false) { promptMessage += " Minimum capacity must be an integer value.\n"; } bool maxCapacityIsInt = false; maxCapacityIsInt = Int32.TryParse(max_capacity.Text, out res); if (maxCapacityIsInt == false) { promptMessage += " Maximum capacity must be an integer value.\n"; } bool durationIsInt = false; durationIsInt = Int32.TryParse(duration.Text, out res); if (durationIsInt == false) { promptMessage += " Duration must be an integer value.\n"; } //checking if price, capacity, etc... are integer values ENDED if (meet_place_address.Text.Length < 3) { promptMessage += " Address of meeting place must have at least 3 symbols.\n"; } if (meet_place_city.Text.Length < 3) { promptMessage += " City of meeting place must have at least 3 symbols.\n"; } if (String.IsNullOrWhiteSpace(RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLatOfExp)) { promptMessage += " Latitude is empty.\n"; } if (String.IsNullOrWhiteSpace(RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLngOfExp)) { promptMessage += " Longitude is empty.\n"; } /*string latFiltered = "", lngFiltered = ""; * /*foreach (char c in lat.Text) * { * if (Char.IsNumber(c) || c == '+' || c == '-' || c == ',' || c == '.') * { * latFiltered += c; * } * } * foreach (char c in lng.Text) * { * if (Char.IsNumber(c) || c == '+' || c == '-' || c == ',' || c == '.') * { * lngFiltered += c; * } * }*/ request.AddParameter("api_token", RecyclerViewSample.Login.token); request.AddParameter("title", title.Text); request.AddParameter("location", location.Text); request.AddParameter("description", description.Text); request.AddParameter("price", price.Text); request.AddParameter("owner_id", RecyclerViewSample.Login.user_id); request.AddParameter("min_capacity", min_capacity.Text); request.AddParameter("max_capacity", max_capacity.Text); request.AddParameter("duration", duration.Text); request.AddParameter("duration_type", 1); request.AddParameter("meet_place_address", meet_place_address.Text); request.AddParameter("meet_place_city", meet_place_city.Text); request.AddParameter("meet_place_country", RecyclerViewSample.Login.user_country_id); request.AddParameter("category_list[0]", IdOfChosenCategory); if (!String.IsNullOrWhiteSpace(RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLatOfExp) && !String.IsNullOrWhiteSpace(RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLngOfExp)) { if (RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLatOfExp.Contains(",")) { request.AddParameter("lat", RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLatOfExp.Replace(",", ".")); } else { request.AddParameter("lat", RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLatOfExp); } if (RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLngOfExp.Contains(",")) { request.AddParameter("lng", RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLngOfExp.Replace(",", ".")); } else { request.AddParameter("lng", RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLngOfExp); } } if (promptMessage == "") { try { add_tour_button.Visibility = ViewStates.Gone; chooseLocationMapBn.Visibility = ViewStates.Gone; activityIndicator.Visibility = ViewStates.Visible; IRestResponse response = await client.ExecuteTaskAsync(request); activityIndicator.Visibility = ViewStates.Gone; add_tour_button.Visibility = ViewStates.Visible; chooseLocationMapBn.Visibility = ViewStates.Visible; var content = response.Content; var myContent = JObject.Parse(content); status = myContent["status"].ToString(); } catch { } if (status == "success") { Toast.MakeText(this, "Tour added successfully", ToastLength.Short).Show(); //setting status variable to null to prevent issues with adding new places in future status = null; //setting variables to null _title = null; _location = null; _description = null; _pricePerPerson = null; _minPeople = null; _maxPeople = null; _duration = null; _city = null; _address = null; //int variables to default _category = 0; _country = 0; IdOfChosenCategory = 0; StartActivity(typeof(RecyclerViewSample.MainActivity)); } } else { Toast.MakeText(this, promptMessage, ToastLength.Long).Show(); } }; }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.main); PCL.HttpMethods.ProfileAndExpertMethods ksg = new PCL.HttpMethods.ProfileAndExpertMethods(); loginRegFragment = new LoginRegFragment(); fragmentManager = this.FragmentManager; edit_dialog = dialog_data.Edit(); if (Intent.Extras != null) { string type = ""; foreach (var key in Intent.Extras.KeySet()) { var value = Intent.Extras.GetString(key); Log.Debug(TAG, "Key: {0} Value: {1}", key, value); if (key == "message_from") { edit_dialog.PutString("expert_id", value); } if (key == "name") { edit_dialog.PutString("expert_name", value); } if (key == "avatar") { edit_dialog.PutString("expert_avatar", value); } if (key == "type") { type = value; } // //break; } edit_dialog.Apply(); from_push = true; if (type == "message") { StartActivity(typeof(DialogActivity)); } else { string review_id = ""; string reviewText = ""; string reviewAnswer = ""; string companionId = ""; string companionFullName = ""; string companionAvatar = ""; string myFullName = ""; string myId = ""; string myAvatar = ""; string is_online = ""; string timestamp = ""; string rating = ""; string categoryId = ""; string msg_cnt_new = ""; foreach (var key in Intent.Extras.KeySet()) { var value = Intent.Extras.GetString(key); if (key == "review_id") { review_id = value; } if (key == "reviewText") { reviewText = value; } if (key == "reviewAnswer") { reviewAnswer = value; } if (key == "companionId") { companionId = value; } if (key == "companionFullName") { companionFullName = value; } if (key == "companionAvatar") { companionAvatar = value; } if (key == "myFullName") { myFullName = value; } if (key == "myAvatar") { myAvatar = value; } if (key == "is_online") { is_online = value; } if (key == "timestamp") { timestamp = value; } if (key == "rating") { rating = value; } if (key == "categoryId") { categoryId = value; } if (key == "myId") { myId = value; } if (key == "msg_cnt_new") { msg_cnt_new = value; } } var activity2 = new Intent(this, typeof(ReviewFromPushActivity)); activity2.PutExtra("type", type); activity2.PutExtra("review_id", review_id); activity2.PutExtra("reviewText", reviewText); activity2.PutExtra("companionId", companionId); activity2.PutExtra("companionFullName", companionFullName); activity2.PutExtra("companionAvatar", companionAvatar); activity2.PutExtra("myFullName", myFullName); activity2.PutExtra("myAvatar", myAvatar); activity2.PutExtra("reviewAnswer", reviewAnswer); activity2.PutExtra("review_rating", rating); activity2.PutExtra("review_date", timestamp); activity2.PutExtra("review_online", is_online); activity2.PutExtra("categoryId", categoryId); activity2.PutExtra("myId", myId); activity2.PutExtra("msg_cnt_new", msg_cnt_new); StartActivity(activity2); } } else { from_push = false; } IsPlayServicesAvailable(); CreateNotificationChannel(); AppCenter.Start("0a86243f-1b34-4bca-bc65-133580015fc1", typeof(Analytics), typeof(Crashes)); var context = Application.Context; String androidOS = Build.VERSION.Release; String androidId = Settings.Secure.GetString(context.ContentResolver, Settings.Secure.AndroidId); var VersionNumber = context.PackageManager.GetPackageInfo(context.PackageName, PackageInfoFlags.MetaData).VersionName; var package_name = context.PackageName; var device_obj = new PCL.Models.Device { platform = "Android", deviceToken = androidId, osVersion = androidOS, appVersion = VersionNumber, packageName = package_name, }; var device_Json = JsonConvert.SerializeObject(device_obj); device_info_prefs = Application.Context.GetSharedPreferences("device_info", FileCreationMode.Private); edit_device_info_prefs = device_info_prefs.Edit(); edit_device_info_prefs.PutString("device_json", device_Json); new MyFirebaseIIDService().OnTokenRefresh(); var tokenFirebase = await GetToken(); edit_device_info_prefs.PutString("firebase_token", tokenFirebase); edit_device_info_prefs.Apply(); loc_pref = Application.Context.GetSharedPreferences("coordinates", FileCreationMode.Private); edit = loc_pref.Edit(); i_need_help_LL = FindViewById <RelativeLayout>(Resource.Id.i_need_help_LL); i_want_to_help_LL = FindViewById <RelativeLayout>(Resource.Id.i_want_to_help_LL); LogoRL = FindViewById <RelativeLayout>(Resource.Id.LogoRL); mainRL = FindViewById <RelativeLayout>(Resource.Id.mainRL); tintLL = FindViewById <RelativeLayout>(Resource.Id.tintLL); EnterMyAccTV = FindViewById <TextView>(Resource.Id.EnterMyAccTV); your_city_valueTV = FindViewById <TextView>(Resource.Id.your_city_valueTV); getting_positionTV = FindViewById <TextView>(Resource.Id.getting_positionTV); noTV = FindViewById <TextView>(Resource.Id.noTV); yesTV = FindViewById <TextView>(Resource.Id.yesTV); restartBn = FindViewById <Button>(Resource.Id.restartBn); activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator); activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply); Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf"); EnterMyAccTV.SetTypeface(tf, TypefaceStyle.Normal); your_city_valueTV.SetTypeface(tf, TypefaceStyle.Normal); getting_positionTV.SetTypeface(tf, TypefaceStyle.Normal); noTV.SetTypeface(tf, TypefaceStyle.Normal); yesTV.SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.textView5).SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.textView4).SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.textView3).SetTypeface(tf, TypefaceStyle.Bold); FindViewById <TextView>(Resource.Id.textView2).SetTypeface(tf, TypefaceStyle.Bold); restartBn.SetTypeface(tf, TypefaceStyle.Normal); restartBn.Visibility = ViewStates.Gone; i_need_help_LL.Click += (s, e) => { if (tintLL.Visibility != ViewStates.Visible) { StartActivity(typeof(SpecialistsCategoryActivity)); } }; i_want_to_help_LL.Click += (s, e) => { if (tintLL.Visibility != ViewStates.Visible) { try { if (!userMethods.UserExists()) { loginRegFragment.Show(fragmentManager, "fragmentManager"); } else { StartActivity(typeof(UserProfileActivity)); } } catch { Toast.MakeText(this, GetString(Resource.String.you_not_logined), ToastLength.Short).Show(); StartActivity(typeof(MainActivity)); } } }; EnterMyAccTV.Click += (s, e) => { if (tintLL.Visibility != ViewStates.Visible) { StartActivity(typeof(AuthorizationActivity)); } }; if (userMethods.UserExists()) { EnterMyAccTV.Visibility = ViewStates.Gone; } if (checkInternetConnection()) { //checking if GPS is enabled if (IsGeolocationEnabled()) { activityIndicator.Visibility = ViewStates.Visible; await Geolocation(); } else { turnGPSon(); } } else { restartBn.Visibility = ViewStates.Visible; activityIndicator.Visibility = ViewStates.Gone; getting_positionTV.Visibility = ViewStates.Gone; Toast.MakeText(this, Resource.String.turn_internet_on, ToastLength.Long).Show(); } restartBn.Click += (s, e) => { StartActivity(typeof(MainActivity)); }; var granted = await checkLocPermission(); if (!granted) { checkLocPermission(); } if (checkInternetConnection() && IsGeolocationEnabled()) { if (userMethods.UserExists()) { if (!from_push) { StartActivity(typeof(UserProfileActivity)); } } } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Tour_Detail); CalligraphyConfig.InitDefault(new CalligraphyConfig.Builder() .SetDefaultFontPath("fonts/HelveticaNeueLight") .SetFontAttrId(Resource.Attribute.fontPath) .Build()); string path = "fonts/HelveticaNeueLight.ttf"; Typeface tf = Typeface.CreateFromAsset(Assets, path); recordExistsInWhishlist = false; fragmentManager = this.FragmentManager; loginOrRegFragment = new Fragments.LoginOrRegistrationFragment(); string text = Intent.GetStringExtra("Title"); string price = Intent.GetStringExtra("Price"); imageUrl = Intent.GetStringExtra("ImageUrl"); string description_tour = Intent.GetStringExtra("Description"); string location = Intent.GetStringExtra("Location"); string duration = Intent.GetStringExtra("Duration"); string min_capacity = Intent.GetStringExtra("Min_capacity"); string max_capacity = Intent.GetStringExtra("Max_capacity"); string lat = Intent.GetStringExtra("Lat"); string lng = Intent.GetStringExtra("Lng"); TextView title = FindViewById <TextView>(Resource.Id.Title); ImageView image = FindViewById <ImageView>(Resource.Id.image); TextView price_text = FindViewById <TextView>(Resource.Id.price); TextView descript = FindViewById <TextView>(Resource.Id.description); TextView location_val = FindViewById <TextView>(Resource.Id.location_value); TextView duration_val = FindViewById <TextView>(Resource.Id.duration_value); TextView capacity = FindViewById <TextView>(Resource.Id.capacity_value); title.Typeface = tf; price_text.Typeface = tf; descript.Typeface = tf; location_val.Typeface = tf; duration_val.Typeface = tf; capacity.Typeface = tf; var scrollView = FindViewById <com.refractored.fab.ObservableScrollView>(Resource.Id.scrollViewDetail); var likeBn = FindViewById <ImageButton>(Resource.Id.likeBn); likeBn.SetBackgroundResource(Resource.Drawable.likeWhite); likeBn.Click += delegate { if (MainActivity.isLogined == true) { Toast.MakeText(this, "Your experience added to wishlist", ToastLength.Short).Show(); likeBn.SetBackgroundResource(Resource.Drawable.likeRed); //creating wishlist table dbr.CreateWishlistTable(); //declaring path for RETRIEVING DATA string dbPath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "ormdemo.db3"); var db = new SQLiteConnection(dbPath); var wishlist_table = db.Table <Wishlist>(); //declaring path for RETRIEVING DATA ENDED count_data_rows_in_users_table = 0; //checking if the place of interest exists foreach (var item in wishlist_table) { count_data_rows_in_users_table = 1; if (item.name == title.Text && item.price == price) { recordExistsInWhishlist = true; break; } else if (item.name != title.Text && item.price != price) { recordExistsInWhishlist = false; } } //if table is empty we insert a record if (count_data_rows_in_users_table == 0) { /*inserting * IMAGE AS memStream.ToArray() * and other fields to database*/ dbr.InsertWhishlistRecord( title.Text, Tours_detail.current_experience_id, price, imageUrl, description_tour, location, duration, min_capacity, max_capacity, lat, lng, false); } if (recordExistsInWhishlist == false && count_data_rows_in_users_table != 0) { /*inserting * IMAGE AS memStream.ToArray() * and other fields to database*/ dbr.InsertWhishlistRecord( title.Text, Tours_detail.current_experience_id, price, imageUrl, description_tour, location, duration, min_capacity, max_capacity, lat, lng, false); } } else { loginOrRegFragment.Show(fragmentManager, "fragmentManager"); } }; if (searchOrMovieAdapterIndicator == "MovieAdapter") { Glide.With(Application.Context) .Load(MovieAdapter.CurrentImageURL)//url) .Into(image); } else if (searchOrMovieAdapterIndicator == "SearchAdapter") { Glide.With(Application.Context) .Load(SearchAdapter.CurrentImageURL)//url) .Into(image); } title.Text = text; price_text.Text = "$" + price; descript.Text = description_tour; location_val.Text = location; duration_val.Text = duration + " hours"; capacity.Text = min_capacity + " - " + max_capacity; ImageButton back = FindViewById <ImageButton>(Resource.Id.back); back.Click += delegate { OnBackPressed(); }; Button book = FindViewById <Button>(Resource.Id.bookbutton); book.Click += delegate { Tours_detail.image_url_static = imageUrl; StartActivity(typeof(MainActivity)); }; book.Typeface = tf; book.Click += delegate { var activity = new Intent(this, typeof(SelectAvialability)); //activity.PutExtra("Title", title.Text); titleStatic = title.Text; StartActivity(activity); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SelectAvialability); countAdult = 0; string text = Tours_detail.titleStatic;//Intent.GetStringExtra("Title"); TextView title = FindViewById <TextView>(Resource.Id.Title); var travelersTV = FindViewById <TextView>(Resource.Id.travelersTV); var adult_number = FindViewById <TextView>(Resource.Id.adultnumber); title.Text = text; Button next = FindViewById <Button>(Resource.Id.nextbutton); ImageButton back = FindViewById <ImageButton>(Resource.Id.back); ImageButton plusAdult = FindViewById <ImageButton>(Resource.Id.plus); ImageButton minusAdult = FindViewById <ImageButton>(Resource.Id.minus); string path = "fonts/HelveticaNeueLight.ttf"; Typeface tf = Typeface.CreateFromAsset(Assets, path); title.Typeface = tf; travelersTV.Typeface = tf; adult_number.Typeface = tf; FindViewById <TextView>(Resource.Id.textView2).Typeface = tf; fragmentManager = this.FragmentManager; loginOrRegFragment = new Fragments.LoginOrRegistrationFragment(); back.Click += delegate { OnBackPressed(); }; next.Typeface = tf; next.Click += delegate { if (countAdult == 0) { Toast.MakeText(this, "Select number of travellers", ToastLength.Short).Show(); } else { //set title of experience for reservations screen Reservations_list_Activity.tour_name = title.Text; if (MainActivity.isLogined == true) { var activity = new Intent(this, typeof(Reservations_list_Activity)); activity.PutExtra("Title", title.Text); StartActivity(activity); //StartActivity(typeof(SelectDate)); } else { loginOrRegFragment.Show(fragmentManager, "fragmentManager"); } } }; plusAdult.Click += delegate { countAdult++; adult_number.Text = countAdult.ToString(); }; minusAdult.Click += delegate { if (countAdult > 0) { countAdult--; adult_number.Text = countAdult.ToString(); } }; }
internal void Show(Android.App.FragmentManager fragmentManager, string tAG) { }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Window.SetFormat(Format.Translucent); RequestWindowFeature(WindowFeatures.NoTitle); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); fmanager = FragmentManager; Window.SetBackgroundDrawable(new ColorDrawable(Color.Black)); Bundle extras = Intent.Extras; if (extras != null) { TrophyName = extras.GetString("TrophyName"); } trophyFragment = TrophyFragment.newInstance(TrophyName, this); //trophyFragment.SetStyle(DialogFragmentStyle.Normal, Resource.Style.AppThemepp); trophyFragment.Show(fmanager, "fragment_edit_name"); trophyFragment.Cancelable = false; trophyFragment.OnCAptureClick += (Bitmap obj, LinearLayout linearButton) => { if (obj != null) { try { bitmaptrophy = obj; mCamera.TakePicture(null, null, mPreview); } catch (System.Exception ex) { trophyFragment.progressBarLL.Visibility = ViewStates.Gone; System.Console.WriteLine("Take Picture Exception:" + ex.ToString()); } } }; trophyFragment.ResetAcitivity += (bool obj) => { System.GC.Collect(); }; trophyFragment.BackPressEvent += (bool obj) => { trophyFragment.Dismiss(); Finish(); }; trophyFragment.ChangeCameraFace += (bool obj) => { if (previewing) { mCamera.StopPreview(); } //NB: if you don't release the current camera before switching, you app will crash mCamera.Release(); //swap the id of the camera to be used if (currentCameraId == Android.Hardware.Camera.CameraInfo.CameraFacingBack) { currentCameraId = Android.Hardware.Camera.CameraInfo.CameraFacingFront; IsFrontCamera = true; } else { currentCameraId = Android.Hardware.Camera.CameraInfo.CameraFacingBack; IsFrontCamera = false; } mCamera = Android.Hardware.Camera.Open((int)currentCameraId); SetCameraDisplayOrientation(this, (int)currentCameraId, mCamera); try { mCamera.SetPreviewDisplay(mPreview.mHolder); } catch (System.Exception exx) { System.Console.WriteLine("Exception Changeing Camera:" + exx.ToString()); } //Android.Hardware.Camera.Parameters parameters = mCamera.GetParameters(); //parameters.SetPreviewSize(mPreview.mPreviewSize.Width, mPreview.mPreviewSize.Height); //System.Console.WriteLine("Param mPreviewSize.Width:" + mPreview.mPreviewSize.Width + " mPreviewSize.height:" + mPreview.mPreviewSize.Height); //parameters.SetPictureSize(mPreview.mPreviewSize.Width, mPreview.mPreviewSize.Height); //parameters.JpegQuality = (100); //parameters.PictureFormat = (ImageFormat.Jpeg); //parameters.FocusMode = Android.Hardware.Camera.Parameters.FocusModeAuto; //if (parameters.IsZoomSupported) // parameters.Zoom = (0); //mCamera.SetParameters(parameters); //mCamera.StartPreview(); previewing = false; mPreview.Dispose(); mPreview = new Preview(this); SetContentView(mPreview); mPreview.PreviewCamera = mCamera; }; //numberOfCameras = Android.Hardware.Camera.NumberOfCameras; //// Find the ID of the default camera //Android.Hardware.Camera.CameraInfo cameraInfo = new Android.Hardware.Camera.CameraInfo(); //for (int i = 0; i < numberOfCameras; i++) //{ // Android.Hardware.Camera.GetCameraInfo(i, cameraInfo); // if (cameraInfo.Facing == CameraFacing.Back) // { // defaultCameraId = i; // } //} }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(RecyclerViewSample.Resource.Layout.Edit); string path = "fonts/HelveticaNeueLight.ttf"; Typeface tf = Typeface.CreateFromAsset(Assets, path); /*//clearing listCategoriesRoot * RecyclerViewSample.GettingCategories.categoriesList.Clear(); * //getting categories method * gc.GetCategories();*/ var chooseLocationMapBn = FindViewById <Button>(RecyclerViewSample.Resource.Id.chooseLocationMapBn); try { activityIndicator = FindViewById <ProgressBar>(RecyclerViewSample.Resource.Id.activityIndicator); var image = FindViewById <ImageView>(RecyclerViewSample.Resource.Id.myImageView); var title = FindViewById <EditText>(RecyclerViewSample.Resource.Id.title); var location = FindViewById <EditText>(RecyclerViewSample.Resource.Id.location); var description = FindViewById <EditText>(RecyclerViewSample.Resource.Id.description); var price = FindViewById <EditText>(RecyclerViewSample.Resource.Id.price); var min_capacity = FindViewById <EditText>(RecyclerViewSample.Resource.Id.min_capacity); var max_capacity = FindViewById <EditText>(RecyclerViewSample.Resource.Id.max_capacity); var duration = FindViewById <EditText>(RecyclerViewSample.Resource.Id.duration); var meet_place_address = FindViewById <EditText>(RecyclerViewSample.Resource.Id.meet_place_address); var meet_place_city = FindViewById <EditText>(RecyclerViewSample.Resource.Id.meet_place_city); Spinner categories_spinner = FindViewById <Spinner>(RecyclerViewSample.Resource.Id.categories_spinner); var applyChangesBn = FindViewById <Button>(RecyclerViewSample.Resource.Id.applyChangesBn); title.Typeface = tf; location.Typeface = tf; description.Typeface = tf; price.Typeface = tf; min_capacity.Typeface = tf; max_capacity.Typeface = tf; duration.Typeface = tf; meet_place_address.Typeface = tf; meet_place_city.Typeface = tf; //adapter // ArrayAdapter adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, RecyclerViewSample.GettingCategories.categoriesList); var adapter = ArrayAdapter.CreateFromResource(this, RecyclerViewSample.Resource.Array.planets_array, Android.Resource.Layout.SimpleListItem1); categories_spinner.Adapter = adapter; categories_spinner.ItemSelected += Categories_spinner_ItemSelected; await getMyExperiences.GettingMyExperiences(RecyclerViewSample.Login.token); var responseData = JsonConvert.DeserializeObject <RecyclerViewSample.RootObjectMyExperiences>(RecyclerViewSample.GetMyExperiences.content); foreach (var item in responseData.experiences) { if (item.id == Convert.ToInt32(RecyclerViewSample.Activities.MyExperiencesDetailActivity.id_of_my_current_experience)) { //setting them to null to prevent situation that one tour will pick another tours coords RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLatOfExp = null; RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLngOfExp = null; title.Text = item.title; location.Text = item.location; description.Text = item.description; price.Text = item.price; min_capacity.Text = item.min_capacity; max_capacity.Text = item.max_capacity; duration.Text = item.duration; meet_place_address.Text = item.meet_place_address; meet_place_city.Text = item.meet_place_city; RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLatOfExp = item.lat; RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLngOfExp = item.lng; if (item.cover_image != null) { Glide.With(Application.Context) .Load(item.cover_image.url) .Into(image); } //category=item. break; } } //!!!!!CHECK HERE EVERYTHING!!!! //categories_spinner.SetSelection(0); image.Click += Image_Click; applyChangesBn.Click += async delegate { if (String.IsNullOrWhiteSpace(RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLatOfExp) && String.IsNullOrWhiteSpace(RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLngOfExp)) { Toast.MakeText(this, "Choose location of the experience", ToastLength.Short).Show(); } else { //setting prompt message empty promptMessage = ""; //WE NEED ALL OF THIS TO WRITE IMAGE TO DATABASE image.BuildDrawingCache(true); Bitmap bitmap = image.GetDrawingCache(true); image.SetImageBitmap(bitmap); Bitmap b = Bitmap.CreateBitmap(image.GetDrawingCache(true)); MemoryStream memStream = new MemoryStream(); b.Compress(Bitmap.CompressFormat.Png, 0, memStream); //memStream.ToArray(); //WE NEED ALL OF THIS TO WRITE IMAGE TO DATABASE ENDED byte[] ba = memStream.ToArray(); string bal = Base64.EncodeToString(ba, Base64.Default); var client = new RestClient("http://api.xplorpal.com/experience/" + RecyclerViewSample.Activities.MyExperiencesDetailActivity.id_of_my_current_experience); var request = new RestRequest("/update", Method.POST); var requestImage = new RestRequest("/uploadPhotos", Method.POST); //CHECKING THE CORRECTNESS OF THE USER'S INTRODUCTION TO ALL FIELDS if (title.Text.Length < 3) { promptMessage += " Title must have at least 3 symbols.\n"; } if (location.Text.Length < 3) { promptMessage += " Location must have at least 3 symbols.\n"; } if (description.Text.Length < 30) { promptMessage += " Description length must be at least 30 symbols.\n"; } //checking if price, capacity, etc... are integer values int res; bool priceIsInt = false; priceIsInt = Int32.TryParse(price.Text, out res); if (priceIsInt == false) { promptMessage += " Price must be an integer value.\n"; } bool minCapacityIsInt = false; minCapacityIsInt = Int32.TryParse(min_capacity.Text, out res); if (minCapacityIsInt == false) { promptMessage += " Minimum capacity must be an integer value.\n"; } bool maxCapacityIsInt = false; maxCapacityIsInt = Int32.TryParse(max_capacity.Text, out res); if (maxCapacityIsInt == false) { promptMessage += " Maximum capacity must be an integer value.\n"; } bool durationIsInt = false; durationIsInt = Int32.TryParse(duration.Text, out res); if (durationIsInt == false) { promptMessage += " Duration must be an integer value.\n"; } //checking if price, capacity, etc... are integer values ENDED if (meet_place_address.Text.Length < 3) { promptMessage += " Address of meeting place must have at least 3 symbols.\n"; } if (meet_place_city.Text.Length < 3) { promptMessage += " City of meeting place must have at least 3 symbols.\n"; } if (IdOfChosenCategory == 0) { promptMessage += " Choose category.\n"; } //CHECKING THE CORRECTNESS OF THE USER'S INTRODUCTION TO ALL FIELDS ENDED request.AddParameter("api_token", RecyclerViewSample.Login.token); request.AddParameter("title", title.Text); request.AddParameter("location", location.Text); request.AddParameter("description", description.Text); request.AddParameter("price", price.Text); request.AddParameter("owner_id", RecyclerViewSample.Login.user_id); request.AddParameter("min_capacity", min_capacity.Text); request.AddParameter("max_capacity", max_capacity.Text); request.AddParameter("duration", duration.Text); request.AddParameter("duration_type", 1); request.AddParameter("meet_place_address", meet_place_address.Text); request.AddParameter("meet_place_city", meet_place_city.Text); request.AddParameter("meet_place_country", RecyclerViewSample.Login.user_country_id); request.AddParameter("category_list[0]", IdOfChosenCategory); if (RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLatOfExp.Contains(",")) { request.AddParameter("lat", RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLatOfExp.Replace(",", ".")); } else { request.AddParameter("lat", RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLatOfExp); } if (RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLngOfExp.Contains(",")) { request.AddParameter("lng", RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLngOfExp.Replace(",", ".")); } else { request.AddParameter("lng", RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLngOfExp); } requestImage.AddParameter("api_token", RecyclerViewSample.Login.token); requestImage.AddParameter("photos[]", "data:image/png;base64," + bal); //"data:image/png;base64,/9j/"+ if (promptMessage == "") { try { activityIndicator.Visibility = Android.Views.ViewStates.Visible; applyChangesBn.Visibility = Android.Views.ViewStates.Gone; chooseLocationMapBn.Visibility = Android.Views.ViewStates.Gone; IRestResponse response = await client.ExecuteTaskAsync(request); IRestResponse responseImage = await client.ExecuteTaskAsync(requestImage); var content = response.Content; var contentImage = responseImage.Content; var myContent = JObject.Parse(content); response_code = myContent["response_code"].ToString(); var myContentImage = JObject.Parse(contentImage); response_img_code = myContentImage["response_code"].ToString(); Console.WriteLine(response_img_code); //now we need to get a new content to set a new cover image if (response_img_code == "200") { await getMyExperiences.GettingMyExperiences(RecyclerViewSample.Login.token); var responseDataSetCoverImage = JsonConvert.DeserializeObject <RecyclerViewSample.RootObjectMyExperiences>(RecyclerViewSample.GetMyExperiences.content); foreach (var item in responseDataSetCoverImage.experiences) { try { if (item.id.ToString() == RecyclerViewSample.Activities.MyExperiencesDetailActivity.id_of_my_current_experience) { //!!!!!!!!!!!!!!!!!!NEED TO CHANGE THIS VALUE FOR THE LAST ADDED IMAGE_ID!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! int image_id = item.cover_image.id; var request_set_cover = new RestRequest("/setCover", Method.POST); request_set_cover.AddQueryParameter("api_token", RecyclerViewSample.Login.token); request_set_cover.AddQueryParameter("image_id", image_id.ToString()); var response_set_cover = await client.ExecuteTaskAsync(request_set_cover); string set_cover_content, set_cover_response; set_cover_content = response_set_cover.Content; var set_c_content = JObject.Parse(set_cover_content); set_cover_response = set_c_content["response_code"].ToString(); } }catch {} } } activityIndicator.Visibility = Android.Views.ViewStates.Gone; applyChangesBn.Visibility = Android.Views.ViewStates.Visible; chooseLocationMapBn.Visibility = Android.Views.ViewStates.Visible; } catch { } if (response_code == "200") { Toast.MakeText(this, "Tour changed successfully", ToastLength.Short).Show(); activityIndicator.Visibility = Android.Views.ViewStates.Gone; applyChangesBn.Visibility = Android.Views.ViewStates.Visible; chooseLocationMapBn.Visibility = Android.Views.ViewStates.Visible; RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLatOfExp = null; RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.chosenLngOfExp = null; StartActivity(typeof(RecyclerViewSample.MainActivity)); } } else if (promptMessage != "") { activityIndicator.Visibility = Android.Views.ViewStates.Gone; applyChangesBn.Visibility = Android.Views.ViewStates.Visible; chooseLocationMapBn.Visibility = Android.Views.ViewStates.Visible; Toast.MakeText(this, promptMessage, ToastLength.Long).Show(); } } }; } catch { } fragmentManager = this.FragmentManager; loadingMapFragment = new RecyclerViewSample.Fragments.LoadingMyExperiencesAndGettingWishlistFrom_DB_ForMapFragment_EditTour(); chooseLocationMapBn.Click += delegate { RecyclerViewSample.Activities.MapForChooseTourCoordsActivity.addOrEditTourIndicator = "edit"; loadingMapFragment.Show(fragmentManager, "fragmentManager"); }; }