Exemple #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            expandableListView = FindViewById <ExpandableListView>(Resource.Id.expandableListView);
            expandableListView.SetAdapter(mAdapter);

            //Set Data
            try
            {
                SetData(out mAdapter);
            }
            catch (System.Exception)
            {
                Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(this);
                alert.SetTitle("Message d'erreur");
                alert.SetMessage("Vérifiez votre connexion internet");
                alert.SetPositiveButton("Quitter", (senderAlert, args) =>
                {
                    Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
                });
                alert.SetNegativeButton("OK", (senderAlert, args) =>
                {
                    Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
                });
                Dialog dialog = alert.Create();
                dialog.Show();
            }
            expandableListView.SetAdapter(mAdapter);
        }
 private void ConfirmSelectedCollaborators(object sender, EventArgs e)
 {
     if (assignUserList.Count > 0)
     {
         AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
         alertBuilder.SetCancelable(false);
         alertBuilder.SetMessage("Do you want to share this report with this selected users?");
         alertBuilder.SetTitle("Share Report");
         alertBuilder.SetPositiveButton("Yes", (sender1, args) =>
         {
             Intent formActivity = new Intent(this, typeof(FormActivity));
             formActivity.PutExtra(Resources.GetString(Resource.String.assign_user_list_type), Resources.GetString(Resource.String.add_collaborators));
             formActivity.PutIntegerArrayListExtra(Resources.GetString(Resource.String.assign_user_id_list), assignUserList);
             SetResult(Result.Ok, formActivity);
             Finish();
         });
         alertBuilder.SetNegativeButton("No", (sender1, args) =>
         {
             assignUserList.Clear();
             alertBuilder.Dispose();
             userListAdapter = new UserListAdapter(this, userCompanies, selectedUserList, userListType);
             userListAdapter.ButtonClickedOnAssignInvite += ButtonClickDelegate;
             expandableListView.SetAdapter(userListAdapter);
         });
         alertBuilder.Show();
     }
     else
     {
         Utility.DisplayToast(this, "Please select a user to share report");
     }
 }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            System.Diagnostics.Debug.WriteLine("ShortDialFragment.OnCreateView");
            View view = inflater.Inflate(Resource.Layout.ShortDialFragment, null);

            InitTableView(view);

            GetLevels();

            // Search EditText
            EditText editSearch = view.FindViewById <EditText>(Resource.Id.editTextSearch);

            editSearch.EditorAction += (object sender, TextView.EditorActionEventArgs e) =>
            {
                if ((e.ActionId == ImeAction.Done || e.Event.KeyCode == Keycode.Enter) && e.Event.Action == KeyEventActions.Down)
                {
                    EditText et = sender as EditText;
                    if (et.Text.Length > 0)
                    {
                        SearchSectionsByName(et.Text);
                    }
                    else
                    {
                        // Return to default levels
                        listView.SetAdapter(mAdapter);
                    }
                }
                // e.Handled = false;
            };

            return(view);
        }
Exemple #4
0
        public void setOnDateChangedListener(int monthOfYear, int dayOfMonth)
        {
            IndexofDay = monthOfYear + 1 == 9 ? (dayOfMonth - 1) % length : monthOfYear + 1 == 10 ? (dayOfMonth + 1) % length : monthOfYear + 1 == 11 ? (dayOfMonth + 4) % length : monthOfYear + 1 == 12 ? (dayOfMonth + 6) % length : length;
            List <string> searchedClass = new List <string>();

            searchedClass.Add(day[IndexofDay]);
            adapter = new EListViewAdapter(this, myHeader, searchedClass);
            mExListView.SetAdapter(adapter);
            mExListView.ExpandGroup(0);
        }
