Skip to content

Commit

Permalink
issue fix: #304
Browse files Browse the repository at this point in the history
  • Loading branch information
cgspine committed Jun 8, 2018
1 parent e23da79 commit 4de1901
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import android.view.ViewConfiguration;
import android.widget.TextView;

import com.qmuiteam.qmui.link.QMUILinkify;
import com.qmuiteam.qmui.R;
import com.qmuiteam.qmui.link.QMUILinkTouchMovementMethod;
import com.qmuiteam.qmui.link.QMUILinkify;
import com.qmuiteam.qmui.span.QMUIOnSpanClickListener;

import java.util.HashSet;
Expand Down Expand Up @@ -232,6 +232,14 @@ protected boolean performSpanLongClick(String text) {
return false;
}

@Override
public boolean performClick() {
if (!mTouchSpanHit && !mNeedForceEventToParent) {
return super.performClick();
}
return false;
}

@Override
public boolean performLongClick() {
int end = getSelectionEnd();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

import com.qmuiteam.qmui.widget.QMUITopBar;
import com.qmuiteam.qmui.widget.textview.QMUILinkTextView;
import com.qmuiteam.qmuidemo.manager.QDDataManager;
import com.qmuiteam.qmuidemo.base.BaseFragment;
import com.qmuiteam.qmuidemo.R;
import com.qmuiteam.qmuidemo.base.BaseFragment;
import com.qmuiteam.qmuidemo.lib.annotation.Widget;
import com.qmuiteam.qmuidemo.manager.QDDataManager;

import butterknife.BindView;
import butterknife.ButterKnife;
Expand All @@ -32,6 +32,26 @@ protected View onCreateView() {
ButterKnife.bind(this, view);
initTopBar();
mLinkTextView.setOnLinkClickListener(mOnLinkClickListener);
mLinkTextView.setOnLinkLongClickListener(new QMUILinkTextView.OnLinkLongClickListener() {
@Override
public void onLongClick(String text) {
Toast.makeText(getContext(), "long click: " + text, Toast.LENGTH_SHORT).show();
}
});
mLinkTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getContext(), "click TextView", Toast.LENGTH_SHORT).show();
}
});
// if parent click event should be triggered when TextView area is clicked
// mLinkTextView.setNeedForceEventToParent(true);
// view.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Toast.makeText(getContext(), "forceEventToParent", Toast.LENGTH_SHORT).show();
// }
// });
return view;
}

Expand Down

0 comments on commit 4de1901

Please sign in to comment.