protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            // Set toolbar
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            _recyclerView = FindViewById <RecyclerView>(Resource.Id.recycleView);
            //As explained in the tutorial, LineatLayoutManager tells the RecyclerView that the view
            //must be arranged in linear fashion
            _recyclerView.SetLayoutManager(new LinearLayoutManager(this));

            /*
             * RecyclerView: Implementing single item click and long press (Part-II)
             */
            _recyclerView.AddOnItemTouchListener(
                new RecyclerTouchListener(this, _recyclerView, new ItemClickListener(this)));

            _adapter = new CustomAdapter(this);

            // Method call for populating the view
            PopulateRecyclerViewValues();
        }
        /// <summary>
        /// 初始化页面控件
        /// </summary>
        protected override void InitViews()
        {
            tv_grade     = FindViewById <TextView>(Resource.Id.tv_grade);
            tv_course    = FindViewById <TextView>(Resource.Id.tv_course);
            tv_title     = FindViewById <TextView>(Resource.Id.tv_title);
            tv_itemTitle = FindViewById <TextView>(Resource.Id.tv_item_title);

            tv_title.Text = areaName;
            if (dataType == 1)
            {
                tv_itemTitle.Text = "总人次";
            }
            else
            {
                tv_itemTitle.Text = "总收入";
            }

            mRecyclerView = (RecyclerView)FindViewById(Resource.Id.recycler_view);
            //adapter展示列表数据
            linearLayoutManager = new LinearLayoutManager(CurrActivity);
            mAdapter            = new SumByTeacherAdapter(CurrContext, sumTeacherList);
            mRecyclerView.SetLayoutManager(linearLayoutManager);
            mRecyclerView.SetAdapter(mAdapter);
            mAdapter.NotifyDataSetChanged();

            RecyclerViewItemOnGestureListener viewOnGestureListener = new RecyclerViewItemOnGestureListener(mRecyclerView, this);

            mRecyclerView.AddOnItemTouchListener(new RecyclerViewItemOnItemTouchListener(mRecyclerView, viewOnGestureListener));

            //下拉刷新
            mSwipeRefreshLayout = (SwipeRefreshLayout)FindViewById(Resource.Id.refresher);
            mSwipeRefreshLayout.SetColorSchemeColors(Color.ParseColor("#db0000"));
            mSwipeRefreshLayout.SetOnRefreshListener(this);
        }
示例#3
0
        /// <summary>
        /// 页面控件
        /// </summary>
        protected void InitViews(View view)
        {
            tv_btn1 = view.FindViewById <TextView>(Resource.Id.tv_btn1);
            tv_btn2 = view.FindViewById <TextView>(Resource.Id.tv_btn2);
            tv_btn3 = view.FindViewById <TextView>(Resource.Id.tv_btn3);
            tv_btn1.SetOnClickListener(this);
            tv_btn2.SetOnClickListener(this);
            tv_btn3.SetOnClickListener(this);


            mSwipeRefreshLayout = (SwipeRefreshLayout)view.FindViewById(Resource.Id.refresher);
            mRecyclerView       = (RecyclerView)view.FindViewById(Resource.Id.recycler_view);

            mSwipeRefreshLayout.SetColorSchemeColors(Color.ParseColor("#db0000"));
            //mSwipeRefreshLayout.SetColorScheme(Resource.Color.xam_dark_blue,
            //Resource.Color.xam_purple,
            //Resource.Color.xam_gray,
            //Resource.Color.xam_green);


            linearLayoutManager = new LinearLayoutManager(CurrActivity);
            mAdapter            = new RenewReportAdapter(CurrActivity, teachReportList);
            mRecyclerView.SetLayoutManager(linearLayoutManager);
            mRecyclerView.SetAdapter(mAdapter);
            mAdapter.NotifyDataSetChanged();

            mSwipeRefreshLayout.SetOnRefreshListener(this);
            RecyclerViewItemOnGestureListener viewOnGestureListener = new RecyclerViewItemOnGestureListener(mRecyclerView, this);

            mRecyclerView.AddOnItemTouchListener(new RecyclerViewItemOnItemTouchListener(mRecyclerView, viewOnGestureListener));
        }
