Merge "Define ICON_UNAVAILABLE for no icon status"

This commit is contained in:
TreeHugger Robot
2020-01-20 09:23:33 +00:00
committed by Android (Google) Code Review
2 changed files with 4 additions and 2 deletions

View File

@@ -28,11 +28,13 @@ import java.util.List;
*/ */
public interface PanelContent extends Instrumentable { public interface PanelContent extends Instrumentable {
int ICON_UNAVAILABLE = -1;
/** /**
* @return a icon resource for the title of the Panel. * @return a icon resource for the title of the Panel.
*/ */
default int getIcon() { default int getIcon() {
return -1; return ICON_UNAVAILABLE;
} }
/** /**

View File

@@ -193,7 +193,7 @@ public class PanelFragment extends Fragment {
loadAllSlices(); loadAllSlices();
final int iconRes = mPanel.getIcon(); final int iconRes = mPanel.getIcon();
if (iconRes == -1) { if (iconRes == PanelContent.ICON_UNAVAILABLE) {
mTitleView.setText(mPanel.getTitle()); mTitleView.setText(mPanel.getTitle());
} else { } else {
mTitleView.setVisibility(View.GONE); mTitleView.setVisibility(View.GONE);