Android Open Source - Volley-Ball Application






From Project

Back to project page Volley-Ball.

License

The source code is released under:

MIT License

If you think the Android project Volley-Ball listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.siu.android.volleyball.samples;
//from   ww  w .  j av  a 2 s  . com
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import com.siu.android.volleyball.BallRequestQueue;
import com.siu.android.volleyball.mock.FileMockNetwork;
import com.siu.android.volleyball.samples.database.DatabaseHelper;
import com.siu.android.volleyball.samples.volley.fake.FakeNetwork;
import com.siu.android.volleyball.samples.volley.OkHttpStack;
import com.siu.android.volleyball.toolbox.VolleyBall;
import com.siu.android.volleyball.toolbox.VolleyBallConfig;

/**
 * Created by lukas on 8/29/13.
 */
public class Application extends android.app.Application {

    private static Context sContext;
    private static BallRequestQueue sRequestQueue;
    private static BallRequestQueue sScenarioRequestQueue;
    private static DatabaseHelper sDatabaseHelper;
    private static SQLiteDatabase sSQLiteDatabase;

    @Override
    public void onCreate() {
        super.onCreate();

        sContext = getApplicationContext();

        if (Constants.DEBUG) {
            deleteDatabase(DatabaseHelper.NAME);
        }

        // init volley ball
        VolleyBallConfig.Builder configBuilder = new VolleyBallConfig.Builder(sContext);

        // mock
        if (Constants.MOCK_WEBSERVICE) {
            FileMockNetwork network = new FileMockNetwork(sContext, new FileMockNetwork.Config()
                    .basePath("fakeapi")
                    .requestDuration(1)
                    .realNetworkHttpStack(new OkHttpStack()));
            configBuilder.network(network);
        } else {
            configBuilder.httpStack(new OkHttpStack());
        }

        sRequestQueue = VolleyBall.newRequestQueue(configBuilder.build());

        sScenarioRequestQueue = VolleyBall.newRequestQueue(new VolleyBallConfig.Builder(sContext)
                .network(new FakeNetwork())
                .build());

        // init database helper
        sDatabaseHelper = new DatabaseHelper(sContext);
        sSQLiteDatabase = sDatabaseHelper.getWritableDatabase();
    }

    public static Context getContext() {
        return sContext;
    }

    public static BallRequestQueue getRequestQueue() {
        return sRequestQueue;
    }

    public static BallRequestQueue getScenarioRequestQueue() {
        return sScenarioRequestQueue;
    }

    public static DatabaseHelper getDatabaseHelper() {
        return sDatabaseHelper;
    }

    public static SQLiteDatabase getSQLiteDatabase() {
        return sSQLiteDatabase;
    }
}




Java Source Code List

.BallExecutorDelivery.java
.LocalRequest.java
com.android.volley.CompatRequest.java
com.siu.android.volleyball.BallCacheDispatcher.java
com.siu.android.volleyball.BallMarkerLog.java
com.siu.android.volleyball.BallNetworkDispatcher.java
com.siu.android.volleyball.BallRequestQueue.java
com.siu.android.volleyball.BallRequest.java
com.siu.android.volleyball.BallResponseDelivery.java
com.siu.android.volleyball.BallResponse.java
com.siu.android.volleyball.ball.BallExecutorDelivery.java
com.siu.android.volleyball.exception.BallException.java
com.siu.android.volleyball.local.LocalDispatcher.java
com.siu.android.volleyball.local.LocalRequestProcessor.java
com.siu.android.volleyball.mock.FileMockNetwork.java
com.siu.android.volleyball.network.NetworkRequestProcessor.java
com.siu.android.volleyball.request.CompleteRequest.java
com.siu.android.volleyball.request.LocalRequest.java
com.siu.android.volleyball.request.NetworkRequest.java
com.siu.android.volleyball.response.ResponseListener.java
com.siu.android.volleyball.response.SingleResponseListener.java
com.siu.android.volleyball.samples.Application.java
com.siu.android.volleyball.samples.Constants.java
com.siu.android.volleyball.samples.activity.CompleteRequestActivity.java
com.siu.android.volleyball.samples.activity.LocalRequestActivity.java
com.siu.android.volleyball.samples.activity.NetworkRequestActivity.java
com.siu.android.volleyball.samples.activity.ScenariosActivity.java
com.siu.android.volleyball.samples.activity.scenarios.Scenario10Activity.java
com.siu.android.volleyball.samples.activity.scenarios.Scenario1Activity.java
com.siu.android.volleyball.samples.activity.scenarios.Scenario2Activity.java
com.siu.android.volleyball.samples.activity.scenarios.Scenario3Activity.java
com.siu.android.volleyball.samples.activity.scenarios.Scenario4Activity.java
com.siu.android.volleyball.samples.activity.scenarios.Scenario5Activity.java
com.siu.android.volleyball.samples.activity.scenarios.Scenario6Activity.java
com.siu.android.volleyball.samples.activity.scenarios.Scenario7Activity.java
com.siu.android.volleyball.samples.activity.scenarios.Scenario8Activity.java
com.siu.android.volleyball.samples.activity.scenarios.Scenario9Activity.java
com.siu.android.volleyball.samples.activity.scenarios.ScenarioActivity.java
com.siu.android.volleyball.samples.adapter.BindableAdapter.java
com.siu.android.volleyball.samples.adapter.EntriesAdapter.java
com.siu.android.volleyball.samples.adapter.LogsAdapter.java
com.siu.android.volleyball.samples.database.DatabaseHelper.java
com.siu.android.volleyball.samples.database.EntryDao.java
com.siu.android.volleyball.samples.database.mapping.EntryMapping.java
com.siu.android.volleyball.samples.fragment.LocalOnlyRequestFragment.java
com.siu.android.volleyball.samples.model.Entry.java
com.siu.android.volleyball.samples.model.Log.java
com.siu.android.volleyball.samples.util.ScenarioUtils.java
com.siu.android.volleyball.samples.util.SimpleLogger.java
com.siu.android.volleyball.samples.volley.OkHttpStack.java
com.siu.android.volleyball.samples.volley.ScenarioListener.java
com.siu.android.volleyball.samples.volley.fake.FakeCache.java
com.siu.android.volleyball.samples.volley.fake.FakeNetwork.java
com.siu.android.volleyball.samples.volley.request.CompleteEntryRequest.java
com.siu.android.volleyball.samples.volley.request.SampleErrorNetworkRequest.java
com.siu.android.volleyball.samples.volley.request.SampleLocalNoResultRequest.java
com.siu.android.volleyball.samples.volley.request.SampleLocalRequest.java
com.siu.android.volleyball.samples.volley.request.SampleNetworkRequest.java
com.siu.android.volleyball.samples.volley.request.SampleRequest.java
com.siu.android.volleyball.samples.volley.request.ScenarioRequest.java
com.siu.android.volleyball.toolbox.BallImageLoader.java
com.siu.android.volleyball.toolbox.BallImageRequest.java
com.siu.android.volleyball.toolbox.BallNetworkImageView.java
com.siu.android.volleyball.toolbox.BallRequestFuture.java
com.siu.android.volleyball.toolbox.VolleyBallConfig.java
com.siu.android.volleyball.toolbox.VolleyBall.java
com.siu.android.volleyball.util.BallLogger.java
com.siu.android.volleyball.util.ConfigUtils.java
com.siu.android.volleyball.util.RequestUtils.java