Closed ramack closed 5 years ago
If you guide me how to fix it, I could give it a try... Actually the question would be how to reference a "default" image and which one in the case of an empty album.
@Philio I am willing to fix this, but please guide me, how should an empty album be displayed? My preference would be a default picture - maybe with a Ø sign? And where to store the image? In app/src/main/res ? and what kind of variant do we need?
As a quick fix I did the following:
//Album has no photos yet - set to dummy value String imageurl =""; if (item.second == null){ imageurl = "drawable/piwigo_logo"; } else { imageurl = item.second.derivatives.large.url; } AlbumItemViewModel viewModel = new AlbumItemViewModel(imageurl, item.first.name, photos);
since the source is a url it will not display the image - I tried just a null string but the program crashed then.
I also played around with a background image but was not able to get it the url image to cover it properly.
Here is the code change - I added the backround line
ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
app:heightRatio="@{0.66}"
android:background="@drawable/ic_action_folder"
app:srcUrl="@{viewModel.url}"
Jeff, would you mind publishing your change? - I had also some local workaround - it was not looking nice, but at least not crashing anymore, but we should reach pull requests, to the main repo...
I do have a forked repository under my account - it is an experimental version where I have been trying different things and have not cleaned up any of the code. Feel free to take a look at it. I also updated it to the latest android version. My fork also has the code I was trying to get to work for displaying images of an album - see issue #8.
I guess you are new to git, right? I would say you did not push your changes, so your changes are only locally. Did you commit them? - then you could do a git push, to make your changes flow into your publicly available version, which would me (and others) allow to see your state and maybe merge your commits into other trees. -> that would be cool!
Sorry about that - pushed my changes.
no need to be sorry. Thanks for pushing. maybe you could try to commit more often in future and to separate the work on different topics. - at least in different commits, better in different branches; this would make it simpler to follow
Jeff, I hope you didn't understand me wrong when I was talking about the access to your gallery. For sure it would be great to have to code available, just the account data would be wise to keep secret - at least for a "production" gallery... I hope we can make this project fly (again)!
It was easiest for me to just delete the repository for the moment. I am working on issue #8 - trying to get album images to display. I only get a little bit of time here and there - which I put toward functionality over other stuff. Might have more time as winter arrives and spend less time outside.
This is good, as #8 seems to be the top prio ticket right now, because without the app is basically useless. I am trying to get used to the code and Android development in general - as you might see by my commits :-)
Was not able to open your code in my environment - so I chose to skip it for tonight - worked on displaying images.
@jeff-amn this looks fixed for me. At least I cannot reproduce with what we have in master currently. Shall we close it?
If there is an empty album a NullPointerException is thrown in AlbumsViewModels.java:98
AlbumItemViewModel viewModel = new AlbumItemViewModel(item.second.derivatives.large.url, item.first.name, photos);
as item.second == null in that case.I think there should be a default image that is shown in the case of an empty album or the album should be hidden completely (I prefer the first, as the user might want to add pictures to it)