Android Open Source - ThinkPageSDK_Android T P Weather Now






From Project

Back to project page ThinkPageSDK_Android.

License

The source code is released under:

MIT License

If you think the Android project ThinkPageSDK_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.thinkpage.sdk;
/*from   w  ww .j av a2 s . c  o  m*/
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class TPWeatherNow 
{
  public TPWeatherNow(JSONObject jsonResponse)
  {
    try
    {
      text = jsonResponse.getString("text");
      code = jsonResponse.getString("code");
      temperature = jsonResponse.getInt("temperature");
      feelsLikeTemperature = jsonResponse.getInt("feels_like");
      windDirection = jsonResponse.getString("wind_direction");
      windSpeed = jsonResponse.getDouble("wind_speed");
      windScale = jsonResponse.getDouble("wind_scale");
      humidity = jsonResponse.getDouble("humidity");
      visibility = jsonResponse.getDouble("visibility");
      pressure = jsonResponse.getDouble("pressure");
      pressureRising = jsonResponse.getString("pressure_rising");
        }
        catch (final JSONException ex)
        {

        };

        try
        {
            //air quality if any
            JSONObject airQualitiesAll = jsonResponse.getJSONObject("air_quality");
            TPAirQuality cityAirQuality = new TPAirQuality(airQualitiesAll.getJSONObject("city"));
            JSONArray stationsAirQualityReport = airQualitiesAll.getJSONArray("stations");
            airQualities = new TPAirQuality[stationsAirQualityReport.length() + 1];
            airQualities[0] = cityAirQuality;
            for (int i = 1; i <= stationsAirQualityReport.length(); ++i)
            {
                airQualities[i] = new TPAirQuality(stationsAirQualityReport.getJSONObject(i - 1));
            }
        }catch (final JSONException ex)
        {

        };
  }
  public String text;

  /*!
   *
   * The weather code corresponding to description
   **/
  public String code;

  /*!
   *
   * The temperature/feel like temperature of now
   **/
  public int temperature;
  public int feelsLikeTemperature;

  /*!
   *
   * The wind direction/speed/scale
   **/
  public String windDirection;
  public double windSpeed;
  public double windScale;

  /*!
   *
   * The humidity, visibility of now
   **/
  public double humidity;
  public double visibility;

  /*!
   *
   * The air pressure and pressure rising of now
   **/
  public double pressure;
  public String pressureRising;
  
  public TPAirQuality[] airQualities;
}




Java Source Code List

com.example.thinkpageandroid.MainActivity.java
com.loopj.android.http.AsyncHttpClient.java
com.loopj.android.http.AsyncHttpRequest.java
com.loopj.android.http.AsyncHttpResponseHandler.java
com.loopj.android.http.Base64DataException.java
com.loopj.android.http.Base64OutputStream.java
com.loopj.android.http.Base64.java
com.loopj.android.http.BaseJsonHttpResponseHandler.java
com.loopj.android.http.BinaryHttpResponseHandler.java
com.loopj.android.http.DataAsyncHttpResponseHandler.java
com.loopj.android.http.FileAsyncHttpResponseHandler.java
com.loopj.android.http.JsonHttpResponseHandler.java
com.loopj.android.http.JsonStreamerEntity.java
com.loopj.android.http.MySSLSocketFactory.java
com.loopj.android.http.PersistentCookieStore.java
com.loopj.android.http.PreemtiveAuthorizationHttpRequestInterceptor.java
com.loopj.android.http.RangeFileAsyncHttpResponseHandler.java
com.loopj.android.http.RequestHandle.java
com.loopj.android.http.RequestParams.java
com.loopj.android.http.ResponseHandlerInterface.java
com.loopj.android.http.RetryHandler.java
com.loopj.android.http.SerializableCookie.java
com.loopj.android.http.SimpleMultipartEntity.java
com.loopj.android.http.SyncHttpClient.java
com.loopj.android.http.TextHttpResponseHandler.java
com.thinkpage.sdk.TPAirQuality.java
com.thinkpage.sdk.TPCity.java
com.thinkpage.sdk.TPWeatherFuture.java
com.thinkpage.sdk.TPWeatherManagerDelegate.java
com.thinkpage.sdk.TPWeatherManager.java
com.thinkpage.sdk.TPWeatherNow.java
com.thinkpage.sdk.TPWeatherSuggestions.java
com.thinkpage.sdk.TPWeather.java