marvinlabs / android-slideshow-widget Goto Github PK
View Code? Open in Web Editor NEWA set of widgets to create smooth slideshows with ease.
License: Apache License 2.0
A set of widgets to create smooth slideshows with ease.
License: Apache License 2.0
Can you give guidance on using a videoview or a similar component playing videos from urls
as elements of the slideshow widget?
I tried to add custom adapter, but failed.
I am getting the following error message while i try to run the code
Process: com.iamnbty.movingtoolbar, PID: 21178
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.iamnbty.movingtoolbar/com.iamnbty.movingtoolbar.SlideShowActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class com.marvinlabs.widget.slideshow.SlideShowView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.marvinlabs.widget.slideshow.SlideShowView
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378)
at android.app.Activity.setContentView(Activity.java:2145)
at com.iamnbty.movingtoolbar.SlideShowActivity.onCreate(SlideShowActivity.java:34)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378)
at android.app.Activity.setContentView(Activity.java:2145)
at com.iamnbty.movingtoolbar.SlideShowActivity.onCreate(SlideShowActivity.java:34)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.ClassCastException: android.graphics.drawable.RippleDrawable cannot be cast to android.graphics.drawable.StateListDrawable
at com.marvinlabs.widget.slideshow.SlideShowView.readAttributeSet(SlideShowView.java:159)
at com.marvinlabs.widget.slideshow.SlideShowView.(SlideShowView.java:144)
at com.marvinlabs.widget.slideshow.SlideShowView.(SlideShowView.java:138)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378)
at android.app.Activity.setContentView(Activity.java:2145)
at com.iamnbty.movingtoolbar.SlideShowActivity.onCreate(SlideShowActivity.java:34)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
07-30 12:31:07.406 21178-21178/? I/Process﹕ Sending signal. PID: 21178 SIG: 9
Looks like slide disappears before rotation reaches 90°
I have just tried setting a duration of 500ms to the slide and it crashed on line 375:
addView(inView);
It says that inView
already has a parent, I suppose that's because it wasn't detached from its parent before showing again.
EDIT: it was with the RemoteBitmapAdapter, so maybe it tried to show a previous picture because the new one wasn't loaded yet.
As I was doing some work on the demo, I found out that if you .stop()
the SlideShowView and you .play()
it again after changing its playlist with .setPlayList()
, it will crash the library.
Logcat:
Process: com.marvinlabs.widget.slideshow.demo, PID: 31309
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.view.ViewGroup.addViewInner(ViewGroup.java:3562)
at android.view.ViewGroup.addView(ViewGroup.java:3415)
at android.view.ViewGroup.addView(ViewGroup.java:3360)
at android.view.ViewGroup.addView(ViewGroup.java:3336)
at com.marvinlabs.widget.slideshow.SlideShowView.displayCurrentSlide(SlideShowView.java:444)
at com.marvinlabs.widget.slideshow.SlideShowView.playCurrentSlide(SlideShowView.java:377)
at com.marvinlabs.widget.slideshow.SlideShowView.next(SlideShowView.java:329)
at com.marvinlabs.widget.slideshow.SlideShowView$3.run(SlideShowView.java:104)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5088)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
at dalvik.system.NativeStart.main(Native Method)
How can you add more slides to the adapter? Seems that in the constructor, it creates another new ArrayList(slideUrls) so if you update the original slideUrls list, there is no way to notify the adapter that the dataSet has changed
Is there a way to hide or show the progress indicator? I prefer to hide it coz even when my resources are local, the indicator is showing.
Add a method to pause the slide show, previous slide, resume, ...
I've had a really difficult time while trying to compile the library as I had to delete most of the build.gradle code referencing signing.
Please make it optional or include all files so anyone can submit pull requests without going crazy.
Bellow is my code:
slideShowView = (SlideShowView) findViewById(R.id.slideshow);
//set slide show adapter
ResourceBitmapAdapter adapter = new ResourceBitmapAdapter(getActivity(), new int[]{
R.drawable.profile,R.drawable.profile2 });
slideShowView.setAdapter(adapter);
The first image is displayed well, but when slider start to display second image this error occur.
Add random transition factory
Hi.
I added the dependency for the library and everything synced fine. But as soon as i ran the application, i got an exception (just added the widget in xml and nothing in the code). The trace is as follows:
02-26 15:31:37.911 11421-11421/com.video.ccolutions.videoeditor W/System.err: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.marvinlabs.widget.slideshow.SlideShowView
02-26 15:31:37.918 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.view.LayoutInflater.inflate(LayoutInflater.java:561)
02-26 15:31:37.918 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.view.LayoutInflater.inflate(LayoutInflater.java:437)
02-26 15:31:37.918 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
02-26 15:31:37.918 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
02-26 15:31:37.918 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
02-26 15:31:37.918 11421-11421/com.video.ccolutions.videoeditor W/System.err: at com.video.ccolutions.videoeditor.SlideshowCreation.onCreate(SlideshowCreation.java:58)
02-26 15:31:37.918 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.app.Activity.performCreate(Activity.java:6372)
02-26 15:31:37.919 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
02-26 15:31:37.919 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2432)
02-26 15:31:37.919 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2539)
02-26 15:31:37.919 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.app.ActivityThread.access$900(ActivityThread.java:168)
02-26 15:31:37.919 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1378)
02-26 15:31:37.919 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
02-26 15:31:37.919 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.os.Looper.loop(Looper.java:150)
02-26 15:31:37.919 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5659)
02-26 15:31:37.919 11421-11421/com.video.ccolutions.videoeditor W/System.err: at java.lang.reflect.Method.invoke(Native Method)
02-26 15:31:37.919 11421-11421/com.video.ccolutions.videoeditor W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:822)
02-26 15:31:37.919 11421-11421/com.video.ccolutions.videoeditor W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712)
02-26 15:31:37.919 11421-11421/com.video.ccolutions.videoeditor W/System.err: Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.marvinlabs.widget.slideshow.SlideShowView
02-26 15:31:37.919 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.view.LayoutInflater.createView(LayoutInflater.java:672)
02-26 15:31:37.920 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:791)
02-26 15:31:37.920 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:731)
02-26 15:31:37.920 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.view.LayoutInflater.rInflate(LayoutInflater.java:862)
02-26 15:31:37.920 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:825)
02-26 15:31:37.920 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
02-26 15:31:37.920 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:825)
02-26 15:31:37.920 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
02-26 15:31:37.920 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:825)
02-26 15:31:37.920 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.view.LayoutInflater.inflate(LayoutInflater.java:537)
02-26 15:31:37.920 11421-11421/com.video.ccolutions.videoeditor W/System.err: ... 17 more
02-26 15:31:37.920 11421-11421/com.video.ccolutions.videoeditor W/System.err: Caused by: java.lang.reflect.InvocationTargetException
02-26 15:31:37.920 11421-11421/com.video.ccolutions.videoeditor W/System.err: at java.lang.reflect.Constructor.newInstance(Native Method)
02-26 15:31:37.920 11421-11421/com.video.ccolutions.videoeditor W/System.err: at android.view.LayoutInflater.createView(LayoutInflater.java:641)
02-26 15:31:37.920 11421-11421/com.video.ccolutions.videoeditor W/System.err: ... 26 more
02-26 15:31:37.920 11421-11421/com.video.ccolutions.videoeditor W/System.err: Caused by: java.lang.ClassCastException: android.graphics.drawable.RippleDrawable cannot be cast to android.graphics.drawable.StateListDrawable
02-26 15:31:37.921 11421-11421/com.video.ccolutions.videoeditor W/System.err: at com.marvinlabs.widget.slideshow.SlideShowView.readAttributeSet(SlideShowView.java:159)
02-26 15:31:37.921 11421-11421/com.video.ccolutions.videoeditor W/System.err: at com.marvinlabs.widget.slideshow.SlideShowView.(SlideShowView.java:144)
02-26 15:31:37.921 11421-11421/com.video.ccolutions.videoeditor W/System.err: at com.marvinlabs.widget.slideshow.SlideShowView.(SlideShowView.java:138)
02-26 15:31:37.921 11421-11421/com.video.ccolutions.videoeditor W/System.err: ... 28 more
I have no idea why this is happened so need all the help i can get.
Thanks.
Thank You for this library.
how can I adjust duration of slide on screen?
Would it be possible to add support for minSdkVersion 8?
The demo should offer a settings panel to allow changing the slide show configuration in real time : slide duration, transitions, playlist type, ...
In some cases, I need to display only 1 drawable in my SlideShowView.
How can I disable the default transition effect (quick dim) that reloads the same image after a default interval of time ?
Thank you for your work and quick response,
Best,
Jad
We should be able to set a few common settings from XML:
Hi marvinlabs :-)
When using com.android.support:appcompat-v7:21.0.3 my app crashes only on Nexus 5 with Android 5.0.1 inflating the SlideShowView:
Caused by: java.lang.ClassCastException: android.graphics.drawable.RippleDrawable cannot be cast to android.graphics.drawable.StateListDrawable
at com.marvinlabs.widget.slideshow.SlideShowView.readAttributeSet(SlideShowView.java:159)
at com.marvinlabs.widget.slideshow.SlideShowView.<init>(SlideShowView.java:144)
at com.marvinlabs.widget.slideshow.SlideShowView.<init>(SlideShowView.java:138)
So taking a look at your code I can see that you use android.R.attr.selectableItemBackground as a fallback for onClickedDrawable (which is a StateListDrawable).
Here comes a tiny workaround:
Take a look at android-sdk\platforms\android-14\data\res\values at attrs.xml, styles.xml and themes.xml.
The StateListDrawable is item_background_holo_light.xml referencing some drawables. So I copied them all, fixed, the references, an at least this is working.
Place this into the layout containg the SlideShowView:
app:selector="@drawable/item_background_holo_light"
The item_background_holo_light.xml contains:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/list_pressed_holo_light"/>
<item android:state_focused="false" android:drawable="@android:color/transparent"/>
<item android:drawable="@android:color/transparent"/>
</selector>
The list_pressed_holo_light.png can be found in android-sdk\platforms\android-14\data\res\drawable-xhdpi and other densities.
Best regards,
DaRolla
Hello Vincent,
First of all I want to thank you for your work. This library is really helpful.
All works perfectly except one: it always skips slide at position 1 when playing 1st loop. Even in your Demo app from Play Store.
Please, if you know where problem is just point out.
Thanks,
Andrew
Then post on the Google Play demo app page
This is for when the slides are shown in order to achieve some kind of KenBurns effect
So that we can be notified when a slide is about to get displayed, when a slide is hidden, ...
In order to display the slideshow progress. Would be nice to support the same indicators as the pager indicators from ViewPager.
Swipe left => next slide
Swipe right => previous slide
Also allow to disable automatic next() action after the slide duration
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.