Closed aboutgaurav closed 4 years ago
@aboutgaurav Thank you for being interested in WeatherView library. I will investigate about this strange bug. Can you provide me your code?
@MatteoBattilana Thank you for quick response.
Snippet for screenshot:
for(int i = 0; i < 12; i++) {
frameLayout.setDrawingCacheEnabled(true)
Bitmap bm = frameLayout.getDrawingCache();
try {
File file = new File(Environment.getExternalStorageDirectory().getPath() +
"/Cread/Short/short_pic" + i + ".jpg");
file.getParentFile().mkdirs();
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
FileOutputStream out = new FileOutputStream(file);
bm.compress(Bitmap.CompressFormat.JPEG, 85, out);
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
//Disable drawing cache
frameLayout.setDrawingCacheEnabled(false);
}
Code for Snow and Rain animation:
//snow animation
whetherView.setWeatherData(PrecipType.SNOW);
//rain aniamtion
whetherView.setWeatherData(PrecipType.RAIN);
Facing the same bug. Especially, in rain mode, the rain doesn't appear in screenshots. Works fine in snow mode.
@MatteoBattilana
@aboutgaurav @AvneeshKhanna Could you provide the versions of Android, Android Support libraries, and WeatherView you are using?
Android version: Jelly Bean (4.3.1) Support Library: 26.1.0 WeatherView : 2.0.3
I'm unable to reproduce this on an Android 4.3.1 emulator. What model of phone are you using to test?
Tested on following devices: -HM 1s xiaomi -OnePlus 3t -OnePlus 5
And i am using above mentioned code to take the screenshot.
I am able to reproduce this behavior. It appears that the motion blur effect is responsible. Because the motion blur effect is based on the previous onDraw
call, having it redraw instantly after a previous draw makes the raindrops have 0 length.
I'm working on a better method of rendering the particles with motion information.
@magneticflux- Thanks for the effort. Let me know when you fix this.
https://github.com/jinatonic/confetti/pull/41 has been merged, so I'll update WeatherView with this fix as soon as they release a version that includes my contributions.
Thanks
@magneticflux- The 1.1.2 confetti library release contains the pull request you opened time ago. Can you merge it and add the missing code?
@MatteoBattilana I have successfully implemented this library in my app. And its working flawlessly. But animation of 'WeatherView' stops abruptly when i try to take the screenshot.
Layout file:
do you know this is happening? Any guide and direction will be helpful. Thanks