The App freezes while explaining UI in recyclerView
- [✓] I have verified the issue exists on the latest version
- [✓] I am able to reproduce it
Version used: 1.12.0
Android version: 8.0 & above
The App seems to freeze if we are trying to explain UI in recyclerView. It kinda resumes when we turn off the screen and turn it back on.
Below is the method I call when I have to show the popUps:
private void explainNearbyCard(View topView, ArrayList<String> targetTitleList, ArrayList<String> targetDescriptionList) { new TapTargetSequence(getActivity()) .targets(TapTarget.forView(topView.findViewById(R.id.ivClickToMenu), targetTitleList.get(0), targetDescriptionList.get(0)) .titleTextColor(R.color.white) .titleTextSize(35) .descriptionTextColor(R.color.white) .descriptionTextSize(20) .descriptionTextAlpha(1.0f) .targetRadius(45) .tintTarget(false) .outerCircleAlpha(0.8f) .outerCircleColor(R.color.spotlight_share_blue), TapTarget.forView(topView.findViewById(R.id.ivLike), targetTitleList.get(1), targetDescriptionList.get(1)) .titleTextColor(R.color.white) .titleTextSize(35) .descriptionTextColor(R.color.white) .descriptionTextSize(20) .descriptionTextAlpha(1.0f) .targetRadius(45) .tintTarget(false) .outerCircleAlpha(0.8f) .outerCircleColor(R.color.spotlight_share_blue)) .considerOuterCircleCanceled(true) .continueOnCancel(true) .listener(new TapTargetSequence.Listener() { @Override public void onSequenceFinish() { Preferences.setNearbyCardLikeExplained(getApplicationContext(), false); } @Override public void onSequenceStep(TapTarget lastTarget, boolean targetClicked) { Preferences.setNearbyCardOptionsExplained(getApplicationContext(), false); } @Override public void onSequenceCanceled(TapTarget lastTarget) { } }) .start(); }
This happens when I try to execute same method over and over again.
ViewTapTarget#onReady() waits for the item to be laid out using View#isLaidOut(), which will never get called after the first layout when it is part of a RecyclerView item.
Either create a custom TapTarget subclass to fix it, or, if you can, map the view to its bounds, and use TapTarget.fromBounds()
(#365 is probably related to this)
@technicalflaw can you please elaborate a bit more for beginners as to how the subclass can fix it..