Exemple #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);


            SetContentView(Resource.Layout.Main);
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            //Toolbar will now take on default actionbar characteristics
            SetSupportActionBar(toolbar);

            SupportActionBar.Title = "Hello from Appcompat Toolbar";

            ExpandableListView expandableList = FindViewById <ExpandableListView>(Resource.Id.navigationmenu);
            NavigationView     navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            if (navigationView != null)
            {
                navigationView.NavigationItemSelected += OnNavigationItemSelected;
            }


            PrepareListData();
            menuAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild, expandableList);

            // setting list adapter
            expandableList.SetAdapter(menuAdapter);
        }
        private void SearchBoxOnQueryTextChange(object sender, SearchView.QueryTextChangeEventArgs queryTextChangeEventArgs)
        {
            SearchableTreeNode stnResult = SampleManager.Current.FullTree.Search(sample => SampleManager.Current.SampleSearchFunc(sample, queryTextChangeEventArgs.NewText));

            if (stnResult != null)
            {
                _filteredSampleCategories = stnResult.Items.OfType <SearchableTreeNode>().ToList();
                if (!_arCompatible)
                {
                    _filteredSampleCategories.RemoveAll(category => category.Name == "Augmented reality");
                }
            }
            else
            {
                _filteredSampleCategories = new List <SearchableTreeNode>();
            }

            _categoriesListView.SetAdapter(new CategoriesAdapter(this, _filteredSampleCategories));

            // Expand all entries; makes it easier to see search results.
            for (int index = 0; index < _filteredSampleCategories.Count; index++)
            {
                _categoriesListView.ExpandGroup(index);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;

            //
            ExpandableListModel.GenerateData(ref ListData, this);
            ListView = (ExpandableListView)this.FindViewById <Android.Widget.ExpandableListView>(Resource.Id.apps);


            ListAdapter = new ExpandableListAdapter(this, ListData, ListView);
            ListView.SetAdapter(ListAdapter);

            ListView.SetOnGroupClickListener(this);
            ListView.SetOnChildClickListener(this);
            //

            DrawerLayout          drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close);

            drawer.AddDrawerListener(toggle);
            toggle.SyncState();

            NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.SetNavigationItemSelectedListener(this);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            // var toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            // SetSupportActionBar(toolbar);
            // SupportActionBar.Title = "Patient Selection";
            expandableListView = FindViewById <ExpandableListView>(Resource.Id.expandableListView);

            // Set Data for the expandable list view
            SetData(out patientExListViewAdapter);
            expandableListView.SetAdapter(patientExListViewAdapter);

            // Popup text for patient selection verification
            expandableListView.ChildClick += (s, e) =>
            {
                var nextPage = new Intent(this, typeof(PatientVisit));
                StartActivity(nextPage);
                // Uncomment for pop-up user selection notification
                //Toast.
                //MakeText(this, "You have selected " /* Patient Name */
                //  + patientExListViewAdapter.GetChild(e.GroupPosition, e.ChildPosition), ToastLength.Short).Show();
            };
        }
Exemple #9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);
            activity = this;

            toolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(false);
            SupportActionBar.SetHomeButtonEnabled(true);

            navigationView = FindViewById <NavigationView>(Resource.Id.navigation_view);
            drawerLayout   = FindViewById <DrawerLayout>(Resource.Id.navigation_drawer);

            toggle = new SmootherDrawerToggle(this, drawerLayout, toolbar, Resource.String.openDrawer, Resource.String.closeDrawer);
            drawerLayout.AddDrawerListener(toggle);
            toggle.SyncState();

            listview = FindViewById <ExpandableListView>(Resource.Id.nav_menu);

            mAdapter = new MenuAdapter(ApplicationContext, mainFileAndFolders, filesAndFolders, this);
            listview.SetAdapter(mAdapter);

            replaceFragment(runningFragment);
        }
Exemple #10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.RoomsList);

            rooms = SQLiteDb.GetRooms(this).ToList();

            expandableListView = FindViewById <ExpandableListView>(Resource.Id.roomsExpandableListView);

            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.roomsListToolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = "Zgłoś zagrożenie";

            adapter = new RoomsListAdapter(this, rooms);
            expandableListView.SetAdapter(adapter);

            expandableListView.ChildClick += (o, e) =>
            {
                var    roomName  = adapter.GetChild(e.GroupPosition, e.ChildPosition).ToString();
                var    floorName = adapter.GetGroup(e.GroupPosition).ToString();
                var    intent    = new Intent(this, typeof(WriteReportDataActivity));
                Bundle extras    = new Bundle();
                extras.PutString("choosenFloor", floorName);
                extras.PutString("choosenRoom", roomName);
                intent.PutExtras(extras);
                StartActivity(intent);
                Finish();
            };
        }
