@@ -180,17 +180,29 @@ object TooltipManager {
180180
181181 // Displays a tooltip for category [TooltipCategory.CATEGORY_IDE] in a particular context
182182 // (An Activity, Fragment, Dialog etc)
183- fun showIdeCategoryTooltip (context : Context , anchorView : View , tag : String ) {
183+ fun showIdeCategoryTooltip (
184+ context : Context ,
185+ anchorView : View ,
186+ tag : String ,
187+ requestFocus : Boolean = true,
188+ ) {
184189 showTooltip(
185190 context = context,
186191 anchorView = anchorView,
187192 category = TooltipCategory .CATEGORY_IDE ,
188- tag = tag
193+ tag = tag,
194+ requestFocus = requestFocus,
189195 )
190196 }
191197
192198 // Displays a tooltip in a particular context with a specific category
193- fun showTooltip (context : Context , anchorView : View , category : String , tag : String ) {
199+ fun showTooltip (
200+ context : Context ,
201+ anchorView : View ,
202+ category : String ,
203+ tag : String ,
204+ requestFocus : Boolean = true,
205+ ) {
194206 CoroutineScope (Dispatchers .Main ).launch {
195207 val tooltipItem = getTooltip(
196208 context,
@@ -203,6 +215,7 @@ object TooltipManager {
203215 anchorView = anchorView,
204216 level = 0 ,
205217 tooltipItem = tooltipItem,
218+ requestFocus = requestFocus,
206219 onHelpLinkClicked = { context, url, title ->
207220 val intent =
208221 Intent (context, HelpActivity ::class .java).apply {
@@ -229,20 +242,22 @@ object TooltipManager {
229242 anchorView : View ,
230243 level : Int ,
231244 tooltipItem : IDETooltipItem ,
245+ requestFocus : Boolean ,
232246 onHelpLinkClicked : (context: Context , url: String , title: String ) -> Unit
233247 ) {
234248 setupAndShowTooltipPopup(
235249 context = context,
236250 anchorView = anchorView,
237251 level = level,
238252 tooltipItem = tooltipItem,
253+ requestFocus = requestFocus,
239254 onActionButtonClick = { popupWindow, urlContent ->
240255 popupWindow.dismiss()
241256 onHelpLinkClicked(context, urlContent.first, urlContent.second)
242257 },
243258 onSeeMoreClicked = { popupWindow, nextLevel, item ->
244259 popupWindow.dismiss()
245- showTooltipPopup(context, anchorView, nextLevel, item, onHelpLinkClicked)
260+ showTooltipPopup(context, anchorView, nextLevel, item, requestFocus, onHelpLinkClicked)
246261 }
247262 )
248263 }
@@ -279,6 +294,7 @@ object TooltipManager {
279294 anchorView : View ,
280295 level : Int ,
281296 tooltipItem : IDETooltipItem ,
297+ requestFocus : Boolean ,
282298 onActionButtonClick : (popupWindow: PopupWindow , url: Pair <String , String >) -> Unit ,
283299 onSeeMoreClicked : (popupWindow: PopupWindow , nextLevel: Int , tooltipItem: IDETooltipItem ) -> Unit ,
284300 ) {
@@ -394,7 +410,7 @@ object TooltipManager {
394410 }
395411 }
396412
397- popupWindow.isFocusable = true
413+ popupWindow.isFocusable = requestFocus
398414 popupWindow.isOutsideTouchable = true
399415 if (anchorView.isInOverlayWindow()) {
400416 showOverlayTooltip(popupWindow, popupView, anchorView)
0 commit comments