Search in sources :

Example 1 with LruCache

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);
}
Also used : LruCache(com.squareup.picasso.LruCache) Picasso(com.squareup.picasso.Picasso)

Example 2 with LruCache

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();
}
Also used : SharedPreferences(android.content.SharedPreferences) LruCache(com.squareup.picasso.LruCache) Picasso(com.squareup.picasso.Picasso) Crashlytics(com.crashlytics.android.Crashlytics)

Aggregations

LruCache (com.squareup.picasso.LruCache)2 Picasso (com.squareup.picasso.Picasso)2 SharedPreferences (android.content.SharedPreferences)1 Crashlytics (com.crashlytics.android.Crashlytics)1