示例#4
0
        protected override void InitViews()
        {
            FindViewById <TextView>(Resource.Id.tv_title).Text = string.Format("{0}教学报表", currReportInfo.Item3);

            tv_btn1 = FindViewById <TextView>(Resource.Id.tv_btn1);
            tv_btn2 = FindViewById <TextView>(Resource.Id.tv_btn2);
            tv_btn3 = FindViewById <TextView>(Resource.Id.tv_btn3);

            mSwipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.refresher);
            mRecyclerView       = FindViewById <RecyclerView>(Resource.Id.recycler_view);
            mSwipeRefreshLayout.SetColorSchemeColors(Color.ParseColor("#db0000"));

            linearLayoutManager = new LinearLayoutManager(CurrActivity);
            mAdapter            = new RenewReportAdapter(CurrContext, teachReportList);
            mRecyclerView.SetLayoutManager(linearLayoutManager);
            mRecyclerView.SetAdapter(mAdapter);
            mAdapter.NotifyDataSetChanged();

            mSwipeRefreshLayout.SetOnRefreshListener(this);
            //mSwipeRefreshLayout.SetOnScrollChangeListener(this);

            //mAdapter.SetOnItemClickListener(this);

            RecyclerViewItemOnGestureListener viewOnGestureListener = new RecyclerViewItemOnGestureListener(mRecyclerView, this);

            mRecyclerView.AddOnItemTouchListener(new RecyclerViewItemOnItemTouchListener(mRecyclerView, viewOnGestureListener));

            arrowDown   = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down);
            arrowDownOn = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down_on);

            SetClassStatusImg(FindViewById <ImageButton>(Resource.Id.imgBtn_lessonIng), "init");
        }
示例#5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.list_of_items_activity);

            var toolbar = (Toolbar)FindViewById(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            _list = (RecyclerView)FindViewById(Resource.Id.list);
            _list.SetLayoutManager(new LinearLayoutManager(this));
            _list.SetAdapter(_adapter);
            var recyclerItemClick = new RecyclerItemClickListener(ApplicationContext);

            _list.AddOnItemTouchListener(recyclerItemClick);
            recyclerItemClick.ItemClickEvent +=
                (sender, e) => { ShowPopup(_adapter.GetItem(e.Position)); };

            var callback = new SwipeTouchHelper();

            callback.ItemSwipeEvent += (sender, e) => { DeleteItem(e.Item); };

            var touchHelper = new ItemTouchHelper(callback);

            touchHelper.AttachToRecyclerView(_list);

            var fab = (FloatingActionButton)FindViewById(Resource.Id.fab);

            fab.Click += delegate { ShowPopup(new ShoppingItem("")); };
        }
示例#6
0
        protected override void InitViews()
        {
            llAdd          = FindViewById <LinearLayout>(Resource.Id.ll_add);
            tvTeacherCount = FindViewById <TextView>(Resource.Id.tv_teachercount);

            mSwipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.refresher);
            mRecyclerView       = FindViewById <RecyclerView>(Resource.Id.recycler_view);

            mSwipeRefreshLayout.SetColorSchemeColors(Color.ParseColor("#db0000"));

            linearLayoutManager = new LinearLayoutManager(CurrActivity);
            mAdapter            = new TeacherScopeAdapter(CurrContext, teachScopeList);
            mRecyclerView.SetLayoutManager(linearLayoutManager);
            mRecyclerView.SetAdapter(mAdapter);
            mAdapter.NotifyDataSetChanged();

            mSwipeRefreshLayout.SetOnRefreshListener(this);
            //mSwipeRefreshLayout.SetOnScrollChangeListener(this);

            //mAdapter.SetOnItemClickListener(this);

            RecyclerViewItemOnGestureListener viewOnGestureListener = new RecyclerViewItemOnGestureListener(mRecyclerView, this);

            mRecyclerView.AddOnItemTouchListener(new RecyclerViewItemOnItemTouchListener(mRecyclerView, viewOnGestureListener));
        }
示例#7
0
        /// <summary>
        /// 初始化页面控件
        /// </summary>
        protected void InitViews(View view)
        {
            tv_year          = view.FindViewById <TextView>(Resource.Id.tv_year);
            tv_district      = view.FindViewById <TextView>(Resource.Id.tv_district);
            tv_title_payment = view.FindViewById <TextView>(Resource.Id.tv_title_payment);

            //添加按钮的事件监控
            tv_year.SetOnClickListener(this);
            tv_district.SetOnClickListener(this);

            mRecyclerView = (RecyclerView)view.FindViewById(Resource.Id.recycler_view);
            //adapter展示列表数据
            linearLayoutManager = new LinearLayoutManager(CurrActivity);
            mAdapter            = new BudgeAdapter(CurrActivity, paymentList);
            mRecyclerView.SetLayoutManager(linearLayoutManager);
            mRecyclerView.SetAdapter(mAdapter);
            mAdapter.NotifyDataSetChanged();

            RecyclerViewItemOnGestureListener viewOnGestureListener = new RecyclerViewItemOnGestureListener(mRecyclerView, this);

            mRecyclerView.AddOnItemTouchListener(new RecyclerViewItemOnItemTouchListener(mRecyclerView, viewOnGestureListener));

            //搜索条件弹框
            popYear     = null;
            popDistrict = null;

            //初始化查询类型
            dataType = 1;

            //下拉刷新
            mSwipeRefreshLayout = (SwipeRefreshLayout)view.FindViewById(Resource.Id.refresher);
            mSwipeRefreshLayout.SetColorSchemeColors(Color.ParseColor("#db0000"));
            mSwipeRefreshLayout.SetOnRefreshListener(this);
        }
示例#8
0
文件: Queue.cs 项目: pictos/Opus
    public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        View view = inflater.Inflate(Resource.Layout.LonelyRecycler, container, false);

        instance = this;
        ListView = view.FindViewById <RecyclerView>(Resource.Id.recycler);
        ListView.SetLayoutManager(new LinearLayoutManager(Application.Context));
        adapter = new QueueAdapter();
        ListView.SetAdapter(adapter);
        adapter.ItemClick     += ListView_ItemClick;
        adapter.ItemLongCLick += ListView_ItemLongCLick;
        ListView.SetItemAnimator(new DefaultItemAnimator());
        ListView.AddItemDecoration(new CurrentItemDecoration(adapter));
        ListView.AddOnItemTouchListener(this);
        ListView.ScrollChange += Scroll;

        ItemTouchHelper.Callback callback = new ItemTouchCallback(adapter, true);
        itemTouchHelper = new ItemTouchHelper(callback);
        itemTouchHelper.AttachToRecyclerView(ListView);

        ListView.ScrollToPosition(MusicPlayer.CurrentID());

        if (MusicPlayer.UseCastPlayer)
        {
            Snackbar snackBar = Snackbar.Make(ListView, "Queue management with chromecast is currently in beta, expect some bugs.", (int)ToastLength.Short);
            snackBar.View.FindViewById <TextView>(Resource.Id.snackbar_text).SetTextColor(Color.White);
            snackBar.Show();
        }
        return(view);
    }
示例#9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.activity_main);

            RecyclerView recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerview);

            this.updateButton    = FindViewById <Button>(Resource.Id.button_update);
            this.isReverseButton = FindViewById <ToggleButton>(Resource.Id.button_is_reverse);

            // Set adapter populated with example dummy data
            this.adapter = new AnimalsHeadersAdapter();
            adapter.Add("Animals below!");
            adapter.AddAll(this.GetDummyDataSet());
            recyclerView.SetAdapter(adapter);

            //adapter.RegisterAdapterDataObserver(

            // Set layout manager
            int orientation = this.GetLayoutManagerOrientation(this.Resources.Configuration.Orientation);

            this.layoutManager = new LinearLayoutManager(this, orientation, isReverseButton.Checked);
            recyclerView.SetLayoutManager(layoutManager);

            // Add the sticky headers decoration
            StickyRecyclerHeadersDecoration headersDecor = new StickyRecyclerHeadersDecoration(adapter);

            recyclerView.AddItemDecoration(headersDecor);

            // Add decoration for dividers between list items
            recyclerView.AddItemDecoration(new DividerDecoration(this));

            this.adapter.RegisterAdapterDataObserver(new HeaderAdapterObserver(headersDecor));

            // Add touch listeners
            this.stickyTouchListener = new StickyRecyclerHeadersTouchListener(recyclerView, headersDecor);
            recyclerView.AddOnItemTouchListener(this.stickyTouchListener);

            this.recyclerItemClick = new RecyclerItemClickListener(this);
            recyclerView.AddOnItemTouchListener(recyclerItemClick);
        }
