@@ -81,6 +81,8 @@ public static class ViewHolder extends RecyclerView.ViewHolder {
8181 private boolean initState ;
8282 public ModuleHolder moduleHolder ;
8383 public Drawable background ;
84+ private boolean canExpand ;
85+ private boolean expanded ;
8486
8587 public ViewHolder (@ NonNull View itemView ) {
8688 super (itemView );
@@ -112,6 +114,11 @@ public ViewHolder(@NonNull View itemView) {
112114 } else if (moduleHolder .notificationType != null ) {
113115 onClickListener = moduleHolder .notificationType .onClickListener ;
114116 if (onClickListener != null ) onClickListener .onClick (v );
117+ } else if (this .canExpand ) {
118+ this .cardView .setClickable (false );
119+ if (this .expanded ) return ;
120+ this .expanded = true ;
121+ // TODO Animated expand code
115122 }
116123 }
117124 });
@@ -171,13 +178,17 @@ public boolean update(ModuleHolder moduleHolder) {
171178 this .cardView .setVisibility (View .GONE );
172179 this .moduleHolder = null ;
173180 this .initState = false ;
181+ this .expanded = false ;
174182 return true ;
183+ } else if (moduleHolder != this .moduleHolder ) {
184+ this .expanded = false ;
175185 }
176186 ModuleHolder .Type type = moduleHolder .getType ();
177187 ModuleHolder .Type vType = moduleHolder .getCompareType (type );
178188 this .cardView .setVisibility (View .VISIBLE );
179189 boolean showCaseMode = MainApplication .isShowcaseMode ();
180190 if (moduleHolder .isModuleHolder ()) {
191+ this .canExpand = false ;
181192 this .buttonAction .setVisibility (View .GONE );
182193 LocalModuleInfo localModuleInfo = moduleHolder .moduleInfo ;
183194 if (localModuleInfo != null ) {
@@ -235,6 +246,8 @@ public boolean update(ModuleHolder moduleHolder) {
235246 this .updateText .setText (R .string .substratum_builtin_module );
236247 } else {
237248 this .updateText .setVisibility (View .GONE );
249+ this .canExpand = false ;
250+ this .expanded = true ;
238251 }
239252 this .actionButtonsTypes .clear ();
240253 moduleHolder .getButtons (itemView .getContext (), this .actionButtonsTypes , showCaseMode );
@@ -256,6 +269,10 @@ public boolean update(ModuleHolder moduleHolder) {
256269 imageButton .setContentDescription (null );
257270 }
258271 }
272+ if (this .actionButtonsTypes .isEmpty ()) {
273+ this .canExpand = false ;
274+ this .expanded = false ;
275+ }
259276 this .cardView .setClickable (false );
260277 if (moduleHolder .isModuleHolder () &&
261278 moduleHolder .hasFlag (ModuleInfo .FLAG_MODULE_ACTIVE )) {
@@ -264,6 +281,8 @@ public boolean update(ModuleHolder moduleHolder) {
264281 this .titleText .setTypeface (Typeface .DEFAULT );
265282 }
266283 } else {
284+ this .canExpand = false ;
285+ this .expanded = false ;
267286 if (type == ModuleHolder .Type .SEPARATOR && moduleHolder .filterLevel != 0 ) {
268287 this .buttonAction .setVisibility (View .VISIBLE );
269288 this .buttonAction .setImageResource (moduleHolder .filterLevel );
@@ -312,6 +331,7 @@ public boolean update(ModuleHolder moduleHolder) {
312331 // Coloration system
313332 Drawable drawable = this .cardView .getBackground ();
314333 if (drawable != null ) this .background = drawable ;
334+ this .invalidPropsChip .setVisibility (View .GONE );
315335 if (type .hasBackground ) {
316336 if (drawable == null ) {
317337 this .cardView .setBackground (this .background );
@@ -323,18 +343,14 @@ public boolean update(ModuleHolder moduleHolder) {
323343 backgroundAttr = moduleHolder .notificationType .backgroundAttr ;
324344 } else if (type == ModuleHolder .Type .INSTALLED &&
325345 moduleHolder .hasFlag (ModuleInfo .FLAG_METADATA_INVALID )) {
326- invalidPropsChip .setOnClickListener (_view -> {
346+ this . invalidPropsChip .setOnClickListener (_view -> {
327347 MaterialAlertDialogBuilder builder =
328348 new MaterialAlertDialogBuilder (_view .getContext ());
329-
330- builder
331- .setTitle (R .string .low_quality_module )
349+ builder .setTitle (R .string .low_quality_module )
332350 .setMessage ("Actual description for Low-quality module" )
333351 .setCancelable (true )
334352 .setPositiveButton (R .string .ok , (x , y ) -> x .dismiss ()).show ();
335-
336353 });
337- this .invalidPropsChip .setVisibility (View .VISIBLE );
338354 // Backup restore
339355 // foregroundAttr = R.attr.colorOnError;
340356 // backgroundAttr = R.attr.colorError;
@@ -365,6 +381,11 @@ public boolean update(ModuleHolder moduleHolder) {
365381 } else {
366382 this .titleText .setMinHeight (0 );
367383 }
384+ if (this .expanded ) {
385+ // TODO Static expand code
386+ } else {
387+ // TODO Static retract code
388+ }
368389 this .moduleHolder = moduleHolder ;
369390 this .initState = false ;
370391 return false ;
0 commit comments