Exemple #11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.CategoriesList);

            try
            {
                // Initialize the SampleManager and create the Sample Categories.
                SampleManager.Current.Initialize();
                _sampleCategories         = SampleManager.Current.FullTree.Items.OfType <SearchableTreeNode>().ToList();
                _filteredSampleCategories = _sampleCategories;

                // Set up the custom ArrayAdapter for displaying the Categories.
                var categoriesAdapter = new CategoriesAdapter(this, _sampleCategories);
                _categoriesListView = FindViewById <ExpandableListView>(Resource.Id.categoriesListView);
                _categoriesListView.SetAdapter(categoriesAdapter);
                _categoriesListView.ChildClick   += CategoriesListViewOnChildClick;
                _categoriesListView.DividerHeight = 2;
                _categoriesListView.SetGroupIndicator(null);

                // Set up the search filtering.
                SearchView searchBox = FindViewById <SearchView>(Resource.Id.categorySearchView);
                searchBox.QueryTextChange += SearchBoxOnQueryTextChange;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        /// <summary>
        ///     Méthode d'initialisation de la liste extensible
        /// </summary>
        private void InitialiseExpandableListView()
        {
            listArticles = FindViewById <ExpandableListView>(Resource.Id.apercu_liste_shopping);
            PrepareListDatas();
            listAdapter = new CustomExpandableListViewAdapter(this, listDataHeader, listDataChild);
            listArticles.SetAdapter(listAdapter);
            listArticles.ChildClick += (s, e) => {
                foreach (Item item in items)
                {
                    if (item.NameFr.Equals(listAdapter.GetChild(e.GroupPosition, e.ChildPosition).ToString()))
                    {
                        // Création de la fenêtre de dialogue
                        AlertDialog.Builder alert = new AlertDialog.Builder(this);
                        alert.SetTitle("Suppression d'un item dans la liste");
                        alert.SetMessage("Souhaitez-vous réellement supprimer " + listAdapter.GetChild(e.GroupPosition, e.ChildPosition).ToString() + " de votre liste de courses ?");
                        alert.SetPositiveButton("Oui", (senderAlert, args) => {
                            foreach (Item itemToDelete in items)
                            {
                                if (itemToDelete.NameFr.Equals(listAdapter.GetChild(e.GroupPosition, e.ChildPosition).ToString()))
                                {
                                    baseDeDonnees.DeleteItemIntoShoppingList(Intent.GetIntExtra("id", -1), item.IdItem);
                                }
                            }
                            shoppingListItems = baseDeDonnees.GetAllShoppingListItemsWithId(Intent.GetIntExtra("id", -1));
                            InitialiseExpandableListView();
                        });

                        alert.SetNegativeButton("Non", (senderAlert, args) => { });
                        Dialog dialog = alert.Create();
                        dialog.Show();
                    }
                }
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Checklist);

            //Action bar
            InitializeActionBar(SupportActionBar);
            delete = ActionBarDelete;

            ActionBarTitle.Text = "Totemisatie checklist";

            sharedPrefs = GetSharedPreferences("checklist", FileCreationMode.Private);
            var ser = sharedPrefs.GetString("states", "empty");
            List <List <bool> > states;

            if (!ser.Equals("empty"))
            {
                states = JsonSerializer.DeserializeFromString <List <List <bool> > >(ser);
            }
            else
            {
                states = null;
            }

            delete.SetImageResource(Resource.Drawable.ic_reset_white_24dp);
            delete.Click     += ResetChecklist;
            delete.Visibility = ViewStates.Visible;

            expand = FindViewById <ExpandableListView>(Resource.Id.expand);

            InitializeExpandableListView();
            expandAdapater = new ExpendListAdapter(this, dictGroup, states);
            expand.SetAdapter(expandAdapater);
        }
Exemple #14
0
        // This method creates a new DisposablesAdapter and sets
        // the listview to use it.
        private void displayDisposablesList(List <Disposable> disposables)
        {
            //DisposablesAdapter adapter = new DisposablesAdapter(Context, disposables);

            lvDisposables.SetAdapter(new DisposableDetailListAdapter(Context, disposables));
            //lvDisposables.GroupClick += (sender, e) => lvDisposables.ChildClick(sender, new ExpandableListView.ChildClickEventArgs(true, e.Parent, e.ClickedView, e.GroupPosition, (int)e.Id, 0));
        }
Exemple #15
0
 void UpdateUI()
 {
     toolbar.Title = "Lịch học tuần " + LoginDataManager.CurrentWeekOfYear;
     toolbar.SetTitleTextColor(Color.White);
     adapter = new CustomExpandableListAdapter(this.Activity, titleNames, SaveInfo.SchedulerOfDay);
     expandListView.SetAdapter(adapter);
 }
        protected override void OnCreate(Bundle bundle)
        {
            var culture = new System.Globalization.CultureInfo("de-DE");

            System.Threading.Thread.CurrentThread.CurrentCulture   = culture;
            System.Threading.Thread.CurrentThread.CurrentUICulture = culture;

            base.OnCreate(bundle);

            Dados = new Dados();
            Dados.Carregar();

            SetContentView(Resource.Layout.Main);

            _listViewGastos = FindViewById <ExpandableListView>(Resource.Id.listViewGastos);
            _listViewGroups = PrepararListViewGroups(Dados.Gastos);
            _adapter        = new ListViewAdapter(this, _listViewGroups);
            _listViewGastos.SetAdapter(_adapter);
            _listViewGastos.ChildClick += ListViewGastos_ChildClick;
            ExpandirTodosOsGruposDoListView();

            _buttonNovo        = FindViewById <Button>(Resource.Id.buttonNovo);
            _buttonNovo.Click += buttonNovo_Click;

            _buttonLimpar        = FindViewById <Button>(Resource.Id.buttonLimpar);
            _buttonLimpar.Click += buttonLimpar_Click;
        }
Exemple #17
0
 private void FnSetUpListView(string _queryString)
 {
     FnGetListData(_queryString);
     //Bind list
     mListAdapter = new ProductsItemListAdapter(this, mListDataHeader, mListDataChild, lvCartItemList);
     lvCartItemList.SetAdapter(mListAdapter);
 }
        private async void ExecuteStatisticsQuery(object sender, EventArgs e)
        {
            // Verify that there is at least one statistic definition
            if (!_statisticDefinitions.Any())
            {
                // Warn the user to define a statistic to query
                ShowMessage("Please define at least one statistic for the query.", "Statistical Query");
                return;
            }

            // Create the statistics query parameters, pass in the list of statistic definitions
            StatisticsQueryParameters statQueryParams = new StatisticsQueryParameters(_statisticDefinitions);

            // Specify the selected group fields (if any)
            if (_groupByFields != null)
            {
                // Find fields in the dictionary with a 'true' value and add them to the group by field names
                foreach (KeyValuePair <string, bool> groupField in _groupByFields.Where(field => field.Value))
                {
                    statQueryParams.GroupByFieldNames.Add(groupField.Key);
                }
            }

            // Specify the fields to order by (if any)
            if (_orderByFields != null)
            {
                foreach (OrderFieldOption orderBy in _orderByFields)
                {
                    statQueryParams.OrderByFields.Add(orderBy.OrderInfo);
                }
            }

            // Ignore counties with missing data
            statQueryParams.WhereClause = "\"State\" IS NOT NULL";

            try
            {
                // Execute the statistical query with these parameters and await the results
                StatisticsQueryResult statQueryResult = await _usStatesTable.QueryStatisticsAsync(statQueryParams);

                // Get results formatted as a dictionary (group names and their associated dictionary of results)
                Dictionary <string, IReadOnlyDictionary <string, object> > resultsLookup = statQueryResult.ToDictionary(r => string.Join(", ", r.Group.Values), r => r.Statistics);

                // Create an instance of a custom list adapter that has logic to show results as expandable groups
                ExpandableResultsListAdapter expandableListAdapter = new ExpandableResultsListAdapter(this, resultsLookup);

                // Create an expandable list view and assign the expandable adapter
                ExpandableListView expandableResultsListView = new ExpandableListView(this);
                expandableResultsListView.SetAdapter(expandableListAdapter);

                // Show the expandable list view in a dialog
                AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
                dialogBuilder.SetView(expandableResultsListView);
                dialogBuilder.Show();
            }
            catch (Exception ex)
            {
                new AlertDialog.Builder(this).SetMessage(ex.ToString()).SetTitle("Error").Show();
            }
        }
Exemple #19
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                // Create your application here
                SetContentView(Resource.Layout.Newslayout);

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

                toolbar.SetBackgroundColor(Color.ParseColor("#bf920d"));
                //Toolbar will now take on default Action Bar characteristics
                SetActionBar(toolbar);
                //You can now use and reference the ActionBar
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                ActionBar.Title = "News";

                //var view = FindViewById<LinearLayout>(Resource.Id.view);
                //view.SetBackgroundColor(Color.ParseColor("#f3cd58"));

                List <News> newsList  = new List <News>();
                string      constring = "Data Source=noctis2.database.windows.net,1433;Initial Catalog=Birdwatching;Persist Security Info=True;User ID=snakesosa;Password=Freyasweetie1*;";
                //string constring2 = "Data Source=tcp:noctis2.database.windows.net,1433;Initial Catalog=Birdwatching;Persist Security Info=True;User ID=snakesosa;Password=Freyasweetie1*;MultipleActiveResultSets=False;Connection Timeout=30;";
                SqlDataReader rdr = null;

                using (SqlConnection connection = new SqlConnection(constring))
                {
                    SqlCommand cmd = new SqlCommand("dbo.allnews", connection);
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    //cmd.Parameters.Add("@email", SqlDbType.VarChar).Value = model.Email;

                    connection.Open();
                    rdr = cmd.ExecuteReader();

                    while (rdr.Read())
                    {
                        newsList.Add(new News()
                        {
                            NewsItem = rdr["NewsItem"].ToString(), Date = (DateTime)rdr["Date"], sDate = "News Update: " + ((DateTime)rdr["Date"]).ToString("dd/MM/yyyy")
                        });
                        //LoginRole = rdr["RoleId"].ToString();
                        //OwnerId = rdr["UserId"].ToString();
                    }
                    connection.Close();
                }
                newsList = newsList.OrderByDescending(x => x.Date).ToList();
                ExpandableListView expListView = FindViewById <ExpandableListView>(Resource.Id.Listview);
                var ListAdapter = new ExpandableScreenAdapter(this, newsList);
                //SetListAdapter(ListAdapter);
                expListView.SetAdapter(ListAdapter);
            }

            catch (Exception e)
            {
                Toast.MakeText(this, e.Message, ToastLength.Long).Show();
                //Console.WriteLine("{0} Exception caught.", e);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.sample_chooser_activity);
            sampleAdapter = new SampleAdapter(this);
            ExpandableListView sampleListView = (ExpandableListView)FindViewById(Resource.Id.sample_list);

            sampleListView.SetAdapter(sampleAdapter);
            sampleListView.SetOnChildClickListener(this);

            Intent intent  = Intent;
            string dataUri = intent.DataString;

            string[] uris;
            if (dataUri != null)
            {
                uris = new string[] { dataUri };
            }
            else
            {
                List <string> uriList      = new List <string>();
                AssetManager  assetManager = Assets;
                try
                {
                    foreach (string asset in assetManager.List(""))
                    {
                        if (asset.EndsWith(".exolist.json"))
                        {
                            uriList.Add("asset:///" + asset);
                        }
                    }
                }
                catch (Java.IO.IOException e)
                {
                    Toast.MakeText(ApplicationContext, Resource.String.sample_list_load_error, ToastLength.Long).Show();
                }

                uriList.Sort();
                uris = uriList.ToArray();
            }

            downloadTracker = ((DemoApplication)Application).GetDownloadTracker();
            SampleListLoader loaderTask = new SampleListLoader(this);

            loaderTask.Execute(uris);

            // Start the download service if it should be running but it's not currently.
            // Starting the service in the foreground causes notification flicker if there is no scheduled
            // action. Starting it in the background throws an exception if the app is in the background too
            // (e.g. if device screen is locked).
            try
            {
                Offline.DownloadService.Start(this, Java.Lang.Class.FromType(typeof(DemoDownloadService)));
            }
            catch (IllegalStateException e)
            {
                Offline.DownloadService.StartForeground(this, Java.Lang.Class.FromType(typeof(DemoDownloadService)));
            }
        }
