Class ImageFetcher
- java.lang.Object
-
- aero.panasonic.inflight.services.image.v2.ImageFetcher
-
public class ImageFetcher extends java.lang.ObjectPackage Starting Point
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImageFetcher.Errorstatic interfaceImageFetcher.Listenerstatic interfaceImageFetcher.onImageReceivedListener
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RequestImagegetImageByImageInfo(ImageInfo imageInfo, ImageFetcher.onImageReceivedListener onImageReceivedListener)Fetch aRequestImageobject with methods to request media image specified by a Image Uri.static voidinitService(Context context, IInFlightCallback inFlightCallback, InFlight inFlight)Initialize a ImageFetcher object and return the object with the IInFlightCallback.
-
-
-
Method Detail
-
initService
public static void initService(Context context, IInFlightCallback inFlightCallback, InFlight inFlight)Initialize a ImageFetcher object and return the object with the IInFlightCallback.- Parameters:
context- : provide a Context to initialize the object.inFlightCallback- : IInFlightCallback will be used to return the instance or providing the error message.inFlight- : provide an InFlight instance to initialize
-
getImageByImageInfo
public RequestImage getImageByImageInfo(ImageInfo imageInfo, ImageFetcher.onImageReceivedListener onImageReceivedListener)
Fetch aRequestImageobject with methods to request media image specified by a Image Uri.- Parameters:
imageInfo-onImageReceivedListener-ImageFetcher.onImageReceivedListener- this callback will be invoked in the context of calling thread.- Returns:
RequestImage- which provide methods to execute asynchronously, cancel the request.- Example:
mInflight = new InFlight(); mInflight.initService(activity,InFlightServices.IMAGE_FETCHER_SERVICE, serviceInstanceId, inflightCallbackListener); public void onInitServiceComplete(Object arg0,String serviceName) { if(serviceName.equals(InFlightServices.IMAGE_FETCHER_SERVICE.getServiceName())) { mMetadata = (Metadata) arg0; RequestMediaMetaImage request = mMetadata.getImageByImageInfo( editTextUri.getText().toString(), new ImageFetcher.onImageReceivedListener() { @Override public void onImageReceived(final Bitmap bitmap,Request request) { String log = "onImageReceived() : request time: " + (System.currentTimeMillis() - timeStamp) + ", image size: (" + bitmap.getWidth() + ", " + bitmap.getHeight() + ")"; Log.v(TAG, log); updateLogs(log); imageViewBitmap.setImageBitmap(bitmap); } }); if (request != null) { request.executeAsync(); timeStamp = System.currentTimeMillis(); } else { Toast.makeText(MetadataTestActivity.this, "request is null", Toast.LENGTH_LONG).show(); } } }
-
-