Java Code Examples for com.squareup.picasso.Picasso.setSingletonInstance()

The following are Jave code examples for showing how to use setSingletonInstance() of the com.squareup.picasso.Picasso class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: furry-sniffle   File: Socialate.java   Source Code and License Vote up 8 votes
@Override
public void onCreate() {
    super.onCreate();

    if(!FirebaseApp.getApps(this).isEmpty()){
        FirebaseDatabase.getInstance().setPersistenceEnabled(true);
    }

    Picasso.Builder builder = new Picasso.Builder(this);
    builder.downloader(new OkHttp3Downloader(this, Integer.MAX_VALUE));
    Picasso built = builder.build();
    built.setIndicatorsEnabled(false);
    built.setLoggingEnabled(true);
    Picasso.setSingletonInstance(built);
}
 
Example 2
Project: DeepImagePreview-Project   File: MenuApplication.java   Source Code and License Vote up 6 votes
@Override
public void onCreate() {
    super.onCreate();

    Picasso picasso = new Picasso.Builder(this)
            .loggingEnabled(BuildConfig.DEBUG)
            .indicatorsEnabled(false)
            .build();
    Picasso.setSingletonInstance(picasso);


    RxBus.getInstance()
            .toObservable()
            .subscribeOn(Schedulers.newThread())
            .subscribe(new Consumer<Object>() {
                @Override
                public void accept(Object o) throws Exception {
                    Log.d("EVENT", "onNewEvent: " + o.getClass().getSimpleName() + " [" + o.toString() + "]");
                }
            });
}
 
Example 3
Project: Tusky   File: TuskyApplication.java   Source Code and License Vote up 5 votes
@Override
public void onCreate() {
    super.onCreate();
    // Initialize Picasso configuration
    Picasso.Builder builder = new Picasso.Builder(this);
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    builder.downloader(new OkHttp3Downloader(OkHttpUtils.getCompatibleClient(preferences)));
    if (BuildConfig.DEBUG) {
        builder.listener((picasso, uri, exception) -> exception.printStackTrace());
    }

    try {
        Picasso.setSingletonInstance(builder.build());
    } catch (IllegalStateException e) {
        throw new RuntimeException(e);
    }

    db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "tuskyDB")
            .allowMainThreadQueries()
            .addMigrations(AppDatabase.MIGRATION_2_3)
            .addMigrations(AppDatabase.MIGRATION_3_4)
            .build();

    JobManager.create(this).addJobCreator(new NotificationPullJobCreator(this));

    //necessary for Android < APi 21
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
 
Example 4
Project: LittleLight   File: LittleLight.java   Source Code and License Vote up 5 votes
@Override
public void onCreate() {
    super.onCreate();
    component = DaggerLittleLight_LittleLightComponent.builder()
            .androidModule(new AndroidModule(this))
            .adapterModule(new AdapterModule("https://www.bungie.net"))
            .build();

    Picasso.setSingletonInstance(component.providePicasso());
}
 
Example 5
Project: TVGuide   File: TvApp.java   Source Code and License Vote up 5 votes
@Override
public void onCreate() {
    super.onCreate();
    Picasso picasso = new Picasso.Builder(this).build();
    Picasso.setSingletonInstance(picasso);
    sSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
}
 
Example 6
Project: TheMovies   File: MyApplication.java   Source Code and License Vote up 4 votes
private void initializePicasso() {
    Picasso built = new Picasso.Builder(this).build();
    //built.setIndicatorsEnabled(true);
    built.setLoggingEnabled(true);
    Picasso.setSingletonInstance(built);
}