public static RequestOptions GetRequestOptions(ImageStyle style, ImagePlaceholders imagePlaceholders)
        {
            try
            {
                var options = new RequestOptions();


                switch (style)
                {
                case ImageStyle.CenterCrop:
                    options.CenterCrop();
                    break;

                case ImageStyle.FitCenter:
                    options.FitCenter();
                    break;

                case ImageStyle.CircleCrop:
                    options.CircleCrop();
                    break;

                case ImageStyle.CircleCropWithBorder:
                    options.CircleCrop();
                    options.Transform(new GlideCircleWithBorder(2, Color.White));
                    break;

                case ImageStyle.RoundedCrop:
                    options.Transform(new MultiTransformation(new CenterCrop(), new RoundedCorners(20)));
                    break;

                default:
                    options.CenterCrop();
                    break;
                }


                switch (imagePlaceholders)
                {
                case ImagePlaceholders.Color:
                    var color = Methods.FunString.RandomColor();
                    options.Placeholder(new ColorDrawable(Color.ParseColor(color))).Fallback(new ColorDrawable(Color.ParseColor(color)));
                    break;

                case ImagePlaceholders.Drawable:
                    options.Placeholder(Resource.Drawable.ImagePlacholder).Fallback(Resource.Drawable.ImagePlacholder);
                    break;
                }

                return(options);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
                return(new RequestOptions());
            }
        }
Example #2
0
        public static RequestOptions GetRequestOptions(ImageStyle style, ImagePlaceholders imagePlaceholders)
        {
            try
            {
                var options = new RequestOptions();


                switch (style)
                {
                case ImageStyle.CenterCrop:
                    options.CenterCrop();
                    break;

                case ImageStyle.FitCenter:
                    options.FitCenter();
                    break;

                case ImageStyle.CircleCrop:
                    options.CircleCrop();
                    break;

                case ImageStyle.RoundedCrop:
                    options.Transform(new MultiTransformation(new CenterCrop(), new RoundedCorners(25)))
                    .SetPriority(Priority.High).Override(450)
                    .SetUseAnimationPool(false).SetDiskCacheStrategy(DiskCacheStrategy.All)
                    .Error(Resource.Drawable.ImagePlacholder_circle)
                    .Placeholder(Resource.Drawable.ImagePlacholder_circle);
                    break;

                default:
                    options.CenterCrop();
                    break;
                }


                switch (imagePlaceholders)
                {
                case ImagePlaceholders.Color:
                    var color = Methods.FunString.RandomColor();
                    options.Placeholder(new ColorDrawable(Color.ParseColor(color))).Fallback(new ColorDrawable(Color.ParseColor(color)));
                    break;

                case ImagePlaceholders.Drawable:
                    options.Placeholder(Resource.Drawable.ImagePlacholder).Fallback(Resource.Drawable.ImagePlacholder);
                    break;
                }

                return(options);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(new RequestOptions());
            }
        }
Example #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.layout1_image);//.test.layout.activity_main2);
            string    url            = "http://img1.dzwww.com:8080/tupian_pl/20150813/16/7858995348613407436.jpg";
            ImageView imageView      = FindViewById <ImageView>(Resource.Id.imgView);
            var       requestOptions = new RequestOptions();

            requestOptions.Placeholder(Resource.Drawable.I5);
            requestOptions.CenterCrop();
            requestOptions.DontAnimate();
            //requestOptions.SkipMemoryCache(true);

            requestOptions.Error(Resource.Drawable.I7);

            //Glide.With(this).Load(ImageUrl).Apply(requestOptions).Into(imageView);
            RequestOptions.DiskCacheStrategyOf(DiskCacheStrategy.None);//磁盘缓存

            Glide.With(imageView.Context)
            .Load(url)

            //.Load(Resource.Drawable.I8)
            //.PlaceHolder(R.drawable.place_image)//图片加载出来前,显示的图片
            //.Error(Resource.Drawable.girl)//图片加载失败后,显示的图片
            .Apply(requestOptions)
            .Apply(RequestOptions.CircleCropTransform())
            .Into(imageView);    //.Into(imageView);
            //new GlideDrawableImageViewTarget


            // Create your application here
        }
Example #4
0
 public MyGridViewAdapter(Context context, MySimpleItemLoader mySimpleItemLoader)
 {
     _context            = context;
     _mySimpleItemLoader = mySimpleItemLoader;
     requestOptions      = new RequestOptions();
     requestOptions.Placeholder(Resource.Drawable.Triangles);
     requestOptions.Error(Resource.Drawable.pumafull);
 }
