Esempio n. 1
0
        private void getProfilePosts()
        {
            Task.Run(async() =>
            {
                return(await Api.DavinciApi.GetProfilePosts());
            }).ContinueWith(t =>
            {
                if (t.Status == TaskStatus.Canceled)
                {
                    return;
                }

                if (t.Result.OK)
                {
                    CategoryGridAdapter likedPostAdapter = new CategoryGridAdapter(t.Result.likedPosts);
                    CategoryGridAdapter userPostAdapter  = new CategoryGridAdapter(t.Result.userPosts);

                    Action <PostModel> onClickPost = (post) =>
                    {
                        PostFragment postFragment = PostFragment.newInstance(post._id);
                        postFragment.Show(parentActivity.SupportFragmentManager, "post");
                    };
                    likedPostAdapter.ItemClick += onClickPost;
                    userPostAdapter.ItemClick  += onClickPost;

                    likesRecyclerView.SetAdapter(likedPostAdapter);
                    postsRecyclerView.SetAdapter(userPostAdapter);
                }
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
Esempio n. 2
0
        public static PostFragment newInstance(string id)
        {
            PostFragment fragment = new PostFragment();
            Bundle       args     = new Bundle();

            args.PutString("id", id);
            fragment.Arguments = args;
            return(fragment);
        }
Esempio n. 3
0
 private void getProfilePosts()
 {
     Task.Run(async() =>
     {
         return(await Api.DavinciApi.GetProfilePosts());
     }).ContinueWith(t =>
     {
         if (t.Result.OK)
         {
             CategoryGridAdapter adapter = new CategoryGridAdapter(t.Result.posts);
             adapter.ItemClick          += (post) =>
             {
                 PostFragment postFragment = PostFragment.newInstance(post._id);
                 postFragment.Show(parentActivity.SupportFragmentManager, "post");
             };
             likesRecyclerView.SetAdapter(adapter);
         }
     }, TaskScheduler.FromCurrentSynchronizationContext());
 }