Example #1
0
            public static object Install(Context context)
            {
                File cacheDir           = AndroidUtils.CreateDefaultCacheDir(context);
                HttpResponseCache cache = HttpResponseCache.Installed;

                if (cache == null)
                {
                    long maxSize = AndroidUtils.CalculateDiskCacheSize(cacheDir);
                    cache = HttpResponseCache.Install(cacheDir, maxSize);
                }
                return(cache);
            }
Example #2
0
 internal Dispatcher(Context context, Handler mainThreadHandler, IExecutorService service, ICache <Bitmap> cache, IDownloader <Bitmap> downloader)
 {
     m_DipatcherThread = new DispatcherThread();
     m_DipatcherThread.Start();
     m_Handler           = new DispatcherHandler(m_DipatcherThread.Looper, this);
     m_Context           = context;
     m_MainThreadHandler = mainThreadHandler;
     m_Cache             = cache;
     m_Downloader        = downloader;
     m_Service           = service;
     m_AirplaneMode      = AndroidUtils.IsAirplaneModeOn(m_Context);
     m_Receiver          = new NetworkBroadcastReceiver(this);
     m_Receiver.Register();
 }
Example #3
0
            public void Register()
            {
                bool shouldScanState = m_Dispatcher.m_Service is PicassoExecutorService &&
                                       AndroidUtils.HasPermission(m_Dispatcher.m_Context,
                                                                  Manifest.Permission.AccessNetworkState);
                var intentFilter = new IntentFilter();

                intentFilter.AddAction(Intent.ActionAirplaneModeChanged);
                if (shouldScanState)
                {
                    intentFilter.AddAction(ConnectivityManager.ConnectivityAction);
                }
                m_Dispatcher.m_Context.RegisterReceiver(this, intentFilter);
            }
Example #4
0
 internal void DispatchCancel(Action <Bitmap, Drawable> action)
 {
     m_Handler.SendMessage(m_Handler.ObtainMessage(RequestCancel, AndroidUtils.Wrap(action)));
 }