Example #5
0
        private void GetImage(string downloadUrl, View postImageView)
        {
            RequestOptions requestOptions = new RequestOptions();

            requestOptions.Placeholder(Resource.Drawable.img_placeholder);
            requestOptions.SkipMemoryCache(true);

            Glide.With(_context)
            .SetDefaultRequestOptions(requestOptions)
            .Load(downloadUrl)
            .Into(postImageView);
        }
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            profile_url          = Arguments.GetString(Constants.IMG_URL_KEY);
            icu                  = new ImageCaptureUtils(Context);
            icu.OnImageCaptured += Icu_OnImageCaptured;
            icu.OnImageSelected += Icu_OnImageSelected;

            requestOptions = new RequestOptions();
            requestOptions.Placeholder(Resource.Drawable.img_placeholder);
            requestOptions.SkipMemoryCache(true);
        }
Example #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.settings_activity);
            extras     = Intent.Extras;
            parcelable = (ProfileParcelable)extras.GetParcelable(Constants.PROFILE_DATA_EXTRA);

            username_tv = FindViewById <TextView>(Resource.Id.set_prof_name_tv);
            status_tv   = FindViewById <TextView>(Resource.Id.set_prof_extras_tv);
            var appBar  = FindViewById <AppBarLayout>(Resource.Id.settings_appbar);
            var toolbar = appBar.FindViewById <Toolbar>(Resource.Id.main_toolbar);

            profileConstraint = FindViewById <ConstraintLayout>(Resource.Id.profile_const);
            profileIv         = FindViewById <CircleImageView>(Resource.Id.set_prof_iv);

            toolbar.Title = "Settings";
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.NavigationClick += Toolbar_NavigationClick;
            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.frag_container_s, new SettingsFragment())
            .CommitAllowingStateLoss();

            var prefs = PreferenceManager.GetDefaultSharedPreferences(this);

            prefs.RegisterOnSharedPreferenceChangeListener(this);
            var isOnline = prefs.GetBoolean(Constants.SWITCH_VALUE_EXTRA, false);

            SetOnlineStatus(isOnline);

            profileConstraint.Click += ProfileConstraint_Click;

            RequestOptions requestOptions = new RequestOptions();

            requestOptions.Placeholder(Resource.Drawable.user);

            imgUrl   = parcelable.UserProfile.ProfileImgUrl;
            username = parcelable.UserProfile.Username;
            phone    = parcelable.UserProfile.Phone;
            email    = parcelable.UserProfile.Email;
            status   = parcelable.UserProfile.Status;
            userPro  = new string[] { imgUrl, username, phone, status };

            Glide.With(this)
            .SetDefaultRequestOptions(requestOptions)
            .Load(imgUrl)
            .Into(profileIv);

            username_tv.Text = username;
            status_tv.Text   = status;
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.profile_activity);
            var bundle = Intent.Extras;

            await LazyCreateUserAsync(bundle.GetStringArrayList("extra_details"));

            var toolbar = FindViewById <Toolbar>(Resource.Id.profile_toolbar);

            camFab           = FindViewById <FloatingActionButton>(Resource.Id.cam_fab);
            profileImageView = FindViewById <CircleImageView>(Resource.Id.prof_prof_iv);
            usernameEt       = FindViewById <TextInputLayout>(Resource.Id.prof_fname_et);
            phoneEt          = FindViewById <TextInputLayout>(Resource.Id.prof_phone_et);
            statusEt         = FindViewById <TextInputLayout>(Resource.Id.prof_about_et);
            toolbar.Title    = "Profile";
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.NavigationClick           += Toolbar_NavigationClick;
            camFab.Click                      += CamFab_Click;
            profileChooserFrag                 = new ProfileChooserFragment();
            profileChooserFrag.OnCropComplete += ProfileChooserFrag_OnCropComplete;

            RequestOptions requestOptions = new RequestOptions();

            requestOptions.Placeholder(Resource.Drawable.user);

            profileImageView.Click += ProfileImageView_Click;

            phoneEt.EditText.Text    = user.Phone;
            usernameEt.EditText.Text = user.Username;
            statusEt.EditText.Text   = user.Status;

            phoneEt.SetOnClickListener(this);
            usernameEt.SetOnClickListener(this);
            statusEt.SetOnClickListener(this);

            Glide.With(this)
            .SetDefaultRequestOptions(requestOptions)
            .Load(user.ProfileImgUrl)
            .Into(profileImageView);
        }
