From d7e42a760cb005e92e6d525c8bab8da5703c508a Mon Sep 17 00:00:00 2001 From: seven332 Date: Thu, 26 Jun 2014 13:59:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=87=BD=E6=95=B0=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hippo/ehviewer/ui/CommentsSectionFragment.java | 4 ++-- src/com/hippo/ehviewer/widget/LinkifyTextView.java | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/com/hippo/ehviewer/ui/CommentsSectionFragment.java b/src/com/hippo/ehviewer/ui/CommentsSectionFragment.java index d4536d3c5..d75242979 100644 --- a/src/com/hippo/ehviewer/ui/CommentsSectionFragment.java +++ b/src/com/hippo/ehviewer/ui/CommentsSectionFragment.java @@ -119,9 +119,9 @@ public class CommentsSectionFragment extends Fragment long id) { // Handler url here LinkifyTextView comment = ((LinkifyTextView)view.findViewById(R.id.comment)); - String url = comment.getTouchUrl(); + String url = comment.getTouchedUrl(); if (url != null) { - comment.clearTouchUrl(); + comment.clearTouchedUrl(); Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); diff --git a/src/com/hippo/ehviewer/widget/LinkifyTextView.java b/src/com/hippo/ehviewer/widget/LinkifyTextView.java index 238102758..9b86e3eb5 100644 --- a/src/com/hippo/ehviewer/widget/LinkifyTextView.java +++ b/src/com/hippo/ehviewer/widget/LinkifyTextView.java @@ -46,27 +46,28 @@ public class LinkifyTextView extends TextView { } public void init() { + // Just make urls striking + // LinkifyTextView itself should not handle touch url event setAutoLinkMask(Linkify.WEB_URLS); setLinksClickable(false); } - public String getTouchUrl() { + public String getTouchedUrl() { return mUrl; } /** * Call it when you do not need the url any more */ - public void clearTouchUrl() { + public void clearTouchedUrl() { mUrl = null; } - /** - * Get some code from android.text.method.LinkMovementMethod. Work fine ! - */ @Override public boolean onTouchEvent(MotionEvent event) { if (getText() instanceof Spannable) { + // Get this code from android.text.method.LinkMovementMethod. + // Work fine ! int x = (int) event.getX(); int y = (int) event.getY(); boolean isGetUrl = false;