Пример #1
0
        private void TaskAwaiter_TaskDone(object sender, EventArgs e)
        {
            _adapter.Refresh();
            _adapter.NotifyDataSetChanged();

            if (_adapter.ItemCount <= 0)
            {
                ((IFragmentContainer)Activity).ShowEmptyView();
            }
        }
Пример #2
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            if (savedInstanceState != null)
            {
                ((IFragmentContainer)Activity).PopFragment();
                return;
            }

            _taskAwaiter           = new TaskAwaiter((IFragmentContainer)Activity);
            _taskAwaiter.TaskDone += TaskAwaiter_TaskDone;

            _accountPosition = Arguments.GetInt(AccountIndexBundleKey, -1);
            if (_accountPosition < 0)
            {
                throw new ArgumentException();
            }
            _account = ((IInstagramAccounts)Activity).GetAccount(_accountPosition);

            ((IActionBarContainer)Activity).SetTitle(_account.Data.User.Fullname);

            ((IEmptyView)Activity).SetEmptyText(Resource.String.msg_no_unfollower);
            ((IEmptyView)Activity).SetEmptyImage(Resource.Drawable.ic_person_remove_black_48dp);

            _recyclerView = view.FindViewById <RecyclerView>(Resource.Id.fragment_recyclerview_view);

            _adapter = new UnfollowerAdapter(_account, (ICacheProvider)Activity, this);
            _recyclerView.SetAdapter(_adapter);

            var whitelistFileName = GetWhitelistFileName();
            var dataContainer     = (IDataStorage)Activity;

            if (dataContainer.DataExists(whitelistFileName))
            {
                var whiteList = (List <User>)dataContainer.LoadData(whitelistFileName);
                _adapter.Whitelist.AddRange(whiteList);
            }

            _adapter.Refresh();

            if (_adapter.ItemCount <= 0)
            {
                ((IFragmentContainer)Activity).ShowEmptyView();
            }
        }
Пример #3
0
        private void UnfollowFragment_Create(object sender, OnCreateEventArgs e)
        {
            Title = _account.Data.User.Fullname;
            // TODO: set ErrorText
            // TODO: set EmptyText
            SetEmptyImage(Resource.Drawable.ic_person_remove_black_48dp);

            _adapter = new UnfollowerAdapter(_account, this);

            var wl_file_name   = _account.Data.User.Id + ".whitelist";
            var data_container = (IDataContainer)Activity;

            if (data_container.DataExists(wl_file_name))
            {
                var wl = (List <User>)data_container.LoadData(wl_file_name);
                _adapter.Whitelist.AddRange(wl);
            }

            Adapter = _adapter;
            _adapter.Refresh();
            ViewMode = RecyclerViewMode.Data;
        }