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

TableViewSampleApp ColumnHeaderLongPressed vs ColumnHeaderClicked #197

Closed
vkhaitan opened this issue Dec 8, 2018 · 3 comments
Closed

TableViewSampleApp ColumnHeaderLongPressed vs ColumnHeaderClicked #197

vkhaitan opened this issue Dec 8, 2018 · 3 comments

Comments

@vkhaitan
Copy link

vkhaitan commented Dec 8, 2018

I find it quite strange that OnColumnHeaderClicked listener is not called when column is touched. Instead the LongPressed version is called. You tableviewsampleapp too execute code in LongPress listener. Why did you not write code in Clicked version, instead of LongPress ? Why Clicked version is not even called ?

@vkhaitan
Copy link
Author

vkhaitan commented Dec 9, 2018

Okay. It was working in 0.8.6 . It stopped working after that. I find that you did some changes to fix #133 and that fix created this new issue. Need another fix now.

@vkhaitan
Copy link
Author

vkhaitan commented Dec 9, 2018

Okay. So I fixed it in my C# source code. Basically you just forgot to update other files in fix of #133 .
e.g. In ClickAction() function

protected internal override bool ClickAction(RecyclerView view, MotionEvent e)
       {
           // Get interacted view from x,y coordinate.
           Android.Views.View childView = view.FindChildViewUnder(e.GetX(), e.GetY());
           if (childView != null && mGestureDetector.OnTouchEvent(e))
           {
               // Find the view holder
               AbstractViewHolder holder = (AbstractViewHolder) mRecyclerView.GetChildViewHolder(childView);
               // Get y position from adapter
               CellRowRecyclerViewAdapter adapter = (CellRowRecyclerViewAdapter) mRecyclerView.GetAdapter();
               int column = holder.AdapterPosition;
               int row = adapter.GetYPosition();
               // Control to ignore selection color
               if (!mTableView.IsIgnoreSelectionColors())
               {
                   mSelectionHandler.SetSelectedCellPositions(holder, column, row);
               }

               if (GetTableViewListener() != null)
               {
                   // Call ITableView listener for item click
                   GetTableViewListener().OnCellClicked(holder, column, row);
               }

               return true;
           }

           return false;
       } 

In this code mGestureDetector.OnTouchEvent(e) is spurious now, since you are already calling it in Listener interface. You need to remove it all 3 files, then commit. I did it for myself in C# code and after that correct methods are being called.

@vkhaitan
Copy link
Author

vkhaitan commented Dec 9, 2018

Okay, I just found that there is already a pull request for this via #181 . So marking it closed.

@vkhaitan vkhaitan closed this as completed Dec 9, 2018
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

1 participant