Giter Site home page Giter Site logo

Comments (8)

yuyakaido avatar yuyakaido commented on June 16, 2024 1

@dsuresh-ap The name getTopIndex is a little confusing, this method returns adapter index displaying on top of card stack.

For example,

  • An adapter has 10 items
  • You swiped twice
  • Third card is displayed on top

In this situation, getTopIndex returns 3.

If you want to know more detail, please see sample app in this repository.

from cardstackview.

dsuresh-ap avatar dsuresh-ap commented on June 16, 2024 1

@jemshit getTopIndex() - 1 should return the index of the swiped Object in your adapter

from cardstackview.

yuyakaido avatar yuyakaido commented on June 16, 2024

@ShrikantBadwaik-007 Thanks 😎

You can get top card by using CardStackView#getTopView().
If you want to disable swipe, call CardContainerView#setDraggable(boolean).

But, CardContainerView#setDraggable(boolean) is an internal API, so this is subject to change without notice in future release.

from cardstackview.

Shrikant-B avatar Shrikant-B commented on June 16, 2024

method call you have mentioned gives me object of CardContainerView but that's not what i'm asking. Say, I have list of Profiles which i'm displaying in cardstackview, so how do i get object of Profile for the currently displayed card?

from cardstackview.

yuyakaido avatar yuyakaido commented on June 16, 2024

@ShrikantBadwaik-007 Oh, I misunderstood.

CardStackView doesn't have a method to return object like a Profile. But, CardStackView#getTopIndex() returns top index of card stack, this index can be used as list index.

from cardstackview.

dsuresh-ap avatar dsuresh-ap commented on June 16, 2024

@yuyakaido Would there be a point where getTopIndex() would return a value other than 0? Since it is a stack wouldn't the top index always be 0?

from cardstackview.

dsuresh-ap avatar dsuresh-ap commented on June 16, 2024

@ShrikantBadwaik-007 When a card is swiped, I get the first item from my adapter

from cardstackview.

jemshit avatar jemshit commented on June 16, 2024

Hi @yuyakaido , is there any way to get index of swiped item?

from cardstackview.

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.