Giter Club home page Giter Club logo

carouselview's Introduction

carouselview's People

Contributors

adeds avatar jama5262 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

carouselview's Issues

Center carousel issue

Describe the bug
when I try to change the height and width of the centre carousel the indicator not working properly even the auto play not working.
and when I give the setCurrentItem to that view also not working.

Smartphone (please complete the following information):

  • Device: moto one action
  • OS: android
  • Browser Chrome
  • Version: android 10

How to implement selected item?

It works like a slider for me. I want the selected item to be highlighted.
I tried some options, but I can't call notifyItemChanged here.

In onBindView, when LinearLayout is clicked, I call the linearLayout.setActivated (row_index == position) method. Doesn't work as I wanted

Cant add the CaruselView

Hi, I'm getting an error while trying to implement the library. I have added maven....

ERROR: Failed to resolve: com.github.jama5262:CarouselView:1.1.0
Show in Project Structure dialog
Affected Modules: app

Could not find com.romandanylyk:pageindicatorview:1.0.3

Describe the bug
Dependency Issue

To Reproduce
Steps to reproduce the behavior:

  1. Just build the project after adding implementation 'com.github.jama5262:CarouselView:1.2.2' in your gradle.

Expected behavior
Should build successfully

Desktop (please complete the following information):

  • Mac, Android Emulator

Additional context

  • What went wrong:
    Execution failed for task ':app:mergeDebugNativeLibs'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.romandanylyk:pageindicatorview:1.0.3.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/romandanylyk/pageindicatorview/1.0.3/pageindicatorview-1.0.3.pom
- https://repo.maven.apache.org/maven2/com/romandanylyk/pageindicatorview/1.0.3/pageindicatorview-1.0.3.pom
- https://jitpack.io/com/romandanylyk/pageindicatorview/1.0.3/pageindicatorview-1.0.3.pom
Required by:
project :app > com.github.jama5262:CarouselView:1.2.2

Looping possibility

The library has name as CarouselView, so I would expect to have possibility have a loop of elements in the Carousel. Even from the beginning to the left side.
Now:
Screenshot 2020-09-01 at 13 14 32
Want:
Screenshot 2020-09-01 at 13 15 01

Also, pls, give possibility to scroll with NOT-smooth animation, but rather immediately.

How to listen to scrolls?

Is your feature request related to a problem? Please describe.
I need to update certain views based on the caraousal item.

Listen to Scrolls events,which position the caraousal currently is?

auto_scroll is not working with ConcatAdapter

When using ConcatAdapter, auto_scroll is not working when you've more than one carousel. It'll work only the very first time but when you scroll the recycler view and that carousel is no more displaying and if you come back you'll notice it is no more auto scrolling. It is only working for the last carousel.

Calling show() multiple times results in an IllegalStateException

Describe the bug
Calling show() multiple times results in an IllegalStateException being thrown by SnapHelper::setupCallbacks, throw new IllegalStateException("An instance of OnFlingListener already set.");

To Reproduce
Steps to reproduce the behavior:

  1. Load an initial data source, call show(). Works as expected
  2. Load a subsequent data source and call show() again
  3. See crash

Expected behavior
Should support calling show() multiple times to repopulate the carousel

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Android 11

Smartphone (please complete the following information):

  • Device: All

Additional context
Add any other context about the problem here.

Maybe I'm doing something wrong, but, I don't see a way to get the carousel to reload data other than calling show(). Here is my code:

        binding.carouselView.apply {
          size = assets.size
          resource = R.layout.view_asset_item
          autoPlay = false
          enableSnapping(true)
          hideIndicator(true)
          indicatorAnimationType = IndicatorAnimationType.NONE
          carouselOffset = OffsetType.CENTER
          setCarouselViewListener { view, position ->
            val assetItemView = view as AssetItemView
            assetItemView.setAsset(assets[position])
          }
          show()
        }

Shape Indicators

Kindly Add a feature to shape indicators like have a circle bordor

Autoplay Feature

It would be better if there was an auto-play feature.
Sometimes, people want to see dynamic carousel where new items are showing without their interaction.

setCurrentItem() doesn't scroll to the correct location

Incorrect item selection when calling setCurrentItem() and passing an indexed value.
For example, my Carousel size is 8, I have eight items. I pass an indexed value (e.g. 0-7) to the setCurrentItem() method. Sometimes this will work correctly and sometimes it doesn't scroll all the way to the correct position and will end up somewhere in-between a selection.

To Reproduce
Steps to reproduce the behavior:

  1. Setup a carousel view:
    CarouselView carouselView = v.findViewById(R.id.carousel_view);
    carouselView.setSize(myItems.length);
    carouselView.hideIndicator(true);
    carouselView.setCarouselViewListener(viewListener);
    carouselView.setCarouselScrollListener(scrollListener);
    carouselView.show();
  1. Call setCurrentItem():
    carouselView.setCurrentItem(6);
  1. See error