示例#10
0
        void InitViews(View view)
        {
            // RecyclerView
            mRecyclerView  = view.FindViewById <RecyclerView>(Resource.Id.news_recycler_view);
            mLayoutManager = new LinearLayoutManager(this.Context);
            mRecyclerView.SetLayoutManager(mLayoutManager);
            mRecyclerView.AddOnItemTouchListener(new RecyclerItemClickListener(this.Activity, mRecyclerView, this));

            mAdapter = new NewsArticleAdapter(this.Context, mArticles);
            mRecyclerView.SetAdapter(mAdapter);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.fragment_context_layout, container, false);

            recyclerView = view.FindViewById <RecyclerView>(Resource.Id.recycler_view);

            recyclerViewAdapter = new RecyclerViewAdapter(recyclerView.Context, slides);
            recyclerView.SetAdapter(recyclerViewAdapter);
            recyclerView.SetLayoutManager(new StaggeredGridLayoutManager(1, OrientationHelper.Vertical));

            gestureDetector = new GestureDetector(Activity, new MySimpleOnGestureListener(recyclerView, listener));

            recyclerView.AddOnItemTouchListener(new MyRvItemTouchListener(gestureDetector));

            return(view);
        }
示例#12
0
        private void SetupRecyclerView()
        {
            // Touch listeners.
            itemTouchListener = new ItemTouchListener(recyclerView, this);
            recyclerView.AddOnItemTouchListener(itemTouchListener);

            var touchCallback = new SwipeDismissCallback(ItemTouchHelper.Up | ItemTouchHelper.Down, ItemTouchHelper.Left, this);
            var touchHelper   = new ItemTouchHelper(touchCallback);

            touchHelper.AttachToRecyclerView(recyclerView);

            // Decorations.
            dividerDecoration = new DividerItemDecoration(Activity, DividerItemDecoration.VerticalList);
            shadowDecoration  = new ShadowItemDecoration(Activity);
            recyclerView.AddItemDecoration(dividerDecoration);
            recyclerView.AddItemDecoration(shadowDecoration);

            recyclerView.GetItemAnimator().SupportsChangeAnimations = false;
        }
示例#13
0
        protected override void InitViews()
        {
            tvTeacherCount = FindViewById <TextView>(Resource.Id.tv_teachercount);

            mSwipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.refresher);
            mRecyclerView       = FindViewById <RecyclerView>(Resource.Id.recycler_view);
            mSwipeRefreshLayout.SetColorSchemeColors(Color.ParseColor("#db0000"));

            linearLayoutManager = new LinearLayoutManager(CurrActivity);
            mAdapter            = new TeacherListAdapter(this, 2);
            mAdapter.HideFootere(true);
            mRecyclerView.SetLayoutManager(linearLayoutManager);
            mRecyclerView.SetAdapter(mAdapter);
            mAdapter.NotifyDataSetChanged();

            mSwipeRefreshLayout.SetOnRefreshListener(this);

            RecyclerViewItemOnGestureListener viewOnGestureListener = new RecyclerViewItemOnGestureListener(mRecyclerView, this);

            mRecyclerView.AddOnItemTouchListener(new RecyclerViewItemOnItemTouchListener(mRecyclerView, viewOnGestureListener));
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.fragment_exhibitlist, container, false);

            recyclerView = (RecyclerView)view.FindViewById(Resource.Id.exhibitListRecyclerView);

            // use a linear layout manager
            RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this.Activity);
            recyclerView.SetLayoutManager(layoutManager);

            //RecycleAdapter
            adapter = new MainRecyclerAdapter(ExhibitSet, GeoLocation, Application.Context);
            recyclerView.SetAdapter(adapter);

            recyclerView.AddOnItemTouchListener(new RecyclerItemClickListener((MainActivity)this.Activity, ExhibitSet));

            // Disable refreshing
            var swipeRefreshLayout = view.FindViewById <SwipeRefreshLayout> (Resource.Id.exhibitListSwipeContainer);

            swipeRefreshLayout.Enabled = false;

            return(view);
        }
 public void AddOnItemTouchListener(IOnItemTouchListener listener)
 {
     _recyclerView.AddOnItemTouchListener(listener);
 }