Exemplo n.º 1
0
        public void SetEmptyPageSubscribeChannelWithPaid(ViewStub emptyStateLayout, View inflated)
        {
            if (emptyStateLayout == null)
            {
                return;
            }
            try
            {
                if (inflated == null)
                {
                    inflated = emptyStateLayout.Inflate();
                }

                EmptyStateInflater x = new EmptyStateInflater();
                x.InflateLayout(inflated, EmptyStateInflater.Type.SubscribeChannelWithPaid);

                var idCurrency = ListUtils.MySettingsList?.PaymentCurrency;
                var(currency, currencyIcon) = AppTools.GetCurrency(idCurrency);
                Console.WriteLine(currency);
                x.TitleText.Text            = Activity.GetText(Resource.String.Lbl_SubscribeFor) + " " + currencyIcon + UserData.SubscriberPrice + " " + Activity.GetText(Resource.String.Lbl_AndUnlockAllTheVideos);
                SubscribeChannelButton.Text = Activity.GetText(Resource.String.Btn_Subscribe) + " " + currencyIcon + UserData.SubscriberPrice;

                if (!x.EmptyStateButton.HasOnClickListeners)
                {
                    x.EmptyStateButton.Click += null;
                    x.EmptyStateButton.Click += SubscribeChannelWithPaidButtonOnClick;
                }

                emptyStateLayout.Visibility = ViewStates.Visible;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 2
0
        private async Task LoadDataAsync()
        {
            if (Methods.CheckConnectivity())
            {
                var channel = await ApiRequest.GetChannelData(Activity, IdChannel);

                if (channel != null)
                {
                    TextSanitizer text = new TextSanitizer(TxtAboutChannel, Activity, GlobalContext);
                    text.Load(AppTools.GetAboutFinal(channel));

                    if (channel.Gender == "male" || channel.Gender == "Male")
                    {
                        TxtGender.Text = GetText(Resource.String.Radio_Male);
                    }
                    else
                    {
                        TxtGender.Text = GetText(Resource.String.Radio_Female);
                    }

                    TxtEmail.Text = channel.Email;

                    Facebook = channel.Facebook;
                    Google   = channel.Google;
                    Twitter  = channel.Twitter;

                    if (string.IsNullOrEmpty(channel.Facebook))
                    {
                        BtnFacebook.Enabled = false;
                        BtnFacebook.SetColor(Color.ParseColor("#8c8a8a"));
                    }
                    else
                    {
                        BtnFacebook.Enabled = true;
                    }

                    if (string.IsNullOrEmpty(channel.Twitter))
                    {
                        BtnTwitter.Enabled = false;
                        BtnTwitter.SetColor(Color.ParseColor("#8c8a8a"));
                    }
                    else
                    {
                        BtnTwitter.Enabled = true;
                    }

                    if (string.IsNullOrEmpty(channel.Google))
                    {
                        BtnGoogle.Enabled = false;
                        BtnGoogle.SetColor(Color.ParseColor("#8c8a8a"));
                    }
                    else
                    {
                        BtnGoogle.Enabled = true;
                    }

                    if (IdChannel == UserDetails.UserId)
                    {
                        var idCurrency = ListUtils.MySettingsList?.PaymentCurrency;
                        var(currency, currencyIcon) = AppTools.GetCurrency(idCurrency);
                        Console.WriteLine(currencyIcon);
                        TxtMonetization.Text = channel.Balance + " " + currency;
                    }
                }
            }
            else
            {
                Toast.MakeText(Context, Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
            }
        }
Exemplo n.º 3
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 UpgradePlansViewHolder holder)
                {
                    UpgradeGoProClass item = PlansList[position];
                    if (item != null)
                    {
                        if (AppSettings.SetTabDarkTheme)
                        {
                            holder.MainLayout.SetBackgroundResource(Resource.Drawable.ShadowLinerLayoutDark);
                            holder.RelativeLayout.SetBackgroundResource(Resource.Drawable.price_gopro_item_style_dark);
                        }

                        holder.PlanImg.SetImageResource(item.ImageResource);
                        holder.PlanImg.SetColorFilter(Color.ParseColor(item.HexColor));

                        var idCurrency = ListUtils.MySettingsList?.PaypalCurrency ?? "USD";
                        var(currency, currencyIcon) = AppTools.GetCurrency(idCurrency);
                        Console.WriteLine(currency);

                        holder.PriceText.Text = currencyIcon + item.PlanPrice;

                        //holder.PlanText.Text = item.PlanText;
                        holder.PerText.Text       = item.PlanTime;
                        holder.UpgradeButton.Text = item.BtnText;

                        //holder.PlanText.SetTextColor(Color.ParseColor(item.HexColor));
                        holder.PriceText.SetTextColor(Color.ParseColor(item.HexColor));
                        holder.UpgradeButton.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor(item.HexColor));

                        Typeface font       = Typeface.CreateFromAsset(Application.Context.Resources.Assets, "ionicons.ttf");
                        string   name       = "go_pro_array_" + item.Id;
                        int?     resourceId = ActivityContext.Resources.GetIdentifier(name, "array", ActivityContext.ApplicationInfo.PackageName);
                        if (resourceId == 0)
                        {
                            return;
                        }

                        string[] planArray = ActivityContext.Resources.GetStringArray(resourceId.Value);
                        if (planArray != null)
                        {
                            foreach (string options in planArray)
                            {
                                if (!string.IsNullOrEmpty(options))
                                {
                                    TextView text = new TextView(ActivityContext)
                                    {
                                        Text     = options,
                                        TextSize = 13
                                    };
                                    text.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.ParseColor("#444444"));
                                    text.Gravity = GravityFlags.CenterHorizontal;
                                    text.SetTypeface(font, TypefaceStyle.Normal);
                                    WoTextDecorator.Content          = options;
                                    WoTextDecorator.DecoratedContent = new Android.Text.SpannableString(options);
                                    WoTextDecorator.SetTextColor(IonIconsFonts.Checkmark, "#43a735");
                                    WoTextDecorator.SetTextColor(IonIconsFonts.Close, "#e13c4c");

                                    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);//height and width are inpixel
                                    layoutParams.SetMargins(0, 30, 0, 5);

                                    text.LayoutParameters = layoutParams;
                                    holder.OptionLinerLayout.AddView(text);
                                    WoTextDecorator.Build(text, WoTextDecorator.DecoratedContent);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 4
0
        private void SetDataUser()
        {
            try
            {
                if (UserData != null)
                {
                    var name = AppTools.GetNameFinal(UserData);
                    CollapsingToolbar.Title = name;
                    ChannelNameText.Text    = name;

                    if (string.IsNullOrEmpty(UserData.SubCount))
                    {
                        UserData.SubCount = "0";
                    }

                    TxtSubscribeCount.Text = UserData.SubCount;

                    GlideImageLoader.LoadImage(Activity, UserData.Avatar, ImageChannel, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                    Glide.With(Activity).Load(UserData.Cover).Apply(new RequestOptions().FitCenter()).Into(ImageCoverChannel);

                    //Verified
                    ChannelVerifiedText.Visibility = UserData.Verified == "1" ? ViewStates.Visible : ViewStates.Gone;

                    if (!string.IsNullOrEmpty(UserData.SubscriberPrice) && UserData.SubscriberPrice != "0")
                    {
                        if (UserData.IsSubscribedToChannel == "0")
                        {
                            //This channel is paid, You must pay to subscribe
                            SubscribeChannelButton.Tag = "PaidSubscribe";

                            //Color
                            SubscribeChannelButton.SetTextColor(Color.ParseColor("#efefef"));
                            //icon
                            Drawable icon = Activity.GetDrawable(Resource.Drawable.SubcribeButton);
                            icon.Bounds = new Rect(10, 10, 10, 7);
                            SubscribeChannelButton.SetCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);

                            var idCurrency = ListUtils.MySettingsList?.PaymentCurrency;
                            var(currency, currencyIcon) = AppTools.GetCurrency(idCurrency);
                            Console.WriteLine(currency);
                            SubscribeChannelButton.Text = Activity.GetText(Resource.String.Btn_Subscribe) + " " + currencyIcon + UserData.SubscriberPrice;

                            PlayListFragment.MRecycler.Visibility = ViewStates.Gone;
                            SetEmptyPageSubscribeChannelWithPaid(PlayListFragment.EmptyStateLayout, PlayListFragment.Inflated);

                            VideosFragment.MRecycler.Visibility = ViewStates.Gone;
                            SetEmptyPageSubscribeChannelWithPaid(VideosFragment.EmptyStateLayout, VideosFragment.Inflated);
                        }
                        else
                        {
                            SubscribeChannelButton.Tag = "Subscribed";

                            SubscribeChannelButton.Text = Activity.GetText(Resource.String.Btn_Subscribed);

                            //Color
                            SubscribeChannelButton.SetTextColor(Color.ParseColor("#efefef"));
                            //icon
                            Drawable icon = Activity.GetDrawable(Resource.Drawable.SubcribedButton);
                            icon.Bounds = new Rect(10, 10, 10, 7);
                            SubscribeChannelButton.SetCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
                        }
                    }
                    else
                    {
                        SubscribeChannelButton.Tag = UserData.IsSubscribedToChannel == "0" ? "Subscribe" : "Subscribed";

                        if (SubscribeChannelButton.Tag.ToString() == "Subscribed")
                        {
                            SubscribeChannelButton.Text = Activity.GetText(Resource.String.Btn_Subscribed);

                            //Color
                            SubscribeChannelButton.SetTextColor(Color.ParseColor("#efefef"));
                            //icon
                            Drawable icon = Activity.GetDrawable(Resource.Drawable.SubcribedButton);
                            icon.Bounds = new Rect(10, 10, 10, 7);
                            SubscribeChannelButton.SetCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
                        }
                        else if (SubscribeChannelButton.Tag.ToString() == "Subscribe")
                        {
                            SubscribeChannelButton.Text = Activity.GetText(Resource.String.Btn_Subscribe);

                            //Color
                            SubscribeChannelButton.SetTextColor(Color.ParseColor("#efefef"));
                            //icon
                            Drawable icon = Activity.GetDrawable(Resource.Drawable.SubcribeButton);
                            icon.Bounds = new Rect(10, 10, 10, 7);
                            SubscribeChannelButton.SetCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 5
0
        public void LoadRestriction(string strtext, string imageUrl, VideoObject videoObject)
        {
            try
            {
                HideRestrictedInfo(false);
                VideoObject = videoObject;
                if (strtext == "AgeRestriction")
                {
                    RestrictedIcon.SetImageResource(Resource.Drawable.icon_18plus);
                    RestrictedTextView.Text = GetText(Resource.String.Lbl_AgeRestricted);
                    if (!string.IsNullOrEmpty(imageUrl))
                    {
                        GlideImageLoader.LoadImage(Activity, imageUrl, ImageVideo, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);
                    }
                }
                else if (strtext == "GeoRestriction")
                {
                    RestrictedIcon.SetImageResource(Resource.Drawable.ic_GeoRestict);
                    RestrictedTextView.Text = GetText(Resource.String.Lbl_GEORestricted);
                    if (!string.IsNullOrEmpty(imageUrl))
                    {
                        GlideImageLoader.LoadImage(Activity, imageUrl, ImageVideo, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);
                    }
                }
                else if (strtext == "purchaseVideo")
                {
                    RestrictedIcon.SetImageResource(Resource.Drawable.ic_action_dollars);
                    RestrictedTextView.Text = GetText(Resource.String.Lbl_purchaseVideo);
                    if (!string.IsNullOrEmpty(imageUrl))
                    {
                        GlideImageLoader.LoadImage(Activity, imageUrl, ImageVideo, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);
                    }

                    var idCurrency = ListUtils.MySettingsList?.PaymentCurrency;
                    var(currency, currencyIcon) = AppTools.GetCurrency(idCurrency);
                    Console.WriteLine(currency);
                    PurchaseButton.Visibility = ViewStates.Visible;
                    PurchaseButton.Text       = GetText(Resource.String.Lbl_Purchase) + " " + currencyIcon + videoObject.SellVideo;
                    PurchaseButton.Tag        = "purchaseVideo";
                }
                else if (strtext == "RentVideo")
                {
                    RestrictedIcon.SetImageResource(Resource.Drawable.ic_action_dollars);
                    RestrictedTextView.Text = GetText(Resource.String.Lbl_RentVideo);
                    if (!string.IsNullOrEmpty(imageUrl))
                    {
                        GlideImageLoader.LoadImage(Activity, imageUrl, ImageVideo, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);
                    }

                    var idCurrency = ListUtils.MySettingsList?.PaymentCurrency;
                    var(currency, currencyIcon) = AppTools.GetCurrency(idCurrency);
                    Console.WriteLine(currency);
                    PurchaseButton.Visibility = ViewStates.Visible;
                    PurchaseButton.Text       = GetText(Resource.String.Lbl_Rent) + " " + currencyIcon + videoObject.RentPrice;
                    PurchaseButton.Tag        = "RentVideo";
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }