예제 #1
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            var holder = (CategoriesListHolder)viewHolder;

            holder.Name.Text = position == 0
                ? _context.Resources.GetString(Resource.String.categoryAll)
                : _source.Get(position - 1).Name;

            holder.ItemView.Selected = position == _selectedPosition;
        }
예제 #2
0
        private void OnMenuClick(object sender, int position)
        {
            var category = _categorySource.Get(position);

            if (category == null)
            {
                return;
            }

            var isDefault = _preferences.DefaultCategory == category.Id;
            var fragment  = new EditCategoryMenuBottomSheet(position, isDefault);

            fragment.ClickRename     += OnRenameClick;
            fragment.ClickSetDefault += OnSetDefaultClick;
            fragment.ClickDelete     += OnDeleteClick;
            fragment.Show(SupportFragmentManager, fragment.Tag);
        }
예제 #3
0
        private void OnMenuClick(object sender, int position)
        {
            var category = _categorySource.Get(position);

            if (category == null)
            {
                return;
            }

            var bundle = new Bundle();

            bundle.PutInt("position", position);
            bundle.PutBoolean("isDefault", _preferences.DefaultCategory == category.Id);

            var fragment = new EditCategoryMenuBottomSheet {
                Arguments = bundle
            };

            fragment.ClickRename     += OnRenameClick;
            fragment.ClickSetDefault += OnSetDefaultClick;
            fragment.ClickDelete     += OnDeleteClick;
            fragment.Show(SupportFragmentManager, fragment.Tag);
        }
예제 #4
0
        private async void OnCategoriesDialogCategoryClick(object sender, AssignCategoriesBottomSheet.CategoryClickedEventArgs e)
        {
            var categoryId = _categorySource.Get(e.CategoryPosition).Id;
            var authSecret = _authSource.Get(e.ItemPosition).Secret;

            if (e.IsChecked)
            {
                await _authSource.AddToCategory(categoryId, authSecret);
            }
            else
            {
                await _authSource.RemoveFromCategory(categoryId, authSecret);
            }
        }
        private void OnRenameClick(object item, int position)
        {
            var category = _categorySource.Get(position);

            if (category == null)
            {
                return;
            }

            var fragment = new EditCategoryBottomSheet(EditCategoryBottomSheet.Mode.Edit, position, category.Name);

            fragment.Submit += OnRenameDialogSubmit;
            fragment.Show(SupportFragmentManager, fragment.Tag);
        }
 public override long GetItemId(int position)
 {
     return(_source.Get(position).Id.GetHashCode());
 }
예제 #7
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            var holder = (ManageCategoriesListHolder)viewHolder;

            holder.Name.Text = _source.Get(position).Name;
        }