bool HandleContextMode(AView view, int position)
        {
            if (view is EditText || view is TextView || view is SearchView)
            {
                return(false);
            }

            Cell cell = GetCellForPosition(position);

            if (cell == null)
            {
                return(false);
            }

            if (_actionMode != null || _supportActionMode != null)
            {
                if (!cell.HasContextActions)
                {
                    CloseContextActions();
                    return(false);
                }

                ActionModeContext = cell;

                if (ActionModeContext.IsContextActionsLegacyModeEnabled == false)
                {
                    _actionModeNeedsUpdates = true;
                }

                _actionMode?.Invalidate();
                _supportActionMode?.Invalidate();
            }
            else
            {
                if (!cell.HasContextActions)
                {
                    return(false);
                }

                ActionModeContext = cell;

                var appCompatActivity = view.Context as AppCompatActivity;
                if (appCompatActivity == null)
                {
                    _actionMode = view.Context.GetActivity().StartActionMode(this);
                }
                else
                {
                    _supportActionMode = appCompatActivity.StartSupportActionMode(this);
                }
            }

            ContextView = view;

            return(true);
        }
示例#2
0
        bool HandleContextMode(AView view, int position)
        {
            if (view is EditText || view is TextView || view is SearchView)
            {
                return(false);
            }

            Cell cell = GetCellForPosition(position);

            if (cell == null)
            {
                return(false);
            }

            if (_actionMode != null || _supportActionMode != null)
            {
                if (!cell.HasContextActions)
                {
                    _actionMode?.Finish();
                    _supportActionMode?.Finish();
                    return(false);
                }

                ActionModeContext = cell;

                _actionMode?.Invalidate();
                _supportActionMode?.Invalidate();
            }
            else
            {
                if (!cell.HasContextActions)
                {
                    return(false);
                }

                ActionModeContext = cell;

                var appCompatActivity = Forms.Context as FormsAppCompatActivity;
                if (appCompatActivity == null)
                {
                    _actionMode = ((Activity)Forms.Context).StartActionMode(this);
                }
                else
                {
                    _supportActionMode = appCompatActivity.StartSupportActionMode(this);
                }
            }

            ContextView = view;

            return(true);
        }
示例#3
0
 bool global::Android.Support.V7.View.ActionMode.ICallback.OnPrepareActionMode(global::Android.Support.V7.View.ActionMode mode, IMenu menu)
 {
     return(OnPrepareActionModeImpl(menu));
 }
示例#4
0
 void global::Android.Support.V7.View.ActionMode.ICallback.OnDestroyActionMode(global::Android.Support.V7.View.ActionMode mode)
 {
     OnDestroyActionModeImpl();
     _supportActionMode.Dispose();
     _supportActionMode = null;
 }
示例#5
0
 bool global::Android.Support.V7.View.ActionMode.ICallback.OnCreateActionMode(global::Android.Support.V7.View.ActionMode mode, IMenu menu)
 {
     CreateContextMenu(menu);
     return(true);
 }
示例#6
0
 bool global::Android.Support.V7.View.ActionMode.ICallback.OnActionItemClicked(global::Android.Support.V7.View.ActionMode mode, IMenuItem item)
 {
     mode.Menu.Clear();
     OnActionItemClickedImpl(item);
     _supportActionMode?.Finish();
     return(true);
 }