Example #9
0
        private RequestOptions GetRequestOptions()
        {
            var options = new RequestOptions();

            if (placeholder != null)
            {
                options = options.Placeholder(placeholder);
            }

            if (downScaleType == DownScaleType.FixSize)
            {
                options = options.Override(downScale);
            }

            if (Circle)
            {
                options = options.CircleCrop();
            }

            return(options);
        }
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            base.OnBindViewHolder(holder, position);

            if (holder is ItemViewHolder)
            {
                ItemViewHolder itemViewHolder = (ItemViewHolder)holder;
                var            relatesBean    = relates[position];//.get(position);
                var            dd             = "http://d.hiphotos.baidu.com/image/pic/item/d000baa1cd11728bc4388fe7c5fcc3cec2fd2cd9.jpg";

                var requestOptions = new RequestOptions();
                requestOptions.Placeholder(Resource.Drawable.I1);
                requestOptions.CenterCrop();
                requestOptions.DontAnimate();
                requestOptions.Error(Resource.Drawable.I7);
                requestOptions.CircleCrop();

                Glide.With(holder.ItemView)
                .Load(dd)
                .Apply(requestOptions)
                .Into(itemViewHolder.mVideoPic);
                //.i
                //.with(getContext())
                //    .load(relatesBean.getPic())
                //    .centerCrop()
                //    .diskCacheStrategy(DiskCacheStrategy.ALL)
                //    .placeholder(R.drawable.bili_default_image_tv)
                //    .dontAnimate()
                //    .into(itemViewHolder.mVideoPic);

                itemViewHolder.mVideoTitle.Text   = "Test"; // relatesBean.getTitle();//.setText(relatesBean.getTitle());
                itemViewHolder.mVideoPlayNum.Text = "10";   // relatesBean.getStat().getView().ToString();//.setText(
                //NumberUtil.converString(relatesBean.getStat().getView()));
                itemViewHolder.mVideoReviewNum.Text = "0";  // relatesBean.getStat().getView().ToString();//setText(
                                                            // NumberUtil.converString(relatesBean.getStat().getDanmaku()));
                itemViewHolder.mUpName.Text = "Someone";    // relatesBean.getOwner().getName();// setText(relatesBean.getOwner().getName());
            }
        }
Example #11
0
        private RequestOptions GetRequestFileOptions()
        {
            var options = new RequestOptions();

            options.SkipMemoryCache(true);
            options.InvokeDiskCacheStrategy(DiskCacheStrategy.None);

            if (placeholder != null)
            {
                options = options.Placeholder(placeholder);
            }

            if (downScaleType == DownScaleType.FixSize)
            {
                options = options.Override(downScale);
            }

            if (Circle)
            {
                options = options.CircleCrop();
            }

            return(options);
        }
Example #12
0
        private static RequestOptions GetOptions(ImageStyle style, ImagePlaceholders imagePlaceholders)
        {
            try
            {
                RequestOptions options = new RequestOptions();

                switch (style)
                {
                case ImageStyle.CenterCrop:
                    options = new RequestOptions().Apply(RequestOptions.CenterCropTransform()
                                                         .CenterCrop()
                                                         .SetPriority(Priority.High)
                                                         .SetUseAnimationPool(false).SetDiskCacheStrategy(DiskCacheStrategy.All).AutoClone()
                                                         .Error(Resource.Drawable.ImagePlacholder)
                                                         .Placeholder(Resource.Drawable.ImagePlacholder));
                    break;

                case ImageStyle.FitCenter:
                    options = new RequestOptions().Apply(RequestOptions.CenterCropTransform().AutoClone()
                                                         .FitCenter()
                                                         .SetPriority(Priority.High)
                                                         .SetUseAnimationPool(false).SetDiskCacheStrategy(DiskCacheStrategy.All)
                                                         .Error(Resource.Drawable.ImagePlacholder)
                                                         .Placeholder(Resource.Drawable.ImagePlacholder));
                    break;

                case ImageStyle.CircleCrop:
                    options = new RequestOptions().Apply(RequestOptions.CircleCropTransform().AutoClone()
                                                         .CenterCrop().CircleCrop()
                                                         .SetPriority(Priority.High)
                                                         .SetUseAnimationPool(false).SetDiskCacheStrategy(DiskCacheStrategy.All)
                                                         .Error(Resource.Drawable.ImagePlacholder_circle)
                                                         .Placeholder(Resource.Drawable.ImagePlacholder_circle));
                    break;

                case ImageStyle.RoundedCrop:
                    options = new RequestOptions().Apply(RequestOptions.CircleCropTransform().AutoClone()
                                                         .CenterCrop()
                                                         .Transform(new MultiTransformation(new CenterCrop(), new RoundedCorners(20)))
                                                         .SetPriority(Priority.High)
                                                         .SetUseAnimationPool(false).SetDiskCacheStrategy(DiskCacheStrategy.All)
                                                         .Error(Resource.Drawable.ImagePlacholder_circle)
                                                         .Placeholder(Resource.Drawable.ImagePlacholder_circle));
                    break;

                default:
                    options.CenterCrop();
                    break;
                }

                switch (imagePlaceholders)
                {
                case ImagePlaceholders.Color:
                    var color = Methods.FunString.RandomColor();
                    options.Placeholder(new ColorDrawable(Color.ParseColor(color))).Fallback(new ColorDrawable(Color.ParseColor(color)));
                    break;

                case ImagePlaceholders.Drawable:
                    switch (style)
                    {
                    case ImageStyle.CircleCrop:
                        options.Placeholder(Resource.Drawable.ImagePlacholder_circle).Fallback(Resource.Drawable.ImagePlacholder_circle);
                        break;

                    default:
                        options.Placeholder(Resource.Drawable.ImagePlacholder).Fallback(Resource.Drawable.ImagePlacholder);
                        break;
                    }
                    break;
                }

                return(options);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
                return(new RequestOptions().CenterCrop());
            }
        }