예제 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.MainLayout);

            // inject views
            Geneticist.Splice(this);

            // set up chrome
            drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, Resource.String.drawer_open, Resource.String.drawer_close);
            drawerLayout.SetDrawerListener(drawerToggle);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            //var styledAttributes = Theme.ObtainStyledAttributes(new[] { Android.Resource.Attribute.ActionBarSize });
            //var actionBarSize = (int)styledAttributes.GetDimension(0, 0);
            //styledAttributes.Recycle();

            // set up list view
            stickyList.EmptyView = FindViewById(Resource.Id.empty);
            stickyList.DrawingListUnderStickyHeader = true;
            stickyList.AreHeadersSticky             = true;
            stickyList.StickyHeaderTopOffset        = 0;// -20;
            stickyList.AddHeaderView(LayoutInflater.Inflate(Resource.Layout.ListHeader, null));
            stickyList.AddFooterView(LayoutInflater.Inflate(Resource.Layout.ListFooter, null));
            stickyList.ItemClick += (sender, e) =>
                                    Toast.MakeText(this, "Item " + e.Position + " clicked!", ToastLength.Short).Show();
            stickyList.HeaderClick += (sender, e) =>
                                      Toast.MakeText(this, "Header " + e.HeaderId + " currentlySticky ? " + e.CurrentlySticky, ToastLength.Short).Show();
            stickyList.StickyHeaderChanged       += (sender, e) => ViewHelper.SetAlpha(e.Header, 1);
            stickyList.StickyHeaderOffsetChanged += (sender, e) =>
            {
                if (fadeHeader)
                {
                    ViewHelper.SetAlpha(e.Header, 1 - (e.Offset / (float)e.Header.MeasuredHeight));
                }
            };

            // set up data
            adapter            = new StickyAdapter(this);
            stickyList.Adapter = adapter;

            // actions
            openExpandableListButton.Click += (sender, e) => StartActivity(new Intent(this, typeof(ExpandableListActivity)));
            restoreButton.Click            += (sender, e) => adapter.Restore();
            updateButton.Click             += (sender, e) => adapter.NotifyDataSetChanged();
            clearButton.Click                += (sender, e) => adapter.Clear();
            stickyCheckBox.CheckedChange     += (sender, e) => stickyList.AreHeadersSticky = e.IsChecked;
            fadeCheckBox.CheckedChange       += (sender, e) => fadeHeader = e.IsChecked;
            drawBehindCheckBox.CheckedChange += (sender, e) => stickyList.DrawingListUnderStickyHeader = e.IsChecked;
            fastScrollCheckBox.CheckedChange += (sender, e) =>
            {
                stickyList.SetFastScrollEnabled(e.IsChecked);
                stickyList.FastScrollAlwaysVisible = e.IsChecked;
            };
        }
        public override View OnCreateView(LayoutInflater p0, ViewGroup p1, Bundle p2)
        {
            var v = p0.Inflate(Resource.Layout.fragment_test, p1, false);
            m_StickyList = v.FindViewById<StickyListHeadersListView>(Resource.Id.list);
            m_StickyList.OnItemClickListener = this;
            m_StickyList.OnHeaderListClickListener = this;
            m_StickyList.AddHeaderView(p0.Inflate(Resource.Layout.list_header, null));
            m_StickyList.AddFooterView(p0.Inflate(Resource.Layout.list_footer, null));

            m_Adapter = new TestBaseAdapter(Activity);
            m_StickyList.EmptyView = v.FindViewById(Resource.Id.empty);
            m_StickyList.Adapter = m_Adapter;
            return v;
        }
예제 #3
0
        public override View OnCreateView(LayoutInflater p0, ViewGroup p1, Bundle p2)
        {
            var v = p0.Inflate(Resource.Layout.fragment_test, p1, false);

            m_StickyList = v.FindViewById <StickyListHeadersListView>(Resource.Id.list);
            m_StickyList.OnItemClickListener       = this;
            m_StickyList.OnHeaderListClickListener = this;
            m_StickyList.AddHeaderView(p0.Inflate(Resource.Layout.list_header, null));
            m_StickyList.AddFooterView(p0.Inflate(Resource.Layout.list_footer, null));

            m_Adapter = new TestBaseAdapter(Activity);
            m_StickyList.EmptyView = v.FindViewById(Resource.Id.empty);
            m_StickyList.Adapter   = m_Adapter;
            return(v);
        }