private void SetProfileChart(int size)
        {
            var votingPowerFrame = new VotingPowerFrame(this)
            {
                Draw             = true,
                VotingPower      = Presenter.UserProfileResponse == null ? 0 : (float)Presenter.UserProfileResponse.VotingPower,
                VotingPowerWidth = BitmapUtils.DpToPixel(3, Resources)
            };
            var padding = (int)BitmapUtils.DpToPixel(7, Resources);

            votingPowerFrame.Layout(0, 0, size, size);
            var avatar = new CircleImageView(this);

            avatar.Layout(padding, padding, size - padding, size - padding);
            avatar.SetImageResource(Resource.Drawable.ic_holder);
            votingPowerFrame.AddView(avatar);

            var profileTab = _tabLayout.GetTabAt(_tabLayout.TabCount - 1);

            if (!string.IsNullOrEmpty(Presenter.UserProfileResponse?.ProfileImage))
            {
                Picasso.With(this).Load(Presenter.UserProfileResponse.ProfileImage).NoFade().Resize(size, size)
                .Placeholder(Resource.Drawable.ic_holder).Into(avatar,
                                                               () => { profileTab.SetIcon(BitmapUtils.GetViewDrawable(votingPowerFrame)); }, null);
            }
            else
            {
                profileTab.SetIcon(BitmapUtils.GetViewDrawable(votingPowerFrame));
            }
        }
Exemple #2
0
        public HeaderViewHolder(View itemView, Context context, Action followersAction, Action followingAction, Action balanceAction, Action followAction) : base(itemView)
        {
            _context = context;

            _name            = itemView.FindViewById <TextView>(Resource.Id.profile_name);
            _place           = itemView.FindViewById <TextView>(Resource.Id.place);
            _description     = itemView.FindViewById <TextView>(Resource.Id.description);
            _site            = itemView.FindViewById <TextView>(Resource.Id.site);
            _photosCount     = itemView.FindViewById <TextView>(Resource.Id.photos_count);
            _photosTitle     = itemView.FindViewById <TextView>(Resource.Id.photos_title);
            _followingCount  = itemView.FindViewById <TextView>(Resource.Id.following_count);
            _followingTitle  = itemView.FindViewById <TextView>(Resource.Id.following_title);
            _followersCount  = itemView.FindViewById <TextView>(Resource.Id.followers_count);
            _followersTitle  = itemView.FindViewById <TextView>(Resource.Id.followers_title);
            _balanceText     = itemView.FindViewById <TextView>(Resource.Id.balance_text);
            _balance         = itemView.FindViewById <TextView>(Resource.Id.balance);
            _votingPower     = itemView.FindViewById <VotingPowerFrame>(Resource.Id.voting_power);
            _votingPowerText = itemView.FindViewById <TextView>(Resource.Id.voting_power_message);

            _profileImage     = itemView.FindViewById <Refractored.Controls.CircleImageView>(Resource.Id.profile_image);
            _followingBtn     = itemView.FindViewById <LinearLayout>(Resource.Id.following_btn);
            _followersBtn     = itemView.FindViewById <LinearLayout>(Resource.Id.followers_btn);
            _balanceContainer = itemView.FindViewById <RelativeLayout>(Resource.Id.balance_container);
            _followButton     = itemView.FindViewById <Button>(Resource.Id.follow_button);
            _loadingSpinner   = itemView.FindViewById <ProgressBar>(Resource.Id.loading_spinner);


            _photosTitle.Text    = AppSettings.LocalizationManager.GetText(LocalizationKeys.Photos);
            _followingTitle.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Following);
            _followersTitle.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Followers);
            _balanceText.Text    = AppSettings.LocalizationManager.GetText(LocalizationKeys.AccountBalance);

            _name.Typeface            = Style.Semibold;
            _place.Typeface           = Style.Regular;
            _description.Typeface     = Style.Regular;
            _site.Typeface            = Style.Regular;
            _photosCount.Typeface     = Style.Semibold;
            _photosTitle.Typeface     = Style.Regular;
            _followingCount.Typeface  = Style.Semibold;
            _followingTitle.Typeface  = Style.Regular;
            _followersCount.Typeface  = Style.Semibold;
            _followersTitle.Typeface  = Style.Regular;
            _balanceText.Typeface     = Style.Regular;
            _balance.Typeface         = Style.Regular;
            _votingPowerText.Typeface = Style.Regular;

            _followersAction = followersAction;
            _followingAction = followingAction;
            _balanceAction   = balanceAction;
            _followAction    = followAction;

            _followingBtn.Click     += OnFollowingBtnOnClick;
            _followersBtn.Click     += OnFollowersBtnOnClick;
            _balanceContainer.Click += OnBalanceContainerOnClick;
            _followButton.Click     += OnFollowButtonOnClick;
            _profileImage.Click     += ProfileImageOnClick;
        }
