添加注释,修改函数名
This commit is contained in:
1 parent
f90588e79e
commit
d7e42a760c
2 files changed
+8
-7
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user