Exemple #1
0
        private async void GetCountryList()
        {
            progressDialog.Show();
            countryModel = new List <SearchModel>();
            var getDataUrl = new System.Uri(BaseURL.GET_COUNTRY);

            using (var client = new HttpClient())
            {
                var countryData = await client.GetStringAsync(getDataUrl);

                JSONArray jsonArray = new JSONArray(countryData.ToString());
                if (jsonArray.Length() > 0)
                {
                    for (int i = 0; i < jsonArray.Length(); i++)
                    {
                        SearchModel country     = new SearchModel();
                        JSONObject  jsonObject1 = jsonArray.GetJSONObject(i);
                        country.Id   = Convert.ToInt32(jsonObject1.GetString("countrymastid"));
                        country.Name = jsonObject1.GetString("countryname");
                        countryModel.Add(country);
                    }
                    countryAdapter = new SearchAdapter(countryModel, this);
                    string[] countryName = countryModel.Select(x => x.Name).ToArray();
                    int      countryID   = Array.IndexOf(countryName, session_management.GetAddressDetails().Get(BaseURL.COUNTRY).ToString());

                    countrySpiner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
                    var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, countryName);
                    adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                    countrySpiner.Adapter = adapter;
                    countrySpiner.SetSelection(countryID);
                }
            }
            progressDialog.Dismiss();
        }
Exemple #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Elements
            var toolbar = FindViewById <Toolbar>(Resource.Id.searchToolBar);

            SetSupportActionBar(toolbar);

            //  Para jugar con el texto escrito
            cajaBusqueda           = FindViewById <EditText>(Resource.Id.searchBox);
            cajaBusqueda.Text      = "TORRE EIFFEL";
            cajaBusqueda.KeyPress += TxtSearch_KeyPress;

            // Mobile Center
            MobileCenter.Start("ff86a1b3-7d26-44e3-930a-42699b0404f4",
                               typeof(Analytics), typeof(Crashes));

            // Plugin Conectivity
            Plugin.Connectivity.CrossConnectivity.Current.ConnectivityChanged += Current_ConnectivityChanged;

            fab        = FindViewById <FloatingActionButton>(Resource.Id.floatingActionButton1);
            fab.Click += Fab_Click;

            resultsListView = FindViewById <ListView>(Resource.Id.chat_list_view);
            // Create an adapter to bind the items with the view
            listSearch = new List <Search>();
            adapter    = new SearchAdapter(this, listSearch);
            resultsListView.Adapter = adapter;
        }
Exemple #3
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            swipeRefreshLayout = view.FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary);
            swipeRefreshLayout.SetOnRefreshListener(this);
            swipeRefreshLayout.Enabled = false;

            recyclerView = view.FindViewById <RecyclerView>(Resource.Id.recyclerView);
            var manager = new LinearLayoutManager(this.Activity);

            recyclerView.SetLayoutManager(manager);

            searchAdapter = new SearchAdapter(position);
            searchAdapter.SetOnLoadMoreListener(this);

            recyclerView.SetAdapter(searchAdapter);

            notDataView        = this.Activity.LayoutInflater.Inflate(Resource.Layout.empty_view, (ViewGroup)recyclerView.Parent, false);
            notDataView.Click += delegate(object sender, EventArgs e)
            {
                OnRefresh();
            };
            errorView        = this.Activity.LayoutInflater.Inflate(Resource.Layout.error_view, (ViewGroup)recyclerView.Parent, false);
            errorView.Click += delegate(object sender, EventArgs e)
            {
                OnRefresh();
            };
        }
Exemple #4
0
        private static Adapter GetSearchAdapter(string query)
        {
            Adapter adapter = new SearchAdapter().SetSearchMode(SearchAdapter.SearchMode.NXQL)
                              .SetSearchQuery(query)
                              .SetPageSize(Int32.MaxValue.ToString() /*This will blow up. Get pagination logic done*/);

            return(adapter);
        }
