Android Open Source - android-weather-demo-application City Model






From Project

Back to project page android-weather-demo-application.

License

The source code is released under:

GNU General Public License

If you think the Android project android-weather-demo-application 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 org.openweathermap.sql.model;
//  ww w.ja  v  a 2 s .  c  o  m
import com.app.sqlite.base.BaseModel;

import java.util.HashMap;

import android.content.ContentValues;

public class CityModel extends BaseModel {
  private int pid;
  private String name;
  private String country;
  private String latitude;
  private String longitude;
  private long lastViewedTimestamp;

  private static final String COLUMN_PID = "pid";
  private static final String COLUMN_NAME = "name";
  private static final String COLUMN_COUNTRY = "country";
  private static final String COLUMN_LATITUDE = "latitude";
  private static final String COLUMN_LONGITUDE = "longitude";
  private static final String COLUMN_LASTVIEWEDTIMESTAMP = "lastViewedTimestamp";

  // The SQL provider uses reflection to retrieve the table name from this variable
  public static final String TABLE_NAME = "City";

  public int getPid() {
    return pid;
  }

  public void setPid(int newVal) {
    pid = newVal;
  }
  public String getName() {
    return name;
  }

  public void setName(String newVal) {
    name = newVal;
  }
  public String getCountry() {
    return country;
  }

  public void setCountry(String newVal) {
    country = newVal;
  }
  public String getLatitude() {
    return latitude;
  }

  public void setLatitude(String newVal) {
    latitude = newVal;
  }
  public String getLongitude() {
    return longitude;
  }

  public void setLongitude(String newVal) {
    longitude = newVal;
  }
  public long getLastViewedTimestamp() {
    return lastViewedTimestamp;
  }

  public void setLastViewedTimestamp(long newVal) {
    lastViewedTimestamp = newVal;
  }

  @Override
  public HashMap<String,Integer> getModelColumnTypeMap() {
    HashMap<String,Integer> modelColumns = new HashMap<String,Integer>();
    modelColumns.put(COLUMN_PID, BaseModel.FIELD_INTEGER);
    modelColumns.put(COLUMN_NAME, BaseModel.FIELD_STRING);
    modelColumns.put(COLUMN_COUNTRY, BaseModel.FIELD_STRING);
    modelColumns.put(COLUMN_LATITUDE, BaseModel.FIELD_STRING);
    modelColumns.put(COLUMN_LONGITUDE, BaseModel.FIELD_STRING);
    modelColumns.put(COLUMN_LASTVIEWEDTIMESTAMP, BaseModel.FIELD_LONG);
    return modelColumns;
  }

  @Override
  public ContentValues toContentValues() {
    ContentValues contentValues = new ContentValues();
    contentValues.put(COLUMN_NAME, getName());
    contentValues.put(COLUMN_COUNTRY, getCountry());
    contentValues.put(COLUMN_LATITUDE, getLatitude());
    contentValues.put(COLUMN_LONGITUDE, getLongitude());
    contentValues.put(COLUMN_LASTVIEWEDTIMESTAMP, getLastViewedTimestamp());
    return contentValues;
  }
}




Java Source Code List

org.openweathermap.WeatherApplication.java
org.openweathermap.activity.MainActivity.java
org.openweathermap.activity.base.BaseActivity.java
org.openweathermap.adapter.CityAdapter.java
org.openweathermap.adapter.ForecastAdapter.java
org.openweathermap.asynctask.GetCitiesAsyncTask.java
org.openweathermap.asynctask.GetLastCityAsyncTask.java
org.openweathermap.asynctask.SaveForecastAsyncTask.java
org.openweathermap.asynctask.SearchCitiesAsyncTask.java
org.openweathermap.asynctask.base.BaseAsyncTask.java
org.openweathermap.asynctask.base.BaseResponse.java
org.openweathermap.asynctask.base.IParam.java
org.openweathermap.asynctask.param.SaveForecastParam.java
org.openweathermap.asynctask.param.SearchCitiesParam.java
org.openweathermap.asynctask.response.GetCitiesResponse.java
org.openweathermap.asynctask.response.GetLastCityResponse.java
org.openweathermap.asynctask.response.SaveForecastResponse.java
org.openweathermap.dto.CityDTO.java
org.openweathermap.dto.CoordDTO.java
org.openweathermap.dto.DayDTO.java
org.openweathermap.dto.ResultDTO.java
org.openweathermap.dto.TempDTO.java
org.openweathermap.dto.WeatherDTO.java
org.openweathermap.dto.base.IDTO.java
org.openweathermap.fragment.ForecastFragment.java
org.openweathermap.fragment.ModalDialogFragment.java
org.openweathermap.fragment.SelectCountryFragment.java
org.openweathermap.sql.SQLInitProvider.java
org.openweathermap.sql.model.CityModel.java
org.openweathermap.sql.model.IconModel.java
org.openweathermap.sql.model.WeatherModel.java
org.openweathermap.utils.DateHelper.java
org.openweathermap.utils.RESTProvider.java
org.openweathermap.utils.ReflectionHelper.java
org.openweathermap.utils.ResourceHelper.java
org.openweathermap.utils.StringHelper.java
org.openweathermap.view.CityListItemView.java
org.openweathermap.view.DateDisplayView.java
org.openweathermap.view.ViewPagerFade.java
org.openweathermap.view.ViewPagerIndicatorView.java
org.openweathermap.view.WeatherDataRowView.java
org.openweathermap.volley.callback.VolleyResponseCallback.java
org.openweathermap.volley.provider.VolleyImageLoader.java
org.openweathermap.volley.provider.VolleyRequest.java