Exemple #21
0
 public void SetData()
 {
     projectsContainer = RedMineManager.Get <ProjectsContainer>("/projects.json");
     projectsGroups    = ProjectsContainer.GetProjectsGroupId();
     projectsItems     = ProjectsContainer.GetProjectsItemsId(projectsContainer);
     mAdapter          = new ExpandableListViewAdapter(this, projectsGroups, projectsItems, projectsContainer.projects);
     RunOnUiThread(() => LVProjects.SetAdapter(mAdapter));
 }
        private void SetAttacksView()
        {
            var attacksView = viewFlipper.CurrentView;

            myAttackList = attacksView.FindViewById <ExpandableListView>(Resource.Id.attacksList);
            myAttackList.SetAdapter(new AttackListAdapter(myViewModel.Attacks, Activity));
            myAttackList.ItemClick += MyAttackList_ItemClick;
        }
Exemple #23
0
        private async Task ShowSavedSongs()
        {
            //initialize UI variables
            ExpandableListView savedList           = FindViewById <ExpandableListView>(Resource.Id.savedList);
            ListView           savedListNonGrouped = FindViewById <ListView>(Resource.Id.savedListNonGrouped);
            ProgressBar        progressBar         = FindViewById <ProgressBar>(Resource.Id.progressBar);

            //--UI--

            progressBar.Visibility = ViewStates.Visible;

            string path = Path.Combine(ApplicationPath, SavedLyricsLocation);

            await MiscTools.CheckAndCreateAppFolders();

            Log(Type.Info, $"Saved lyrics location is '{path}'");

            List <SongBundle> songList = await Database.GetSongList();

            if (songList != null)
            {
                await GetSavedList(songList);

                allSongs    = new List <SongBundle>();
                artistSongs = new Dictionary <Artist, List <SongBundle> >();

                foreach (Artist a in artistList)
                {
                    artistSongs.Add(a, a.Songs);

                    foreach (SongBundle s in a.Songs)
                    {
                        allSongs.Add(s);
                    }
                }

                Log(Type.Processing, "Set up adapter data");

                if (nonGrouped)
                {
                    savedListNonGrouped.Adapter = new SavedLyricsAdapter(this, allSongs);
                    Log(Type.Info, "Showing adapter for non grouped view");
                    progressBar.Visibility = ViewStates.Gone;
                }
                else
                {
                    savedList.SetAdapter(new ExpandableListAdapter(this, artistList, artistSongs));
                    Log(Type.Info, "Showing adapter for grouped view");
                    progressBar.Visibility = ViewStates.Gone;
                }
            }
            else
            {
                Log(Type.Info, "No files found!");
                progressBar.Visibility = ViewStates.Gone;
            }
        }
Exemple #24
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View v = inflater.Inflate(Resource.Layout.categoriesLayout, null);
            ExpandableListView ex = (ExpandableListView)v.FindViewById(Resource.Id.expandableListView1);

            ex.SetAdapter(mAdapter);
            ex.ChildClick += HandleSelect;
            return(v);
        }
        private async void yearSelectButton_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            Spinner yearSelectButton = (Spinner)sender;

            this.year = (string)yearSelectButton.GetItemAtPosition(e.Position);

            mAdapter = ExpandableListViewAdapter.CreateFromData(this, (await service.GetSeriesRatings(this.year, this.makeSlug, this.seriesSlug)));
            expandableListView.SetAdapter(mAdapter);
        }
Exemple #26
0
        private void CreateHamburgerMenu()
        {
            drawerLayout          = FindViewById <Android.Support.V4.Widget.DrawerLayout>(Resource.Id.drawer_layout);
            actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout,
                                                              Resource.String.NavigationDrawerOpen, Resource.String.NavigationDrawerClose);

            actionBarDrawerToggle.SyncState();

            ExpandableListView expandableList = FindViewById <ExpandableListView>(Resource.Id.navigationmenu);
            //setup navigation view
            NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.NavigationItemSelected += (sender, e) =>
            {
                var menuItem = e.MenuItem;

                int id = menuItem.ItemId;

                menuItem.SetChecked(!menuItem.IsChecked);
                drawerLayout.CloseDrawers();
            };

            PrepareListData();

            menuAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild, expandableList);

            expandableList.SetAdapter(menuAdapter);

            expandableList.ChildClick += delegate(object sender, ExpandableListView.ChildClickEventArgs e)
            {
                drawerLayout.CloseDrawers();

                List <string> ls = listDataChild[listDataHeader[e.GroupPosition]];

                string menuClicked = ls[(int)e.Id];

                if (menuClicked == "Settings")
                {
                }
                else if (menuClicked == "Edit Profile")
                {
                    Dialogs.UserAlertDialog.ShowDialog(this, LayoutInflater);
                }
                else if (menuClicked == "Beneficiary(ies)")
                {
                    SignatureRecoveryActivity.FirstTimeUse = false;
                    SignatureRecoveryActivity.WalletName   = "";

                    StartActivity(new Intent(Application.Context, typeof(SignatureRecoveryActivity)));
                }
                else
                {
                    Toast.MakeText(this, "child clicked : " + ls[(int)e.Id], ToastLength.Short).Show();
                }
            };
        }
