Ejemplo n.º 1
0
        private void InitComponents()
        {
            toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationOnClickListener(this);
            SetSupportActionBar(toolbar);
            if (SupportActionBar != null)
            {
                SupportActionBar.Title = string.Empty;
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_action_back);
                for (int i = 0; i < toolbar.ChildCount; i++)
                {
                    View child = toolbar.GetChildAt(i);
                    if (child is TextView toolbarTitle)
                    {
                        toolbarTitle.SetTypeface(FontUtils.GetBoldFont(this), Android.Graphics.TypefaceStyle.Normal);
                        break;
                    }
                }
            }

            collapsingToolbar = FindViewById <Android.Support.Design.Widget.CollapsingToolbarLayout>(Resource.Id.collapsingtoolbar_layout);
            collapsingToolbar.SetExpandedTitleTextAppearance(Resource.Style.ExpandedAppBar);
            collapsingToolbar.SetCollapsedTitleTextAppearance(Resource.Style.CollapsedAppBar);

            likeButton = FindViewById <LikeButton>(Resource.Id.likeButton);
            likeButton.SetOnLikeListener(this);

            if (ViewModel.MovieDetails.IsFavorite)
            {
                likeButton.SetLiked(Java.Lang.Boolean.True);
            }

            var chipGroup = FindViewById <ChipGroup>(Resource.Id.genre_chipGroup);

            AddGenreChips(chipGroup);

            var writeareview = FindViewById <Button>(Resource.Id.writeareview_button);

            writeareview.SetTypeface(FontUtils.GetNormalFont(this), TypefaceStyle.Normal);

            attachmentImageView = FindViewById <Refractored.Controls.CircleImageView>(Resource.Id.attachment_imageView);
            if (ViewModel.CurrentMovieReview != null)
            {
                AddAttachment();
            }
        }
Ejemplo n.º 2
0
            public PostAdapterViewHolder(View itemView, Action <PostAdapterClickEventArgs> clickListener,
                                         Action <PostAdapterClickEventArgs> longClickListener) : base(itemView)
            {
                usernameTextView  = (TextView)itemView.FindViewById(Resource.Id.post_name_tv);
                postBodyTextView  = (TextView)itemView.FindViewById(Resource.Id.post_caption_tv);
                likeCountTextView = (TextView)itemView.FindViewById(Resource.Id.post_like_count_tv);
                postImageView     = (ImageView)itemView.FindViewById(Resource.Id.post_img_iv);
                profileImageView  = (CircleImageView)itemView.FindViewById(Resource.Id.post_user_profile);
                durationTextView  = (TextView)itemView.FindViewById(Resource.Id.post_time_tv);
                postLikeBtn       = itemView.FindViewById <LikeButton>(Resource.Id.post_like_btn);

                itemView.Click += (sender, e) => clickListener(new PostAdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition, ImageView = postImageView
                });
                itemView.LongClick += (sender, e) => longClickListener(new PostAdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition
                });


                postLikeBtn.SetOnLikeListener(new OnLikeEventListener((liked) =>
                {
                }, (unliked) =>
                {
                    var likeref = SessionManager.GetFireDB().GetReference($"posts/{_items[AdapterPosition].ID}/likes/{SessionManager.UserId}");
                    likeref.AddValueEventListener(new SingleValueListener((s) =>
                    {
                        if (!s.Exists())
                        {
                            return;
                        }

                        likeref.RemoveValue();
                    }, (de) =>
                    {
                    }));
                }));
            }
Ejemplo n.º 3
0
 public static void SetOnLikeAction(this LikeButton self, Action <LikeButton> likeHandler, Action <LikeButton> unlikeHandler)
 {
     self.SetOnLikeListener(new DelegateOnLikeListener(likeHandler, unlikeHandler));
 }