GithubHelp home page GithubHelp logo

imagecoverflow's Introduction

ImageCoverFlow

To show Cover Flow effect on Android

ImageCoverFlow is an open source Android library that allows developers to easily create applications with a cover flow effect to show images. This library does not extend Gallery. Feel free to use it all you want in your Android apps provided that you cite this project and include the license in your app.

Oops! The screenshot is missing!

ImageCoverFlow is currently used in some published Android apps:

  1. ICardEnglish
  2. PNP iSerbis

How to Use:

Step One: Add CoverFlowView to your project

  1. Via XML:
<com.dolphinwang.imagecoverflow.CoverFlowView
    xmlns:imageCoverFlow="http://schemas.android.com/apk/res-auto"
    android:id="@+id/coverflow"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="20dp"
    android:paddingRight="20dp"
    imageCoverFlow:coverflowGravity="center_vertical"
    imageCoverFlow:coverflowLayoutMode="wrap_content"
    imageCoverFlow:reflectionGap="10dp"
    imageCoverFlow:reflectionHeight="30%"
    imageCoverFlow:visibleImage="5" />
  1. Programatically (via Java):
CoverFlowView<MyCoverFlowAdapter> mCoverFlowView =
    (CoverFlowView<MyCoverFlowAdapter>) findViewById(R.id.coverflow);

mCoverFlowView.setCoverFlowGravity(CoverFlowGravity.CENTER_VERTICAL);
mCoverFlowView.setCoverFlowLayoutMode(CoverFlowLayoutMode.WRAP_CONTENT);
mCoverFlowView.setReflectionHeight(30);
mCoverFlowView.setReflectionGap(20);
mCoverFlowView.setVisibleImage(5);

Step Two: Set an adapter, which extends CoverFlowAdapter:

MyCoverFlowAdapter adapter = new MyCoverFlowAdapter(this);
mCoverFlowView.setAdapter(adapter);

TIPS:

  • Method setAdapter() should be called after all properties of CoverFlow are settled.
  • If you want to load image dynamically, you can call method notifyDataSetChanged() when bitmaps are loaded.

Step Three: if you want to listen for the click event of the top image, you can set a StateListener to it:

mCoverFlowView.setStateListener(new CoverFlowView.StateListener() {
    @Override
    public void imageOnTop(CoverFlowView<MyCoverFlowAdapter> view, int position,
            float left, float top, float right,float bottom) {
        // TODO
    }

    @Override
    public void invalidationCompleted(CoverFlowView view) {
        // TODO
    }
});

if you want to listen for click events of showing images, you can set a ImageClickListener to it:

mCoverFlowView.setImageClickListener(new CoverFlowView.ImageClickListener() {
            @Override
            public void onClick(CoverFlowView coverFlowView, int position) {
				// TODO
            }
});

If you want to listen for long click events of the top image, you can set a ImageLongClickListener to it:

mCoverFlowView
    .setImageLongClickListener(new CoverFlowView.ImageLongClickListener() {
        @Override
        public void onLongClick(CoverFlowView view, int position) {
            // TODO
        }
    });

Users can use method setSelection(int position) to show a specific position at the top.


If you want to subclass CoverFlowView

  1. You can override method getCustomTransformMatrix() to make more transformations for images (there is some annotated code which shows how to make image y-axis rotation).
  2. You should never override method onLayout() to layout any of CoverFlowView’s children, because all of image will draw on the canvas directly.

Developed By:

Roy Wang ([email protected])

If you use this library, please let me know.


License:

Copyright 2013 Roy Wang

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

imagecoverflow's People

Contributors

dolphinwang 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imagecoverflow's Issues

Project is out of date.

When I cloned your project and copied sample codes from ReadMe, the project can't be compiled. It implied that reflectionShaderEnable and enableReflection are not included in your current project. So, would you update your ImageCoverFlow as soon as possible?

Adapter

Hi can you show me how to make adapter for you library because topImageClicked is not active with my adapter ?

only

only one item ,can't be used!

Current Position

Hi. I have a question. I tried implement player with your coverflow, and have issue. I have List of custom objects, which have links to bitmaps, i set it's in adapter. But i can't handle which object present in current position of coverflow, to handle tracks changing if i scroll coverflow.

Thx

do you have working demo project?

It will be great if you can have a working demo project to let use try and feel the performance of your library with minimum effort.

XML problem it would't get loaded

Included this on the top (xmlns:imageCoverFlow="http://schemas.android.com/apk/res-auto" )

<com.dolphinwang.imagecoverflow.CoverFlowView
android:id="@+id/CoverFlow"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="30"
android:paddingLeft="20dp"
android:paddingRight="20dp" >
</com.dolphinwang.imagecoverflow.CoverFlowView>