Exemple #27
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            MobileAds.Initialize(this, "ca-app-pub-5131184764831509~8873327557");
            ShowBannerAd();
            ISharedPreferences       prefs  = PreferenceManager.GetDefaultSharedPreferences(this);
            ISharedPreferencesEditor editor = prefs.Edit();

            day    = DataProvider.getdayInfo(this);
            length = day.Length - 1;

            mButton        = FindViewById <Button>(Resource.Id.button1);
            mButton.Click += (sender, e) =>
            {
                editor.Clear();
                editor.Apply();

                Intent I = new Intent(this, typeof(MainActivity));
                StartActivity(I);
                Finish();
            };
            DatePickerChangeHandler datePickerChangeHandler = new DatePickerChangeHandler(this);

            DP    = FindViewById <DatePicker>(Resource.Id.datePicker1);
            DTNow = DateTime.Now;
            DP.Init(DTNow.Year, DTNow.Month - 1, DTNow.Day, datePickerChangeHandler);


            IndexofDay = DTNow.Month == 9 ? (DTNow.Day - 1) % length : DTNow.Month == 10 ? (DTNow.Day + 1) % length : DTNow.Month == 11 ? (DTNow.Day + 4) % length : DTNow.Month == 12 ? (DTNow.Day + 6) % length : length;


            myHeader = DataProvider.getInfo(this);
            myChild  = new List <string>();
            myChild.Add(day[IndexofDay]);
            mExListView = FindViewById <ExpandableListView>(Resource.Id.EListView);
            adapter     = new EListViewAdapter(this, myHeader, myChild);
            mExListView.SetAdapter(adapter);
            mExListView.ExpandGroup(0);


            mExListView.ChildClick += (sender, e) =>
            {
                if (prefs.Contains("QKG 3") || prefs.Contains("QKG 4"))
                {
                    ChildData = DataProvider.getChildInfo(myHeader[day[IndexofDay]][e.ChildPosition], day[IndexofDay], this);
                }
                else
                {
                    ChildData = DataProvider.getChildInfo(myHeader[day[IndexofDay]][e.ChildPosition], this);
                }
                RegisterForContextMenu(mExListView);
                OpenContextMenu(mExListView);
            };
        }
