diff options
3 files changed, 34 insertions, 28 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index 67a835c..9a99b81 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -313,6 +313,14 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc }); locationUpdater = new CacheDetailsGeoDirHandler(this); + + // If we have a newer Android device setup Android Beam for easy cache sharing + initializeAndroidBeam(new ActivitySharingInterface() { + @Override + public String getUri() { + return cache != null ? cache.getCgeoUrl() : null; + } + }); } @Override @@ -605,16 +613,6 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc updateTitleBar(cache.getGeocode(), cache.getName(), cache.getType()); - // if we have a newer Android device setup Android Beam for easy cache sharing - initializeAndroidBeam( - new ActivitySharingInterface() { - @Override - public String getUri() { - return cache.getCgeoUrl(); - } - } - ); - // reset imagesList so Images view page will be redrawn imagesList = null; reinitializeViewPager(); 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; |
