コード例 #1
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)
                {
                    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
ファイル: CellAdapter.cs プロジェクト: yuka1984/Xamarin.Forms
        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
ファイル: CellAdapter.cs プロジェクト: zBrianW/Xamarin.Forms
 bool global::Android.Support.V7.View.ActionMode.ICallback.OnPrepareActionMode(global::Android.Support.V7.View.ActionMode mode, IMenu menu)
 {
     return(OnPrepareActionModeImpl(menu));
 }
コード例 #4
0
ファイル: CellAdapter.cs プロジェクト: zBrianW/Xamarin.Forms
 void global::Android.Support.V7.View.ActionMode.ICallback.OnDestroyActionMode(global::Android.Support.V7.View.ActionMode mode)
 {
     OnDestroyActionModeImpl();
     _supportActionMode.Dispose();
     _supportActionMode = null;
 }
コード例 #5
0
ファイル: CellAdapter.cs プロジェクト: zBrianW/Xamarin.Forms
 bool global::Android.Support.V7.View.ActionMode.ICallback.OnCreateActionMode(global::Android.Support.V7.View.ActionMode mode, IMenu menu)
 {
     CreateContextMenu(menu);
     return(true);
 }
コード例 #6
0
ファイル: CellAdapter.cs プロジェクト: zBrianW/Xamarin.Forms
 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);
 }