aboutsummaryrefslogtreecommitdiffstats
path: root/showcaseview
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2014-08-27 22:12:19 +0200
committerSamuel Tardieu <sam@rfc1149.net>2014-08-27 22:12:19 +0200
commit5612c3d8ba05043ce21169c0c01eb5f74262f62c (patch)
treeed56f2645c8d62ec201cb1b77cd4ae6038ee1953 /showcaseview
parenta6a103098da207025188fcfdb5538de81ba816b4 (diff)
parentf421a88ed7f8c11d1ab8632f2da40a0da08da694 (diff)
downloadcgeo-5612c3d8ba05043ce21169c0c01eb5f74262f62c.zip
cgeo-5612c3d8ba05043ce21169c0c01eb5f74262f62c.tar.gz
cgeo-5612c3d8ba05043ce21169c0c01eb5f74262f62c.tar.bz2
Merge branch 'release' into upstream
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;