FlowTextView icon indicating copy to clipboard operation
FlowTextView copied to clipboard

onLinkClick never called

Open indywidualny opened this issue 8 years ago • 1 comments

I tried to implement OnLinkClickListener to handle clicks of HTML links. Unfortunately it doesn't work. Links are highlighted correctly but onLinkClick(String url) is never called after clicking a link.

My layout hierarchy:

<ScrollView
    <LinearLayout
        <TextView />
        <View />
        <TextView />
        <View />
        <uk.co.deanwild.flowtextview.FlowTextView>
            <ImageView />
        </uk.co.deanwild.flowtextview.FlowTextView>
    </LinearLayout>
</ScrollView>

Some code:

public class RssFragment extends Fragment implements OnLinkClickListener {


    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {

        // ...

        Spanned html = Html.fromHtml(rss.getSummary() + rss.getDescription(),
                new RssImageGetter(getActivity()), null);
        flowTextView.setText(html);
        flowTextView.setOnLinkClickListener(this);
    }


    @Override
    public void onLinkClick(String url) {
        Log.e("Click", url);
    }

Has anyone any idea what's wrong?

indywidualny avatar Jun 09 '16 16:06 indywidualny

please add fun: public boolean onTouchEvent(MotinEvent event){ mClickHandler.onTouch(this,event); return super.onTouchEvent(event); } in FlowTextView.java; and change fun public boolean onTouch(View view,MotionEvent event){ ... if(distance < 10){ if(event_code == MotionEvent.ACTION_DOWN){ ... } } ... } in ClickHandler.java

congxc avatar Nov 03 '16 08:11 congxc