public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (savedInstanceState != null) { var annotationsPanelStatusCache = FileCacheHelper.ReadCacheFile( ContentActivity.CacheCatagory, string.Format( AnnotationsPanelStatusCacheFile, ((ContentActivity)Activity).AsyncTaskActivityGUID)); if (annotationsPanelStatusCache != null) { status = JsonConvert.DeserializeObject <AnnotationsPanelFragmentStatus>(annotationsPanelStatusCache); } } var v = inflater.Inflate(Resource.Layout.contentpage_annotationspanel_fragment, container, false); ivTagFilter = v.FindViewById <ImageView>(Resource.Id.ivTagFilter); rvAnnotationList = v.FindViewById <RecyclerView>(Resource.Id.rvAnnotationList); rgAnnotationTypeFilter = v.FindViewById <RadioGroup>(Resource.Id.rgAnnotationTypeFilter); annotationListLayoutManager = new LinearLayoutManager(Activity); annotationListLayoutManager.Orientation = LinearLayoutManager.Vertical; rvAnnotationList.SetLayoutManager(annotationListLayoutManager); alrvAdaptor = new AnnotationListAdaptor( this, Resource.Layout.contentpage_annotationlist_annotationitem, TagContainerTotalWidthMargins); alrvAdaptor.SetAnnotationList(FakeAnnotationList); rvAnnotationList.SetAdapter(alrvAdaptor); rvAnnotationList.ViewTreeObserver.AddOnGlobalLayoutListener(this); ivTagFilter.Click += delegate { var tagFilterDialogFragment = new TagFilterDialogFragment(); tagFilterDialogFragment.Show(FragmentManager.BeginTransaction(), TagFilterDialogFragment.FragmentTag); }; rgAnnotationTypeFilter.Check(status.AnnotationTypeFilter); rgAnnotationTypeFilter.CheckedChange += AnnotationTypeFilterCheckedChange; return(v); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var v = inflater.Inflate(Resource.Layout.annotationlist_fragment, container, false); rgAnnotationTypeFilter = v.FindViewById <RadioGroup>(Resource.Id.rgAnnotationTypeFilter); rvTagFilter = v.FindViewById <RecyclerView>(Resource.Id.rvTagFilter); rvAnnotationList = v.FindViewById <RecyclerView>(Resource.Id.rvAnnotationList); tagFilterLayoutManager = new LinearLayoutManager(Activity); tagFilterLayoutManager.Orientation = LinearLayoutManager.Vertical; rvTagFilter.SetLayoutManager(tagFilterLayoutManager); if (cachedAdaptor == null || cachedAdaptor.Item1 != ((IAsyncTaskActivity)Activity).AsyncTaskActivityGUID) { cachedAdaptor = new Tuple <string, TagFilterAdaptor>( ((IAsyncTaskActivity)Activity).AsyncTaskActivityGUID, new TagFilterAdaptor(this)); } cachedAdaptor.Item2.SetTagList(AnnCategoryTagUtil.Instance.GetTags()); rvTagFilter.SetAdapter(cachedAdaptor.Item2); annotationListLayoutManager = new LinearLayoutManager(Activity); annotationListLayoutManager.Orientation = LinearLayoutManager.Vertical; rvAnnotationList.SetLayoutManager(annotationListLayoutManager); alrvAdaptor = new AnnotationListAdaptor( this, Resource.Layout.annotationlist_annotationitem, TagContainerTotalWidthMargins); alrvAdaptor.SetAnnotationList(FakeAnnotationList); rvAnnotationList.SetAdapter(alrvAdaptor); rvAnnotationList.ViewTreeObserver.AddOnGlobalLayoutListener(this); rgAnnotationTypeFilter.CheckedChange += AnnotationTypeFilterCheckedChange; return(v); }