use of com.squareup.picasso.LruCache in project greedo-layout-for-android by 500px.
the class App method onCreate.
@Override
public void onCreate() {
super.onCreate();
Picasso picasso = new Picasso.Builder(this).memoryCache(new LruCache(calculateMemoryCacheSize())).build();
Picasso.setSingletonInstance(picasso);
}
use of com.squareup.picasso.LruCache in project iNaturalistAndroid by inaturalist.
the class INaturalistApp method onCreate.
@Override
public void onCreate() {
super.onCreate();
Fabric.with(this, new Crashlytics());
FacebookSdk.sdkInitialize(getApplicationContext());
AnalyticsClient.initAnalyticsClient(this);
AnalyticsClient.getInstance().logEvent(AnalyticsClient.EVENT_NAME_APP_LAUNCH);
// Build a custom Picasso instance that uses more memory for image cache (50% of free memory
// instead of the default 15%)
Picasso picasso = new Picasso.Builder(getApplicationContext()).memoryCache(new LruCache((int) (Runtime.getRuntime().maxMemory() * 0.5))).build();
Picasso.setSingletonInstance(picasso);
// Picasso.with(getApplicationContext())
// .setIndicatorsEnabled(true);
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
INaturalistApp.context = getApplicationContext();
deviceLocale = getResources().getConfiguration().locale;
applyLocaleSettings();
// Create the root offline guides directory, if needed
GuideXML.createOfflineGuidesDirectory(this);
SharedPreferences pref = getSharedPreferences("iNaturalistPreferences", MODE_PRIVATE);
String username = pref.getString("username", null);
if (username != null) {
setShownOnboarding(true);
}
int missionViewCount = getPrefs().getInt("mission_view_count", 0);
getPrefs().edit().putInt("mission_view_count", ++missionViewCount).commit();
}
Aggregations