Expected behavior
When I pass a value of 6, I expect setCurrentItem() to scroll the carousel view to index 6.

Screenshots
Screenshot from 2020-05-21 16 07 20

Smartphone (please complete the following information):

  • Device: [Pixel 4]
  • OS: [Android 10]

Additional context
I just noticed that the carouselScrollPosition is being set twice which may be causing an issue with the smooth scrolling.

Thank you!

Can't scroll to the last item

after implementation, the slider works fine but can't scroll to the last item it always bouncing back to the (last item-1) position

scroll to position by index

Hi, Is there a possibility to add a function that auto scrolls to a specified index ?
It will be very helpful, (that also disables scrolling).
thanks.

How to set Indiator to the carouselview

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

setCurrentItem func bug - java

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Cannot see indicator view

The indicator is hidden behind the layout resource

layout resource used:-
`
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/_12sdp"
app:cardCornerRadius="@dimen/_8sdp"
app:cardPreventCornerOverlap="true"
app:layout_constraintTop_toTopOf="parent"
app:strokeColor="@color/glade_green"
app:strokeWidth="0.5dp">

<androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:scaleType="centerCrop"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:srcCompat="@tools:sample/avatars[3]" />

    <TextView
        android:id="@+id/textViewTitle"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/_30sdp"
        android:fontFamily="monospace"
        tools:text="Gold Savings"
        android:textColor="@android:color/background_light"
        android:textSize="@dimen/_20ssp"
        android:textStyle="bold"
        app:layout_constraintBottom_toBottomOf="@+id/imageView"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/imageView"
        app:layout_constraintVertical_bias="0.86" />
</androidx.constraintlayout.widget.ConstraintLayout>

</com.google.android.material.card.MaterialCardView>`

Center carousel issue

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

setCurrentItem func bug - java

Hi,
the carousel view works very well, unfortunately I tried using the setCurrentItem() I found a really weird bug about it even though I can't tell something specific.

So what I have created is just the carousel view and each time the user clicks a button it keeps going to the next item.

THE BUG:
When i'm on the first item and setting current item to the next one (index:1) it doesn't respond.
only when I "treat" the index as normal page number it scrolls to the next item.
but, the problem doesn't solve here, when im clicking to move on to the third item it sometimes responds and sometimes not. If I'm lucky and it went to the third item when im clicking the button again it jumps to the sevenths item.
By the way, I have checked my counter multiple times and it's not the problem.

BASIC CODE:
button_next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.e("clicked","next"); if(carouselView!=null) { index++; carouselView.setCurrentItem(index); } } });

Thanks.

Can't load item carousel when item layout to set match_parent

I've tried to set my item set is full screen or match_parent like this in my item_carousel.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/layoutCarousel"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginBottom="8dp"
        app:cardCornerRadius="16dp"
        app:cardUseCompatPadding="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <ImageView
                android:id="@+id/imageView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                tools:srcCompat="@tools:sample/backgrounds/scenic" />

        </androidx.constraintlayout.widget.ConstraintLayout>
    </androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>

here my main_activity.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.jama.carouselview.CarouselView
        android:id="@+id/carouselView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:resource="@layout/item_carousel" />

</androidx.constraintlayout.widget.ConstraintLayout>

and also my MainActivity.kt

class MainActivity : AppCompatActivity() {

    val TAG = "MainActivity"
    private lateinit var binding: ActivityMainBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        val data = Data.data

        Log.d(TAG, "onCreate: data = ${data.size}")

        binding.carouselView.apply {
            size = data.size
            resource = R.layout.item_carousel
            scaleOnScroll = true
            spacing = 50
            hideIndicator(true)
            setCarouselViewListener { view, position ->
                val carouselBinding = ItemCarouselBinding.bind(view)
                carouselBinding.imageView.load(data[position].bannerPhoto) {
                    crossfade(true)
                }
            }
            show()
        }
    }
}

when I launched my app it doesn't display, like this

Screenshot_20200812

when I resize it in another size like this, it works properly, but in this case, I need to set my item match_parent

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <androidx.cardview.widget.CardView
        android:layout_width="300dp"
        android:layout_height="400dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginBottom="8dp"
        app:cardCornerRadius="16dp"
        app:cardUseCompatPadding="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <ImageView
                android:id="@+id/imageView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                tools:srcCompat="@tools:sample/backgrounds/scenic" />

        </androidx.constraintlayout.widget.ConstraintLayout>
    </androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>

Screenshot_20200812

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.