04-02 06:13:26.840: E/c*********.common.UnCaughtException(1490): java.lang.RuntimeException: Unable to start activity ComponentInfo{com********_/com_.activity.PostDetailActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class com.dolphinwang.imagecoverflow.CoverFlowView

Plz help

Attributes not found

  • Not found these attributes
    imageCoverFlow:enableReflection="true"
    imageCoverFlow:reflectionShaderEnable="true"
  • After integrating this lib to main project, ICF does not show images

Load images in recycle bin

Hi.. Your code is very neat. I've tried to override adapter.getimage and load images. But it doesn't seems to work. Can you help me in this regard. Thanks.

Problem with swipe left and right

Sometimes the coverflow center image or some of its childs sleeps or become stedy at strange deegre do you know how to fix that ?

CircleImageView

Hey, dolphinwang! Thank you for your great lib. I was wondering if i could use CircleImageView to display my data.

getting an error on inflation of the coverflowview class

E/c******.common.UnCaughtException(1490): java.lang.RuntimeException: Unable to start activity ComponentInfo{com*****_/com_.activity.PostDetailActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class com.dolphinwang.imagecoverflow.CoverFlowView
Can you please send a demo to [email protected]. thanks in advance

occur a ANR 😭

03-30 10:21:36.402 501-534/? E/ActivityManagerService: ANR in com.mogujie.coverflowsample (com.mogujie.coverflowsample/.MyActivity)
PID: 3195
Reason: Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 49. Wait queue head age: 5512.6ms.)
Load: 1.06 / 1.09 / 0.89
CPU usage from 7153ms to 0ms ago:
81% 3195/com.mogujie.coverflowsample: 79% user + 2% kernel / faults: 139 minor
7.6% 703/com.android.systemui: 6.2% user + 1.3% kernel / faults: 4026 minor
6.9% 161/surfaceflinger: 2.6% user + 4.3% kernel / faults: 1797 minor
4.1% 155/logd: 4% user + 0.1% kernel
3% 501/system_server: 1.9% user + 1.1% kernel / faults: 396 minor
1.6% 976/com.ubtechinc.cruzr.launcher2: 0.9% user + 0.6% kernel / faults: 9 minor
0.6% 146/dhd_dpc: 0% user + 0.6% kernel
0.5% 113/ddrfreqd: 0% user + 0.5% kernel
0.5% 180/adbd: 0.1% user + 0.4% kernel
0.5% 2979/kworker/0:2: 0% user + 0.5% kernel
0.4% 120/kworker/u8:2: 0% user + 0.4% kernel
0.4% 547/logcat: 0% user + 0.4% kernel
0.2% 3151/logcat: 0.1% user + 0.1% kernel
0.1% 8/rcu_preempt: 0% user + 0.1% kernel
0.1% 44/fb-vsync: 0% user + 0.1% kernel
0.1% 45/rk-fb: 0% user + 0.1% kernel
0.1% 46/cfinteractive: 0% user + 0.1% kernel
0.1% 145/dhd_watchdog_th: 0% user + 0.1% kernel
0.1% 147/dhd_rxf: 0% user + 0.1% kernel
0% 151/jbd2/mmcblk0p12: 0% user + 0% kernel
0% 157/lmkd: 0% user + 0% kernel

图片间距

大神,怎么让所有图片间的间距是相等的? 不是像现在这样离中间越远越大

Inflate XML.

Hello,Your demo application of cover flow really different from other and its same as i-phone gallery.Thanks to post this helpful code.Now i tried to inflate XML file but i cant achieved.Help me for that .
Can i inflate xml file ?

Can i Stop looping mode ?

Adapter

Hi can you show me how to make adapter for you library because topImageClicked is not active with my adapter ?

Stop the loop

@dolphinwang Is it possible to stop the loop of the items for example at any position if I have 5 items and I want them to finish at the third item and not going 3 -> 1,but just stop any movement to the fourth image ?

How to add this lib to my project

I tried to add this library to my project, but i don't know how to add image into coverflow view.

After some days, I Integrated this library again and get Error Message "Caused by: java.lang.IllegalArgumentException: total count in adapter must larger than visible images!", For my Adapter

           @Override
    public int getCount() {
        return 4;
    }
    @Override
    public Bitmap getImage(int position) {
        return selectedBmp.get(position); // here selectedBmp arraylist and size = 3;
    } 

How can solve this issues, please help me and my request for upload sample its useful to every one. For my mail-id [email protected]

2 issues for me

what is the class MyCoverFlowAdapter ? do you have an exmaple for it ?
hot do you add spesific images for this coverflow ?

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.