Exemple #1
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is FriendRequestsAdapterViewHolder holder)
                {
                    var item = UserList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                        holder.Name.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(item), 35);

                        if (item.Verified == "1")
                        {
                            holder.Name.SetCompoundDrawablesWithIntrinsicBounds(0, 0, Resource.Drawable.icon_checkmark_small_vector, 0);
                        }

                        holder.About.Text = ActivityContext.GetString(Resource.String.Lbl_Last_seen) + " " + Methods.Time.TimeAgo(Convert.ToInt32(item.LastseenUnixTime), false);
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Exemple #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            try
            {
                base.OnCreateView(inflater, container, savedInstanceState);

                // Set our view from the "Dialog_BlockUser_Fragment" layout resource
                var view = inflater.Inflate(Resource.Layout.Dialog_BlockUser_Fragment, container, false);

                // Get values
                TxtUsername = view.FindViewById <TextView>(Resource.Id.Txt_Username);
                TxtName     = view.FindViewById <TextView>(Resource.Id.Txt_SecendreName);

                BtnUnBlockUser = view.FindViewById <Button>(Resource.Id.UnBlockUser_Button);

                ImageUserProfile = view.FindViewById <ImageView>(Resource.Id.profileAvatar_image);

                GlideImageLoader.LoadImage(ActivityContext, Item.Avatar, ImageUserProfile, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                TxtUsername.Text = WoWonderTools.GetNameFinal(Item);
                TxtName.Text     = "@" + Item.Username;

                return(view);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                switch (viewHolder)
                {
                case CommonThingsAdapterViewHolder holder:
                {
                    var item = CommonThingsList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.UserData.Avatar, holder.Image, ImageStyle.FitCenter, ImagePlaceholders.Drawable);

                        holder.Name.Text        = WoWonderTools.GetNameFinal(item.UserData);
                        holder.CountCommon.Text = item.CommonThings + " " + ActivityContext.GetText(Resource.String.Lbl_ThingInCommon);
                    }

                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Exemple #4
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                switch (viewHolder)
                {
                case SuggestionsUserAdapterViewHolder holder:
                {
                    var item = UserList[position];
                    if (item != null)
                    {
                        holder.Username.Text = Methods.FunString.SubStringCutOf("@" + item.Username, 15);
                        holder.Name.Text     = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(item), 15);

                        GlideImageLoader.LoadImage(ActivityContext, item.Avatar, holder.Image, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                        WoWonderTools.SetAddFriendCondition(item.IsFollowing, holder.Button);
                    }

                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                switch (viewHolder)
                {
                case InvitationLinksAdapterViewHolder holder:
                {
                    var item = LinksList[position];
                    if (item != null)
                    {
                        DateTime dateTimeSeen = Methods.Time.UnixTimeStampToDateTime(Convert.ToInt32(item.Time));
                        holder.Date.Text = dateTimeSeen.ToLongDateString();

                        if (item.UserData?.UserDataClass != null)
                        {
                            holder.InvitedUser.Text = WoWonderTools.GetNameFinal(item.UserData?.UserDataClass);
                        }
                    }

                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Exemple #6
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is InviteMembersAdapterViewHolder holder)
                {
                    var item = UserList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                        holder.Name.Text  = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(item), 25);
                        holder.About.Text = item.UserId == UserDetails.UserId ? ActivityContext.GetString(Resource.String.Lbl_Online) : ActivityContext.GetString(Resource.String.Lbl_Last_seen) + " " + Methods.Time.TimeAgo(Convert.ToInt32(item.LastseenUnixTime), false);

                        if (item.Verified == "1")
                        {
                            holder.Name.SetCompoundDrawablesWithIntrinsicBounds(0, 0, Resource.Drawable.icon_checkmark_small_vector, 0);
                        }

                        //Online Or offline
                        var online = WoWonderTools.GetStatusOnline(Convert.ToInt32(item.LastseenUnixTime), item.LastseenStatus);
                        holder.ImageLastSeen.SetImageResource(online ? Resource.Drawable.Green_Color : Resource.Drawable.Grey_Offline);

                        if (item.UserId == UserDetails.UserId)
                        {
                            holder.ButtonMore.Visibility = ViewStates.Gone;
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        private void Initialize(NotificationsAdapterViewHolder holder, Notification notify)
        {
            try
            {
                if (notify.Type == "memory")
                {
                    Glide.With(ActivityContext).Load(Resource.Mipmap.icon).Apply(new RequestOptions().CircleCrop()).Into(holder.ImageUser);
                    holder.UserNameNotfy.Text = AppSettings.ApplicationName;
                }
                else
                {
                    GlideImageLoader.LoadImage(ActivityContext, notify.Notifier?.Avatar, holder.ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                    holder.UserNameNotfy.Text = WoWonderTools.GetNameFinal(notify.Notifier);
                }

                AddIconFonts(holder, notify.Type, notify.Icon);

                var drawable = TextDrawable.InvokeBuilder().BeginConfig().FontSize(30).EndConfig().BuildRound("", Color.ParseColor(GetColorFonts(notify.Type, notify.Icon)));
                holder.Image.SetImageDrawable(drawable);

                if (notify.Type == "share_post" || notify.Type == "shared_your_post")
                {
                    holder.TextNotfy.Text = ActivityContext.GetText(Resource.String.Lbl_sharedYourPost);
                }
                else
                {
                    holder.TextNotfy.Text = notify.TypeText;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemple #8
0
 private void MAdapterOnItemLongClick(object sender, ContactsAdapterClickEventArgs e)
 {
     try
     {
         var position = e.Position;
         if (position >= 0)
         {
             var item = MAdapter.GetItem(position);
             if (item == null)
             {
                 return;
             }
             if (item.Avatar == "addImage")
             {
                 return;
             }
             Position = e.Position;
             var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
             dialog.Title(GetString(Resource.String.Lbl_Remove) + " " + WoWonderTools.GetNameFinal(item));
             dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive(this);
             dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this);
             dialog.AlwaysCallSingleChoiceCallback();
             dialog.Build().Show();
         }
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
     }
 }
Exemple #9
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is ShowApplyJobsAdapterViewHolder holder)
                {
                    var item = JobList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.UserData.Avatar, holder.Image, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                        holder.Username.Text      = WoWonderTools.GetNameFinal(item.UserData);
                        holder.AddressText.Text   = item.Position;
                        holder.TimeText.Text      = item.Location;
                        holder.PhoneText.Text     = item.PhoneNumber;
                        holder.EmailText.Text     = item.Email;
                        holder.PositionText.Text  = item.Position;
                        holder.StartDateText.Text = item.ExperienceStartDate;
                        holder.EndDateText.Text   = item.ExperienceEndDate;

                        holder.Description.Text = Methods.FunString.DecodeString(item.ExperienceDescription);
                        ReadMoreOption.AddReadMoreTo(holder.Description, new String(holder.Description.Text));
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        private void Initialize(MarketAdapterViewHolder holder, ProductDataObject item)
        {
            try
            {
                if (item.Images?.Count > 0)
                {
                    if (item.Images[0].Image.Contains("http"))
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.Images?[0]?.Image, holder.Thumbnail, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);
                    }
                    else
                    {
                        Glide.With(ActivityContext).Load(new File(item.Images?[0]?.Image)).Apply(new RequestOptions().CenterCrop().Placeholder(Resource.Drawable.ImagePlacholder).Error(Resource.Drawable.ImagePlacholder)).Into(holder.Thumbnail);
                    }
                }

                GlideImageLoader.LoadImage(ActivityContext, item.Seller?.Avatar, holder.Userprofilepic, ImageStyle.CircleCrop, ImagePlaceholders.Color);



                holder.Title.Text    = Methods.FunString.DecodeString(item.Name);
                holder.UserName.Text = WoWonderTools.GetNameFinal(item.Seller);
                holder.Time.Text     = item.TimeText;

                var(currency, currencyIcon) = WoWonderTools.GetCurrency(item.Currency);
                Console.WriteLine(currency);

                holder.TxtPrice.Text     = currencyIcon + " " + item.Price;
                holder.LocationText.Text = !string.IsNullOrEmpty(item.Location) ? item.Location : ActivityContext.GetText(Resource.String.Lbl_Unknown);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        private async void LoadData()
        {
            try
            {
                DataStories = JsonConvert.DeserializeObject <GetUserStoriesObject.StoryObject>(Intent.GetStringExtra("DataItem"));
                if (DataStories != null)
                {
                    GlideImageLoader.LoadImage(this, DataStories.Avatar, UserImageView, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                    UsernameTextView.Text     = WoWonderTools.GetNameFinal(DataStories);
                    DeleteIconView.Visibility = DataStories.Stories[0].IsOwner ? ViewStates.Visible : ViewStates.Invisible;

                    int count = DataStories.Stories.Count;
                    StoriesProgress.Visibility = ViewStates.Visible;
                    StoriesProgress.SetStoriesCount(count);   // <- set stories
                    StoriesProgress.SetStoriesListener(this); // <- set listener
                    //StoriesProgress.SetStoryDuration(10000L); // <- set a story duration

                    var fistStory = DataStories.Stories.FirstOrDefault();
                    if (fistStory != null)
                    {
                        StoriesProgress.SetStoriesCountWithDurations(DataStories.DurationsList.ToArray());

                        await SetStory(fistStory);

                        StoriesProgress.StartStories(); // <- start progress
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemple #12
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is SelectContactsAdapterViewHolder holder)
                {
                    var item = UserList[position];
                    if (item != null)
                    {
                        holder.CheckBox.Checked = item.Selected;

                        GlideImageLoader.LoadImage(ActivityContext, item.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                        holder.Name.Text = WoWonderTools.GetNameFinal(item);

                        if (item.Verified == "1")
                        {
                            holder.Name.SetCompoundDrawablesWithIntrinsicBounds(0, 0, Resource.Drawable.icon_checkmark_small_vector, 0);
                        }

                        holder.About.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetAboutFinal(item), 25);
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is RecentDonationAdapterViewHolder holder)
                {
                    var item = UserList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.UserData.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable, true);

                        holder.Name.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(item.UserData), 20);

                        if (item.UserData.Verified == "1")
                        {
                            holder.Name.SetCompoundDrawablesWithIntrinsicBounds(0, 0, Resource.Drawable.icon_checkmark_small_vector, 0);
                        }

                        holder.About.Text = AppSettings.CurrencyFundingPriceStatic + item.Amount + " " + Methods.Time.TimeAgo(Convert.ToInt32(item.Time), true);

                        //Online Or offline
                        var online = WoWonderTools.GetStatusOnline(Convert.ToInt32(item.UserData.LastseenUnixTime), item.UserData.LastseenStatus);
                        holder.ImageLastSeen.SetImageResource(online ? Resource.Drawable.Green_Color : Resource.Drawable.Grey_Offline);

                        WoWonderTools.SetAddFriendCondition(item.UserData.IsFollowing, holder.Button);
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        private void Initialize(NearbyShopsAdapterViewHolder holder, NearbyShopsDataObject item)
        {
            try
            {
                switch (item.Product?.ProductClass?.Images?.Count)
                {
                case > 0 when item.Product?.ProductClass != null && item.Product.Value.ProductClass.Images[0].Image.Contains("http"):
                    GlideImageLoader.LoadImage(ActivityContext, item.Product?.ProductClass?.Images?[0]?.Image, holder.Thumbnail, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);
                    break;

                case > 0:
                    Glide.With(ActivityContext).Load(new File(item.Product?.ProductClass?.Images?[0]?.Image)).Apply(new RequestOptions().CenterCrop().Placeholder(Resource.Drawable.ImagePlacholder).Error(Resource.Drawable.ImagePlacholder)).Into(holder.Thumbnail);
                    break;
                }

                GlideImageLoader.LoadImage(ActivityContext, item.Product?.ProductClass?.Seller?.Avatar, holder.Userprofilepic, ImageStyle.CircleCrop, ImagePlaceholders.Color);



                holder.Title.Text = Methods.FunString.DecodeString(item.Product?.ProductClass?.Name);

                holder.UserName.Text = WoWonderTools.GetNameFinal(item.Product?.ProductClass?.Seller);
                holder.Time.Text     = item.Product?.ProductClass?.TimeText;

                var(currency, currencyIcon) = WoWonderTools.GetCurrency(item.Product?.ProductClass?.Currency);
                Console.WriteLine(currency);

                holder.TxtPrice.Text     = item.Product?.ProductClass?.Price + " " + currencyIcon;
                holder.LocationText.Text = !string.IsNullOrEmpty(item.Product?.ProductClass?.Location) ? item.Product?.ProductClass?.Location : ActivityContext.GetText(Resource.String.Lbl_Unknown);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Exemple #15
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                switch (viewHolder)
                {
                case RowStoryAdapterViewHolder holder:
                {
                    var item = StoryList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                        holder.Name.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(item), 25);

                        //holder.About.Text = Type == ContactsAdapter.TypeTextSecondary.About ? Methods.FunString.SubStringCutOf(WoWonderTools.GetAboutFinal(users), 25) : Methods.Time.TimeAgo(Convert.ToInt32(users.LastseenUnixTime));
                    }

                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        private void Initialize(RateUsersAdapterViewHolder holder, UserDataObject users)
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, users.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable, true);

                holder.Name.Text            = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(users), 20);
                holder.UserRatingBar.Rating = (float)Convert.ToDouble(users.Points);
                //if (users.Verified == "1")
                //    holder.Name.SetCompoundDrawablesWithIntrinsicBounds(0, 0, Resource.Drawable.icon_checkmark_small_vector, 0);

                //if (Type == TypeTextSecondary.None)
                //{
                //    holder.About.Visibility = ViewStates.Gone;
                //}
                //else
                //{
                //    holder.About.Text = Type == TypeTextSecondary.About ? Methods.FunString.SubStringCutOf(WoWonderTools.GetAboutFinal(users), 25) : ActivityContext.GetString(Resource.String.Lbl_Last_seen) + " " + Methods.Time.TimeAgo(Convert.ToInt32(users.LastseenUnixTime), true);
                //}

                //Online Or offline
                //var online = WoWonderTools.GetStatusOnline(Convert.ToInt32(users.LastseenUnixTime), users.LastseenStatus);
                //holder.ImageLastSeen.SetImageResource(online ? Resource.Drawable.Green_Color : Resource.Drawable.Grey_Offline);

                //if (!ShowButton) return;

                //WoWonderTools.SetAddFriendCondition(users.IsFollowing, holder.Button);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        private void Initialize(MembersAdapterViewHolder holder, UserDataObject users)
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, users.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                holder.Name.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(users), 25);

                if (users.Verified == "1")
                {
                    holder.Name.SetCompoundDrawablesWithIntrinsicBounds(0, 0, Resource.Drawable.icon_checkmark_small_vector, 0);
                }

                holder.About.Text = users.UserId == UserDetails.UserId ? ActivityContext.GetString(Resource.String.Lbl_Online): ActivityContext.GetString(Resource.String.Lbl_Last_seen) + " " + Methods.Time.TimeAgo(Convert.ToInt32(users.LastseenUnixTime), false);

                //Online Or offline
                var online = WoWonderTools.GetStatusOnline(Convert.ToInt32(users.LastseenUnixTime), users.LastseenStatus);
                holder.ImageLastSeen.SetImageResource(online ? Resource.Drawable.Green_Color : Resource.Drawable.Grey_Offline);


                if (users.UserId == UserDetails.UserId)
                {
                    holder.ButtonMore.Visibility = ViewStates.Gone;
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                switch (viewHolder)
                {
                case LiveMessageAdapterViewHolder holder:
                {
                    var item = CommentList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.Publisher.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                        holder.TxtName.Text    = WoWonderTools.GetNameFinal(item.Publisher);
                        holder.TxtMessage.Text = Methods.FunString.DecodeString(item.Orginaltext);
                    }

                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Exemple #19
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is ReviewsAdapterViewHolder holder)
                {
                    var item = UserList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.UserData.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                        holder.Name.Text = WoWonderTools.GetNameFinal(item.UserData);

                        if (!string.IsNullOrEmpty(item.Valuation))
                        {
                            holder.Review.Text       = Methods.FunString.DecodeString(item.Review);
                            holder.Review.Visibility = ViewStates.Visible;
                        }
                        else
                        {
                            holder.Review.Visibility = ViewStates.Gone;
                        }

                        holder.Val.Text = item.Valuation;
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        private void Initialize(ArticlesAdapterViewHolder holder, ArticleDataObject item)
        {
            try
            {
                var colorImage = Color.ParseColor(Methods.FunString.RandomColor());

                Glide.With(ActivityContext)
                .Load(item.Thumbnail)
                .Apply(RequestOptions.CenterCropTransform().Placeholder(new ColorDrawable(colorImage)).Fallback(new ColorDrawable(colorImage)).SetPriority(Priority.High))
                .Into(holder.Image);

                Glide.With(ActivityContext)
                .Load(item.Author.Avatar)
                .Apply(RequestOptions.CircleCropTransform())
                .Into(holder.UserImageProfile);

                holder.Category.SetBackgroundColor(colorImage);

                CategoriesController cat = new CategoriesController();
                string id = item.CategoryLink.Split('/').Last();


                holder.Category.Text = cat.Get_Translate_Categories_Communities(id, item.CategoryName, "Blog");

                holder.Description.Text = Methods.FunString.DecodeString(item.Description);
                holder.Title.Text       = Methods.FunString.DecodeString(item.Title);
                holder.Username.Text    = WoWonderTools.GetNameFinal(item.Author);
                holder.ViewMore.Text    = ActivityContext.GetText(Resource.String.Lbl_ReadMore) + " >"; //READ MORE &gt;
                holder.Time.Text        = item.Posted;
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        private static SpannableString AddImages(PostDataObject item, Context context, SpannableString spendable)
        {
            try
            {   //Regex pattern that looks for embedded images of the format: [img src=imageName/]
                //exp. This [img src=imageName/] is an icon.

                Pattern refImg = Pattern.Compile("\\Q[img src=\\E([a-zA-Z0-9_]+?)\\Q/]\\E");

                //bool hasChanges = false;

                Matcher matcher = refImg.Matcher(spendable);

                while (matcher.Find())
                {
                    bool set = true;
                    foreach (var span in spendable.GetSpans(matcher.Start(), matcher.End(), Class.FromType(typeof(ImageSpan))))
                    {
                        if (spendable.GetSpanStart(span) >= matcher.Start() && spendable.GetSpanEnd(span) <= matcher.End())
                        {
                            spendable.RemoveSpan(span);
                        }
                        else
                        {
                            set = false;
                            break;
                        }
                    }

                    if (set)
                    {
                        string resName = spendable.SubSequence(matcher.Start(1), matcher.End(1))?.Trim();
                        int    id      = context.Resources.GetIdentifier(resName, "drawable", context.PackageName);

                        var d = ContextCompat.GetDrawable(context, id);
                        if (d != null)
                        {
                            d.SetBounds(0, 0, d.IntrinsicWidth, d.IntrinsicHeight);
                            spendable.SetSpan(new ImageSpan(d, SpanAlign.Baseline), matcher.Start(), matcher.End(), SpanTypes.ExclusiveExclusive);
                        }
                        else
                        {
                            spendable.SetSpan(new ImageSpan(context, id, SpanAlign.Baseline), matcher.Start(), matcher.End(), SpanTypes.ExclusiveExclusive);
                        }

                        //hasChanges = true;
                    }
                }

                var username = WoWonderTools.GetNameFinal(Publisher);
                SetTextStyle(spendable, username, TypefaceStyle.Bold);

                if (spendable.ToString() !.Contains(context.GetText(Resource.String.Lbl_ChangedProfileCover)))
                {
                    SetTextColor(spendable, context.GetText(Resource.String.Lbl_ChangedProfileCover), "#888888");
                }
                else if (spendable.ToString() !.Contains(context.GetText(Resource.String.Lbl_ChangedProfilePicture)))
                {
                    SetTextColor(spendable, context.GetText(Resource.String.Lbl_ChangedProfilePicture), "#888888");
                }
        private void GetDataFunding()
        {
            try
            {
                DataObject = JsonConvert.DeserializeObject <FundingDataObject>(Intent?.GetStringExtra("ItemObject") ?? "");
                if (DataObject != null)
                {
                    GlideImageLoader.LoadImage(this, DataObject.UserData.Avatar, ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                    GlideImageLoader.LoadImage(this, DataObject.Image, ImageFunding, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                    TxtUsername.Text = WoWonderTools.GetNameFinal(DataObject.UserData);

                    bool success = int.TryParse(DataObject.Time, out var number);
                    if (success)
                    {
                        Console.WriteLine("Converted '{0}' to {1}.", DataObject.Time, number);
                        TxtTime.Text     = GetString(Resource.String.Lbl_Last_seen) + " " + Methods.Time.TimeAgo(number, true);
                        TxtDonation.Text = IonIconsFonts.IosClockOutline + "  " + Methods.Time.TimeAgo(number, false);
                    }
                    else
                    {
                        Console.WriteLine("Attempted conversion of '{0}' failed.", DataObject.Time ?? "<null>");
                        TxtTime.Text     = Methods.Time.ReplaceTime(DataObject.Time);
                        TxtDonation.Text = IonIconsFonts.IosClockOutline + "  " + DataObject.Time;
                    }

                    TxtTitle.Text       = Methods.FunString.DecodeString(DataObject.Title);
                    TxtDescription.Text = Methods.FunString.DecodeString(DataObject.Description);

                    TxtMore.Visibility = DataObject.UserData.UserId == UserDetails.UserId ? ViewStates.Visible : ViewStates.Gone;

                    try
                    {
                        DataObject.Raised = DataObject.Raised.Replace(AppSettings.CurrencyFundingPriceStatic, "");
                        DataObject.Amount = DataObject.Amount.Replace(AppSettings.CurrencyFundingPriceStatic, "");

                        decimal d = decimal.Parse(DataObject.Raised, CultureInfo.InvariantCulture);
                        TxtFundRaise.Text = AppSettings.CurrencyFundingPriceStatic + d.ToString("0.00");

                        decimal amount = decimal.Parse(DataObject.Amount, CultureInfo.InvariantCulture);
                        TxtFundAmount.Text = AppSettings.CurrencyFundingPriceStatic + amount.ToString("0.00");
                    }
                    catch (Exception exception)
                    {
                        TxtFundRaise.Text  = AppSettings.CurrencyFundingPriceStatic + DataObject.Raised;
                        TxtFundAmount.Text = AppSettings.CurrencyFundingPriceStatic + DataObject.Amount;
                        Methods.DisplayReportResultTrack(exception);
                    }

                    BtnContact.Visibility = DataObject.UserData.UserId == UserDetails.UserId ? ViewStates.Gone  : ViewStates.Visible;

                    ProgressBar.Progress = Convert.ToInt32(DataObject.Bar);
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                switch (viewHolder)
                {
                case NearByAdapterViewHolder holder:
                {
                    var users = UserList[position];
                    switch (users)
                    {
                    case null:
                        return;
                    }

                    GlideImageLoader.LoadImage(ActivityContext, users.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Color);

                    var online = WoWonderTools.GetStatusOnline(Convert.ToInt32(users.LastseenUnixTime), users.LastseenStatus);

                    switch (online)
                    {
                    //Online Or offline
                    case true:
                        //Online
                        holder.ImageOnline.SetImageResource(Resource.Drawable.Green_Color);
                        holder.LastTimeOnline.Text = ActivityContext.GetString(Resource.String.Lbl_Online);
                        break;

                    default:
                        holder.ImageOnline.SetImageResource(Resource.Drawable.Grey_Offline);
                        holder.LastTimeOnline.Text = Methods.Time.TimeAgo(Convert.ToInt32(users.LastseenUnixTime), false);
                        break;
                    }

                    holder.Name.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(users), 14);

                    switch (users.Verified)
                    {
                    case "1":
                        holder.Name.SetCompoundDrawablesWithIntrinsicBounds(0, 0, Resource.Drawable.icon_checkmark_small_vector, 0);
                        break;
                    }

                    WoWonderTools.SetAddFriendCondition(users.IsFollowing, holder.Button);
                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Exemple #24
0
        private void GetDataFunding()
        {
            try
            {
                DataObject = JsonConvert.DeserializeObject <FundingDataObject>(Intent.GetStringExtra("ItemObject"));
                if (DataObject != null)
                {
                    GlideImageLoader.LoadImage(this, DataObject.UserData.Avatar, ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                    GlideImageLoader.LoadImage(this, DataObject.Image, ImageFunding, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                    TxtUsername.Text = WoWonderTools.GetNameFinal(DataObject.UserData);

                    TxtTime.Text = GetString(Resource.String.Lbl_Last_seen) + " " + Methods.Time.TimeAgo(Convert.ToInt32(DataObject.Time), true);

                    TxtTitle.Text       = Methods.FunString.DecodeString(DataObject.Title);
                    TxtDescription.Text = Methods.FunString.DecodeString(DataObject.Description);
                    TxtDonation.Text    = IonIconsFonts.IosClockOutline + "  " + Methods.Time.TimeAgo(int.Parse(DataObject.Time));

                    if (DataObject.UserData.UserId == UserDetails.UserId)
                    {
                        TxtMore.Visibility = ViewStates.Visible;
                    }

                    try
                    {
                        decimal d = decimal.Parse(DataObject.Raised, CultureInfo.InvariantCulture);
                        TxtFundRaise.Text = "$" + d.ToString("0.00");

                        decimal amount = decimal.Parse(DataObject.Amount, CultureInfo.InvariantCulture);
                        TxtFundAmount.Text = "$" + amount.ToString("0.00");
                    }
                    catch (Exception exception)
                    {
                        TxtFundRaise.Text  = "$" + DataObject.Raised;
                        TxtFundAmount.Text = "$" + DataObject.Amount;
                        Console.WriteLine(exception);
                    }

                    if (DataObject.UserData.UserId == UserDetails.UserId)
                    {
                        BtnContact.Visibility = ViewStates.Gone;
                    }

                    ProgressBar.Progress = Convert.ToInt32(DataObject.Bar);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemple #25
0
        private void GetDataArticles()
        {
            try
            {
                ArticleData = JsonConvert.DeserializeObject <ArticleDataObject>(Intent.GetStringExtra("ArticleObject"));
                if (ArticleData != null)
                {
                    GlideImageLoader.LoadImage(this, ArticleData.Author.Avatar, ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                    GlideImageLoader.LoadImage(this, ArticleData.Thumbnail, ImageBlog, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                    TxtUsername.Text = WoWonderTools.GetNameFinal(ArticleData.Author);

                    TxtTitle.Text = Methods.FunString.DecodeString(ArticleData.Title);
                    TxtViews.Text = ArticleData.View + " " + GetText(Resource.String.Lbl_Views);

                    string style = AppSettings.SetTabDarkTheme ? "<style type='text/css'>body{color: #fff; background-color: #282828;}</style>" : "<style type='text/css'>body{color: #444; background-color: #FFFAFA;}</style>";

                    var content = Html.FromHtml(ArticleData.Content, FromHtmlOptions.ModeCompact).ToString();
                    DataWebHtml  = "<!DOCTYPE html>";
                    DataWebHtml += "<head><title></title>" + style + "</head>";
                    DataWebHtml += "<body>" + content + "</body>";
                    DataWebHtml += "</html>";

                    TxtHtml.SetWebViewClient(new MyWebViewClient(this));
                    TxtHtml.Settings.LoadsImagesAutomatically = true;
                    TxtHtml.Settings.JavaScriptEnabled        = true;
                    TxtHtml.Settings.JavaScriptCanOpenWindowsAutomatically = true;
                    //TxtHtml.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.NarrowColumns);
                    TxtHtml.Settings.DomStorageEnabled       = true;
                    TxtHtml.Settings.AllowFileAccess         = true;
                    TxtHtml.Settings.DefaultTextEncodingName = "utf-8";

                    TxtHtml.LoadDataWithBaseURL(null, DataWebHtml, "text/html", "UTF-8", null);

                    TxtTime.Text = Methods.Time.TimeAgo(Convert.ToInt32(ArticleData.Posted));

                    if (Methods.CheckConnectivity())
                    {
                        PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                            () => RequestsAsync.Article.GetBlogById(ArticlesId)
                        });
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        private void Initialize(NotificationsAdapterViewHolder holder, NotificationObject notify)
        {
            try
            {
                switch (notify.Type)
                {
                case "memory":
                    Glide.With(ActivityContext).Load(Resource.Mipmap.icon).Apply(new RequestOptions().CircleCrop()).Into(holder.ImageUser);
                    holder.UserNameNotfy.Text = AppSettings.ApplicationName;
                    break;

                default:
                {
                    GlideImageLoader.LoadImage(ActivityContext, notify.Notifier?.Avatar, holder.ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                    var name = WoWonderTools.GetNameFinal(notify.Notifier);

                    string tempString = notify.Type == "share_post" || notify.Type == "shared_your_post"
                            ? name + " " + ActivityContext.GetText(Resource.String.Lbl_sharedYourPost)
                            : name + " " + notify.TypeText;
                    try
                    {
                        SpannableString spanString = new SpannableString(tempString);
                        spanString.SetSpan(new StyleSpan(TypefaceStyle.Bold), 0, name.Length, 0);

                        holder.UserNameNotfy.SetText(spanString, TextView.BufferType.Spannable);
                    }
                    catch
                    {
                        holder.UserNameNotfy.Text = tempString;
                    }

                    break;
                }
                }

                holder.TextNotfy.Text = Methods.Time.TimeAgo(Convert.ToInt32(notify.Time), false);

                AddIconFonts(holder, notify.Type, notify.Icon);

                var drawable = TextDrawable.InvokeBuilder().BeginConfig().FontSize(30).EndConfig().BuildRound("", Color.ParseColor(GetColorFonts(notify.Type, notify.Icon)));
                holder.Image.SetImageDrawable(drawable);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        private void LoadData()
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, Item.Avatar, ImageUserProfile, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                Glide.With(ActivityContext).Load(Item.Cover).Apply(new RequestOptions()).Into(ImageCover);

                TxtUsername.Text = WoWonderTools.GetNameFinal(Item);
                TxtName.Text     = "@" + Item.Username;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is StoryAdapterViewHolder holder)
                {
                    var item = StoryList[position];
                    if (item != null)
                    {
                        if (item.Stories?.Count > 0 && item.Stories[0].Thumbnail.Contains("http"))
                        {
                            GlideImageLoader.LoadImage(ActivityContext, item.Stories[0]?.Thumbnail, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                        }
                        else if (item.Stories?.Count > 0)
                        {
                            Glide.With(ActivityContext).Load(new File(item.Stories[0].Thumbnail)).Apply(new RequestOptions().CircleCrop().Placeholder(Resource.Drawable.ImagePlacholder_circle).Error(Resource.Drawable.ImagePlacholder_circle)).Into(holder.Image);
                        }

                        if (item.Stories != null)
                        {
                            holder.TimeText.Text = Methods.Time.TimeAgo(Convert.ToInt32(item.Stories[0].Posted), false);
                        }

                        if (item.ProfileIndicator == null)
                        {
                            item.ProfileIndicator = AppSettings.MainColor;
                        }

                        // holder.Circleindicator.BorderColor = Color.ParseColor(item.ProfileIndicator);  // Default_Color

                        holder.Name.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(item), 22);

                        if (!holder.Circleindicator.HasOnClickListeners)
                        {
                            holder.Circleindicator.Click += (sender, e) => Click(new StoryAdapterClickEventArgs {
                                View = holder.MainView, Position = position
                            });
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Exemple #29
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is StoryAdapterViewHolder holder)
                {
                    var item = StoryList[position];
                    if (item != null)
                    {
                        if (item.Stories?.Count > 0 && item.Stories[0].Thumbnail.Contains("http"))
                        {
                            GlideImageLoader.LoadImage(ActivityContext, item.Stories[0]?.Thumbnail, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                        }
                        else if (item.Stories?.Count > 0)
                        {
                            Glide.With(ActivityContext).Load(new File(item.Stories[0].Thumbnail)).Apply(new RequestOptions().CircleCrop().Placeholder(Resource.Drawable.ImagePlacholder_circle).Error(Resource.Drawable.ImagePlacholder_circle)).Into(holder.Image);
                        }

                        if (item.Type == "Your")
                        {
                            holder.Circleindicator.Visibility = ViewStates.Invisible;
                        }
                        else
                        {
                            item.ProfileIndicator ??= AppSettings.MainColor;

                            holder.Circleindicator.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor(item.ProfileIndicator)); // Default_Color
                        }

                        holder.Name.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(item), 12);

                        if (!holder.Circleindicator.HasOnClickListeners)
                        {
                            holder.Circleindicator.Click += (sender, e) => Click(new StoryAdapterClickEventArgs {
                                View = holder.MainView, Position = position
                            });
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                switch (viewHolder)
                {
                case PokesAdapterViewHolder holder:
                {
                    var item = PokeList[position];
                    if (item != null)
                    {
                        if (item.UserData?.UserDataClass != null)
                        {
                            GlideImageLoader.LoadImage(ActivityContext, item.UserData?.UserDataClass.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable, true);
                            holder.Name.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(item.UserData?.UserDataClass), 20);

                            switch (item.UserData?.UserDataClass.Verified)
                            {
                            case "1":
                                holder.Name.SetCompoundDrawablesWithIntrinsicBounds(0, 0, Resource.Drawable.icon_checkmark_small_vector, 0);
                                break;
                            }

                            holder.About.Text = ActivityContext.GetString(Resource.String.Lbl_Last_seen) + " " + Methods.Time.TimeAgo(Convert.ToInt32(item.UserData?.UserDataClass.LastseenUnixTime), false);

                            //Online Or offline
                            var online = WoWonderTools.GetStatusOnline(Convert.ToInt32(item.UserData?.UserDataClass.LastseenUnixTime), item.UserData?.UserDataClass.LastseenStatus);
                            holder.ImageLastSeen.SetImageResource(online ? Resource.Drawable.Green_Color : Resource.Drawable.Grey_Offline);
                        }

                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                        holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_PokeBack);
                        holder.BindEvents(position, item, holder.Button, PokeItemClickListener);
                    }

                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }