Esempio n. 1
0
        private void BtnCreateDB_Click(object sender, EventArgs e)
        {
            DBRepository dbr    = new DBRepository();
            var          result = dbr.CreateDB();

            Toast.MakeText(this, result, ToastLength.Short).Show();
        }
Esempio n. 2
0
        //checking internet connection ended

        public async Task <string> Geolocation()
        {
            var locator = CrossGeolocator.Current;

            locator.DesiredAccuracy = 50;

            //var position = await locator.GetPositionAsync(timeoutMilliseconds: 10000);
            var position = await locator.GetPositionAsync();


            if (position == null)
            {
                return("");
            }
            lat = position.Latitude.ToString();
            lon = position.Longitude.ToString();

            /*
             *          //static coordinates of Washington:
             *          lat = "38.8951100"; lon = "-77.0363700";
             *          //Vinnitsya coords:
             *          lat = "49.2316534"; lon = "28.4986605";*/

            //replacing dot instead of comma in coordinates
            if (lat.Contains(","))
            {
                lat = lat.Replace(',', '.');
            }
            if (lon.Contains(","))
            {
                lon = lon.Replace(',', '.');
            }

            if (lat == null)
            {
            }
            else
            {
                //here we create DB
                dbr.CreateDB();
                textView1.Text = "Getting user`s info";
                await gettingJSON.VictorSologoob(lat, lon);

                StartActivity(typeof(RecyclerViewSample.MainActivity));
                //StartActivity(typeof(Login));
            }

            return("");
        }
Esempio n. 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Login);

            Button   login              = FindViewById <Button>(Resource.Id.login_button);
            Button   cancelBn           = FindViewById <Button>(Resource.Id.cancelBn);
            TextView forgetYourPassword = FindViewById <TextView>(Resource.Id.forgetYourPassword);

            activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator);

            string   path = "fonts/HelveticaNeueLight.ttf";
            Typeface tf   = Typeface.CreateFromAsset(Assets, path);

            login.Typeface                = tf;
            cancelBn.Typeface             = tf;
            login.Visibility              = ViewStates.Visible;
            cancelBn.Visibility           = ViewStates.Visible;
            forgetYourPassword.Visibility = ViewStates.Visible;
            //activityIndicator.Visibility = Android.Views.ViewStates.Gone;
            login.Click += async delegate
            {
                await Logining();

                //Geolocation();
            };

            cancelBn.Click += delegate
            {
                login.Visibility              = Android.Views.ViewStates.Visible;
                activityIndicator.Visibility  = Android.Views.ViewStates.Gone;
                forgetYourPassword.Visibility = ViewStates.Visible;
                StartActivity(typeof(MainActivity));
            };

            //here we create DB
            dbr.CreateDB();
            //here we create table
            dbr.CreateUsersTable();
            //button if the users forgets password
            forgetYourPassword.Click += Login_Click;
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Tours_detail.image_url_static = null;

            recordExistsInWhishlist = false;

            string text  = Intent.GetStringExtra("Title");
            string price = Intent.GetStringExtra("Price");

            url = 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");
            bool   isMyExperience   = Convert.ToBoolean(Intent.GetStringExtra("isMyExperience"));

            //hiding book button for my tours
            if (isMyExperience == true)
            {
                SetContentView(RecyclerViewSample.Resource.Layout.Wish_Detail_for_my_exp);
            }
            else
            {
                SetContentView(RecyclerViewSample.Resource.Layout.Wish_Detail);
            }
            CalligraphyConfig.InitDefault(new CalligraphyConfig.Builder()
                                          .SetDefaultFontPath("fonts/HelveticaNeueLight")
                                          .SetFontAttrId(Resource.Attribute.fontPath)
                                          .Build());

            var    unlikeBn = FindViewById <ImageButton>(Resource.Id.unlikeBn);
            Button book     = FindViewById <Button>(Resource.Id.bookbutton);

            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);

            Glide.With(Application.Context)
            .Load(url)
            .Into(image);

            var scrollView = FindViewById <com.refractored.fab.ObservableScrollView>(Resource.Id.scrollViewDetail);

            unlikeBn.SetBackgroundResource(Resource.Drawable.DeleteFromWishlist);



            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();
            };

            book.Click += delegate
            {
                Tours_detail.image_url_static = url;
                var activity = new Intent(this, typeof(SelectAvialability));
                //activity.PutExtra("Title", title.Text);
                Tours_detail.titleStatic = title.Text;
                StartActivity(activity);
            };

            unlikeBn.Click += delegate
            {
                Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
                builder.SetTitle("Deleting tour");
                builder.SetMessage("Remove from wishlist?");
                builder.SetCancelable(true);
                builder.SetPositiveButton("No", (object sender1, DialogClickEventArgs e1) =>
                                          { });
                builder.SetNegativeButton("Yes", (object sender1, DialogClickEventArgs e1) =>
                {
                    //here we create DB
                    dbr.CreateDB();
                    //here we create 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 <ORM.Wishlist>();
                    //finding the id of the tour
                    foreach (var item in wishlist_table)
                    {
                        if (item.name == title.Text)
                        {
                            dbr.RemoveWishlistRecord(item.Id);
                            Toast.MakeText(this, "Tour removed from the wishlist", ToastLength.Short).Show();
                            StartActivity(typeof(Activities.Wishlist));
                        }
                    }
                });
                Android.App.AlertDialog dialog = builder.Create();
                dialog.Show();
            };
        }