Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onLinkClick never called #25

Open
indywidualny opened this issue Jun 9, 2016 · 1 comment
Open

onLinkClick never called #25

indywidualny opened this issue Jun 9, 2016 · 1 comment

Comments

@indywidualny
Copy link

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?

@congxc
Copy link

congxc commented Nov 3, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants