Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            id             = Intent.GetIntExtra("id", 0);
            handler        = new Handler();
            dailyPresenter = new DailyPresenter(this);

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

            coordinatorLayout = FindViewById <CoordinatorLayout>(Resource.Id.main_content);
            collapsingToolbar = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsingtoolbar);
            collapsingToolbar.SetTitle("");
            appbar = FindViewById <AppBarLayout>(Resource.Id.appbar);
            appbar.AddOnOffsetChangedListener(this);

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

            toolbarTitle = FindViewById <TextView>(Resource.Id.toolbarTitle);
            txtTitle     = FindViewById <TextView>(Resource.Id.txtTitle);
            txtAuthor    = FindViewById <TextView>(Resource.Id.txtAuthor);
            titleImage   = FindViewById <ImageView>(Resource.Id.titleImage);
            body         = FindViewById <DailyWebView>(Resource.Id.body);
            txtGood      = FindViewById <TextView>(Resource.Id.txtGood);
            txtComments  = FindViewById <TextView>(Resource.Id.txtComments);

            swipeRefreshLayout.Post(async() =>
            {
                await dailyPresenter.GetClientDaily(id);
                await dailyPresenter.GetClientDailyExtra(id);
            });
        }
Exemplo n.º 2
0
 public DailyContentPageViewModel(int id) : base(id)
 {
     dailyPresenter = DependencyService.Get <DailyPresenter>();
     InitializeAsync(null);
 }