Search in sources :

Example 1 with PluginModule

use of com.willowtreeapps.hyperion.plugin.v1.PluginModule in project Hyperion-Android by willowtreeapps.

the class HyperionPluginView method onDetachedFromWindow.

@Override
protected void onDetachedFromWindow() {
    super.onDetachedFromWindow();
    if (modules != null) {
        for (PluginModule module : modules) {
            module.destroy();
        }
    }
    pluginExtension.setHyperionMenu(null);
}
Also used : PluginModule(com.willowtreeapps.hyperion.plugin.v1.PluginModule)

Example 2 with PluginModule

use of com.willowtreeapps.hyperion.plugin.v1.PluginModule in project Hyperion-Android by willowtreeapps.

the class HyperionPluginView method update.

private void update(Try<List<PluginModule>> result) {
    try {
        modules = result.get();
    } catch (Throwable t) {
        // TODO
        t.printStackTrace();
        return;
    }
    final Context context = new PluginExtensionContextWrapper(getContext(), pluginExtension);
    final LayoutInflater inflater = LayoutInflater.from(context);
    for (PluginModule module : modules) {
        module.create(pluginExtension, context);
        View view = module.createPluginView(inflater, pluginListContainer);
        pluginListContainer.addView(view);
    }
}
Also used : Context(android.content.Context) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) View(android.view.View) PluginModule(com.willowtreeapps.hyperion.plugin.v1.PluginModule)

Example 3 with PluginModule

use of com.willowtreeapps.hyperion.plugin.v1.PluginModule in project Hyperion-Android by willowtreeapps.

the class PluginLoader method load.

@WorkerThread
List<PluginModule> load() {
    List<PluginModule> plugins = new ArrayList<>();
    ServiceLoader<Plugin> loader = ServiceLoader.load(Plugin.class);
    for (Plugin plugin : loader) {
        PluginModule module = plugin.createPluginModule();
        if (module != null) {
            plugins.add(module);
        }
    }
    return plugins;
}
Also used : ArrayList(java.util.ArrayList) PluginModule(com.willowtreeapps.hyperion.plugin.v1.PluginModule) Plugin(com.willowtreeapps.hyperion.plugin.v1.Plugin) WorkerThread(android.support.annotation.WorkerThread)

Aggregations

PluginModule (com.willowtreeapps.hyperion.plugin.v1.PluginModule)3 Context (android.content.Context)1 WorkerThread (android.support.annotation.WorkerThread)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 TextView (android.widget.TextView)1 Plugin (com.willowtreeapps.hyperion.plugin.v1.Plugin)1 ArrayList (java.util.ArrayList)1