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 @@ -450,7 +450,8 @@ open class EditorHandlerActivity :
TooltipManager.showIdeCategoryTooltip(
context = this@EditorHandlerActivity,
anchorView = anchor,
tag = action.retrieveTooltipTag(false)
tag = action.retrieveTooltipTag(false),
requestFocus = false,
)
},
onHoverExit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class ProjectActionsToolbar @JvmOverloads constructor(
var onNavIconLongClick: (() -> Unit)? = null
) : MaterialToolbar(context, attrs) {

companion object {
private const val TOOLTIP_HOVER_SHOW_DELAY_MS = 600L
}

init {
// Navigation icon is no longer used in ProjectActionsToolbar
// It's now handled by the title toolbar
Expand Down Expand Up @@ -71,7 +75,7 @@ class ProjectActionsToolbar @JvmOverloads constructor(
MotionEvent.ACTION_HOVER_ENTER -> {
hoverRunnable?.let { view.removeCallbacks(it) }
hoverRunnable = Runnable { onHover?.invoke(view) }
view.postDelayed(hoverRunnable, 600L)
view.postDelayed(hoverRunnable, TOOLTIP_HOVER_SHOW_DELAY_MS)
}
MotionEvent.ACTION_HOVER_EXIT -> {
hoverRunnable?.let { view.removeCallbacks(it) }
Expand Down Expand Up @@ -102,4 +106,3 @@ class ProjectActionsToolbar @JvmOverloads constructor(
this.onNavIconLongClick = listener
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,29 @@ object TooltipManager {

// Displays a tooltip for category [TooltipCategory.CATEGORY_IDE] in a particular context
// (An Activity, Fragment, Dialog etc)
fun showIdeCategoryTooltip(context: Context, anchorView: View, tag: String) {
fun showIdeCategoryTooltip(
context: Context,
anchorView: View,
tag: String,
requestFocus: Boolean = true,
) {
showTooltip(
context = context,
anchorView = anchorView,
category = TooltipCategory.CATEGORY_IDE,
tag = tag
tag = tag,
requestFocus = requestFocus,
)
}

// Displays a tooltip in a particular context with a specific category
fun showTooltip(context: Context, anchorView: View, category: String, tag: String) {
fun showTooltip(
context: Context,
anchorView: View,
category: String,
tag: String,
requestFocus: Boolean = true,
) {
CoroutineScope(Dispatchers.Main).launch {
val tooltipItem = getTooltip(
context,
Expand All @@ -203,6 +215,7 @@ object TooltipManager {
anchorView = anchorView,
level = 0,
tooltipItem = tooltipItem,
requestFocus = requestFocus,
onHelpLinkClicked = { context, url, title ->
val intent =
Intent(context, HelpActivity::class.java).apply {
Expand All @@ -229,20 +242,22 @@ object TooltipManager {
anchorView: View,
level: Int,
tooltipItem: IDETooltipItem,
requestFocus: Boolean,
onHelpLinkClicked: (context: Context, url: String, title: String) -> Unit
) {
setupAndShowTooltipPopup(
context = context,
anchorView = anchorView,
level = level,
tooltipItem = tooltipItem,
requestFocus = requestFocus,
onActionButtonClick = { popupWindow, urlContent ->
popupWindow.dismiss()
onHelpLinkClicked(context, urlContent.first, urlContent.second)
},
onSeeMoreClicked = { popupWindow, nextLevel, item ->
popupWindow.dismiss()
showTooltipPopup(context, anchorView, nextLevel, item, onHelpLinkClicked)
showTooltipPopup(context, anchorView, nextLevel, item, requestFocus, onHelpLinkClicked)
}
)
}
Expand Down Expand Up @@ -279,6 +294,7 @@ object TooltipManager {
anchorView: View,
level: Int,
tooltipItem: IDETooltipItem,
requestFocus: Boolean,
onActionButtonClick: (popupWindow: PopupWindow, url: Pair<String, String>) -> Unit,
onSeeMoreClicked: (popupWindow: PopupWindow, nextLevel: Int, tooltipItem: IDETooltipItem) -> Unit,
) {
Expand Down Expand Up @@ -394,7 +410,7 @@ object TooltipManager {
}
}

popupWindow.isFocusable = true
popupWindow.isFocusable = requestFocus
popupWindow.isOutsideTouchable = true
if (anchorView.isInOverlayWindow()) {
showOverlayTooltip(popupWindow, popupView, anchorView)
Expand Down
Loading