Exemple #5
0
        public void TestSearchAdapter()
        {
            Adapter adapter = new SearchAdapter().SetSearchMode(SearchAdapter.SearchMode.NXQL)
                              .SetSearchQuery("SELECT * FROM File WHERE ecm:parentId = \"" + folder.Uid + "\"");
            Documents documents = (Documents)folder.SetAdapter(adapter).Get().Result;

            Assert.NotNull(documents);
            Assert.Equal(3, documents.Entries.Count);
        }
        public void OnResponse(Java.Lang.Object response)
        {
            progressDialog.Show();
            try
            {
                JSONArray jsonArray = new JSONArray(response.ToString());
                if (jsonArray.Length() > 0)
                {
                    searchlist.Clear();
                    for (int i = 0; i < jsonArray.Length(); i++)
                    {
                        JSONObject jsonObject1   = jsonArray.GetJSONObject(i);
                        string     product_id    = jsonObject1.GetString("itemmastid");
                        string     varient_id    = jsonObject1.GetString("itemmastid");
                        string     product_name  = jsonObject1.GetString("itemid");
                        string     description   = jsonObject1.GetString("itemdesc");
                        string     pprice        = jsonObject1.GetString("selrate");
                        string     quantity      = "50";
                        string     product_image = jsonObject1.GetString("ItemImage");
                        string     mmrp          = jsonObject1.GetString("MRP");
                        string     unit          = jsonObject1.GetString("priunitvalue");
                        string     count         = "0";
                        string     totalOff      = string.Empty;
                        if ((decimal.Parse(mmrp)) > 0)
                        {
                            var savePrice = (decimal.Parse(mmrp) - decimal.Parse(pprice));
                            var per       = (savePrice / (decimal.Parse(mmrp)) * 100);
                            totalOff = System.Math.Round(per, 0).ToString();
                        }

                        int warehouseid = jsonObject1.GetString("WareHouseToId") == "" ? 0 : Convert.ToInt32(jsonObject1.GetString("WareHouseToId"));
                        int rowstate    = 0;

                        SearchModel recentData = new SearchModel();
                        recentData.Id   = Convert.ToInt32(product_id);
                        recentData.Name = product_name;
                        searchlist.Add(recentData);
                    }
                    searchAdapter = new SearchAdapter(searchlist, this.Activity);
                    recyclerSearch.SetLayoutManager(new LinearLayoutManager(this.Activity));
                    recyclerSearch.SetAdapter(searchAdapter);
                    searchAdapter.NotifyDataSetChanged();
                }
                else
                {
                    string msg = "No Record found";
                    Toast.MakeText(Context, msg, ToastLength.Short).Show();
                }
                progressDialog.Dismiss();
            }
            catch (JSONException e)
            {
                e.PrintStackTrace();
            }
            progressDialog.Dismiss();
        }
Exemple #7
0
 private void SetupList()
 {
     loadingCircle.Visibility = ViewStates.Visible;
     adapter              = new SearchAdapter <ISearchable>(countriesCollection, recycler, Resource.Layout.row_search_result);
     adapter.ItemClicked += ItemClicked;
     recycler.SetLayoutManager(new LinearLayoutManager(Activity));
     recycler.SetAdapter(adapter);
     recycler.SetItemAnimator(new DefaultItemAnimator());
     loadingCircle.Visibility = ViewStates.Gone;
 }
        void SetuprecyclerView()
        {
            //imagelist.Clear();

            //buyinguser = SecondPageActivity.loggedinuser;

            //username = buyinguser.Fullname;
            //foreach (var item in searchproducts)
            //{
            //    imagelist.Add($"{username}_image");

            //}
            searchrv.SetLayoutManager(new LinearLayoutManager(searchrv.Context));
            searchadapter            = new SearchAdapter(searchproducts, imagelist);
            searchadapter.ItemClick += Searchadapter_ItemClick;
            searchrv.SetAdapter(searchadapter);

            searchrv.Visibility = ViewStates.Invisible;

            searchtext.TextChanged += (sender, e) =>
            {
                SearchResult =
                    (from product in searchproducts
                     where product.productname.ToLower().Contains(searchtext.Text.ToLower()) || product.category.ToLower().Contains(searchtext.Text.ToLower())
                     select product).ToList();

                //foreach(var item in SearchResult)
                //{
                //    StorageReference ppref = FirebaseStorage.Instance.GetReference($"products/{item.productname}_image");

                //    ppref.GetDownloadUrl().AddOnSuccessListener(this, this);
                //    searchresultimagelist.Add(
                //}
                searchresultimagelist.Clear();
                buyinguser = SecondPageActivity.loggedinuser;

                username = buyinguser.Fullname;
                foreach (var item in SearchResult)
                {
                    searchresultimagelist.Add($"{item.productname}_image.jpg");
                }

                searchadapter            = new SearchAdapter(SearchResult, searchresultimagelist);
                searchadapter.ItemClick += SearchResult_ItemClick;
                searchrv.SetAdapter(searchadapter);

                if (string.IsNullOrEmpty(searchtext.Text))
                {
                    searchrv.Visibility = ViewStates.Invisible;
                }
                searchrv.Visibility = ViewStates.Visible;
            };
        }
