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)));
            }
        }
示例#2
0
        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);
            SampleAdapter adapter = new SampleAdapter(Activity);

            for (var i = 0; i < 20; i++)
            {
                adapter.Add(new SampleItem("Sample List", Android.Resource.Drawable.IcMenuSearch));
            }
            ListAdapter = adapter;
        }
        public override void OnActivityCreated(Bundle p0)
        {
            base.OnActivityCreated(p0);
            var adapter = new SampleAdapter(Activity);

            for (var i = 0; i < 20; i++)
            {
                adapter.Add(new SampleItem {
                    IconRes = Android.Resource.Drawable.IcMenuSearch, Tag = "Sample Demo List"
                });
            }
            ListAdapter = adapter;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.sample_chooser_activity);

            var sampleList    = FindViewById <ListView>(Resource.Id.sample_list);
            var sampleAdapter = new SampleAdapter(this);

            sampleAdapter.Add(new Header("YouTube DASH"));
            // ReSharper disable CoVariantArrayConversion
            sampleAdapter.AddAll(Samples.YoutubeDashMp4);
            sampleAdapter.Add(new Header("Widevine GTS DASH"));
            sampleAdapter.AddAll(Samples.WidevineGts);
            sampleAdapter.Add(new Header("SmoothStreaming"));
            sampleAdapter.AddAll(Samples.Smoothstreaming);
            sampleAdapter.Add(new Header("HLS"));
            sampleAdapter.AddAll(Samples.Hls);
            sampleAdapter.Add(new Header("Misc"));
            sampleAdapter.AddAll(Samples.Misc);

            // Add WebM samples if the device has a VP9 decoder.
            try
            {
                if (MediaCodecUtil.GetDecoderInfo(MimeTypes.VideoVp9, false) != null)
                {
                    sampleAdapter.Add(new Header("YouTube WebM DASH (Experimental)"));
                    sampleAdapter.AddAll(Samples.YoutubeDashWebm);
                }
            }
            catch (MediaCodecUtil.DecoderQueryException e)
            {
                Log.Error(Tag, "Failed to query vp9 decoder", e);
            }
            // ReSharper restore CoVariantArrayConversion

            sampleList.Adapter    = sampleAdapter;
            sampleList.ItemClick += (sender, args) =>
            {
                var item   = sampleAdapter.GetItem(args.Position);
                var sample = item as Samples.Sample;
                if (sample != null)
                {
                    OnSampleSelected(sample);
                }
            };
        }
示例#5
0
 private async Task LoadFilteredData(string filter)
 {
     listesamplecurrent = listesamplefull;
     if (!String.IsNullOrWhiteSpace(filter))
     {
         listesamplecurrent = listesamplefull.Where(x => x.Title.Contains(filter)).ToList();
         //On crée notre CustomAdapter
         SampleAdapter myadapter = new SampleAdapter(this, listesamplecurrent);
         //On assigne notre customAdapter à notre listview
         mylist.Adapter = myadapter;
     }
     else
     {
         SampleAdapter myadapter = new SampleAdapter(this, listesamplecurrent);
         //On assigne notre customAdapter à notre listview
         mylist.Adapter = myadapter;
     }
 }
示例#6
0
        /// <summary>
        /// Override to create the required scene
        /// </summary>
        protected override void OnCreate()
        {
            base.OnCreate();

            // Get the window instance and change background color
            Window window = Window.Instance;

            window.BackgroundColor = Color.White;

            SampleAdapter sampleAdapter = new SampleAdapter();

            sampleAdapter.Data = DummyData.CreateDummyData(50);

            recyclerView = new Tizen.NUI.Wearable.RecyclerView(sampleAdapter, new RecycleLayoutManager())
            {
                // Size = new Size(480, 800),
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
            };

            window.Add(recyclerView);

            window.KeyEvent += OnKeyEvent;
        }
示例#7
0
        /// <summary>
        /// Override to create the required scene
        /// </summary>
        protected override void OnCreate()
        {
            base.OnCreate();

            // Get the window instance and change background color
            Window window = Window.Instance;

            window.BackgroundColor = new Color("#141414");

            View root = new View()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                },
            };

            window.Add(root);

            TextLabel horizontalLabel = new TextLabel("Horizontal Grid")
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = 60,
                VerticalAlignment   = VerticalAlignment.Center,
                TextColor           = Color.White,
                Margin    = new Extents(20, 0, 10, 0),
                PointSize = 18,
            };

            root.Add(horizontalLabel);

            SampleAdapter horizontalAdapter = new SampleAdapter();

            horizontalAdapter.Data = DummyData.CreateDummyPictureData(73);

            RecyclerView horizontalGrid = new RecyclerView()
            {
                Adapter       = horizontalAdapter,
                LayoutManager = new GridRecycleLayoutManager()
                {
                    LayoutOrientation = RecycleLayoutManager.Orientation.Horizontal,
                    Row = 2,
                },
                ScrollingDirection  = ScrollableBase.Direction.Horizontal,
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = 240,
                TotalItemCount      = 20,
            };

            root.Add(horizontalGrid);

            TextLabel verticalLabel = new TextLabel("Vertical Grid")
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = 60,
                VerticalAlignment   = VerticalAlignment.Center,
                TextColor           = Color.White,
                Margin    = new Extents(20, 0, 10, 0),
                PointSize = 18,
            };

            root.Add(verticalLabel);

            SampleAdapter verticalAdapter = new SampleAdapter();

            verticalAdapter.Data = DummyData.CreateDummyPictureData(132);

            RecyclerView verticalGrid = new RecyclerView()
            {
                Adapter       = verticalAdapter,
                LayoutManager = new GridRecycleLayoutManager()
                {
                    LayoutOrientation = RecycleLayoutManager.Orientation.Vertical,
                    Column            = 4,
                },
                ScrollingDirection = ScrollableBase.Direction.Vertical,
                Weight             = 1,
                TotalItemCount     = 40,
            };

            root.Add(verticalGrid);

            window.KeyEvent += OnKeyEvent;
        }
示例#8
0
 public SampleFilter(SampleAdapter adapter)
 {
     _adapter = adapter;
 }