Giter Club home page Giter Club logo

carouselview's People

Contributors

sunny-chung 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

carouselview's Issues

OnItemClickListener's Callback is not returning proper position values

Hi. I've noticed that onItemClick Callback isn't returning proper position values. I have 3 items total in my CarouselView. Callback onItemSelected is returning the proper positions but onItemClick is returning valid positions only for the first item.

Here is my code:

carousel.setOnItemSelectedListener(new CarouselView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(CarouselView carouselView, int position, int adapterPosition, RecyclerView.Adapter adapter) {
                System.out.println("onItemSelected: position=" + position + ", adapterPosition=" + adapterPosition);
            }

            @Override
            public void onItemDeselected(CarouselView carouselView, int position, int adapterPosition, RecyclerView.Adapter adapter) {
            }
        });
carousel.setOnItemClickListener(new CarouselView.OnItemClickListener() {
            @Override
            public void onItemClick(RecyclerView.Adapter adapter, View view, int position, int adapterPosition) {
                System.out.println("onItemClick: position=" + position + ", adapterPosition=" + adapterPosition);
            }
        });

And here are the Logs:

  • Item 1:
System.out: onItemSelected: position=0, adapterPosition=0
System.out: onItemClick: position=0, adapterPosition=0
  • Item 2:
System.out: onItemSelected: position=1, adapterPosition=1
System.out: onItemClick: position=0, adapterPosition=0
  • Item 3:
System.out: onItemSelected: position=2, adapterPosition=2
System.out: onItemClick: position=1, adapterPosition=1

Picasso with placeholder after loaded images from URL is showing the url images, but with placeholder size

Hi,

We are showing the images from the Picasso inside the carousel view, with the below code.

Picasso.with(context)
             .load(thumbURL)
             .placeholder(R.drawable.spin)
             .error(R.drawable.image_unavailable)
             .into(holder.slide);

The small placeholder image shows first. But after when the image is loaded from URL, the image still shows in the size of small placeholder. But once we go and come back to the same screen(refresh), this time the same image appears in the right size. As the same image loaded this time is from the Memory Cache.

Could you please let us know do we have any fixes/workaround for this one.

Thanks,
Raghu

How to make carousel child view blur effect???

My code:

carouselView = (CarouselView) fragmentView.findViewById(R.id.carouselView);
carouselView.setGravity(Gravity.CENTER);
carouselView.setClickToScroll(false);
carouselView.setExtraVisibleChilds(2);
carouselView.setEnableFling(false); // Disable fast scrolling
carouselView.setTransformer(new CarouselView.ViewTransformer() {
@OverRide
public void onAttach(CarouselLayoutManager layoutManager) {
layoutManager.setDrawOrder(CarouselView.DrawOrder.FirstFront);
}

            @Override
            public void transform(View view, float position) {
                int width = view.getMeasuredWidth(), height = view.getMeasuredHeight();
                Float value = width * position * translationXRate * (1f / (Math.abs(position) + 1));
                view.setTranslationX(value);
                view.setScaleX(2f / (position + 2));
                view.setScaleY(3f / (position + 3f));
                view.setAlpha(position < 0 ? Math.max(1 + position, 0) : 1);
            }
        });

Empty carousel may lead to an ArithmeticException

CarouselLayoutManager's translatePosition method may try to divide the position by zero as there are no item available. This would occur if a user tries to scroll on an empty carousel.

	public int translatePosition(int position) {
		if (!mInfinite) return position;
		int itemCount = getItemCount();
		**position %= itemCount**;
		if (position < 0) position += itemCount;
		return position;
	}

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.