33import android .content .Context ;
44import android .content .pm .PackageManager ;
55import android .util .Log ;
6+ import android .view .View ;
67
78import androidx .annotation .NonNull ;
89import androidx .annotation .StringRes ;
@@ -24,6 +25,7 @@ public final class ModuleHolder implements Comparable<ModuleHolder> {
2425 public final NotificationType notificationType ;
2526 public final Type separator ;
2627 public final int footerPx ;
28+ public View .OnClickListener onClickListener ;
2729 public LocalModuleInfo moduleInfo ;
2830 public RepoModule repoModule ;
2931 public int filterLevel ;
@@ -205,54 +207,56 @@ public int compareTo(ModuleHolder o) {
205207 }
206208
207209 public enum Type implements Comparator <ModuleHolder > {
208- SEPARATOR (R .string .loading , false ) {
210+ SEPARATOR (R .string .loading , false , false ) {
209211 @ Override
210212 @ SuppressWarnings ("ConstantConditions" )
211213 public int compare (ModuleHolder o1 , ModuleHolder o2 ) {
212214 return o1 .separator .compareTo (o2 .separator );
213215 }
214216 },
215- NOTIFICATION (R .string .loading , true ) {
217+ NOTIFICATION (R .string .loading , true , false ) {
216218 @ Override
217219 @ SuppressWarnings ("ConstantConditions" )
218220 public int compare (ModuleHolder o1 , ModuleHolder o2 ) {
219221 return o1 .notificationType .compareTo (o2 .notificationType );
220222 }
221223 },
222- UPDATABLE (R .string .updatable , true ) {
224+ UPDATABLE (R .string .updatable , true , true ) {
223225 @ Override
224226 public int compare (ModuleHolder o1 , ModuleHolder o2 ) {
225227 int cmp = Integer .compare (o1 .filterLevel , o2 .filterLevel );
226228 if (cmp != 0 ) return cmp ;
227229 return Long .compare (o2 .repoModule .lastUpdated , o1 .repoModule .lastUpdated );
228230 }
229231 },
230- INSTALLED (R .string .installed , true ) {
232+ INSTALLED (R .string .installed , true , true ) {
231233 @ Override
232234 public int compare (ModuleHolder o1 , ModuleHolder o2 ) {
233235 int cmp = Integer .compare (o1 .filterLevel , o2 .filterLevel );
234236 if (cmp != 0 ) return cmp ;
235237 return o1 .getMainModuleName ().compareTo (o2 .getMainModuleName ());
236238 }
237239 },
238- SPECIAL_NOTIFICATIONS (R .string .loading , true ),
239- INSTALLABLE (R .string .online_repo , true ) {
240+ SPECIAL_NOTIFICATIONS (R .string .loading , true , false ),
241+ INSTALLABLE (R .string .online_repo , true , true ) {
240242 @ Override
241243 public int compare (ModuleHolder o1 , ModuleHolder o2 ) {
242244 int cmp = Integer .compare (o1 .filterLevel , o2 .filterLevel );
243245 if (cmp != 0 ) return cmp ;
244246 return Long .compare (o2 .repoModule .lastUpdated , o1 .repoModule .lastUpdated );
245247 }
246248 },
247- FOOTER (R .string .loading , false );
249+ FOOTER (R .string .loading , false , false );
248250
249251 @ StringRes
250252 public final int title ;
251253 public final boolean hasBackground ;
254+ public final boolean moduleHolder ;
252255
253- Type (@ StringRes int title , boolean hasBackground ) {
256+ Type (@ StringRes int title , boolean hasBackground , boolean moduleHolder ) {
254257 this .title = title ;
255258 this .hasBackground = hasBackground ;
259+ this .moduleHolder = moduleHolder ;
256260 }
257261
258262 // Note: This method should only be called if both element have the same type
0 commit comments