File tree Expand file tree Collapse file tree 4 files changed +11
-21
lines changed
app/src/main/java/com/elconfidencial/bubbleshowcase
bubbleshowcase/src/main/java/com/elconfidencial/bubbleshowcase Expand file tree Collapse file tree 4 files changed +11
-21
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ BubbleShowCaseBuilder(this) //Activity instance
5757 // Called when the user clicks on the background dim
5858 }
5959 })
60- .targetView(buttonArrowRightShowCase ) // View to point out
60+ .targetView(view ) // View to point out
6161 .show() // Display the ShowCase
6262```
6363
Original file line number Diff line number Diff line change @@ -17,16 +17,6 @@ class MainActivity : AppCompatActivity() {
1717 setUpListeners()
1818 }
1919
20- override fun onCreateOptionsMenu (menu : Menu ): Boolean {
21- menuInflater.inflate(R .menu.menu_test, menu)
22- return true
23- }
24-
25- override fun onOptionsItemSelected (item : MenuItem ): Boolean {
26- val id = item.itemId
27- return if (id == R .id.action_test) true else super .onOptionsItemSelected(item)
28- }
29-
3020 private fun setUpListeners (){
3121 buttonSimpleShowCase.setOnClickListener { getSimpleShowCaseBuilder().show() }
3222 buttonColorShowCase.setOnClickListener { getCustomColorShowCaseBuilder().show() }
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ class BubbleShowCase(builder: BubbleShowCaseBuilder){
104104 bubbleMessageViewBuilder = getBubbleMessageViewBuilder()
105105 }
106106
107- if (ScreenUtils . isVisibleOnScreen(target)) {
107+ if (isVisibleOnScreen(target)) {
108108 addTargetViewAtBackgroundDimLayout(target, backgroundDimLayout)
109109 addBubbleMessageViewDependingOnTargetView(target, bubbleMessageViewBuilder!! , backgroundDimLayout)
110110 } else {
@@ -375,6 +375,15 @@ class BubbleShowCase(builder: BubbleShowCaseBuilder){
375375 return bitmap
376376 }
377377
378+ private fun isVisibleOnScreen (targetView : View ? ): Boolean {
379+ if (targetView!= null ){
380+ if (getXposition(targetView) >= 0 && getYposition(targetView) >= 0 ){
381+ return getXposition(targetView) != 0 || getYposition(targetView) != 0
382+ }
383+ }
384+ return false
385+ }
386+
378387 private fun getXposition (targetView : View ): Int {
379388 return ScreenUtils .getAxisXpositionOfViewOnScreen(targetView) - getScreenHorizontalOffset()
380389 }
Original file line number Diff line number Diff line change @@ -61,15 +61,6 @@ object ScreenUtils {
6161 return androidContent.parent.parent as ViewGroup
6262 }
6363
64- fun isVisibleOnScreen (targetView : View ? ): Boolean {
65- if (targetView!= null ){
66- if (getAxisXpositionOfViewOnScreen(targetView) >= 0 && getAxisYpositionOfViewOnScreen(targetView) >= 0 ){
67- return getAxisXpositionOfViewOnScreen(targetView) != 0 || getAxisYpositionOfViewOnScreen(targetView) != 0
68- }
69- }
70- return false
71- }
72-
7364 fun getStatusBarHeight (context : Context ): Int {
7465 var result = 0
7566 val resourceId = context.resources.getIdentifier(" status_bar_height" , " dimen" , " android" )
You can’t perform that action at this time.
0 commit comments