use of com.aviary.android.feather.library.services.ThreadPoolService in project mobile-android by photo.
the class FeatherActivity method loadExif.
/**
* load the original file EXIF data and store the result into the local data instance
*/
protected void loadExif() {
logger.log("loadExif");
final LocalDataService data = mFilterManager.getService(LocalDataService.class);
ThreadPoolService thread = mFilterManager.getService(ThreadPoolService.class);
if (null != data && thread != null) {
final String path = data.getSourceImagePath();
FutureListener<Bundle> listener = new FutureListener<Bundle>() {
@Override
public void onFutureDone(Future<Bundle> future) {
try {
Bundle result = future.get();
if (null != result) {
data.setOriginalExifBundle(result);
}
} catch (Throwable e) {
e.printStackTrace();
}
}
};
if (null != path) {
thread.submit(new ExifTask(), listener, path);
} else {
logger.warning("orinal file path not available");
}
}
}
use of com.aviary.android.feather.library.services.ThreadPoolService in project mobile-android by photo.
the class FilterManager method updateInstalledPlugins.
private void updateInstalledPlugins(Bundle extras) {
logger.info("updateInstalledPlugins");
ThreadPoolService background = getService(ThreadPoolService.class);
if (background != null) {
final boolean externalItemsEnabled = Constants.getExternalPacksEnabled();
FutureListener<PluginFetchTask.Result> listener = new FutureListener<PluginFetchTask.Result>() {
@Override
public void onFutureDone(Future<PluginFetchTask.Result> future) {
PluginFetchTask.Result result;
try {
result = future.get();
} catch (Throwable t) {
logger.error(t.getMessage());
return;
}
mPluingsHandler.post(new PluginTaskCompletedRunnable(result));
}
};
BackgroundCallable<Bundle, PluginFetchTask.Result> task;
if (null == extras) {
// first time
task = new PluginFetchTask();
} else {
// when a plugin is changed
task = new PluginUpdaterTask(externalItemsEnabled ? mPluingsHandler : null);
}
background.submit(task, listener, extras);
} else {
logger.error("failed to retrieve ThreadPoolService");
}
}
use of com.aviary.android.feather.library.services.ThreadPoolService in project mobile-android by photo.
the class FilterManager method updateAvailablePlugins.
private void updateAvailablePlugins() {
logger.info("updateAvailablePlugins");
ThreadPoolService background = getService(ThreadPoolService.class);
if (null != background) {
if (Constants.getExternalPacksEnabled()) {
FutureListener<Bundle> listener = new FutureListener<Bundle>() {
@Override
public void onFutureDone(Future<Bundle> future) {
logger.log("updateAvailablePlugins::completed");
Bundle result = null;
try {
result = future.get();
} catch (Throwable t) {
logger.error(t.getMessage());
return;
}
mPluingsHandler.post(new ExternalPluginTaskCompletedRunnable(result));
}
};
// submit the task to download the list of external content
background.submit(new ExternalPacksTask(), listener, null);
}
}
}
Aggregations