Exemple #1
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Id               = Intent.GetIntExtra("id", 0);
            handler          = new Handler();
            answersPresenter = new QuestionAnswersPresenter(this);
            StatusBarCompat.SetOrdinaryToolBar(this);
            dialog = new ProgressDialog(this);
            dialog.SetCancelable(false);

            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);
            toolbar.SetOnMenuItemClickListener(this);

            swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary);
            swipeRefreshLayout.SetOnRefreshListener(this);

            recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            recyclerView.SetLayoutManager(new LinearLayoutManager(this));
            adapter = new QuestionAnswersAdapter();
            adapter.SetOnLoadMoreListener(this);
            adapter.User = await SQLiteUtils.Instance().QueryUser();

            adapter.OnDeleteClickListener = this;

            notDataView        = this.LayoutInflater.Inflate(Resource.Layout.empty_view, (ViewGroup)recyclerView.Parent, false);
            notDataView.Click += delegate(object sender, EventArgs e)
            {
                OnRefresh();
            };
            errorView        = this.LayoutInflater.Inflate(Resource.Layout.error_view, (ViewGroup)recyclerView.Parent, false);
            errorView.Click += delegate(object sender, EventArgs e)
            {
                OnRefresh();
            };
            recyclerView.SetAdapter(adapter);
            recyclerView.Post(() =>
            {
                swipeRefreshLayout.Refreshing = true;
                OnRefresh();
            });
        }
        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            await viewModel.LoadQuestions();

            // Create your application here
            SetContentView(Resource.Layout.GameLoopView);
            _listView            = FindViewById <ListView>(Resource.Id.GameLoopListview);
            _adapter             = new QuestionAnswersAdapter(this);
            _listView.Adapter    = _adapter;
            _listView.ItemClick += _listView_ItemClick;

            _q              = FindViewById <TextView>(Resource.Id.GameLoopQuestion);
            _qn             = FindViewById <TextView>(Resource.Id.GameLoopQuestionNumber);
            _btnNext        = FindViewById <Button>(Resource.Id.GameLoopBtnForward);
            _btnNext.Click += _btnNext_Click;

            _qn.Text = viewModel.CurrentQuestionNumber + ". question";
            _q.Text  = viewModel.CurrentQuestion.Text;
        }