Example #1
0
        internal bool ImageViewReused(PhotoToLoad photoToLoad)
        {
            try
            {
                if (!m_ImageViews.ContainsKey(photoToLoad.ImageView))
                {
                    return(true);
                }

                if (!m_ImageViews[photoToLoad.ImageView].Equals(photoToLoad.Url))
                {
                    return(true);
                }
                if (!m_LinearLayOutViews.ContainsKey(photoToLoad.linearlayout))
                {
                    return(true);
                }

                if (!m_LinearLayOutViews[photoToLoad.linearlayout].Equals(photoToLoad.Url))
                {
                    return(true);
                }
            }
            catch (Exception)
            {
            }

            return(false);
        }
Example #2
0
        internal void BitmapDisplayer(Bitmap bitmap, PhotoToLoad photoToLoad)
        {
            Activity activity = null;

            if (photoToLoad.ImageView != null)
            {
                // if (photoToLoad.ImageView.Context is ContextWrapper) return;

                activity = photoToLoad.ImageView.Context as Activity;
                if (activity == null)
                {
                    return;
                }
                activity = (Activity)photoToLoad.ImageView.Context;
                activity.RunOnUiThread(() =>
                {
                    if (ImageViewReused(photoToLoad))
                    {
                        return;
                    }
                    photoToLoad.ImageView.Visibility = Android.Views.ViewStates.Visible;
                    if (bitmap != null)
                    {
                        photoToLoad.ImageView.SetImageBitmap(bitmap);
                    }
                    else if (m_StubID != -1)
                    {
                        photoToLoad.ImageView.SetImageResource(m_StubID);
                    }
                });
            }
            if (photoToLoad.linearlayout != null)
            {
                //  if (photoToLoad.linearlayout.Context is ContextWrapper) return;
                activity = (Activity)photoToLoad.linearlayout.Context;
                activity.RunOnUiThread(() =>
                {
                    if (ImageViewReused(photoToLoad))
                    {
                        return;
                    }
                    photoToLoad.linearlayout.Visibility = Android.Views.ViewStates.Visible;
                    if (bitmap != null)
                    {
                        Drawable db = new BitmapDrawable(bitmap);
                        photoToLoad.linearlayout.SetBackgroundDrawable(db);
                    }
                    else if (m_StubID != -1)
                    {
                        photoToLoad.linearlayout.SetBackgroundResource(m_StubID);
                    }
                });
            }
        }
Example #3
0
        internal void BitmapDisplayer(Bitmap bitmap, PhotoToLoad photoToLoad)
        {
            var activity = (Activity)photoToLoad.ImageView.Context;

            activity.RunOnUiThread(() => {
                if (ImageViewReused(photoToLoad))
                {
                    return;
                }
                photoToLoad.ImageView.Visibility = Android.Views.ViewStates.Visible;
                if (bitmap != null)
                {
                    photoToLoad.ImageView.SetImageBitmap(bitmap);
                }
                else if (m_StubID != -1)
                {
                    photoToLoad.ImageView.SetImageResource(m_StubID);
                }
            });
        }
Example #4
0
        internal bool ImageViewReused(PhotoToLoad photoToLoad)
        {
            try
            {
                if (!imageViews.ContainsKey(photoToLoad.ImageView))
                {
                    return(true);
                }

                if (!imageViews[photoToLoad.ImageView].Equals(photoToLoad.Url))
                {
                    return(true);
                }
            }
            catch (Exception)
            {
            }

            return(false);
        }
Example #5
0
        public void QueueImage(string url, ImageView imageView)
        {
            var photoToUpload = new PhotoToLoad(url, imageView);

            ThreadPool.QueueUserWorkItem(state => LoadPhoto(photoToUpload));
        }
        internal bool ImageViewReused(PhotoToLoad photoToLoad)
        {
            try
            {
                if (!m_ImageViews.ContainsKey(photoToLoad.ImageView))
                    return true;

                if (!m_ImageViews[photoToLoad.ImageView].Equals(photoToLoad.Url))
                    return true;
            }
            catch (Exception)
            {
            }

            return false;
        }
 internal void BitmapDisplayer(Bitmap bitmap, PhotoToLoad photoToLoad)
 {
     var activity = (Activity) photoToLoad.ImageView.Context;
     activity.RunOnUiThread(() =>
                                {
                                    if (ImageViewReused(photoToLoad))
                                        return;
                                    photoToLoad.ImageView.Visibility = Android.Views.ViewStates.Visible;
                                    if (bitmap != null)
                                        photoToLoad.ImageView.SetImageBitmap(bitmap);
                                    else if(m_StubID != -1)
                                        photoToLoad.ImageView.SetImageResource(m_StubID);
                                });
 }
 public void QueueImage(string url, ImageView imageView)
 {
     var photoToUpload = new PhotoToLoad(url, imageView);
     ThreadPool.QueueUserWorkItem(state => LoadPhoto(photoToUpload));
 }
Example #9
0
        public void QueueImage(string url, ImageView imageView, int size)
        {
            var photoToUpload = new PhotoToLoad(url, imageView, size);

            LoadPhoto(photoToUpload);
        }