Device Year Class
facebook的一个开源库,用于通过年份来区分手机的性能,以让我们针对不同的设备做不同的处理。
示例
Calculating the current device’s Year Class is simple.
int year = YearClass.get(getApplicationContext());
Then, later on, you can use the year class to make decisions in your app, or send it along with your analytics.
if (year >= 2013) {
// Do advanced animation
} else if (year > 2010) {
// Do simple animation
} else {
// Phone too slow, don't do any animations
}
待续…