Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Setting Layout INVISIBLE until Glide finished loading images from server

Ranch Hand
Posts: 36
Android Java ME
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello i asked the same question few days ago on StackOverflow but no answer...and i kinda  need an answer

The problem is that Glide .listener() is triggered image by image, so when i tried to set my fragment layout invisible until all images are loaded, it set's fragment layout visibility to visible after first image is loaded and  ignores the fact that rest of images are still not loaded into imageview.
Glide checks with it's listener images by images and after first one is ready it set's my visibility t visible and i do not want this..i want to my fragment layout be invisible until all images are ready to display. Now i will basically past my SstockOverflow post here.

i have a fragment with several recycleviews that contain some text and image from users. Problem is that my images are loaded a second or less after my layout is inflated. I can't use any placeholder for that time or something else.
My instructions are that my layout must be shown only when all data and images are ready from all recyclerviews, and be shown in the same time. I am using glide .listener() method.
I tried: 1)to set boolean value in .listener() and save it in SharedPref and load it in my fragment where my recycleviews are and if Boolean value is the same then set visibility of fragment to visible ,which previously was set to invisible
2) to do the same thing just with custom callbacks
3)and this solution that i am going to past here. Basically i am passing my layout to adapter with constructor and setting it invisible in .listener().

my glide in adapter:

and my adapter:
If I'd had more time, I would have written a shorter letter. -T.S. Eliot such a short, tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
    Bookmark Topic Watch Topic
  • New Topic