eluleci / FlatUI

Android FlatUI Kit
1.67k stars 423 forks source link

Fix for issue #18 "Strange Issue on Consecutive Activity Opening". Chang... #21

Closed michalbrz closed 10 years ago

michalbrz commented 10 years ago

...e naming of size variables and introducing new variables, so pixel size calculation is not done in relation to the same variable, what caused size to continuously increase when going back and opening application again.

Bug was caused by FlatUI.initDefaultValues(this), (usually used in onCreate, I suppose) where values are calculated in relation to themselves, like Attributes.DEFAULT_SIZE = (int) dipToPx(context, Attributes.DEFAULT_SIZE); Attributes.DEFAULT_SIZE is not always created from scratch when user leaves app and launches it again. That causes Attributes.DEFAULT_SIZE to increase every time app is launched - the bigger screen density the higher that growth. I introduced Attributes.DEFAULT_SIZE_PX and Attributes.DEFAULT_SIZE_DP, so base value is always in dp and PX will be calculated in relation to it.