Esempio n. 1
0
        public override async void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);
            await _categoryView.LoadFromPersistence();

            _categoryListAdapter.NotifyDataSetChanged();

            var selectedCategoryPosition =
                _currentCategoryId == null ? 0 : _categoryView.IndexOf(_currentCategoryId) + 1;

            _categoryListAdapter.SelectedPosition = selectedCategoryPosition;
            _categoryListAdapter.NotifyItemChanged(selectedCategoryPosition);
        }
        private void OnSetDefaultClickedClick(object item, int position)
        {
            var category   = _categoryView.ElementAt(position);
            var oldDefault = _preferences.DefaultCategory;
            var isDefault  = oldDefault == category.Id;

            SetDefaultCategory(isDefault ? null : category.Id);

            if (oldDefault != null)
            {
                var oldDefaultPos = _categoryView.IndexOf(oldDefault);

                if (oldDefaultPos > -1)
                {
                    _categoryListAdapter.NotifyItemChanged(oldDefaultPos);
                }
            }

            _categoryListAdapter.NotifyItemChanged(position);
        }