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(); } }; }
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 async void OnCreate(Bundle bundle) { base.OnCreate(bundle); //setToursTitle(); 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.Visible; layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); recyclerView.SetLayoutManager(layoutManager); Fragments.SearchFragment.searchByWordIndicator = false; string path = "fonts/HelveticaNeueLight.ttf"; Typeface tf = Typeface.CreateFromAsset(Assets, path); experienceTitleTV.Typeface = tf; var repository = new MoviesRepository(); //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>(); isLogined = false; //clearing table foreach (var item in user_table) { isLogined = true; Login.name = item.name; Login.email_ = item.email; Login.avatar = item.avatar; Login.token = item.api_token; Login.birth_date = item.birth_date; Login.gender = item.gender; Login.phone_num = item.phone_num; Login.interests = item.biography; Login.user_id = item.user_id; Login.user_country_id = item.country_id; Login.password = item.password; } //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 films = await repository.GetAllFilms(GettingJSON.content); //THIS CONSTRUCTION IS TO DISPLAY ITEMS FROM REVERSE List <StarWars.Api.Repository.Movie> tmpReverseList = new List <StarWars.Api.Repository.Movie>(); for (int i = films.results.Count - 1; i >= 0; i--) { tmpReverseList.Add(new StarWars.Api.Repository.Movie { id = films.results[i].id, title = films.results[i].title, description = films.results[i].description, owner_id = films.results[i].owner_id, price = films.results[i].price, min_capacity = films.results[i].min_capacity, max_capacity = films.results[i].max_capacity, location = films.results[i].location, created_at = films.results[i].created_at, updated_at = films.results[i].updated_at, price_rate = films.results[i].price_rate, duration = films.results[i].duration, duration_type = films.results[i].duration_type, video_url = films.results[i].video_url, alien_video_id = films.results[i].alien_video_id, video_source = films.results[i].video_source, has_cover = films.results[i].has_cover, status = films.results[i].status, publish_date = films.results[i].publish_date, meet_place_address = films.results[i].meet_place_address, meet_place_city = films.results[i].meet_place_city, meet_place_country = films.results[i].meet_place_country, nearby_landmarks = films.results[i].nearby_landmarks, must_have = films.results[i].must_have, instructions = films.results[i].instructions, approved = films.results[i].approved, approved_by = films.results[i].approved_by, approve_date = films.results[i].approve_date, lat = films.results[i].lat, lng = films.results[i].lng, cover_image = films.results[i].cover_image }); } var moviesAdapter = new MovieAdapter(tmpReverseList, this); //THIS CONSTRUCTION IS TO DISPLAY ITEMS FROM REVERSE ENDED if (films.results == null || films.results.Count == 0) { mainLayout.SetBackgroundResource(Resource.Drawable.NoTours); } else { recyclerView.SetAdapter(moviesAdapter); } activityIndicator.Visibility = Android.Views.ViewStates.Gone; //FindViewById<LinearLayout>(Resource.Id.mainLayout).SetBackgroundResource(Resource.Drawable.NoTours); //SupportActionBar.SetDisplayHomeAsUpEnabled(false); //SupportActionBar.SetHomeButtonEnabled(false); 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"); }; }