示例#1
0
 private void OnEditTag(AnnotationTag tag)
 {
     NewEditTagDialogFragment.NewInstance(
         tag.TagId.ToString(),
         tag.Title,
         tag.Color).Show(
         Activity.SupportFragmentManager.BeginTransaction(),
         NewEditTagDialogFragment.NewEditTagDialogFragmentTag);
     Dismiss();
 }
示例#2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            Dialog.RequestWindowFeature((int)WindowFeatures.NoTitle);
            Dialog.SetCanceledOnTouchOutside(true);

            var vwDialog = inflater.Inflate(Resource.Layout.annotation_edittags_popup, container);

            rcAnnotationList = vwDialog.FindViewById <RecyclerView>(Resource.Id.rcAnnotationList);
            vwDialog.FindViewById <View>(Resource.Id.ivAddTag).Click += delegate
            {
                NewEditTagDialogFragment.NewInstance().Show(
                    Activity.SupportFragmentManager.BeginTransaction(),
                    NewEditTagDialogFragment.NewEditTagDialogFragmentTag);
                Dismiss();
            };

            llm             = new LinearLayoutManager(Activity);
            llm.Orientation = LinearLayoutManager.Vertical;
            llm.ScrollToPosition(0);
            rcAnnotationList.SetLayoutManager(llm);

            tagm = new RecyclerViewTouchActionGuardManager();
            tagm.SetInterceptVerticalScrollingWhileAnimationRunning(true);
            tagm.Enabled = true;

            ddm = new RecyclerViewDragDropManager();
            ddm.SetInitiateOnLongPress(true);
            ddm.SetInitiateOnMove(false);

            sm = new RecyclerViewSwipeManager();
            sm.UserHandleSwipeUi = true;

            if (editTagsListAdaptor == null)
            {
                editTagsListAdaptor = new EditTagsListAdaptor(OnEditTag, OnDeleteTag, OnSortTag);
            }

            editTagsListAdaptor.SetTagList(AnnCategoryTagUtil.Instance.GetTags());

            wrappedAdapter = ddm.CreateWrappedAdapter(editTagsListAdaptor);
            wrappedAdapter = sm.CreateWrappedAdapter(wrappedAdapter);

            ia = new SwipeDismissItemAnimator();

            rcAnnotationList.SetAdapter(wrappedAdapter);
            rcAnnotationList.SetItemAnimator(ia);

            tagm.AttachRecyclerView(rcAnnotationList);
            sm.AttachRecyclerView(rcAnnotationList);
            ddm.AttachRecyclerView(rcAnnotationList);

            return(vwDialog);
        }
        public static NewEditTagDialogFragment NewInstance(string tagId = null, string tagName = null, string tagColor = null)
        {
            var b        = new Bundle();
            var fragment = new NewEditTagDialogFragment();

            fragment.Arguments = b;
            if (!string.IsNullOrEmpty(tagId) &&
                !string.IsNullOrEmpty(tagName) &&
                !string.IsNullOrEmpty(tagColor))
            {
                b.PutString(TagIdKey, tagId);
                b.PutString(TagNameKey, tagName);
                b.PutString(TagColorKey, tagColor);
            }

            return(fragment);
        }