zixpo / candybar

Dashboard for Android Icon Packs. Supported by the community.
Apache License 2.0
299 stars 54 forks source link

Add support for visibly disabled requests #134

Closed moertel closed 1 year ago

moertel commented 1 year ago

This commit follows the discussion in https://github.com/zixpo/candybar/discussions/133 and makes more options available to the FilterRequestHandler. In addition to the return value of true/false which completely hides apps from the icon request section, the new methods setAvailableForRequest() and setInfoText() allow to arbitrarily annotate and disable icons as follows:

When setInfoText() sets a non-empty string, a little (i) icon will be displayed and upon tapping it, a dialog with infoText pops up.

When setAvailableForRequest() is set to false, the entire item will be greyed out. When tapping it, nothing happens. Unless setInfoText() is used as well, in which case a dialog with the infoText pops up.

This allows for flexible combinations of selectively hiding, greying out, or just annotating icons based on matched patterns.

moertel commented 1 year ago

Heads-up: the info icon bit is yielding occasional fatals. Not for all users, just some. Investigating.

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.setVisibility(int)' on a null object reference
       at candybar.lib.adapters.RequestAdapter.onBindViewHolder(RequestAdapter.java:200)

Affected line: https://github.com/zixpo/candybar/blob/5c48b54fb10e9c62ed756e81fb87ef2941646ad5/library/src/main/java/candybar/lib/adapters/RequestAdapter.java#L200

moertel commented 1 year ago

I forgot to update the layout files for landscape and sw600dp. Fixed!