Exemple #9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _checkedTextView = (CheckedTextView)FindViewById(Resource.Id.checkedTextView);
            _mainLayout      = (LinearLayout)FindViewById(Resource.Id.main_content);
            var button = (Button)FindViewById(Resource.Id.btnSearch);

            button.Click += btnSearch_Click;

            _actv = (AutoCompleteTextView)FindViewById(Resource.Id.autocomplete_search);

            _actv.Threshold = 1;

            var disp  = WindowManager.DefaultDisplay;
            var widht = disp.Width;

            _actv.DropDownWidth = widht;
            var searchImage = GetDrawable(Resource.Drawable.search);

            searchImage.SetBounds(0, 0, 75, 75);
            _actv.SetCompoundDrawables(searchImage, null, null, null);

            _actv.ItemClick += actv_ItemClick;

            _searchAdapter = new SearchAdapter(this);
            var autoCompleteItems = new[] { "Light rum", "Applejack", "Gin", "Dark rum", "Sweet Vermouth", "Strawberry schnapps", "Scotch", "Apricot brandy", "Triple sec", "Southern Comfort", "Orange bitters", "Brandy", "Lemon vodka", "Blended whiskey", "Dry Vermouth", "Amaretto", "Tea", "Creme de Cacao", "Apple brandy", "Dubonnet Blanc", "Apple schnapps", "Añejo rum", "Champagne", "Coffee liqueur", "Rum", "Cachaca", "Sugar", "Blackberry brandy", "Calvados", "Ice", "Lemon", "Coffee brandy", "Bourbon", "Irish whiskey", "Vodka", "Tequila", "Bitters", "Lime juice", "Egg", "Mint", "Sherry", "Cherry brandy", "Canadian whisky", "Kahlua", "Yellow Chartreuse", "Cognac", "demerara Sugar", "Sake", "Dubonnet Rouge", "Anis", "White Creme de Menthe", "Gold tequila", "Sweet and sour", "Salt", "Galliano", "Green Creme de Menthe", "Kummel", "Anisette", "Carbonated water", "Lemon peel", "White wine", "Sloe gin", "Melon liqueur", "Swedish Punsch", "Peach brandy", "Passion fruit juice", "Peppermint schnapps", "Creme de Noyaux", "Grenadine", "Port", "Red wine", "Rye whiskey", "Grapefruit juice", "Ricard", "Banana liqueur", "Vanilla ice-cream", "Whiskey", "Creme de Banane", "Lime juice cordial", "Strawberry liqueur", "Sambuca", "Peach schnapps", "Apple juice", "Berries", "Blueberries", "Orange juice", "Pineapple juice", "Cranberries", "Brown sugar", "Milk", "Egg yolk", "Lemon juice", "Soda water", "Coconut liqueur", "Cream", "Pineapple", "Sugar syrup", "Ginger ale", "Worcestershire sauce", "Ginger", "Strawberries", "Chocolate syrup", "Yoghurt", "Grape juice", "Orange", "Apple cider", "Banana", "Mango", "Soy milk", "Lime", "Cantaloupe", "Grapes", "Kiwi", "Tomato juice", "Cocoa powder", "Chocolate", "Heavy cream", "Peach Vodka", "Ouzo", "Coffee", "Spiced rum", "Water", "Espresso", "Angelica root", "Condensed milk", "Honey", "Whipping cream", "Half-and-half", "Bread", "Plums", "Johnnie Walker", "Vanilla", "Apple", "Orange rum", "Everclear", "Kool-Aid", "Lemonade", "Cranberry juice", "Eggnog", "Carbonated soft drink", "Cloves", "Raisins", "Almond", "Beer", "Pink lemonade", "Sherbet", "Peach nectar", "Firewater", "Absolut Citron", "Malibu rum", "Midori melon liqueur", "151 proof rum", "Bacardi Limon", "Bailey's irish cream", "Lager", "Orange vodka", "Blue Curacao", "Absolut Vodka", "Jägermeister", "Jack Daniels", "Drambuie", "Whisky", "White rum", "Pisco", "Irish cream", "Yukon Jack", "Goldschlager", "Butterscotch schnapps", "Grand Marnier", "Peachtree schnapps", "Absolut Kurant", "Ale", "Chambord raspberry liqueur", "Tia maria", "Chocolate liqueur", "Frangelico", "Barenjager", "Hpnotiq", "Coca-Cola", "Tuaca", "Tang", "Tropicana", "Grain alcohol", "Schnapps", "Cider", "Aftershock", "Sprite", "Rumple Minze", "Key Largo schnapps", "Pisang Ambon", "Pernod", "7-Up", "Limeade", "Gold rum", "Wild Turkey", "Cointreau", "Lime vodka", "Maraschino cherry juice", "Creme de Cassis", "Zima", "Crown Royal", "Cardamom", "Orange Curacao", "Tabasco sauce", "Peach liqueur", "Curacao", "Cherry Heering", "Fruit punch", "Vermouth", "Cherry juice", "Cinnamon schnapps", "Orange peel", "Advocaat", "Clamato juice", "Sour mix", "Apfelkorn", "Green Chartreuse", "Root beer schnapps", "Coconut rum", "Raspberry schnapps", "Black Sambuca", "Vanilla vodka", "Root beer", "Absolut Peppar", "Vanilla schnapps", "Orange liqueur", "Kiwi liqueur", "Hot chocolate", "Jello", "Mountain Dew", "Blueberry schnapps", "Maui", "Tennessee whiskey", "White chocolate liqueur", "Cream of coconut", "Citrus vodka", "Fruit juice", "Cranberry vodka", "Campari", "Corona", "Chocolate ice-cream", "Jim Beam", "Aquavit", "Hawaiian Punch", "Blackberry schnapps", "Chocolate milk", "Watermelon schnapps", "Beef bouillon", "Dr. Pepper", "Iced tea", "Hot Damn", "Club soda", "Benedictine", "Dark Creme de Cacao", "Black rum", "Cherry Cola", "Absinthe", "Angostura bitters", "Tequila Rose", "Guinness stout", "Orange soda", "Wildberry schnapps", "Lemon-lime soda", "Godiva liqueur", "Baileys irish cream", "Schweppes Russchian", "Melon vodka", "Sour Apple Pucker", "Raspberry vodka", "coconut milk", "Ginger beer", "Light cream", "Powdered sugar", "Wine", "Maraschino liqueur", "Kirschwasser", "Passion fruit syrup", "Tonic water", "Maraschino cherry", "Tawny port", "Orgeat syrup", "Raspberry syrup", "White port", "Madeira", "Maple syrup", "Forbidden Fruit", "Egg white", "Carrot", "Blackberries", "Butter", "Bitter lemon", "Mint syrup", "Almond flavoring", "Allspice", "Papaya", "Fruit", "Cinnamon", "Coriander", "Wormwood", "Vanilla extract", "Corn syrup", "Coconut syrup", "Banana rum", "Ice-cream", "White grape juice", "Cherry liqueur", "Pineapple-orange-banana juice", "Raspberry cordial", "Lemon soda", "Celery salt", "Erin Cream", "Crystal light", "Margarita mix", "Fanta", "Blackcurrant cordial", "Sarsaparilla", "Cynar", "Purple passion", "Pineapple vodka", "Pina colada mix", "Surge", "", "Peychaud bitters", "Candy", "Strawberry juice", "Raspberry jam", "Grape soda", "Cranberry liqueur", "Nutmeg", "Cherries", "Peach juice", "Passoa", "Mezcal", "Cola", "Lime liqueur", "Mandarine Napoleon", "Hazelnut liqueur", "Pepsi Cola", "Sunny delight", "Raspberry liqueur", "Soy sauce", "Guava juice", "Whipped cream", "Olive", "Cherry", "Cocktail onion", "Papaya juice", "Cayenne pepper", "Clove", "Cumin seed", "Aperol", "Cornstarch", "Anise", "Apricot", "Yeast", "Daiquiri mix", "Cucumber", "Blackcurrant squash", "Hoopers Hooch", "Nuts", "Strawberry syrup", "Schweppes Lemon", "Food coloring", "Agave Syrup", "Black pepper", "Vanilla syrup", "Gatorade", "Orange spiral", "Lillet", "Peach", "Lime peel", "Asafoetida", "Sirup of roses", "Fennel seeds", "Licorice root", "Peppermint extract", "Glycerine", "Pineapple rum", "Squirt", "Celery", "Apricot nectar", "Blackcurrant schnapps", "Vanilla liqueur", "Banana syrup", "Raspberry juice", "Coconut cream", "Cream soda", "squeezed orange" };

            _searchAdapter.OriginalItems = autoCompleteItems.Select(s => new SearchAdapter.SearchItem()
            {
                Text = s
            }).ToArray();
            _actv.Adapter = _searchAdapter;

            // Register this as a listener with the underlying service.
            var sensorManager = GetSystemService(SensorService) as Android.Hardware.SensorManager;
            var sensor        = sensorManager.GetDefaultSensor(Android.Hardware.SensorType.Accelerometer);

            sensorManager.RegisterListener(this, sensor, Android.Hardware.SensorDelay.Game);
        }
        protected virtual void SetupList()
        {
            App.Post(async() =>
            {
                var searchResult = await searchHandler.Invoke(string.Empty);
                searchResult     = searchResult ?? new List <ISearchable>();

                if (searchResult.ToList().Count == 0)
                {
                    ShowEmptyState();
                }

                collection           = new ObservableCollection <ISearchable>(searchResult);
                adapter              = new SearchAdapter <ISearchable>(collection, recycler, Resource.Layout.row_search_result);
                adapter.ItemClicked += ItemClicked;
                recycler.SetLayoutManager(new LinearLayoutManager(Activity));
                recycler.SetAdapter(adapter);
                recycler.SetItemAnimator(new DefaultItemAnimator());
                SetSelectedItem();

                loadingCircle.Visibility = ViewStates.Gone;
            });
        }
