@Override
  protected void onPostExecute(VendorListResponse result) {
    int duration = Toast.LENGTH_SHORT;
    if (result != null) {
      // erfolgreich eingeloggt
      if (result.getReturnCode() == 200 || result.getReturnCode() == 404) {

        myApp.setVendors(result.getVendorList());
        myApp.increaseInitialDataCounter();
        Log.d("INFO", "Händlerliste erfolgreich angelegt.");
        listener.onTaskCompleted(true);
      }
    } else {
      Log.d("INFO", "Händler konnten nicht geladen werden.");
      listener.onTaskCompleted(false);
    }
  }
Example #2
0
 @Override
 protected void onPostExecute(String result) {
   super.onPostExecute(result);
   Log.d("result", result + "");
   if (listener != null && result != null) {
     try {
       listener.onTaskCompleted(new JSONObject(result));
     } catch (JSONException e) {
       e.printStackTrace();
     }
   } else if (result == null) {
     Toast.makeText(context, "Failed to contact Autumn Server.", Toast.LENGTH_LONG).show();
   }
 }
    @Override
    protected Void doInBackground(String... urls) {
      JSONObject jsonObject = null;
      String url = urls[0];
      HttpClient cliente = new DefaultHttpClient();
      HttpPost postHttp = new HttpPost(url);
      // Log.e("Otra URL",url)
      ArrayList<NameValuePair> datos = new ArrayList<NameValuePair>();
      datos.add(new BasicNameValuePair("grant_type", grandType));
      datos.add(new BasicNameValuePair("refresh_token", refreshToken));
      // datos.add(new BasicNameValuePair("password", password));
      UrlEncodedFormEntity parametrosEncriptados = null;
      try {
        parametrosEncriptados = new UrlEncodedFormEntity(datos);
      } catch (Exception e) {
        e.printStackTrace();
        Log.e("LoginAccessTask", "" + e.getMessage());
      }
      postHttp.setEntity(parametrosEncriptados);
      postHttp.setHeader("Authorization", "Basic VEVTVDo=");
      postHttp.setHeader("X-Requested-With", "XMLHttpRequest");

      try {
        HttpResponse resHttp = cliente.execute(postHttp);

        BufferedReader lector =
            new BufferedReader(new InputStreamReader(resHttp.getEntity().getContent()));
        StringBuilder respuesta = new StringBuilder();
        String separador = System.getProperty("line.separator");
        String fila;

        while ((fila = lector.readLine()) != null) {
          respuesta.append(fila + separador);
        }
        lector.close();
        jsonObject = new JSONObject(respuesta.toString());
        Log.e("Respuesta Refresh", respuesta.toString());
      } catch (Exception e) {
        e.printStackTrace();
        Log.e("RefreshTokenTask", "" + e.getMessage());
      }
      if (callback != null) callback.onTaskCompleted(jsonObject);
      return null;
    }
Example #4
0
 protected void onPostExecute(String result) {
   if (Search != null) Search.onTaskCompleted();
 }
Example #5
0
 @Override
 protected void onPostExecute(Void v) {
   if (onTaskCompletedListener != null)
     onTaskCompletedListener.onTaskCompleted(Hipstacast.TASK_UPGRADE);
 }
  protected void onPostExecute(Map[] Result) {

    Arrays.sort(Result);
    Globals.setMaps(Result);
    listener.onTaskCompleted(Result);
  }