Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,17 @@ object TooltipManager {
}
)
} else {
Log.e(TAG, "Tooltip item $tooltipItem is null")
Log.d(TAG, "No tooltip for category='$category', tag='$tag'; showing documentation fallback")
showTooltipPopup(
context = context,
anchorView = anchorView,
level = 0,
tooltipItem = IDETooltipItem(-1, -1, category, tag, "", "", arrayListOf(), ""),
requestFocus = requestFocus,
onHelpLinkClicked = { context, url, _ ->
HelpActivity.launch(context, url, context.getString(ResR.string.back_to_cogo))
}
)
Comment thread
Daniel-ADFA marked this conversation as resolved.
}
}
}
Expand Down Expand Up @@ -308,12 +318,18 @@ object TooltipManager {
else ResR.color.tooltip_link_color_light,
).toCssHex()

val detailContent = tooltipItem.detail.takeUnless { it.isMissingTooltipContent() } ?: ""
val tooltipHtmlContent = when (level) {
0 -> {
tooltipItem.summary
// A blank or "n/a" summary is a dead end; route the user to the
// documentation instead (ADFA-4754).
tooltipItem.summary.takeUnless { it.isMissingTooltipContent() }
?: context.getString(
ResR.string.tooltip_missing_fallback_html,
context.getString(ResR.string.docs_url),
)
}
1 -> {
val detailContent = tooltipItem.detail.ifBlank { "" }
if (tooltipItem.buttons.isNotEmpty()) {
val buttonsSeparator = context.getString(R.string.tooltip_buttons_separator)
val linksHtml = tooltipItem.buttons.joinToString(buttonsSeparator) { (label, url) ->
Expand Down Expand Up @@ -367,7 +383,7 @@ object TooltipManager {
onSeeMoreClicked(popupWindow, nextLevel, tooltipItem)
}
val shouldShowSeeMore = when {
level == 0 && (tooltipItem.detail.isNotBlank() || tooltipItem.buttons.isNotEmpty()) -> true
level == 0 && (detailContent.isNotBlank() || tooltipItem.buttons.isNotEmpty()) -> true
else -> false
}
seeMore.visibility = if (shouldShowSeeMore) View.VISIBLE else View.GONE
Expand Down Expand Up @@ -550,6 +566,9 @@ object TooltipManager {
""".trimIndent()
}

private fun String.isMissingTooltipContent(): Boolean =
isBlank() || trim().equals("n/a", ignoreCase = true)

private fun View.isInOverlayWindow(): Boolean {
val params = layoutParams
return params is WindowManager.LayoutParams &&
Expand Down
1 change: 1 addition & 0 deletions resources/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,7 @@

<!-- Tooltip Links HTML Template -->
<string name="tooltip_links_html_template"><![CDATA[<a href="%1$s" style="color:%2$s;text-decoration:underline;">%3$s</a>]]></string>
<string name="tooltip_missing_fallback_html"><![CDATA[Sorry, we don&#8217;t have a tooltip for that. <a href="%1$s">Explore the documentation</a>.]]></string>
<string name="title_alert">Send feedback</string>

<!-- Strings from BaseApplication.java -->
Expand Down
Loading