@@ -33,6 +33,9 @@ public class HyperionPluginView extends FrameLayout {
33
33
@ Inject
34
34
Set <PluginModule > modules ;
35
35
36
+ @ Inject
37
+ PluginFilter filter ;
38
+
36
39
public HyperionPluginView (@ NonNull Context context ) {
37
40
this (context , null );
38
41
}
@@ -66,9 +69,11 @@ public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets)
66
69
}
67
70
});
68
71
72
+ Set <PluginModule > filteredModules = filter .filter (modules );
73
+
69
74
final Comparator <PluginModule > comparator = new AlphabeticalComparator (getContext ());
70
75
final Set <PluginModule > sortedModules = new TreeSet <>(comparator );
71
- sortedModules .addAll (modules );
76
+ sortedModules .addAll (filteredModules );
72
77
73
78
final Context inflaterContext = new PluginExtensionContextWrapper (getContext (), pluginExtension );
74
79
final LayoutInflater inflater = LayoutInflater .from (inflaterContext );
@@ -88,7 +93,7 @@ static final class Factory implements PluginViewFactory {
88
93
this .container = container ;
89
94
}
90
95
91
- private CoreComponent getCoreComponent (Activity activity ) {
96
+ private CoreComponent getCoreComponent (Activity activity , boolean standalone ) {
92
97
final ViewGroup windowContentView = activity .getWindow ().findViewById (android .R .id .content );
93
98
final HyperionMenuController controller = new HyperionMenuController (windowContentView );
94
99
@@ -102,13 +107,18 @@ private CoreComponent getCoreComponent(Activity activity) {
102
107
.commit ();
103
108
}
104
109
110
+ PluginFilter filter = new IdentityPluginFilter ();
111
+ if (standalone ) {
112
+ filter = new StandalonePluginFilter ();
113
+ }
114
+
105
115
CoreComponent component = DaggerCoreComponent .builder ()
106
116
.appComponent (AppComponent .Holder .getInstance (activity ))
107
117
.activity (activity )
108
- .pluginSource (container .getPluginSource ())
109
118
.menuController (controller )
110
119
.container (windowContentView )
111
120
.activityResults (activityResults )
121
+ .pluginFilter (filter )
112
122
.build ();
113
123
114
124
container .putComponent (activity , component );
@@ -117,11 +127,11 @@ private CoreComponent getCoreComponent(Activity activity) {
117
127
118
128
@ Override
119
129
public View create (Activity activity ) {
120
- return createInternal (activity , false );
130
+ return createInternal (activity , false , true );
121
131
}
122
132
123
- HyperionPluginView createInternal (Activity activity , Boolean bindToMenuController ) {
124
- CoreComponent component = getCoreComponent (activity );
133
+ HyperionPluginView createInternal (Activity activity , boolean bindToMenuController , boolean standalone ) {
134
+ CoreComponent component = getCoreComponent (activity , standalone );
125
135
HyperionPluginView pluginView = new HyperionPluginView (new ComponentContextThemeWrapper (activity , component ));
126
136
if (bindToMenuController ) {
127
137
component .getMenuController ().setPluginView (pluginView );
0 commit comments