//#region SearchView.IOnQueryTextListener Members


        //public bool OnQueryTextChange (string query)
        //{
        //	//begins an async filtering operation
        //	((Android.Widget.IFilterable) Adapter).Filter.InvokeFilter (query);

        //	return true;
        //}


        //public bool OnQueryTextSubmit (string query)
        //{
        //	return false;
        //}


        //#endregion


        protected override void UpdateContent()
        {
            if (Assets?.Count == 0 && ContentClient.Shared.AvContent.Count > 0)
            {
                var content = ContentClient.Shared.AvContent [UserRoles.General]
                              .Where(m => m.HasId && m.HasRemoteAssetUri)
                              .Select(s => AssetPersistenceManager.Shared.GetMusicAsset(s))
                              .ToList();

                Activity.RunOnUiThread(() => ContentAdapter.SetItems(content));
            }
            else
            {
                //var newAssets = ContentClient.Shared.AvContent [UserRoles.General].Where (m => m.HasId && m.HasRemoteAssetUri && !allAssets.Any (ma => ma.Id == m.Id))
                //																  .Select (s => AssetPersistenceManager.Shared.GetMusicAsset (s));



                //allAssets.AddRange (newAssets);

                //allAssets.RemoveAll (ma => !ContentClient.Shared.AvContent [UserRoles.General].Any (a => a.Id == ma.Id));

                //allAssets.Sort ((x, y) => y.Music.Timestamp.CompareTo (x.Music.Timestamp));


                var content = ContentClient.Shared.AvContent [UserRoles.General].Where(m => m.HasId && m.HasRemoteAssetUri)
                              .Select(s => AssetPersistenceManager.Shared.GetMusicAsset(s))
                              .ToList();

                Activity.RunOnUiThread(() => ContentAdapter.SetItems(content));
            }

            Log.Debug("Content updated in ContentRecyclerFragment");
        }
Esempio n. 2
0
        private async void SetUpContentRecycler(RecyclerView recyclerView, View view)
        {
            ((SimpleItemAnimator)recyclerView.GetItemAnimator()).SupportsChangeAnimations = false;
            recyclerView.SetLayoutManager(new LinearLayoutManager(Context));
            recyclerView.AddItemDecoration(new VerticalSpaceItemDecoration(20)
            {
                ShouldShowBeforeFirst = true
            });

            _currentPath = FilePathHelper.INITIAL_LOCAL_DIRECTORY;
            _isAtRoot    = true;

            _localFetcher = new LocalFetcher(FilePathHelper.INITIAL_LOCAL_DIRECTORY);

            //var thumbnailGenerator = new ThumbnailGenerator();
            //_previewManager = new PreviewManager(thumbnailGenerator);

            await _localFetcher.Fetch();

            _contentAdapter            = new ContentAdapter(Activity, _localFetcher.RootContents.Cast <IContent>().ToList());
            _contentAdapter.ItemClick += (s, args) => OpenContent(args.Item);

            //_contentAdapter.SetMultiChoiceModeListener(this);
            //_contentAdapter.ItemClick += FragmentHelper.Push(Activity, IncidentDetailsFragment.Instantiate(args.Item.PetID, args.Item.IncidentTypeID));

            recyclerView.SetAdapter(_contentAdapter);
        }