private void PerformRetry(BitmapHunter hunter) { if (hunter.Cancelled) { return; } if (m_Service.IsShutdown) { PerformError(hunter); return; } bool hasConnectivity = m_NetworkInfo != null && m_NetworkInfo.IsConnectedOrConnecting; bool shouldRetryHunter = hunter.ShouldRetry(m_AirplaneMode, m_NetworkInfo); if (shouldRetryHunter) { if (hasConnectivity) { hunter.Future = m_Service.Submit(hunter); } else { PerformError(hunter); } } else { PerformError(hunter); } }
void PerformComplete(BitmapHunter hunter) { if (!hunter.SkipCache) { m_Cache.Set(hunter.Key, hunter.Result); } m_Hunters.Remove(hunter.Key); Batch(hunter); }
internal async void DispatchFailed(BitmapHunter hunter) { await Task.Factory.StartNew(() => { lock (m_Lock) { m_Hunters.Remove(hunter.Key); } Batch(hunter); }); }
void Batch(BitmapHunter hunter) { if (hunter.Cancelled) { return; } m_Batch.Add(hunter); if (!m_Handler.HasMessages(HunterDelayNextBatch)) { m_Handler.SendEmptyMessageDelayed(HunterDelayNextBatch, BatchDelay); } }
private void Batch(BitmapHunter hunter) { if (hunter.IsCancelled) { return; } lock (m_Lock) { m_Batch.Add(hunter); } Task.Delay(BatchDelay).ContinueWith((t) => PerformBatchComplete()); }
public Bitmap Get() { if (m_Deferred) { throw new InvalidOperationException("Fit cannot be used with get"); } if (!m_Data.HasImage) { return(null); } Request <Bitmap> request = CreateRequest(); string key = Utils.CreateKey(request, new StringBuilder()); Action <Bitmap, Drawable> getAction = new GetAction <Bitmap, Drawable>(m_Picasso, request, m_SkipCache, key); return(BitmapHunter.ForRequest(m_Picasso, getAction, m_Picasso.Dispatcher, m_Picasso.Cache).Hunt()); }
internal async void DispatchSubmit(Action <UIImage, UIImage> action) { await Task.Factory.StartNew(() => { lock (m_Lock) { BitmapHunter hunter; if (m_Hunters.TryGetValue(action.Key, out hunter)) { hunter.Attach(action); return; } hunter = BitmapHunter.ForRequest(action.Picasso, action, this, m_Cache); hunter.Run(); m_Hunters.Add(action.Key, hunter); } }); }
void PerformSubmit(Action <Bitmap, Drawable> action) { BitmapHunter hunter; if (m_Hunters.TryGetValue(action.Key, out hunter)) { hunter.Attach(action); return; } if (m_Service.IsShutdown) { return; } hunter = BitmapHunter.ForRequest(action.Picasso, action, this, m_Cache); hunter.Future = m_Service.Submit(hunter); m_Hunters.Add(action.Key, hunter); }
internal void DispatchFailed(BitmapHunter hunter) { m_Handler.SendMessage(m_Handler.ObtainMessage(HunterDecodeFailed, hunter)); }
public void DispatchRetry(BitmapHunter hunter) { m_Handler.SendMessage(m_Handler.ObtainMessage(HunterRetry, hunter)); }
internal void DispatchComplete(BitmapHunter hunter) { m_Handler.SendMessage(m_Handler.ObtainMessage(HunterComplete, hunter)); }
void PerformError(BitmapHunter hunter) { m_Hunters.Remove(hunter.Key); Batch(hunter); }