Search in sources :

Example 1 with OkHttpDownloader

use of com.squareup.picasso.OkHttpDownloader in project iNGAGE by davis123123.

the class App method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    context = getApplicationContext();
    Picasso.Builder builder = new Picasso.Builder(this);
    builder.downloader(new OkHttpDownloader(this, Integer.MAX_VALUE));
    Picasso built = builder.build();
    built.setIndicatorsEnabled(true);
    // built.setLoggingEnabled(true);
    Picasso.setSingletonInstance(built);
}
Also used : Picasso(com.squareup.picasso.Picasso) OkHttpDownloader(com.squareup.picasso.OkHttpDownloader)

Example 2 with OkHttpDownloader

use of com.squareup.picasso.OkHttpDownloader in project Lets-Chat by kshitiz1007.

the class LetsChat method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    mAuth = FirebaseAuth.getInstance();
    FirebaseUser mUser = mAuth.getCurrentUser();
    // ---DO IT WHENEVER YOU GET TIME---
    if (mUser != null) {
        // ---FIREBASE OFFLINE FEATURE---
        FirebaseDatabase.getInstance().setPersistenceEnabled(true);
        // ---PIACSSO OFFLINE FEATURE--
        mAuth = FirebaseAuth.getInstance();
        Picasso.Builder builder = new Picasso.Builder(this);
        builder.downloader(new OkHttpDownloader(this, Integer.MAX_VALUE));
        Picasso built = builder.build();
        built.setIndicatorsEnabled(true);
        built.setLoggingEnabled(true);
        Picasso.setSingletonInstance(built);
        // String user_id = mAuth.getCurrentUser().getUid();
        // Log.e("Current user inside : ",user_id);
        // ---SEETING TIME_STAMP ON DISCONNECT-----
        mUserDatabase = FirebaseDatabase.getInstance().getReference().child("users").child(mAuth.getCurrentUser().getUid());
        mUserDatabase.addValueEventListener(new ValueEventListener() {

            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                if (dataSnapshot != null) {
                    mUserDatabase.child("online").onDisconnect().setValue(ServerValue.TIMESTAMP);
                }
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {
            }
        });
    }
}
Also used : DatabaseError(com.google.firebase.database.DatabaseError) Picasso(com.squareup.picasso.Picasso) FirebaseUser(com.google.firebase.auth.FirebaseUser) OkHttpDownloader(com.squareup.picasso.OkHttpDownloader) ValueEventListener(com.google.firebase.database.ValueEventListener) DataSnapshot(com.google.firebase.database.DataSnapshot)

Example 3 with OkHttpDownloader

use of com.squareup.picasso.OkHttpDownloader in project sbt-android by scala-android.

the class DebugDataModule method providePicasso.

@Provides
@Singleton
Picasso providePicasso(OkHttpClient client, NetworkBehavior behavior, @IsMockMode boolean isMockMode, Application app) {
    Picasso.Builder builder = new Picasso.Builder(app).downloader(new OkHttpDownloader(client));
    if (isMockMode) {
        builder.addRequestHandler(new MockRequestHandler(behavior, app.getAssets()));
    }
    builder.listener((picasso, uri, exception) -> {
        Timber.e(exception, "Error while loading image " + uri);
    });
    return builder.build();
}
Also used : Picasso(com.squareup.picasso.Picasso) OkHttpDownloader(com.squareup.picasso.OkHttpDownloader) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Example 4 with OkHttpDownloader

use of com.squareup.picasso.OkHttpDownloader in project iNGAGE by davis123123.

the class App method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    context = getApplicationContext();
    Picasso.Builder builder = new Picasso.Builder(this);
    builder.downloader(new OkHttpDownloader(this, Integer.MAX_VALUE));
    Picasso built = builder.build();
    // built.setIndicatorsEnabled(true);
    // built.setLoggingEnabled(true);
    Picasso.setSingletonInstance(built);
}
Also used : Picasso(com.squareup.picasso.Picasso) OkHttpDownloader(com.squareup.picasso.OkHttpDownloader)

Aggregations

OkHttpDownloader (com.squareup.picasso.OkHttpDownloader)4 Picasso (com.squareup.picasso.Picasso)4 FirebaseUser (com.google.firebase.auth.FirebaseUser)1 DataSnapshot (com.google.firebase.database.DataSnapshot)1 DatabaseError (com.google.firebase.database.DatabaseError)1 ValueEventListener (com.google.firebase.database.ValueEventListener)1 Provides (dagger.Provides)1 Singleton (javax.inject.Singleton)1