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

onHashTagClicked not working correctly #8

Closed
Shajeel-Afzal opened this issue Jan 16, 2016 · 2 comments
Closed

onHashTagClicked not working correctly #8

Shajeel-Afzal opened this issue Jan 16, 2016 · 2 comments

Comments

@Shajeel-Afzal
Copy link

I am showing Hash Tags in a TextView in the RecyclerAdaper.

Problem is that the Click Listener on the adapter Item is not working properly when i am using HashTagHelper library. If the user clicks on TextView's text that is not a Hash Tag then the onClick of the Item is not being called.

Inside onBindView method i am showing the Hash Tag on the TextView:

@Override
    public void onBindViewHolder(TaskViewHolder holder, int position) {
        ...
        holder.mTaskTitleTv.setText(mTasksList.get(position).getTitle());
        holder.mTextHashTagHelper.handle(holder.mTaskTitleTv);
    }

And ViewHolder looks like this:

class TaskViewHolder extends RecyclerView.ViewHolder implements OnClickListener {

        ...
        public TaskViewHolder(View itemView) {
            super(itemView);
            findViews(itemView);
            itemView.setOnClickListener(this);
            mTextHashTagHelper = HashTagHelper.Creator.create(mContext.getResources().getColor(R.color.primary), new HashTagHelper.OnHashTagClickListener() {
                @Override
                public void onHashTagClicked(String hashTag) {
                    mContext.startActivity(HashTagTaskActivity.createLauncherIntent(mContext, hashTag));
                }
            });
        }

       @Override
        public void onClick(View v) {
            mListner.onItemClick(v, getLayoutPosition());
        }
}
@danylovolokh
Copy link
Owner

As you said:
If the user clicks on TextView's text that is not a Hash Tag then the onClick of the Item is not being called.

The HashTagHelper is designed to handle clicks on hashtags only. It doesn't call onClick on a regular text without #hashtag.

The library is opensource. Feel free to modify it to suit your needs

@Shajeel-Afzal
Copy link
Author

Alright. I will try to understand the code and do the changes to achieve what i need. Thanks.

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