Exemple #28
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     SetContentView(Resource.Layout.Main);
     newDataList = Data.SampleData();
     myadapter   = new ExpandableDataAdapter(this, newDataList);
     listView    = FindViewById <ExpandableListView> (Resource.Id.myExpandableListview);
     listView.SetAdapter(myadapter);
     listView.SetOnChildClickListener(this);
 }
Exemple #29
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);
            expandableList = FindViewById <ExpandableListView> (Resource.Id.expandableListView);

            CreateExpendableListData();
            expandableList.SetAdapter(new ExpandableListAdapter(this, groupItems));
            expandableList.ChildClick += ExpandableList_ChildClick;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.CategoriesList);

            try
            {
                // Initialize the SampleManager and create the Sample Categories.
                SampleManager.Current.Initialize();
                _sampleCategories = SampleManager.Current.FullTree.Items.OfType <SearchableTreeNode>().ToList();

                // Remove AR category if device does not support AR.
                try
                {
                    var arSession = new Session(this);
                    _arCompatible = true;
                }
                catch (UnavailableException ex)
                {
                    Console.WriteLine(ex.Message);
                    _arCompatible = false;
                }

                if (!_arCompatible)
                {
                    _sampleCategories.RemoveAll(category => category.Name == "Augmented reality");
                }

                _filteredSampleCategories = _sampleCategories;

                // Set up the custom ArrayAdapter for displaying the Categories.
                var categoriesAdapter = new CategoriesAdapter(this, _sampleCategories);
                _categoriesListView = FindViewById <ExpandableListView>(Resource.Id.categoriesListView);
                _categoriesListView.SetAdapter(categoriesAdapter);
                _categoriesListView.ChildClick   += CategoriesListViewOnChildClick;
                _categoriesListView.DividerHeight = 2;
                _categoriesListView.SetGroupIndicator(null);

                // Set up the search filtering.
                SearchView searchBox = FindViewById <SearchView>(Resource.Id.categorySearchView);
                searchBox.QueryTextChange += SearchBoxOnQueryTextChange;

                // Add a button that brings up settings.
                Button settingsButton = FindViewById <Button>(Resource.Id.settingsButton);
                settingsButton.Click += (s, e) => PromptForKey();

                // Check the existing API key for validity.
                _ = CheckApiKey();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }