Search in sources :

Example 1 with PluginFetchTask

use of com.aviary.android.feather.library.plugins.PluginFetchTask 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");
    }
}
Also used : FutureListener(com.aviary.android.feather.library.services.FutureListener) PluginFetchTask(com.aviary.android.feather.library.plugins.PluginFetchTask) Bundle(android.os.Bundle) PluginUpdaterTask(com.aviary.android.feather.library.plugins.PluginUpdaterTask) ThreadPoolService(com.aviary.android.feather.library.services.ThreadPoolService) Future(java.util.concurrent.Future)

Aggregations

Bundle (android.os.Bundle)1 PluginFetchTask (com.aviary.android.feather.library.plugins.PluginFetchTask)1 PluginUpdaterTask (com.aviary.android.feather.library.plugins.PluginUpdaterTask)1 FutureListener (com.aviary.android.feather.library.services.FutureListener)1 ThreadPoolService (com.aviary.android.feather.library.services.ThreadPoolService)1 Future (java.util.concurrent.Future)1