Пример #1
0
        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 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)));
            }
        }
Пример #3
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);
 }
Пример #4
0
        /// <summary>
        /// ExpandableListAdapter constructor. Set up a long click listener and the group expander helper class
        /// </summary>
        /// <param name="context"></param>
        /// <param name="view"></param>
        /// <param name="provider"></param>
        public ExpandableListAdapter(Context context, ExpandableListView view, IGroupContentsProvider <T> provider,
                                     ExpandableListAdapterModel model, IAdapterEventHandler stateChange)
        {
            // Save the parameters
            adapterModel        = model;
            contentsProvider    = provider;
            parentView          = view;
            stateChangeReporter = stateChange;

            // Save the inflator to use when creating the item views
            inflator = LayoutInflater.FromContext(context);

            // Set up listeners for group and child selection and item long click
            parentView.SetOnGroupClickListener(this);
            parentView.SetOnChildClickListener(this);
            parentView.OnItemLongClickListener = this;
            parentView.SetOnScrollListener(this);
        }
Пример #5
0
        /// <summary>
        /// Setups the side menu.
        /// </summary>
        /// <returns>The side menu.</returns>
        private async void SetupSideMenu()
        {
            LoginResponse loginResponseObj = mSharedPreferencesManager.GetLoginResponse();

            drawerList = FindViewById <RelativeLayout>(Resource.Id.left_drawer);
            TextView txt_user_name  = FindViewById <TextView>(Resource.Id.txt_user_name);
            TextView txt_user_email = FindViewById <TextView>(Resource.Id.txt_user_email);

            txt_user_name.Text  = loginResponseObj.Name;
            txt_user_email.Text = loginResponseObj.UserEmail;

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

            menuListView.SetOnChildClickListener(this);
            menuListView.SetOnGroupClickListener(this);
            menuListView.SetOnGroupExpandListener(this);

            menuList = GetExpandableMenuItem();
            mAdapter = new SideMenuListExpandableAdapter(mActivity, menuList);

            // set up the drawer's list view with items and click listener
            menuListView.SetAdapter(mAdapter);

            drawerToggle = new MyActionBarDrawerToggle(this,
                                                       drawerLayout, toolbar,
                                                       Resource.String.open_drawer,
                                                       Resource.String.close_drawer);
            drawerLayout.AddDrawerListener(drawerToggle);

            SupportActionBar.SetDisplayShowHomeEnabled(true);

            drawerToggle.SyncState();
            drawerToggle.DrawerIndicatorEnabled = true;

            // Call Email Count webservice
            await GetEmailCounts();
        }
Пример #6
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View v = inflater.Inflate(Resource.Layout.ChooseCoffee, null);

            favChecked = false;

            v.FindViewById <ImageView> (Resource.Id.chosen_logo).SetBackgroundResource(TempStorage.ChosenLogo);
            coffeeLv  = v.FindViewById <ExpandableListView> (Android.Resource.Id.List);
            payButton = v.FindViewById <Button> (Resource.Id.btnPay);

            payButton.Click += delegate {
                ProcessPayments();
            };

            coffeeAdapter = new ExpandableListAdapter(this.Activity, CoffeeData);

            coffeeLv.SetAdapter(coffeeAdapter);
            coffeeLv.SetOnChildClickListener(this);

            //don't forget!
            price = "4.50";

            return(v);
        }