protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); blogApp = Intent.GetStringExtra("blogApp"); blogPresenter = new BlogPresenter(this); handler = new Handler(); coordinatorLayout = FindViewById <CoordinatorLayout>(Resource.Id.coordinatorLayout); appBarLayout = FindViewById <AppBarLayout>(Resource.Id.appbar); linearLayout = FindViewById <LinearLayout>(Resource.Id.linearLayout); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.back_24dp); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.SetNavigationOnClickListener(this); StatusBarCompat.SetCollapsingToolbar(this, coordinatorLayout, appBarLayout, linearLayout, toolbar); imgAvatar = FindViewById <ImageView>(Resource.Id.avatar); txtTitle = FindViewById <TextView>(Resource.Id.txtTitle); txtSubTitle = FindViewById <TextView>(Resource.Id.txtSubTitle); user = await SQLiteUtils.Instance().QueryUser(); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); swipeRefreshLayout.SetOnRefreshListener(this); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); var manager = new LinearLayoutManager(this); recyclerView.SetLayoutManager(manager); adapter = new ArticlesAdapter(); adapter.SetOnLoadMoreListener(this); recyclerView.SetAdapter(adapter); 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.Post(async() => { await blogPresenter.GetClientBlog(blogApp); OnRefresh(); }); }
public BlogController(IOptions <BlogOptions> blogOptions, IAuthorizationService authorizationService, ICategoriesCache categoriesCache, OperationKeysContainer operationKeysContainer, IBlogPresenter blogPresenter, IServiceProvider serviceProvider) : base(serviceProvider) { OperationKeys = operationKeysContainer; this.blogOptions = blogOptions.Value; this.authorizationService = authorizationService; this.categoriesCache = categoriesCache; this.blogPresenter = blogPresenter; }