Exemple #1
0
        bool ActionMode.ICallback.OnActionItemClicked(ActionMode mode, IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.appbar_fans_item_select_all:
                _adapter.SelectAll();
                _actionMode.Subtitle = GetString(Resource.String.title_selected, _adapter.SelectedItems.Count);
                return(true);

            case Resource.Id.appbar_fans_item_follow:
                _taskAwaiter.AwaitTask(BatchFollowAsync(_adapter.GetSelected()));
                mode.Finish();
                return(true);

            case Resource.Id.appbar_fans_item_whitelist:
                _adapter.Whitelist.AddRange(_adapter.GetSelected());
                ((IDataStorage)Activity).SaveData(GetWhitelistFileName(),
                                                  _adapter.Whitelist);
                _adapter.Refresh();
                _adapter.NotifyDataSetChanged();
                if (_adapter.ItemCount <= 0)
                {
                    ((IFragmentContainer)Activity).ShowEmptyView();
                }
                mode.Finish();
                return(true);

            default:
                return(false);
            }
        }
Exemple #2
0
        // TODO
        //private void FansFragment_RetryClick(object sender, EventArgs e)
        //{
        //    _taskAwaiter.AwaitTask(_account.RefreshAsync());
        //}

        private void SelectOrDeselectItem(int pos)
        {
            _adapter.SelectOrDeselectItem(pos);

            if (_adapter.SelectedItems.Count <= 0)
            {
                _actionMode?.Finish();
                return;
            }

            if (_actionMode == null)
            {
                _actionMode       = ((AppCompatActivity)Activity).StartSupportActionMode(this);
                _actionMode.Title = _account.Data.User.Fullname;
            }

            _actionMode.Subtitle = GetString(Resource.String.title_selected, _adapter.SelectedItems.Count);
        }
Exemple #3
0
        public bool OnActionItemClicked(ActionMode mode, IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.appbar_unfollow_item_selectall:
                _adapter.SelectAll();
                _action_mode.Subtitle = string.Format(
                    GetString(Resource.String.title_selected),
                    _adapter.SelectedItems.Count);
                return(true);

            case Resource.Id.appbar_unfollow_item_unfollow:
                DoTask(BatchUnfollowAsync(
                           _adapter.GetSelected()),
                       _refresh_adapter_data);
                mode.Finish();
                return(true);

            default:
                return(false);
            }
        }
Exemple #4
0
 void ActionMode.ICallback.OnDestroyActionMode(ActionMode mode)
 {
     _adapter.DeselectAll();
     mode.Dispose();
     _actionMode = null;
 }
Exemple #5
0
 bool ActionMode.ICallback.OnCreateActionMode(ActionMode mode, IMenu menu)
 {
     mode.MenuInflater.Inflate(Resource.Menu.appbar_menu_fans_contextual, menu);
     return(true);
 }
Exemple #6
0
 bool ActionMode.ICallback.OnPrepareActionMode(ActionMode mode, IMenu menu)
 {
     return(false);
 }
Exemple #7
0
 public bool OnPrepareActionMode(ActionMode mode, IMenu menu)
 {
     return(false);
 }
Exemple #8
0
 public void OnDestroyActionMode(ActionMode mode)
 {
     _adapter.DeselectAll();
     mode.Dispose();
     _action_mode = null;
 }
Exemple #9
0
 public bool OnCreateActionMode(ActionMode mode, IMenu menu)
 {
     mode.MenuInflater
     .Inflate(Resource.Menu.appbar_menu_unfollow_contextual, menu);
     return(true);
 }