Exemple #3
0
        public HeaderViewHolder(View itemView, Context context, Action <ActionType> profileAction) : base(itemView)
        {
            _context = context;

            _name            = itemView.FindViewById <TextView>(Resource.Id.profile_name);
            _place           = itemView.FindViewById <TextView>(Resource.Id.place);
            _description     = itemView.FindViewById <TextView>(Resource.Id.description);
            _site            = itemView.FindViewById <AutoLinkTextView>(Resource.Id.site);
            _photosCount     = itemView.FindViewById <TextView>(Resource.Id.photos_count);
            _photosTitle     = itemView.FindViewById <TextView>(Resource.Id.photos_title);
            _followingCount  = itemView.FindViewById <TextView>(Resource.Id.following_count);
            _followingTitle  = itemView.FindViewById <TextView>(Resource.Id.following_title);
            _followersCount  = itemView.FindViewById <TextView>(Resource.Id.followers_count);
            _followersTitle  = itemView.FindViewById <TextView>(Resource.Id.followers_title);
            _balanceText     = itemView.FindViewById <TextView>(Resource.Id.balance_text);
            _balance         = itemView.FindViewById <TextView>(Resource.Id.balance);
            _votingPower     = itemView.FindViewById <VotingPowerFrame>(Resource.Id.voting_power);
            _votingPowerText = itemView.FindViewById <TextView>(Resource.Id.voting_power_message);

            _profileImage     = itemView.FindViewById <Refractored.Controls.CircleImageView>(Resource.Id.profile_image);
            _followingBtn     = itemView.FindViewById <LinearLayout>(Resource.Id.following_btn);
            _followersBtn     = itemView.FindViewById <LinearLayout>(Resource.Id.followers_btn);
            _balanceContainer = itemView.FindViewById <RelativeLayout>(Resource.Id.balance_container);
            _followContainer  = itemView.FindViewById <RelativeLayout>(Resource.Id.follow_container);
            _followButton     = itemView.FindViewById <Button>(Resource.Id.follow_button);
            _transferButton   = itemView.FindViewById <Button>(Resource.Id.transfer_button);
            _loadingSpinner   = itemView.FindViewById <ProgressBar>(Resource.Id.loading_spinner);


            _photosTitle.Text    = AppSettings.LocalizationManager.GetText(LocalizationKeys.Photos);
            _followingTitle.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Following);
            _followersTitle.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Followers);
            _balanceText.Text    = AppSettings.LocalizationManager.GetText(LocalizationKeys.AccountBalance);
            _transferButton.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.SendTokens);

            _name.Typeface            = Style.Semibold;
            _place.Typeface           = Style.Regular;
            _description.Typeface     = Style.Regular;
            _site.Typeface            = Style.Regular;
            _photosCount.Typeface     = Style.Semibold;
            _photosTitle.Typeface     = Style.Regular;
            _followingCount.Typeface  = Style.Semibold;
            _followingTitle.Typeface  = Style.Regular;
            _followersCount.Typeface  = Style.Semibold;
            _followersTitle.Typeface  = Style.Regular;
            _balanceText.Typeface     = Style.Regular;
            _balance.Typeface         = Style.Regular;
            _votingPowerText.Typeface = Style.Regular;
            _transferButton.Typeface  = Style.Semibold;

            _followBtnBackground = new GradientDrawable();
            _followBtnBackground.SetCornerRadius(TypedValue.ApplyDimension(ComplexUnitType.Dip, 25, itemView.Context.Resources.DisplayMetrics));
            _followButton.Background = _followBtnBackground;
            _site.Flags    = (int)AutoLinkType.Url;
            _profileAction = profileAction;

            _followingBtn.Click     += OnFollowingBtnOnClick;
            _followersBtn.Click     += OnFollowersBtnOnClick;
            _balanceContainer.Click += OnBalanceContainerOnClick;
            _followButton.Click     += OnFollowButtonOnClick;
            _transferButton.Click   += OnTransferButtonOnClick;
            _profileImage.Click     += ProfileImageOnClick;
            _site.LinkClick         += LinkClick;
        }