Android Open Source - pokedex Pokedex Application






From Project

Back to project page pokedex.

License

The source code is released under:

MIT License

If you think the Android project pokedex 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.andrescanales.pokedex;
/* w  w w  .j a v a2s.  c  o m*/
/**
 * Created by andrescanales on 10/31/14.
 */
import android.app.Application;
import android.text.TextUtils;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;

public class PokedexApplication extends Application {

    public static final String TAG = PokedexApplication.class
            .getSimpleName();

    private RequestQueue mRequestQueue;

    private static PokedexApplication mInstance;

    @Override
    public void onCreate() {
        super.onCreate();
        mInstance = this;
    }

    public static synchronized PokedexApplication getInstance() {
        return mInstance;
    }

    public RequestQueue getRequestQueue() {
        if (mRequestQueue == null) {
            mRequestQueue = Volley.newRequestQueue(getApplicationContext());
        }

        return mRequestQueue;
    }

    public <T> void addToRequestQueue(Request<T> req, String tag) {
        req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
        getRequestQueue().add(req);
    }

    public <T> void addToRequestQueue(Request<T> req) {
        req.setTag(TAG);
        getRequestQueue().add(req);
    }

    public void cancelPendingRequests(Object tag) {
        if (mRequestQueue != null) {
            mRequestQueue.cancelAll(tag);
        }
    }

}




Java Source Code List

com.andrescanales.pokedex.ApplicationTest.java
com.andrescanales.pokedex.GsonRequest.java
com.andrescanales.pokedex.MainActivity.java
com.andrescanales.pokedex.PokedexApplication.java
com.andrescanales.pokedex.PokemonAdapter.java
com.andrescanales.pokedex.PokemonDetailFragment.java
com.andrescanales.pokedex.PokemonDetail.java
com.andrescanales.pokedex.PokemonListApiTask.java
com.andrescanales.pokedex.PokemonListFragment.java
com.andrescanales.pokedex.Pokemon.java
com.andrescanales.pokedex.SettingsActivity.java