Win a copy of Murach's MySQL this week in the JDBC and Relational Databases 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic