aboutsummaryrefslogtreecommitdiffstats
path: root/showcaseview
diff options
context:
space:
mode:
Diffstat (limited to 'showcaseview')
-rw-r--r--showcaseview/java/com/github/amlcurran/showcaseview/ShowcaseView.java41
-rw-r--r--showcaseview/java/com/github/amlcurran/showcaseview/targets/ViewTarget.java3
2 files changed, 26 insertions, 18 deletions
diff --git a/showcaseview/java/com/github/amlcurran/showcaseview/ShowcaseView.java b/showcaseview/java/com/github/amlcurran/showcaseview/ShowcaseView.java
index 6d5f386..d3fa88e 100644
--- a/showcaseview/java/com/github/amlcurran/showcaseview/ShowcaseView.java
+++ b/showcaseview/java/com/github/amlcurran/showcaseview/ShowcaseView.java
@@ -26,6 +26,7 @@ import android.graphics.Point;
import android.graphics.PorterDuff;
import android.text.TextUtils;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@@ -157,24 +158,28 @@ public class ShowcaseView extends RelativeLayout
postDelayed(new Runnable() {
@Override
public void run() {
-
- if (!shotStateStore.hasShot()) {
-
- updateBitmap();
- Point targetPoint = target.getPoint();
- if (targetPoint != null) {
- hasNoTarget = false;
- if (animate) {
- animationFactory.animateTargetToPoint(ShowcaseView.this, targetPoint);
- } else {
- setShowcasePosition(targetPoint);
- }
- } else {
- hasNoTarget = true;
- invalidate();
- }
-
- }
+
+ try {
+ if (!shotStateStore.hasShot()) {
+
+ updateBitmap();
+ Point targetPoint = target.getPoint();
+ if (targetPoint != null) {
+ hasNoTarget = false;
+ if (animate) {
+ animationFactory.animateTargetToPoint(ShowcaseView.this, targetPoint);
+ } else {
+ setShowcasePosition(targetPoint);
+ }
+ } else {
+ hasNoTarget = true;
+ invalidate();
+ }
+
+ }
+ } catch (RuntimeException e) {
+ Log.e("cgeo", "Couldn't create showcase view", e);
+ }
}
}, 100);
}
diff --git a/showcaseview/java/com/github/amlcurran/showcaseview/targets/ViewTarget.java b/showcaseview/java/com/github/amlcurran/showcaseview/targets/ViewTarget.java
index d59dd0d..b7fb4f5 100644
--- a/showcaseview/java/com/github/amlcurran/showcaseview/targets/ViewTarget.java
+++ b/showcaseview/java/com/github/amlcurran/showcaseview/targets/ViewTarget.java
@@ -37,6 +37,9 @@ public class ViewTarget implements Target {
@Override
public Point getPoint() {
+ if (mView == null) {
+ return null;
+ }
int[] location = new int[2];
mView.getLocationInWindow(location);
int x = location[0] + mView.getWidth() / 2;