Пример #1
0
        private TextColoringAdapterWithLoadMoreButton CreateListAdapter()
        {
            var from      = new[] { "User", "Msg", "Date" };
            var to        = new[] { Ids.LatestCommitsWidget_ChangesetUser, Ids.LatestCommitsWidget_ChangesetText, Ids.LatestCommitsWidget_ChangesetDate };
            var listItems = CreateListItems();
            var layout    = Resource.Layout.LatestCommitsWidget_ListItem;

            var adapter = new TextColoringAdapterWithLoadMoreButton(Context, listItems, layout, from, to, GetHighlightColor());

            adapter.LoadMoreClick += (o, e) =>
            {
                scrollDown = true;
                GC.Collect(0); //LoadMore is expensive memory wise, so we do a minor GC here
                model.LoadMore(() => ((Activity)Context).RunOnUiThread(Redraw));
            };
            return(adapter);
        }
Пример #2
0
        public void Redraw()
        {
            var listView = FindViewById <ListView>(Resource.Id.LatestCommitsList);
            var lastItemBeforeExpansion = Math.Max(0, listView.Count - 1);

            if (ShouldRecreateListAdapter())
            {
                listAdapter = CreateListAdapter();
            }

            listAdapter.ButtonEnabled = model.HasMore;
            listView.Adapter          = listAdapter;

            if (scrollDown)
            {
                var xScroll = lastItemBeforeExpansion == 0
                                  ? 0
                                  : Height - 70;
                listView.SetSelectionFromTop(lastItemBeforeExpansion, xScroll);
            }
            OnDescriptionChanged(new EventArgs());
        }
Пример #3
0
        public void Redraw()
        {
            var listView = FindViewById<ListView>(Resource.Id.LatestCommitsList);
            var lastItemBeforeExpansion = Math.Max(0, listView.Count - 1);

            if (ShouldRecreateListAdapter())
            {
                listAdapter = CreateListAdapter();
            }

            listAdapter.ButtonEnabled = model.HasMore;
            listView.Adapter = listAdapter;

            if (scrollDown)
            {
                var xScroll = lastItemBeforeExpansion == 0
                                  ? 0
                                  : Height - 70;
                listView.SetSelectionFromTop(lastItemBeforeExpansion, xScroll);
            }
            OnDescriptionChanged(new EventArgs());
        }
Пример #4
0
        private TextColoringAdapterWithLoadMoreButton CreateListAdapter()
        {
            var from = new[] { "User", "Msg", "Date" };
            var to = new[] { Ids.LatestCommitsWidget_ChangesetUser, Ids.LatestCommitsWidget_ChangesetText, Ids.LatestCommitsWidget_ChangesetDate };
            var listItems = CreateListItems();
            var layout = Resource.Layout.LatestCommitsWidget_ListItem;

            var adapter = new TextColoringAdapterWithLoadMoreButton(Context, listItems, layout, from, to, GetHighlightColor());
            adapter.LoadMoreClick += (o, e) =>
            {
                scrollDown = true;
                GC.Collect(0); //LoadMore is expensive memory wise, so we do a minor GC here
                model.LoadMore(() => ((Activity) Context).RunOnUiThread(Redraw));
            };
            return adapter;
        }