Coder Social home page Coder Social logo

Comments (8)

mradzinski avatar mradzinski commented on May 18, 2024

DialogsList.setOnDialogLongClickListener should give you a Dialog instance of the dialog the user is pressing. So, having that instance already you should invoke DialogsList.getLayoutManager to get the LinearLayoutManager instance held by the RecyclerView that DialogsList extends from. Once you have the reference to that LayoutManager it's easy, you should invoke LayoutManager.findViewByPosition which will return the view you are looking for.

from chatkit.

mubtadasyed avatar mubtadasyed commented on May 18, 2024

How can I get the position of that dialog instance, as dialog adapter does not have that method? kindly help!

from chatkit.

mradzinski avatar mradzinski commented on May 18, 2024

DialogsListAdapter doesn't seem to provide a getter for the list of items you need, so you either keep track of your actions (by having a secondary list of DIALOG synchronized with the one held inside the DialogsListAdapter) or fork this repo and add a getItems() method on the DialogsListAdapter class. Having that list of DIALOG you'll be able to call List.indexOf to get the position.

Check the code of DialogsListAdapter and read the RecyclerView.adapter and LinearLayoutManager official documentation. All you need is in there, you just need to think how to use it.

from chatkit.

mubtadasyed avatar mubtadasyed commented on May 18, 2024

Thanks, it worked!

from chatkit.

mradzinski avatar mradzinski commented on May 18, 2024

I already created a PR to allow the users to retrieve the current position of a certain dialog. As soon as it gets merged (if it is) you can get back to relay on the official implementation of this library.

from chatkit.

troy379 avatar troy379 commented on May 18, 2024

Hi @mubtadasyed !
Starting from version 0.2.1 you can use OnMessageViewClickListener and OnMessageViewLongClickListener, which has the same behavior as previous listeners, but also returns view. Hope it helps you.

Best regards, Alexander.

from chatkit.

mradzinski avatar mradzinski commented on May 18, 2024

Hey @troy379, the main reason for creating the PR was because providing listeners can be very limiting for the developer. For example, how does the developer implement a swipe to delete functionality based on those listeners? IMHO, having the possibility to retrieve the view itself (through RecyclerView and RecyclerView.Adapter methods) is much more flexible than providing a listener itself.

from chatkit.

bevzaanton avatar bevzaanton commented on May 18, 2024

#32 merged. Thanks @mradzinski

from chatkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.