commit 243ee723ed1ff8127fe40d9a855ea97d0264a34a Author: aminecmi Date: Tue Jun 23 14:43:35 2015 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..afbdab3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..a3f76f8 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Myterio \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..a852314 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..8d2df47 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..fc2f074 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.6 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..2b1d372 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..6564d52 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Myterio.iml b/Myterio.iml new file mode 100644 index 0000000..cbad85a --- /dev/null +++ b/Myterio.iml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/app.iml b/app/app.iml new file mode 100644 index 0000000..7b13054 --- /dev/null +++ b/app/app.iml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..9a6aab6 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,47 @@ +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.1.1' + } +} +apply plugin: 'com.android.application' + +repositories { + jcenter() +} + +android { + compileSdkVersion 22 + buildToolsVersion "23.0.0 rc2" + + defaultConfig { + applicationId "com.amine.myterio.app" + minSdkVersion 15 + targetSdkVersion 22 + versionCode 1 + versionName "1.0" + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:+' + compile 'com.android.support:cardview-v7:+' + compile 'com.android.support:recyclerview-v7:+' + compile "com.android.support:support-v4:+" + compile 'com.melnykov:floatingactionbutton:+' + compile 'com.squareup.retrofit:retrofit:+' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..bef92eb --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:/Users/Amine/Desktop/android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/app/src/androidTest/java/com/amine/myterio/app/ApplicationTest.java b/app/src/androidTest/java/com/amine/myterio/app/ApplicationTest.java new file mode 100644 index 0000000..14e9eaf --- /dev/null +++ b/app/src/androidTest/java/com/amine/myterio/app/ApplicationTest.java @@ -0,0 +1,13 @@ +package com.amine.myterio.app; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..2aa4118 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/java/com/amine/myterio/app/CitiesAdapter.java b/app/src/main/java/com/amine/myterio/app/CitiesAdapter.java new file mode 100644 index 0000000..263a31b --- /dev/null +++ b/app/src/main/java/com/amine/myterio/app/CitiesAdapter.java @@ -0,0 +1,92 @@ +package com.amine.myterio.app; + +import android.content.Context; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; +import android.widget.Toast; +import com.amine.myterio.app.api.WeatherAdapters; +import com.amine.myterio.app.api.WeatherApis; +import com.amine.myterio.app.model.City; +import retrofit.Callback; +import retrofit.RetrofitError; +import retrofit.client.Response; + +import java.util.ArrayList; + +public class CitiesAdapter extends RecyclerView.Adapter { + private static ArrayList mDataset; + private static Context c; + + public class ViewHolder extends RecyclerView.ViewHolder implements RecyclerView.OnClickListener{ + public View mCardView; + + public ViewHolder(View itemView) { + super(itemView); + mCardView = itemView; + itemView.setOnClickListener(this); + } + + @Override + public void onClick(View v) { + // Go to details activity + } + } + + public CitiesAdapter(ArrayList cities, Context c) { + mDataset = cities; + this.c = c; + } + + @Override + public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.city_card_view, parent, false); + ViewHolder vh = new ViewHolder(v); + return vh; + } + + @Override + public void onBindViewHolder(final ViewHolder holder, int position) { + final City[] currentCity = {mDataset.get(position)}; + TextView name = (TextView) holder.mCardView.findViewById(R.id.name); + name.setText(currentCity[0].getName()); + + WeatherAdapters adapters = new WeatherAdapters(); + WeatherApis.WeatherCityApi s = adapters.getWeatherCityAdapter(); + s.cityWeather(currentCity[0].getCityIdentifier(), new Callback() { + @Override + public void success(City city, Response response) { + currentCity[0] = city; + // Update with found data + + TextView maxTemp = (TextView) holder.mCardView.findViewById(R.id.max_temp); + maxTemp.setText("" + city.getMain().getTemp_max()); + + TextView minTemp = (TextView) holder.mCardView.findViewById(R.id.temp_min); + minTemp.setText("" + city.getMain().getTemp_min()); + + TextView wind = (TextView) holder.mCardView.findViewById(R.id.wind_speed); + wind.setText("" + city.getWind().getSpeed()); + + TextView weatherName = (TextView) holder.mCardView.findViewById(R.id.weather_text); + weatherName.setText(city.getWeather().get(0).getDescription()); + + ImageView image = (ImageView) holder.mCardView.findViewById(R.id.weather_image); + image.setImageDrawable(city.getWeather().get(0).getIconDrawable(c, c.getPackageName())); + } + + @Override + public void failure(RetrofitError error) { + Toast.makeText(c, "Hello toast!", Toast.LENGTH_SHORT).show(); + } + }); + } + + @Override + public int getItemCount() { + return mDataset.size(); + } +} diff --git a/app/src/main/java/com/amine/myterio/app/MainActivity.java b/app/src/main/java/com/amine/myterio/app/MainActivity.java new file mode 100644 index 0000000..2b0951e --- /dev/null +++ b/app/src/main/java/com/amine/myterio/app/MainActivity.java @@ -0,0 +1,105 @@ +package com.amine.myterio.app; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.GridLayoutManager; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.view.Menu; +import android.view.MenuItem; +import com.amine.myterio.app.db.CityDAO; +import com.amine.myterio.app.model.City; +import com.melnykov.fab.FloatingActionButton; + +import java.util.ArrayList; + + +public class MainActivity extends AppCompatActivity { + + private RecyclerView mRecyclerView; + private RecyclerView.Adapter mAdapter; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + handleView(); + + /* WeatherAdapters adapters = new WeatherAdapters(); + WeatherApis.WeatherDailyForecastApi s = adapters.getWeatherForecastAdapter(); + s.cityForecast(1851632, new Callback() { + @Override + public void success(Forecast forecast, Response response) { + Toast.makeText(getApplicationContext(), "Hello toast!", Toast.LENGTH_SHORT).show(); + } + + @Override + public void failure(RetrofitError error) { + Toast.makeText(getApplicationContext(), "Hello toast!", Toast.LENGTH_SHORT).show(); + } + });*/ + } + + private void handleView() { + setContentView(R.layout.activity_main); + mRecyclerView = (RecyclerView) findViewById(R.id.list); + + + // Google way to test is tablet + boolean isTablet = ((this.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE); + + final RecyclerView.LayoutManager layoutManager; + if (isTablet) { + layoutManager = new GridLayoutManager(this, 2); + } + else { + layoutManager = new LinearLayoutManager(this); + } + + mRecyclerView.setLayoutManager(layoutManager); + mRecyclerView.setHasFixedSize(true); + + ArrayList cities = new ArrayList(); + + CityDAO dao = CityDAO.getInstance(this); + + City c = new City("Cairns", 2172797); + City c1 = new City("Moscow", 524901); + + dao.insertCity(c); + dao.insertCity(c1); + cities = dao.getAllCities(); + + mAdapter = new CitiesAdapter(cities, this); + mRecyclerView.setAdapter(mAdapter); + + FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); + fab.attachToRecyclerView(mRecyclerView); + + + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } + +} diff --git a/app/src/main/java/com/amine/myterio/app/api/WeatherAdapters.java b/app/src/main/java/com/amine/myterio/app/api/WeatherAdapters.java new file mode 100644 index 0000000..a19c88c --- /dev/null +++ b/app/src/main/java/com/amine/myterio/app/api/WeatherAdapters.java @@ -0,0 +1,26 @@ +package com.amine.myterio.app.api; + +import retrofit.RestAdapter; + +public class WeatherAdapters { + RestAdapter restAdapter; + + + public WeatherAdapters() { + this.restAdapter = new RestAdapter.Builder() + .setEndpoint("http://api.openweathermap.org") + .build(); + } + + public WeatherApis.WeatherLocationApi getWeatherLocationAdapter() { + return restAdapter.create(WeatherApis.WeatherLocationApi.class); + } + + public WeatherApis.WeatherCityApi getWeatherCityAdapter() { + return restAdapter.create(WeatherApis.WeatherCityApi.class); + } + + public WeatherApis.WeatherDailyForecastApi getWeatherForecastAdapter() { + return restAdapter.create(WeatherApis.WeatherDailyForecastApi.class); + } +} diff --git a/app/src/main/java/com/amine/myterio/app/api/WeatherApis.java b/app/src/main/java/com/amine/myterio/app/api/WeatherApis.java new file mode 100644 index 0000000..41b4c69 --- /dev/null +++ b/app/src/main/java/com/amine/myterio/app/api/WeatherApis.java @@ -0,0 +1,22 @@ +package com.amine.myterio.app.api; + +import com.amine.myterio.app.model.City; +import com.amine.myterio.app.model.Forecast; +import retrofit.Callback; +import retrofit.http.GET; +import retrofit.http.Query; + +public class WeatherApis { + public interface WeatherLocationApi { + @GET("/data/2.5/weather") + void locationWeather(@Query("q") String location, Callback cb); + } + public interface WeatherCityApi { + @GET("/data/2.5/weather") + void cityWeather(@Query("id") int city, Callback cb); + } + public interface WeatherDailyForecastApi { + @GET("/data/2.5/forecast/daily?units=metric&cnt=7") + void cityForecast(@Query("id") int city, Callback cb); + } +} diff --git a/app/src/main/java/com/amine/myterio/app/db/CityDAO.java b/app/src/main/java/com/amine/myterio/app/db/CityDAO.java new file mode 100644 index 0000000..71ccd97 --- /dev/null +++ b/app/src/main/java/com/amine/myterio/app/db/CityDAO.java @@ -0,0 +1,117 @@ +package com.amine.myterio.app.db; + +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import com.amine.myterio.app.model.City; + +import java.util.ArrayList; + +public class CityDAO { + private static final int VERSION_BDD = 1; + private static final String NOM_BDD = "cities.db"; + + private static final String TABLE_CITIES = "cities"; + private static final String COL_ID = "ID"; + private static final String COL_NAME = "Name"; + private static final String COL_CITY_ID = "CityId"; + + private static final int NUM_COL_ID = 0; + private static final int NUM_COL_NAME = 1; + private static final int NUM_COL_CITY_ID = 2; + private static CityDAO instance = null; + private final CityDB maBaseSQLite; + private SQLiteDatabase bdd; + + private CityDAO(Context context) { + maBaseSQLite = new CityDB(context, NOM_BDD, null, VERSION_BDD); + } + + public static CityDAO getInstance(Context c) { + if (instance == null) { + instance = new CityDAO(c); + return instance; + } else { + return instance; + } + } + + public void open() { + bdd = maBaseSQLite.getWritableDatabase(); + } + + public void close() { + bdd.close(); + } + + public void insertCity(City city) { + this.open(); + ContentValues values = getContentValues(city); + bdd.insert(TABLE_CITIES, null, values); + this.close(); + } + + private ContentValues getContentValues(City city) { + ContentValues values = new ContentValues(); + values.put(COL_NAME, city.getName()); + values.put(COL_CITY_ID, city.getCityIdentifier()); + return values; + } + + public void updateCity(City city) { + this.open(); + ContentValues values = getContentValues(city); + bdd.update(TABLE_CITIES, values, COL_CITY_ID + " = " + city.getCityIdentifier(), null); + this.close(); + } + + public void deleteCity(City city) { + this.open(); + bdd.delete(TABLE_CITIES, COL_CITY_ID + " = " + city.getCityIdentifier(), null); + this.close(); + } + + public City getCity(int identifier) { + this.open(); + Cursor c = bdd.query(TABLE_CITIES, null, COL_CITY_ID + " = " + identifier, null, null, null, null); + c.moveToFirst(); + City city = cursorToCity(c); + c.close(); + this.close(); + return city; + } + + private City cursorToCity(Cursor c) { + if (c.getCount() == 0) { + return null; + } else { + City city = new City(); + city.setName(c.getString(NUM_COL_NAME)); + city.setCityIdentifier(c.getInt(NUM_COL_CITY_ID)); + return city; + } + } + + public ArrayList getAllCities() { + this.open(); + Cursor c = bdd.rawQuery("SELECT * FROM " + TABLE_CITIES, null); + ArrayList cities = cursorToListeCities(c); + this.close(); + return cities; + } + + private ArrayList cursorToListeCities(Cursor cursor) { + ArrayList list = new ArrayList(); + if (cursor.getCount() != 0) { + if (cursor.moveToFirst()) { + while (!cursor.isAfterLast()) { + list.add(cursorToCity(cursor)); + cursor.moveToNext(); + } + } + } + cursor.close(); + return list; + } +} diff --git a/app/src/main/java/com/amine/myterio/app/db/CityDB.java b/app/src/main/java/com/amine/myterio/app/db/CityDB.java new file mode 100644 index 0000000..d122407 --- /dev/null +++ b/app/src/main/java/com/amine/myterio/app/db/CityDB.java @@ -0,0 +1,33 @@ +package com.amine.myterio.app.db; + +import android.content.Context; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; + +public class CityDB extends SQLiteOpenHelper { + + private static final String TABLE_CITIES = "cities"; + private static final String COL_ID = "ID"; + private static final String COL_NAME = "Name"; + private static final String COL_CITY_ID = "CityId"; + + private static final String CREATE_BDD = "CREATE TABLE " + TABLE_CITIES + " (" + + COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + + COL_NAME + " TEXT, " + + COL_CITY_ID + " INTEGER);"; + + public CityDB(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) { + super(context, name, factory, version); + } + + @Override + public void onCreate(SQLiteDatabase db) { + db.execSQL(CREATE_BDD); + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + + } +} + diff --git a/app/src/main/java/com/amine/myterio/app/model/City.java b/app/src/main/java/com/amine/myterio/app/model/City.java new file mode 100644 index 0000000..b8ee008 --- /dev/null +++ b/app/src/main/java/com/amine/myterio/app/model/City.java @@ -0,0 +1,63 @@ +package com.amine.myterio.app.model; + +import java.util.List; + +public class City { + + public String name; + public int id; + public MainInfo main; + public List weather; + public Wind wind; + + public City(String name, int id) { + this.name = name; + this.id = id; + } + + public City() { + + + } + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getCityIdentifier() { + return id; + } + + public void setCityIdentifier(int cityIdentifier) { + this.id = cityIdentifier; + } + + public MainInfo getMain() { + return main; + } + + public void setMain(MainInfo main) { + this.main = main; + } + + public List getWeather() { + return weather; + } + + public void setWeather(List weather) { + this.weather = weather; + } + + public Wind getWind() { + return wind; + } + + public void setWind(Wind wind) { + this.wind = wind; + } +} diff --git a/app/src/main/java/com/amine/myterio/app/model/Forecast.java b/app/src/main/java/com/amine/myterio/app/model/Forecast.java new file mode 100644 index 0000000..08a1665 --- /dev/null +++ b/app/src/main/java/com/amine/myterio/app/model/Forecast.java @@ -0,0 +1,24 @@ +package com.amine.myterio.app.model; + +import java.util.List; + +public class Forecast { + public City city; + public List list; + + public City getCity() { + return city; + } + + public void setCity(City city) { + this.city = city; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } +} diff --git a/app/src/main/java/com/amine/myterio/app/model/ForecastWeather.java b/app/src/main/java/com/amine/myterio/app/model/ForecastWeather.java new file mode 100644 index 0000000..8b59d85 --- /dev/null +++ b/app/src/main/java/com/amine/myterio/app/model/ForecastWeather.java @@ -0,0 +1,33 @@ +package com.amine.myterio.app.model; + +import java.util.List; + +public class ForecastWeather { + public TempInfo temp; + public List weather; + public float speed; + + public TempInfo getTemp() { + return temp; + } + + public void setTemp(TempInfo temp) { + this.temp = temp; + } + + public List getWeather() { + return weather; + } + + public void setWeather(List weather) { + this.weather = weather; + } + + public float getSpeed() { + return speed; + } + + public void setSpeed(float speed) { + this.speed = speed; + } +} diff --git a/app/src/main/java/com/amine/myterio/app/model/MainInfo.java b/app/src/main/java/com/amine/myterio/app/model/MainInfo.java new file mode 100644 index 0000000..a44826b --- /dev/null +++ b/app/src/main/java/com/amine/myterio/app/model/MainInfo.java @@ -0,0 +1,31 @@ +package com.amine.myterio.app.model; + +public class MainInfo { + public float temp; + public float temp_max; + public float temp_min; + + public float getTemp() { + return temp; + } + + public void setTemp(float temp) { + this.temp = temp; + } + + public float getTemp_max() { + return temp_max; + } + + public void setTemp_max(float temp_max) { + this.temp_max = temp_max; + } + + public float getTemp_min() { + return temp_min; + } + + public void setTemp_min(float temp_min) { + this.temp_min = temp_min; + } +} diff --git a/app/src/main/java/com/amine/myterio/app/model/TempInfo.java b/app/src/main/java/com/amine/myterio/app/model/TempInfo.java new file mode 100644 index 0000000..570e40f --- /dev/null +++ b/app/src/main/java/com/amine/myterio/app/model/TempInfo.java @@ -0,0 +1,58 @@ +package com.amine.myterio.app.model; + +public class TempInfo { + public float day; + public float min; + public float max; + public float night; + public float eve; + public float morn; + + public float getDay() { + return day; + } + + public void setDay(float day) { + this.day = day; + } + + public float getMin() { + return min; + } + + public void setMin(float min) { + this.min = min; + } + + public float getMax() { + return max; + } + + public void setMax(float max) { + this.max = max; + } + + public float getNight() { + return night; + } + + public void setNight(float night) { + this.night = night; + } + + public float getEve() { + return eve; + } + + public void setEve(float eve) { + this.eve = eve; + } + + public float getMorn() { + return morn; + } + + public void setMorn(float morn) { + this.morn = morn; + } +} diff --git a/app/src/main/java/com/amine/myterio/app/model/Weather.java b/app/src/main/java/com/amine/myterio/app/model/Weather.java new file mode 100644 index 0000000..a026118 --- /dev/null +++ b/app/src/main/java/com/amine/myterio/app/model/Weather.java @@ -0,0 +1,99 @@ +package com.amine.myterio.app.model; + +import android.content.Context; +import android.graphics.drawable.Drawable; + +public class Weather { + public String description; + public String icon; + public int id; + public String main; + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getIcon() { + return icon; + } + + public Drawable getIconDrawable(Context c, String packageName) { + String uri = "@mipmap/"; + + if (this.getIcon().equals("01d")) { + // 01d => ic_sun + uri += "ic_sun"; + } + else if(this.getIcon().equals("01n")) { + // 01n => ic_moon + uri += "ic_moon"; + } + else if(this.getIcon().equals("02d")) { + // 02d => ic_sunny_cloud + uri += "ic_sunny_cloud"; + } + else if(this.getIcon().equals("02n")) { + // 02n => ic_moony_cloud + uri += "ic_moony_cloud"; + } + else if(this.getIcon().equals("03d") || this.getIcon().equals("03n")) { + // 03d/03n => ic_cloud + uri += "ic_cloud"; + } + else if(this.getIcon().equals("04d") || this.getIcon().equals("04n")) { + // 04d/04n => ic_coud_grey + uri += "ic_coud_grey"; + } + else if(this.getIcon().equals("09d") || this.getIcon().equals("09n")) { + // 09d/09n => ic_rainy_rain + uri += "ic_rainy"; + } + else if(this.getIcon().equals("10d")) { + // 10d => ic_sunny_rain + uri += "ic_sunny_rain"; + } + else if(this.getIcon().equals("10n")) { + // 10n => ic_moony_rain + uri += "ic_moony_rain"; + } + else if(this.getIcon().equals("11d") || this.getIcon().equals("11n")) { + // 11d/11n => ic_thunder + uri += "ic_thunder"; + } + else if(this.getIcon().equals("13d") || this.getIcon().equals("13n")) { + // 13d/13n => ic_snow + uri += "ic_snow"; + } + else if(this.getIcon().equals("50d") || this.getIcon().equals("50n")) { + // 50d/50n => ic_mist + uri += "ic_mist"; + } + + int imageResource = c.getResources().getIdentifier(uri, null, packageName); + return c.getResources().getDrawable(imageResource); + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getMain() { + return main; + } + + public void setMain(String main) { + this.main = main; + } +} diff --git a/app/src/main/java/com/amine/myterio/app/model/Wind.java b/app/src/main/java/com/amine/myterio/app/model/Wind.java new file mode 100644 index 0000000..d4eaab7 --- /dev/null +++ b/app/src/main/java/com/amine/myterio/app/model/Wind.java @@ -0,0 +1,22 @@ +package com.amine.myterio.app.model; + +public class Wind { + public float deg; + public float speed; + + public float getDeg() { + return deg; + } + + public void setDeg(float deg) { + this.deg = deg; + } + + public float getSpeed() { + return speed; + } + + public void setSpeed(float speed) { + this.speed = speed; + } +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..4d4ab3e --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/app/src/main/res/layout/city_card_view.xml b/app/src/main/res/layout/city_card_view.xml new file mode 100644 index 0000000..20487c3 --- /dev/null +++ b/app/src/main/res/layout/city_card_view.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml new file mode 100644 index 0000000..6183458 --- /dev/null +++ b/app/src/main/res/layout/fragment_main.xml @@ -0,0 +1,16 @@ + + + + + diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml new file mode 100644 index 0000000..a459e0a --- /dev/null +++ b/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/mipmap-hdpi/Thumbs.db b/app/src/main/res/mipmap-hdpi/Thumbs.db new file mode 100644 index 0000000..6664c53 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/Thumbs.db differ diff --git a/app/src/main/res/mipmap-hdpi/ic_cloud.png b/app/src/main/res/mipmap-hdpi/ic_cloud.png new file mode 100644 index 0000000..cc6bf0e Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_cloud.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_coud_grey.png b/app/src/main/res/mipmap-hdpi/ic_coud_grey.png new file mode 100644 index 0000000..938f28c Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_coud_grey.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..e6f8c87 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_max.png b/app/src/main/res/mipmap-hdpi/ic_max.png new file mode 100644 index 0000000..9dc3076 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_max.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_min.png b/app/src/main/res/mipmap-hdpi/ic_min.png new file mode 100644 index 0000000..75fbac8 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_min.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_mist.png b/app/src/main/res/mipmap-hdpi/ic_mist.png new file mode 100644 index 0000000..9dbf52c Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_mist.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_moon.png b/app/src/main/res/mipmap-hdpi/ic_moon.png new file mode 100644 index 0000000..511bedf Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_moon.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_moony_cloud.png b/app/src/main/res/mipmap-hdpi/ic_moony_cloud.png new file mode 100644 index 0000000..425c508 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_moony_cloud.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_moony_rain.png b/app/src/main/res/mipmap-hdpi/ic_moony_rain.png new file mode 100644 index 0000000..05f7728 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_moony_rain.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_rainy.png b/app/src/main/res/mipmap-hdpi/ic_rainy.png new file mode 100644 index 0000000..a23e352 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_rainy.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_rainy_rain.png b/app/src/main/res/mipmap-hdpi/ic_rainy_rain.png new file mode 100644 index 0000000..b43ed88 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_rainy_rain.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_search_white_24dp.png b/app/src/main/res/mipmap-hdpi/ic_search_white_24dp.png new file mode 100644 index 0000000..bbfbc96 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_search_white_24dp.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_snow.png b/app/src/main/res/mipmap-hdpi/ic_snow.png new file mode 100644 index 0000000..2da0e98 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_snow.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_sun.png b/app/src/main/res/mipmap-hdpi/ic_sun.png new file mode 100644 index 0000000..1455718 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_sun.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_sunny_cloud.png b/app/src/main/res/mipmap-hdpi/ic_sunny_cloud.png new file mode 100644 index 0000000..217c22f Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_sunny_cloud.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_sunny_rain.png b/app/src/main/res/mipmap-hdpi/ic_sunny_rain.png new file mode 100644 index 0000000..a41fce6 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_sunny_rain.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_temp.png b/app/src/main/res/mipmap-hdpi/ic_temp.png new file mode 100644 index 0000000..fd3a913 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_temp.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_thunder.png b/app/src/main/res/mipmap-hdpi/ic_thunder.png new file mode 100644 index 0000000..536a9db Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_thunder.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_wind.png b/app/src/main/res/mipmap-hdpi/ic_wind.png new file mode 100644 index 0000000..a84b8f3 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_wind.png differ diff --git a/app/src/main/res/mipmap-mdpi/Thumbs.db b/app/src/main/res/mipmap-mdpi/Thumbs.db new file mode 100644 index 0000000..18b7a14 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/Thumbs.db differ diff --git a/app/src/main/res/mipmap-mdpi/ic_cloud.png b/app/src/main/res/mipmap-mdpi/ic_cloud.png new file mode 100644 index 0000000..4681653 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_cloud.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_coud_grey.png b/app/src/main/res/mipmap-mdpi/ic_coud_grey.png new file mode 100644 index 0000000..26700e1 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_coud_grey.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..23575be Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_max.png b/app/src/main/res/mipmap-mdpi/ic_max.png new file mode 100644 index 0000000..24d89a6 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_max.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_min.png b/app/src/main/res/mipmap-mdpi/ic_min.png new file mode 100644 index 0000000..86d43f2 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_min.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_mist.png b/app/src/main/res/mipmap-mdpi/ic_mist.png new file mode 100644 index 0000000..f427dba Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_mist.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_moon.png b/app/src/main/res/mipmap-mdpi/ic_moon.png new file mode 100644 index 0000000..f91f11f Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_moon.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_moony_cloud.png b/app/src/main/res/mipmap-mdpi/ic_moony_cloud.png new file mode 100644 index 0000000..2cb28b9 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_moony_cloud.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_moony_rain.png b/app/src/main/res/mipmap-mdpi/ic_moony_rain.png new file mode 100644 index 0000000..693a996 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_moony_rain.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_rainy.png b/app/src/main/res/mipmap-mdpi/ic_rainy.png new file mode 100644 index 0000000..d84aab6 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_rainy.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_rainy_rain.png b/app/src/main/res/mipmap-mdpi/ic_rainy_rain.png new file mode 100644 index 0000000..b62c566 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_rainy_rain.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_search_white_24dp.png b/app/src/main/res/mipmap-mdpi/ic_search_white_24dp.png new file mode 100644 index 0000000..faefc59 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_search_white_24dp.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_snow.png b/app/src/main/res/mipmap-mdpi/ic_snow.png new file mode 100644 index 0000000..e3bb468 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_snow.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_sun.png b/app/src/main/res/mipmap-mdpi/ic_sun.png new file mode 100644 index 0000000..17c964b Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_sun.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_sunny_cloud.png b/app/src/main/res/mipmap-mdpi/ic_sunny_cloud.png new file mode 100644 index 0000000..dd1622a Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_sunny_cloud.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_sunny_rain.png b/app/src/main/res/mipmap-mdpi/ic_sunny_rain.png new file mode 100644 index 0000000..d079a23 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_sunny_rain.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_temp.png b/app/src/main/res/mipmap-mdpi/ic_temp.png new file mode 100644 index 0000000..95437f8 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_temp.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_thunder.png b/app/src/main/res/mipmap-mdpi/ic_thunder.png new file mode 100644 index 0000000..93deb72 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_thunder.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_wind.png b/app/src/main/res/mipmap-mdpi/ic_wind.png new file mode 100644 index 0000000..33c7cf9 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_wind.png differ diff --git a/app/src/main/res/mipmap-xhdpi/Thumbs.db b/app/src/main/res/mipmap-xhdpi/Thumbs.db new file mode 100644 index 0000000..324c515 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/Thumbs.db differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_cloud.png b/app/src/main/res/mipmap-xhdpi/ic_cloud.png new file mode 100644 index 0000000..fa2acc5 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_cloud.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_coud_grey.png b/app/src/main/res/mipmap-xhdpi/ic_coud_grey.png new file mode 100644 index 0000000..9e443b8 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_coud_grey.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..2c76c5a Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_max.png b/app/src/main/res/mipmap-xhdpi/ic_max.png new file mode 100644 index 0000000..de25314 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_max.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_min.png b/app/src/main/res/mipmap-xhdpi/ic_min.png new file mode 100644 index 0000000..df3cd8f Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_min.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_mist.png b/app/src/main/res/mipmap-xhdpi/ic_mist.png new file mode 100644 index 0000000..f93f869 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_mist.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_moon.png b/app/src/main/res/mipmap-xhdpi/ic_moon.png new file mode 100644 index 0000000..48a9814 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_moon.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_moony_cloud.png b/app/src/main/res/mipmap-xhdpi/ic_moony_cloud.png new file mode 100644 index 0000000..6194b86 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_moony_cloud.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_moony_rain.png b/app/src/main/res/mipmap-xhdpi/ic_moony_rain.png new file mode 100644 index 0000000..56c8fa7 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_moony_rain.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_rainy.png b/app/src/main/res/mipmap-xhdpi/ic_rainy.png new file mode 100644 index 0000000..5e82cb3 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_rainy.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_rainy_rain.png b/app/src/main/res/mipmap-xhdpi/ic_rainy_rain.png new file mode 100644 index 0000000..310dfec Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_rainy_rain.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_search_white_24dp.png b/app/src/main/res/mipmap-xhdpi/ic_search_white_24dp.png new file mode 100644 index 0000000..bfc3e39 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_search_white_24dp.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_snow.png b/app/src/main/res/mipmap-xhdpi/ic_snow.png new file mode 100644 index 0000000..6e23894 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_snow.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_sun.png b/app/src/main/res/mipmap-xhdpi/ic_sun.png new file mode 100644 index 0000000..83a7525 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_sun.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_sunny_cloud.png b/app/src/main/res/mipmap-xhdpi/ic_sunny_cloud.png new file mode 100644 index 0000000..45e1c87 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_sunny_cloud.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_sunny_rain.png b/app/src/main/res/mipmap-xhdpi/ic_sunny_rain.png new file mode 100644 index 0000000..f79dc4e Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_sunny_rain.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_temp.png b/app/src/main/res/mipmap-xhdpi/ic_temp.png new file mode 100644 index 0000000..34c515a Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_temp.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_thunder.png b/app/src/main/res/mipmap-xhdpi/ic_thunder.png new file mode 100644 index 0000000..552dbc4 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_thunder.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_wind.png b/app/src/main/res/mipmap-xhdpi/ic_wind.png new file mode 100644 index 0000000..f6d7f5a Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_wind.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/Thumbs.db b/app/src/main/res/mipmap-xxhdpi/Thumbs.db new file mode 100644 index 0000000..b178981 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/Thumbs.db differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_cloud.png b/app/src/main/res/mipmap-xxhdpi/ic_cloud.png new file mode 100644 index 0000000..db3b8d3 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_cloud.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_coud_grey.png b/app/src/main/res/mipmap-xxhdpi/ic_coud_grey.png new file mode 100644 index 0000000..8c6d246 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_coud_grey.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..c5432d3 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_max.png b/app/src/main/res/mipmap-xxhdpi/ic_max.png new file mode 100644 index 0000000..9d0803a Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_max.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_min.png b/app/src/main/res/mipmap-xxhdpi/ic_min.png new file mode 100644 index 0000000..7c29f24 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_min.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_mist.png b/app/src/main/res/mipmap-xxhdpi/ic_mist.png new file mode 100644 index 0000000..c9b0e87 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_mist.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_moon.png b/app/src/main/res/mipmap-xxhdpi/ic_moon.png new file mode 100644 index 0000000..960283f Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_moon.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_moony_cloud.png b/app/src/main/res/mipmap-xxhdpi/ic_moony_cloud.png new file mode 100644 index 0000000..3c05b62 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_moony_cloud.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_moony_rain.png b/app/src/main/res/mipmap-xxhdpi/ic_moony_rain.png new file mode 100644 index 0000000..08a3db3 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_moony_rain.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_rainy.png b/app/src/main/res/mipmap-xxhdpi/ic_rainy.png new file mode 100644 index 0000000..933ebc6 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_rainy.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_rainy_rain.png b/app/src/main/res/mipmap-xxhdpi/ic_rainy_rain.png new file mode 100644 index 0000000..2943efe Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_rainy_rain.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_search_white_24dp.png b/app/src/main/res/mipmap-xxhdpi/ic_search_white_24dp.png new file mode 100644 index 0000000..abbb989 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_search_white_24dp.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_snow.png b/app/src/main/res/mipmap-xxhdpi/ic_snow.png new file mode 100644 index 0000000..b4e342a Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_snow.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_sun.png b/app/src/main/res/mipmap-xxhdpi/ic_sun.png new file mode 100644 index 0000000..1669c25 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_sun.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_sunny_cloud.png b/app/src/main/res/mipmap-xxhdpi/ic_sunny_cloud.png new file mode 100644 index 0000000..fac8bcb Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_sunny_cloud.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_sunny_rain.png b/app/src/main/res/mipmap-xxhdpi/ic_sunny_rain.png new file mode 100644 index 0000000..d38fee7 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_sunny_rain.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_temp.png b/app/src/main/res/mipmap-xxhdpi/ic_temp.png new file mode 100644 index 0000000..69bb6f7 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_temp.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_thunder.png b/app/src/main/res/mipmap-xxhdpi/ic_thunder.png new file mode 100644 index 0000000..48ac444 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_thunder.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_wind.png b/app/src/main/res/mipmap-xxhdpi/ic_wind.png new file mode 100644 index 0000000..23cc84f Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_wind.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/Thumbs.db b/app/src/main/res/mipmap-xxxhdpi/Thumbs.db new file mode 100644 index 0000000..a462c29 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/Thumbs.db differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_cloud.png b/app/src/main/res/mipmap-xxxhdpi/ic_cloud.png new file mode 100644 index 0000000..8a4e9be Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_cloud.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_coud_grey.png b/app/src/main/res/mipmap-xxxhdpi/ic_coud_grey.png new file mode 100644 index 0000000..28d0c5c Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_coud_grey.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..6688f86 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_max.png b/app/src/main/res/mipmap-xxxhdpi/ic_max.png new file mode 100644 index 0000000..cbd752c Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_max.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_min.png b/app/src/main/res/mipmap-xxxhdpi/ic_min.png new file mode 100644 index 0000000..7926061 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_min.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_mist.png b/app/src/main/res/mipmap-xxxhdpi/ic_mist.png new file mode 100644 index 0000000..1f55690 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_mist.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_moon.png b/app/src/main/res/mipmap-xxxhdpi/ic_moon.png new file mode 100644 index 0000000..adfbd25 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_moon.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_moony_cloud.png b/app/src/main/res/mipmap-xxxhdpi/ic_moony_cloud.png new file mode 100644 index 0000000..adbc61e Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_moony_cloud.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_moony_rain.png b/app/src/main/res/mipmap-xxxhdpi/ic_moony_rain.png new file mode 100644 index 0000000..cb8465d Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_moony_rain.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_rainy.png b/app/src/main/res/mipmap-xxxhdpi/ic_rainy.png new file mode 100644 index 0000000..345e455 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_rainy.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_rainy_rain.png b/app/src/main/res/mipmap-xxxhdpi/ic_rainy_rain.png new file mode 100644 index 0000000..605a99b Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_rainy_rain.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_search_white_24dp.png b/app/src/main/res/mipmap-xxxhdpi/ic_search_white_24dp.png new file mode 100644 index 0000000..dd5adfc Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_search_white_24dp.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_snow.png b/app/src/main/res/mipmap-xxxhdpi/ic_snow.png new file mode 100644 index 0000000..81b1a52 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_snow.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_sun.png b/app/src/main/res/mipmap-xxxhdpi/ic_sun.png new file mode 100644 index 0000000..31706df Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_sun.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_sunny_cloud.png b/app/src/main/res/mipmap-xxxhdpi/ic_sunny_cloud.png new file mode 100644 index 0000000..a2580ab Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_sunny_cloud.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_sunny_rain.png b/app/src/main/res/mipmap-xxxhdpi/ic_sunny_rain.png new file mode 100644 index 0000000..5b5c841 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_sunny_rain.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_temp.png b/app/src/main/res/mipmap-xxxhdpi/ic_temp.png new file mode 100644 index 0000000..6c4cd33 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_temp.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_thunder.png b/app/src/main/res/mipmap-xxxhdpi/ic_thunder.png new file mode 100644 index 0000000..aebca03 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_thunder.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_wind.png b/app/src/main/res/mipmap-xxxhdpi/ic_wind.png new file mode 100644 index 0000000..5d592f3 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_wind.png differ diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..63fc816 --- /dev/null +++ b/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..47c8224 --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ + + + 16dp + 16dp + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..b37a377 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,5 @@ + + Myterio + Hello world! + Settings + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..dd12b20 --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,17 @@ + + + + + #2196f3 + #186eb2 + #fad200 + + diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..4f7a2f1 --- /dev/null +++ b/build.gradle @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.1.1' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..1d3591c --- /dev/null +++ b/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..8c0fb64 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0c71e76 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..91a7e26 --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..e90d927 Binary files /dev/null and b/icon.png differ diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/web_hi_res_512.png b/web_hi_res_512.png new file mode 100644 index 0000000..2e0ba37 Binary files /dev/null and b/web_hi_res_512.png differ