예제 #1
0
        public NewsFeedAdapter(Activity context, PRecyclerView recyclerView)
        {
            try
            {
                ActivityContext  = context;
                MainRecyclerView = recyclerView;

                PreCachingLayoutManager mLayoutManager = new PreCachingLayoutManager(ActivityContext)
                {
                    Orientation = LinearLayoutManager.Vertical
                };

                mLayoutManager.SetPreloadItemCount(5);

                MainRecyclerView.SetLayoutManager(mLayoutManager);
                MainRecyclerView.GetLayoutManager().ItemPrefetchEnabled = true;
                FullGlideRequestBuilder = Glide.With(context).AsDrawable().SetDiskCacheStrategy(DiskCacheStrategy.Automatic).SkipMemoryCache(true).Override(550).Placeholder(new ColorDrawable(Color.ParseColor("#efefef")));

                FixedPreloadSizeProvider            sizeProvider = new FixedPreloadSizeProvider(10, 10);
                RecyclerViewPreloader <PostsObject> preLoader    = new RecyclerViewPreloader <PostsObject>(context, this, sizeProvider, 8);
                MainRecyclerView.AddOnScrollListener(preLoader);

                MainRecyclerView.SetAdapter(this);

                PixelNewsFeedList = new ObservableCollection <PostsObject>();

                ReadMoreOption = new ReadMoreOption.Builder(ActivityContext)
                                 .TextLength(200, ReadMoreOption.TypeCharacter)
                                 .MoreLabel(ActivityContext.GetText(Resource.String.Lbl_ReadMore))
                                 .LessLabel(ActivityContext.GetText(Resource.String.Lbl_ReadLess))
                                 .MoreLabelColor(Color.ParseColor(AppSettings.MainColor))
                                 .LessLabelColor(Color.ParseColor(AppSettings.MainColor))
                                 .LabelUnderLine(true)
                                 .Build();

                ClickListeners = new SocialIoClickListeners(context);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #2
0
        private void Get_Data_Event()
        {
            try
            {
                _Event_Data = JsonConvert.DeserializeObject <Get_Events_Object.Event>(Intent.GetStringExtra("EventView"));
                if (_Event_Data != null)
                {
                    var CoverSplit     = _Event_Data.cover.Split('/').Last();
                    var getImage_Cover =
                        IMethods.MultiMedia.GetMediaFrom_Disk(IMethods.IPath.FolderDiskEvent, CoverSplit);
                    if (getImage_Cover != "File Dont Exists")
                    {
                        ImageServiceLoader.Load_Image(ImageEventCover, "ImagePlacholder.jpg", getImage_Cover);
                    }
                    else
                    {
                        IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskEvent,
                                                                      _Event_Data.cover);
                        ImageServiceLoader.Load_Image(ImageEventCover, "ImagePlacholder.jpg", _Event_Data.cover);
                    }

                    Txt_Name.Text = _Event_Data.name;

                    Txt_Going.Text      = _Event_Data.going_count + " " + GetText(Resource.String.Lbl_GoingPeople);
                    Txt_Interested.Text = _Event_Data.interested_count + " " +
                                          GetText(Resource.String.Lbl_InterestedPeople);
                    Txt_Location.Text = _Event_Data.location;

                    Txt_StartDate.Text = _Event_Data.start_date;
                    Txt_EndDate.Text   = _Event_Data.end_date;

                    var Description =
                        IMethods.Fun_String.DecodeString(
                            IMethods.Fun_String.DecodeStringWithEnter(_Event_Data.description));

                    var readMoreOption = new ReadMoreOption.Builder(this)
                                         .TextLength(250)
                                         .MoreLabel(GetText(Resource.String.Lbl_ReadMore))
                                         .LessLabel(GetText(Resource.String.Lbl_ReadLess))
                                         .MoreLabelColor(Color.ParseColor(Settings.MainColor))
                                         .LessLabelColor(Color.ParseColor(Settings.MainColor))
                                         .LabelUnderLine(true)
                                         .Build();
                    readMoreOption.AddReadMoreTo(Txt_Description, Description);

                    if (_Event_Data.is_going)
                    {
                        Btn_Go.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        Btn_Go.SetTextColor(Color.ParseColor("#ffffff"));
                        Btn_Go.Text = GetText(Resource.String.Lbl_Going);
                        Btn_Go.Tag  = "true";
                    }
                    else
                    {
                        Btn_Go.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        Btn_Go.SetTextColor(Color.ParseColor(Settings.MainColor));
                        Btn_Go.Text = GetText(Resource.String.Lbl_Go);
                        Btn_Go.Tag  = "false";
                    }

                    if (_Event_Data.is_interested)
                    {
                        Btn_Intersted.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        Btn_Intersted.SetTextColor(Color.ParseColor("#ffffff"));
                        Btn_Intersted.Text = GetText(Resource.String.Lbl_Interested);
                        Btn_Intersted.Tag  = "true";
                    }
                    else
                    {
                        Btn_Intersted.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        Btn_Intersted.SetTextColor(Color.ParseColor(Settings.MainColor));
                        Btn_Intersted.Text = GetText(Resource.String.Lbl_Interested);
                        Btn_Intersted.Tag  = "false";
                    }

                    //Set WebView and Load url to be rendered on WebView
                    if (!IMethods.CheckConnectivity())
                    {
                        HybirdView.Visibility = ViewStates.Gone;
                        News_Empty.Visibility = ViewStates.Visible;

                        Txt_News_Empty.Text = GetText(Resource.String.Lbl_Empty_News);
                        Txt_News_start.Text = GetText(Resource.String.Lbl_CheckYourInternetConnection);
                    }
                    else
                    {
                        HybirdView.Visibility = ViewStates.Visible;
                        News_Empty.Visibility = ViewStates.Gone;

                        if (Settings.ClearCachSystem)
                        {
                            HybridController.HybirdView.ClearCache(true);
                        }

                        if (Settings.FlowDirection_RightToLeft)
                        {
                            HybridController.LoadUrl(Current.URLS.UrlInstance.API_Get_News_Feed_Event + _Event_Data.id +
                                                     "&lang=arabic");
                        }
                        else
                        {
                            HybridController.LoadUrl(Current.URLS.UrlInstance.API_Get_News_Feed_Event + _Event_Data.id);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
예제 #3
0
        private void Get_Data_Product()
        {
            try
            {
                _Product_Data =
                    JsonConvert.DeserializeObject <Get_Products_Object.Product>(Intent.GetStringExtra("ProductView"));
                if (_Product_Data != null)
                {
                    ImageServiceLoader.Load_Image(imgBackground, "ImagePlacholder.jpg", _Product_Data.images[0].image,
                                                  2, false, 5);

                    var AvatarSplit     = _Product_Data.seller.avatar.Split('/').Last();
                    var getImage_Avatar =
                        IMethods.MultiMedia.GetMediaFrom_Disk(IMethods.IPath.FolderDiskImage, AvatarSplit);
                    if (getImage_Avatar != "File Dont Exists")
                    {
                        ImageServiceLoader.Load_Image(UserImageAvatar, "no_profile_image.png", getImage_Avatar, 1,
                                                      false, 5);
                    }
                    else
                    {
                        IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskImage,
                                                                      _Product_Data.seller.avatar);
                        ImageServiceLoader.Load_Image(UserImageAvatar, "no_profile_image.png",
                                                      _Product_Data.seller.avatar, 1, false, 5);
                    }

                    Txt_Product_Title.Text =
                        IMethods.Fun_String.DecodeString(IMethods.Fun_String.DecodeStringWithEnter(_Product_Data.name));
                    Txt_Product_Price.Text = _Product_Data.price + " " + Settings.Market_curency;

                    var readMoreOption = new ReadMoreOption.Builder(this)
                                         .TextLength(200)
                                         .MoreLabel(GetText(Resource.String.Lbl_ReadMore))
                                         .LessLabel(GetText(Resource.String.Lbl_ReadLess))
                                         .MoreLabelColor(Color.ParseColor(Settings.MainColor))
                                         .LessLabelColor(Color.ParseColor(Settings.MainColor))
                                         .LabelUnderLine(true)
                                         .Build();

                    if (IMethods.Fun_String.StringNullRemover(_Product_Data.description) != "Empty")
                    {
                        var description =
                            IMethods.Fun_String.DecodeString(
                                IMethods.Fun_String.DecodeStringWithEnter(_Product_Data.description));
                        readMoreOption.AddReadMoreTo(Txt_Product_Description, description);
                    }
                    else
                    {
                        readMoreOption.AddReadMoreTo(Txt_Product_Description, GetText(Resource.String.Lbl_Empty));
                    }

                    Txt_Product_Location.Text = _Product_Data.location;
                    Txt_Product_CardName.Text = IMethods.Fun_String.SubStringCutOf(_Product_Data.seller.name, 14);
                    Txt_Product_Time.Text     = _Product_Data.time_text;

                    if (_Product_Data.type == "0") // New
                    {
                        Txt_Product_BoleanNew.Visibility = ViewStates.Visible;
                    }
                    else // Used
                    {
                        Txt_Product_BoleanNew.Visibility = ViewStates.Gone;
                    }

                    if (_Product_Data.status == "0") // Status InStock
                    {
                        Txt_Product_BoleanInStock.Visibility = ViewStates.Visible;
                    }
                    else
                    {
                        Txt_Product_BoleanInStock.Visibility = ViewStates.Gone;
                    }
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }