Android Open Source - wristband-android Wristband Request






From Project

Back to project page wristband-android.

License

The source code is released under:

The Artistic License 2.0 Copyright (c) 2014 Allan Pichardo Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed...

If you think the Android project wristband-android 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.nimo.wristband.net;
//from w  w  w  .  j av a 2  s. c om
import java.util.Map;

import android.util.Log;

import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
import com.android.volley.RetryPolicy;
import com.android.volley.toolbox.StringRequest;
import com.nimo.wristband.constants.Constants;

public class WristbandRequest extends StringRequest{

  private Map<String,String> parameters;
  private RetryPolicy policy;

  public WristbandRequest(Map<String,String> parameters, Listener<String> listener,
      ErrorListener errorListener) {
    super(Method.POST, Constants.URL_WRISTBAND, listener, errorListener);
    this.parameters = parameters;
    policy = new DefaultRetryPolicy(1000 * 30, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    setRetryPolicy(policy);
    
    printDebug();
  }
  
  private void printDebug(){
    String params = "?" + "fn=" + parameters.get(Constants.PARAM_FUNCTION) + "&date=" + parameters.get(Constants.PARAM_DATE) + "&page=" + parameters.get(Constants.PARAM_PAGE) + "&latitude=" + parameters.get(Constants.PARAM_LATITUDE) + "&longitude=" + parameters.get(Constants.PARAM_LONGITUDE);
    String debugUrl = getUrl() + params;
    Log.d("wristband request",debugUrl);
  }

  @Override
  protected Map<String, String> getParams() throws AuthFailureError {
    return this.parameters;
  }
  
  @Override
  public com.android.volley.Request.Priority getPriority() {
    return Priority.HIGH;
  }

  @Override
  public String getCacheKey() {

    String key = parameters.get(Constants.PARAM_FUNCTION) + "," + parameters.get(Constants.PARAM_DATE) + "," + parameters.get(Constants.PARAM_PAGE);
    return key;
  }

  @Override
  public RetryPolicy getRetryPolicy() {
    return policy;
  }

  public void setTimeout(int seconds){
    policy = new DefaultRetryPolicy(1000 * seconds, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    setRetryPolicy(policy);
  }
  

}




Java Source Code List

android.UnusedStub.java
com.android.volley.AuthFailureError.java
com.android.volley.CacheDispatcher.java
com.android.volley.Cache.java
com.android.volley.DefaultRetryPolicy.java
com.android.volley.ExecutorDelivery.java
com.android.volley.NetworkDispatcher.java
com.android.volley.NetworkError.java
com.android.volley.NetworkResponse.java
com.android.volley.Network.java
com.android.volley.NoConnectionError.java
com.android.volley.ParseError.java
com.android.volley.RequestQueue.java
com.android.volley.Request.java
com.android.volley.ResponseDelivery.java
com.android.volley.Response.java
com.android.volley.RetryPolicy.java
com.android.volley.ServerError.java
com.android.volley.TimeoutError.java
com.android.volley.VolleyError.java
com.android.volley.VolleyLog.java
com.android.volley.toolbox.AndroidAuthenticator.java
com.android.volley.toolbox.Authenticator.java
com.android.volley.toolbox.BasicNetwork.java
com.android.volley.toolbox.ByteArrayPool.java
com.android.volley.toolbox.ClearCacheRequest.java
com.android.volley.toolbox.DiskBasedCache.java
com.android.volley.toolbox.HttpClientStack.java
com.android.volley.toolbox.HttpHeaderParser.java
com.android.volley.toolbox.HttpStack.java
com.android.volley.toolbox.HurlStack.java
com.android.volley.toolbox.ImageLoader.java
com.android.volley.toolbox.ImageRequest.java
com.android.volley.toolbox.JsonArrayRequest.java
com.android.volley.toolbox.JsonObjectRequest.java
com.android.volley.toolbox.JsonRequest.java
com.android.volley.toolbox.NetworkImageView.java
com.android.volley.toolbox.NoCache.java
com.android.volley.toolbox.PoolingByteArrayOutputStream.java
com.android.volley.toolbox.RequestFuture.java
com.android.volley.toolbox.StringRequest.java
com.android.volley.toolbox.Volley.java
com.nimo.wristband.DetailActivity.java
com.nimo.wristband.MainActivity.java
com.nimo.wristband.SettingsActivity.java
com.nimo.wristband.adapters.ShowListAdapter.java
com.nimo.wristband.constants.Constants.java
com.nimo.wristband.db.ShowData.java
com.nimo.wristband.db.SimpleStorage.java
com.nimo.wristband.fragments.MusicPlayerFragment.java
com.nimo.wristband.fragments.WristbandMap.java
com.nimo.wristband.net.BitmapLruCache.java
com.nimo.wristband.net.Show.java
com.nimo.wristband.net.WristbandRequest.java
com.nimo.wristband.net.WristbandResponse.java
com.nimo.wristband.service.WristbandPlayerService.java