Exemple #11
0
 public void TestSearchAdapter()
 {
     Adapter adapter = new SearchAdapter().SetSearchMode(SearchAdapter.SearchMode.NXQL)
                                          .SetSearchQuery("SELECT * FROM File WHERE ecm:parentId = \"" + folder.Uid + "\"");
     Documents documents = (Documents)folder.SetAdapter(adapter).Get().Result;
     Assert.NotNull(documents);
     Assert.Equal(3, documents.Entries.Count);
 }
Exemple #12
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);
        }
Exemple #13
0
        //Modify Existing Code on Main App
        //207 Lines of Code
        private void Search(string query)
        {
            int  docCount = 1;
            bool truncate = false;

            Log.Info("Search()", String.Format("Search Begins" + ""));
            searchFragmentActivity = new SearchFragmentActivity();
            // RadioButton radio = FindViewById<RadioButton>(Resource.Id.viewAllRadio);
            using (var conn = new SQLite.SQLiteConnection(dbPath))
            {
                var      cmd = new SQLite.SQLiteCommand(conn); var searchStr = new SQLite.SQLiteCommand(conn);
                bool     proofs = true, answers = true, searchAll = false, viewDocs = false;
                CheckBox answerCheck = FindViewById <CheckBox>(Resource.Id.AnswerBox), proofCheck = FindViewById <CheckBox>(Resource.Id.proofBox),
                         searchCheck = FindViewById <CheckBox>(Resource.Id.searchAllCheckBox);
                RadioButton viewRadio = FindViewById <RadioButton>(Resource.Id.viewAllRadio);
                Spinner     spinner = FindViewById <Spinner>(Resource.Id.spinner1), spinner2 = FindViewById <Spinner>(Resource.Id.spinner2);
                spinner.ItemSelected  += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinner1_ItemSelected);
                spinner2.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinner2_ItemSelected);

                string fileString = "", accessString = "";
                accessString = TableAccess("");
                if (searchCheck.Checked)
                {
                    searchAll = true;
                }
                else
                {
                    searchAll = false; accessString = TableAccess(string.Format(" where documentname = '{0}' ", fileName));
                }
                //Data filters
                if (allOpen)
                {
                    if (searchAll)
                    {
                        fileString = TableAccess("");//"select * from Documenttitlelist";
                    }
                    else
                    {
                        fileString = TableAccess(string.Format("Where Documentname='{0}'", fileName));//String.Format("select * from DocumentTableList where DocumentName='{0}'", fileName);
                    }
                }
                if (catechismOpen)
                {
                    if (searchAll)
                    {
                        fileString = TableAccess("Where documentTypeName='CATECHISM'"); //"and DocumentTypeName='CATECHISM'");
                    }
                    else
                    {
                        fileString = TableAccess(String.Format("where DocumentTypeName='CATECHISM' and DocumentName='{0}' ", fileName));
                    }
                }
                if (confessionOpen)
                {
                    if (searchAll)
                    {
                        fileString = TableAccess("where DocumentTypeName='CONFESSION' ");
                    }
                    else
                    {
                        fileString = TableAccess(String.Format("where DocumentTypeName='CONFESSION' and DocumentName='{0}'  ", fileName));
                    }
                }
                if (creedOpen)
                {
                    if (searchAll)
                    {
                        fileString = TableAccess("where DocumentTypeName='CREED' ");
                    }
                    else
                    {
                        fileString = TableAccess(string.Format("where DocumentTypeName='CREED' and DocumentName='{0}' ", fileName));
                    }
                }
                //Proofs enabled
                if (proofCheck.Checked)
                {
                    proofs = true;
                }
                else
                {
                    proofs = false;
                }
                //Read Document
                if (viewRadio.Checked)
                {
                    viewDocs = true;
                }
                else
                {
                    viewDocs = false;
                }
                cmd.CommandText       = fileString;
                searchStr.CommandText = accessString;
                var r = cmd.ExecuteQuery <DocumentTitle>();
                var searchFields = searchStr.ExecuteQuery <Document>();
                documentList = new DocumentList();
                //Add Entries to DocumentList
                for (int x = 0; x < searchFields.Count; x++)
                {
                    DocumentTitle docTitle = new DocumentTitle();
                    docTitle.DocumentID = searchFields[x].DocumentID;
                    for (int y = 0; y < r.Count; y++)
                    {
                        if (!r[y].DocumentID.Equals(docTitle.DocumentID))
                        {
                            foreach (DocumentTitle doc in r)
                            {
                                if (doc.DocumentID == docTitle.DocumentID)
                                {
                                    docTitle.Title = doc.Title;
                                }
                                else
                                {
                                    continue;
                                }
                            }
                        }
                        else
                        {
                            docTitle.Title = r[y].CompareIDs(docTitle.DocumentID);
                        }
                    }
                    searchFields[x].DocumentName = docTitle.Title;
                    Document document = new Document();
                    document.ChName       = searchFields[x].ChName;
                    document.DocDetailID  = searchFields[x].DocDetailID;
                    document.DocumentText = Formatter(searchFields[x].DocumentText);
                    document.DocumentName = searchFields[x].DocumentName;
                    document.ChNumber     = searchFields[x].ChNumber;
                    document.ChProofs     = Formatter(searchFields[x].ChProofs);
                    document.Tags         = searchFields[x].Tags;
                    documentList.Add(document);
                }
                if (FindViewById <CheckBox>(Resource.Id.truncateCheck).Checked)
                {
                    truncate = true;
                }
                if (viewRadio.Checked != true && query != "" && FindViewById <RadioButton>(Resource.Id.topicRadio).Checked)
                {
                    if (FindViewById <RadioButton>(Resource.Id.topicRadio).Checked)
                    {
                        stopwatch.Start();
                        FilterResults(documentList, truncate, true, proofs, searchAll, query);
                        documentList.Reverse();
                        stopwatch.Stop();
                    }
                }
                else if (FindViewById <RadioButton>(Resource.Id.chapterRadio).Checked & query != "")
                {
                    int searchInt = Int32.Parse(query);
                    FilterResults(this.documentList, truncate, answers, proofs, searchAll, searchInt);
                }
                else if (viewDocs)
                {
                    if (!FindViewById <CheckBox>(Resource.Id.searchAllCheckBox).Checked)
                    {
                        query = "Results for All";
                    }
                    else
                    {
                        query = "View All";
                    }
                }
                if (documentList.Count > 1)
                {
                    SetContentView(Resource.Layout.search_results);
                    ViewPager     viewPager = FindViewById <ViewPager>(Resource.Id.viewpager);
                    SearchAdapter adapter   = new SearchAdapter(SupportFragmentManager, documentList, query, truncate);
                    searchFragmentActivity.DisplayResults(documentList, viewPager, adapter, query, 0, truncate);
                }
                else
                {
                    stopwatch.Stop();
                    if (this.documentList.Count == 0)
                    {
                        #region Error Logging
                        Log.Info("Search()", String.Format("No Results were found for {0}", query));
                        Toast.MakeText(this, String.Format("No results were found for  {0}", query), ToastLength.Long).Show();
                        #endregion
                        #region Variable Declaration and Assignment

                        SetContentView(Resource.Layout.errorLayout);
                        TextView errorMsg = FindViewById <TextView>(Resource.Id.errorTV);
                        errorMsg.Text = String.Format("No Search Results were found for {0}\r\n\r\n" +
                                                      "Go back to home page to search for another topic", query);


                        #endregion
                        #region Dialog Box
                        Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(this);
                        alert.SetTitle("No Results Found");
                        alert.SetMessage(String.Format("No Results were found for {0}.\r\n\r\n" +
                                                       "Do you want to go back and search for another topic?", query));
                        alert.SetPositiveButton("Yes", (senderAlert, args) =>
                        {
                            intent = new Intent(this, Class);
                            searchFragmentActivity = null;
                            this.OnStop();
                            this.Finish();
                            StartActivity(intent);
                        });
                        alert.SetNegativeButton("No", (senderAlert, args) => { alert.Dispose(); });

                        Dialog dialog = alert.Create();
                        dialog.Show();
                        #endregion
                    }
                    else
                    {
                        //SetTitle();
                        Document document = this.documentList[this.documentList.Count - 1];
                        SetContentView(Resource.Layout.confession_results);
                        TextView chapterBox  = FindViewById <TextView>(Resource.Id.chapterText);
                        TextView proofBox    = FindViewById <TextView>(Resource.Id.proofText);
                        TextView chNumbBox   = FindViewById <TextView>(Resource.Id.confessionChLabel);
                        TextView docTitleBox = FindViewById <TextView>(Resource.Id.documentTitleLabel);

                        chapterBox.Text  = document.DocumentText;
                        chNumbBox.Text   = String.Format("Chapter {0} : {1}", document.ChNumber.ToString(), document.ChName);
                        proofBox.Text    = document.ChProofs;
                        docTitleBox.Text = document.DocumentName;
                        TextView proofView = FindViewById <TextView>(Resource.Id.proofLabel);
                        ChangeColor(true, Android.Graphics.Color.Black, chapterBox, proofBox, chNumbBox, docTitleBox);
                        ChangeColor(proofView, false, Android.Graphics.Color.Black);
                        shareList = docTitleBox.Text + newLine + chNumbBox.Text + newLine + chapterBox.Text + newLine + "Proofs" + newLine + proofBox.Text;
                        FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.shareActionButton);
                        ChangeColor(fab, Android.Graphics.Color.Black);

                        fab.Click += ShareContent;
                    }
                }
            }
        }