Esempio n. 1
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. 2
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);
        }