screen and text

This commit is contained in:
aminecmi 2015-07-12 15:49:17 +02:00
parent 65b45bc19c
commit 896978ac28
29 changed files with 1143 additions and 8 deletions

View File

@ -6,6 +6,7 @@ import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
@ -13,14 +14,18 @@ import com.amine.myterio.app.adapters.ForecastAdapter;
import com.amine.myterio.app.api.WeatherAdapters;
import com.amine.myterio.app.api.WeatherApis;
import com.amine.myterio.app.config.Config;
import com.amine.myterio.app.db.CityDAO;
import com.amine.myterio.app.model.City;
import com.amine.myterio.app.model.Forecast;
import com.melnykov.fab.FloatingActionButton;
import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;
public class DetailsActivity extends AppCompatActivity {
static boolean isFav = true;
static FloatingActionButton fab;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -36,8 +41,10 @@ public class DetailsActivity extends AppCompatActivity {
list.setLayoutManager(layoutManager);
list.setHasFixedSize(true);
CityDAO dao = CityDAO.getInstance(this);
if (cityName != null) {
isFav = dao.getCity(cityName) != null;
WeatherApis.WeatherDailyForecastLocationApi s = adapters.getWeatherForecastLocationAdapter();
s.cityForecast(cityName, Config.country, new Callback<Forecast>() {
@ -70,6 +77,7 @@ public class DetailsActivity extends AppCompatActivity {
} else {
City city = getIntent().getExtras().getParcelable("city");
cityName = city.getName();
isFav = dao.getCity(city.getCityIdentifier()) != null;
WeatherApis.WeatherDailyForecastApi s = adapters.getWeatherForecastAdapter();
s.cityForecast(city.getCityIdentifier(), Config.country, new Callback<Forecast>() {
@ -86,7 +94,7 @@ public class DetailsActivity extends AppCompatActivity {
});
WeatherApis.WeatherCityApi sWeather = adapters.getWeatherCityAdapter();
sWeather.cityWeather(city.getCityIdentifier(), new Callback<City>() {
sWeather.cityWeather(city.getCityIdentifier(), Config.country, new Callback<City>() {
@Override
public void success(City c, Response response) {
ImageView image = (ImageView) findViewById(R.id.weatherImage);
@ -102,6 +110,26 @@ public class DetailsActivity extends AppCompatActivity {
TextView name = (TextView) findViewById(R.id.cityName);
name.setText(cityName);
fab = (FloatingActionButton) findViewById(R.id.fab);
if (isFav) {
fab.setImageResource(R.mipmap.ic_favorite_border_black_24dp);
} else {
fab.setImageResource(R.mipmap.ic_favorite_black_24dp);
}
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CityDAO dao = CityDAO.getInstance(DetailsActivity.this);
if (DetailsActivity.isFav) {
dao.deleteCity(f[0].getCity());
fab.setImageResource(R.mipmap.ic_favorite_black_24dp);
} else {
dao.insertCity(f[0].getCity());
fab.setImageResource(R.mipmap.ic_favorite_border_black_24dp);
}
}
});
}

View File

@ -29,6 +29,12 @@ public class MainActivity extends AppCompatActivity {
handleView();
}
@Override
protected void onResume() {
super.onResume();
handleView();
}
private void saveUserCountry() {
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
Config.country = tm.getSimCountryIso().toLowerCase();

View File

@ -1,7 +1,9 @@
package com.amine.myterio.app.adapters;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
@ -14,6 +16,7 @@ import com.amine.myterio.app.R;
import com.amine.myterio.app.api.WeatherAdapters;
import com.amine.myterio.app.api.WeatherApis;
import com.amine.myterio.app.config.Config;
import com.amine.myterio.app.db.CityDAO;
import com.amine.myterio.app.model.City;
import retrofit.Callback;
import retrofit.RetrofitError;
@ -33,6 +36,12 @@ public class CitiesAdapter extends RecyclerView.Adapter<CitiesAdapter.ViewHolder
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.city_card_view, parent, false);
v.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
return false;
}
});
return new ViewHolder(v);
}
@ -81,13 +90,14 @@ public class CitiesAdapter extends RecyclerView.Adapter<CitiesAdapter.ViewHolder
return mDataset.size();
}
public class ViewHolder extends RecyclerView.ViewHolder implements RecyclerView.OnClickListener {
public class ViewHolder extends RecyclerView.ViewHolder implements RecyclerView.OnClickListener, RecyclerView.OnLongClickListener {
public final View mCardView;
public ViewHolder(View itemView) {
super(itemView);
mCardView = itemView;
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
}
@Override
@ -98,5 +108,31 @@ public class CitiesAdapter extends RecyclerView.Adapter<CitiesAdapter.ViewHolder
intent.putExtra("city", mDataset.get(position));
c.startActivity(intent);
}
@Override
public boolean onLongClick(View v) {
final int position = getLayoutPosition();
AlertDialog.Builder builder = new AlertDialog.Builder(c);
builder.setMessage(R.string.message_remove_from_favs)
.setTitle(R.string.title_remove_from_favs);
builder.setPositiveButton(c.getString(R.string.delete), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
CityDAO dao = CityDAO.getInstance(c);
dao.deleteCity(mDataset.get(position));
mDataset.remove(position);
notifyItemRemoved(position);
notifyItemRangeChanged(position, mDataset.size());
}
});
builder.setNegativeButton(c.getString(R.string.cancel), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog dialog = builder.create();
dialog.show();
return false;
}
}
}

View File

@ -82,6 +82,17 @@ public class CityDAO {
return city;
}
public City getCity(String name) {
this.open();
Cursor c = bdd.query(TABLE_CITIES, null, COL_NAME + " like \"" + name + "\"", 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;

View File

@ -0,0 +1,45 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.amine.myterio.app.DetailsActivity">
<TextView
android:id="@+id/cityName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<ImageView
android:id="@+id/weatherImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cityName"
android:layout_centerHorizontal="true"
android:layout_marginTop="90dp"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/weekForecast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="@+id/weatherImage"
android:layout_centerHorizontal="true"
android:layout_marginTop="90dp"/>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"/>
</RelativeLayout>

View File

@ -0,0 +1,25 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@mipmap/ic_search_white_24dp"/>
</RelativeLayout>

View File

@ -2,15 +2,26 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$PlaceholderFragment">
tools:context="com.amine.myterio.app.SearchActivity">
<TextView
android:text="@string/hello_world"
<SearchView
android:id="@+id/searchView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="100dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"/>
<ListView
android:id="@+id/listView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/searchView"/>
</RelativeLayout>

View File

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="2dp"
android:orientation="vertical"
android:padding="10dp">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="300dp"
android:padding="2dp"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="2dp"
card_view:cardUseCompatPadding="true"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:baselineAligned="false"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/left_card_part"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight=".5">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="25dp"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@+id/temp_min"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/max_temp"
android:layout_alignStart="@+id/max_temp"
android:layout_alignTop="@+id/imageView2"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:id="@+id/max_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/imageView"
android:layout_toEndOf="@+id/imageView"
android:layout_toRightOf="@+id/imageView"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_above="@+id/imageView2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="17dp"
android:src="@mipmap/ic_max"
android:tint="#d50000"/>
<ImageView
android:id="@+id/imageView2"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="5dp"
android:src="@mipmap/ic_min"
android:tint="#0091ea"/>
<TextView
android:id="@+id/temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<ImageView
android:id="@+id/imageView4"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/temp"
android:layout_toStartOf="@+id/temp"
android:src="@mipmap/ic_temp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/right_card_part"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight=".5">
<ImageView
android:id="@+id/weather_image"
android:layout_width="128dp"
android:layout_height="128dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
<TextView
android:id="@+id/wind_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/weather_image"
android:layout_centerHorizontal="true"
android:layout_marginTop="25dp"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<TextView
android:id="@+id/weather_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/weather_image"
android:layout_centerHorizontal="true"
android:layout_marginBottom="25dp"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<ImageView
android:id="@+id/imageView3"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignBottom="@+id/wind_speed"
android:layout_alignLeft="@+id/weather_image"
android:layout_alignStart="@+id/weather_image"
android:src="@mipmap/ic_wind"/>
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/dateText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".4"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@+id/temp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".6"/>
</LinearLayout>

View File

@ -0,0 +1,45 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.amine.myterio.app.DetailsActivity">
<TextView
android:id="@+id/cityName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<ImageView
android:id="@+id/weatherImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cityName"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/weekForecast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="@+id/weatherImage"
android:layout_centerHorizontal="true"
android:layout_marginTop="37dp"/>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"/>
</RelativeLayout>

View File

@ -0,0 +1,25 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@mipmap/ic_search_white_24dp"/>
</RelativeLayout>

View File

@ -0,0 +1,27 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.amine.myterio.app.SearchActivity">
<SearchView
android:id="@+id/searchView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"/>
<ListView
android:id="@+id/listView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/searchView"/>
</RelativeLayout>

View File

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="2dp"
android:orientation="vertical"
android:padding="10dp">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="250dp"
android:padding="2dp"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="2dp"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:baselineAligned="false"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/left_card_part"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight=".5">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="25dp"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@+id/temp_min"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/max_temp"
android:layout_alignStart="@+id/max_temp"
android:layout_alignTop="@+id/imageView2"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:id="@+id/max_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/imageView"
android:layout_toEndOf="@+id/imageView"
android:layout_toRightOf="@+id/imageView"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_above="@+id/imageView2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="7dp"
android:src="@mipmap/ic_max"
android:tint="#d50000"/>
<ImageView
android:id="@+id/imageView2"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="5dp"
android:src="@mipmap/ic_min"
android:tint="#0091ea"/>
<TextView
android:id="@+id/temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<ImageView
android:id="@+id/imageView4"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/temp"
android:layout_toStartOf="@+id/temp"
android:src="@mipmap/ic_temp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/right_card_part"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight=".5">
<ImageView
android:id="@+id/weather_image"
android:layout_width="128dp"
android:layout_height="128dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
<TextView
android:id="@+id/wind_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/weather_image"
android:layout_centerHorizontal="true"
android:layout_marginTop="25dp"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<TextView
android:id="@+id/weather_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/weather_image"
android:layout_centerHorizontal="true"
android:layout_marginBottom="25dp"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<ImageView
android:id="@+id/imageView3"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignBottom="@+id/wind_speed"
android:layout_alignLeft="@+id/weather_image"
android:layout_alignStart="@+id/weather_image"
android:src="@mipmap/ic_wind"/>
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/dateText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".4"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@+id/temp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".6"/>
</LinearLayout>

View File

@ -0,0 +1,47 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.amine.myterio.app.DetailsActivity">
<TextView
android:id="@+id/cityName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<ImageView
android:id="@+id/weatherImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cityName"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/weekForecast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="@+id/weatherImage"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp"/>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
fab:fab_type="mini"/>
</RelativeLayout>

View File

@ -0,0 +1,25 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@mipmap/ic_search_white_24dp"/>
</RelativeLayout>

View File

@ -0,0 +1,27 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.amine.myterio.app.SearchActivity">
<SearchView
android:id="@+id/searchView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"/>
<ListView
android:id="@+id/listView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/searchView"/>
</RelativeLayout>

View File

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="2dp"
android:orientation="vertical"
android:padding="10dp">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:padding="2dp"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="2dp"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:baselineAligned="false"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/left_card_part"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight=".5">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="5dp"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@+id/temp_min"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/max_temp"
android:layout_alignStart="@+id/max_temp"
android:layout_alignTop="@+id/imageView2"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:id="@+id/max_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/imageView"
android:layout_toEndOf="@+id/imageView"
android:layout_toRightOf="@+id/imageView"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_above="@+id/imageView2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="3dp"
android:src="@mipmap/ic_max"
android:tint="#d50000"/>
<ImageView
android:id="@+id/imageView2"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="3dp"
android:src="@mipmap/ic_min"
android:tint="#0091ea"/>
<TextView
android:id="@+id/temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<ImageView
android:id="@+id/imageView4"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/temp"
android:layout_toStartOf="@+id/temp"
android:src="@mipmap/ic_temp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/right_card_part"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight=".5">
<ImageView
android:id="@+id/weather_image"
android:layout_width="128dp"
android:layout_height="128dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
<TextView
android:id="@+id/wind_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/weather_image"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<TextView
android:id="@+id/weather_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/weather_image"
android:layout_centerHorizontal="true"
android:layout_marginBottom="25dp"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<ImageView
android:id="@+id/imageView3"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignBottom="@+id/wind_speed"
android:layout_alignLeft="@+id/weather_image"
android:layout_alignStart="@+id/weather_image"
android:src="@mipmap/ic_wind"/>
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/dateText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".4"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@+id/temp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".6"/>
</LinearLayout>

View File

@ -0,0 +1,45 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.amine.myterio.app.DetailsActivity">
<TextView
android:id="@+id/cityName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<ImageView
android:id="@+id/weatherImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cityName"
android:layout_centerHorizontal="true"
android:layout_marginTop="150dp"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/weekForecast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="@+id/weatherImage"
android:layout_centerHorizontal="true"
android:layout_marginTop="37dp"/>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"/>
</RelativeLayout>

View File

@ -0,0 +1,25 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@mipmap/ic_search_white_24dp"/>
</RelativeLayout>

View File

@ -0,0 +1,27 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.amine.myterio.app.SearchActivity">
<SearchView
android:id="@+id/searchView"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"/>
<ListView
android:id="@+id/listView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/searchView"/>
</RelativeLayout>

View File

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="2dp"
android:orientation="vertical"
android:padding="10dp">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="350dp"
android:padding="2dp"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="2dp"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:baselineAligned="false"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/left_card_part"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight=".5">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="35dp"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@+id/temp_min"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/max_temp"
android:layout_alignStart="@+id/max_temp"
android:layout_alignTop="@+id/imageView2"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:id="@+id/max_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/imageView"
android:layout_toEndOf="@+id/imageView"
android:layout_toRightOf="@+id/imageView"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_above="@+id/imageView2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="17dp"
android:src="@mipmap/ic_max"
android:tint="#d50000"/>
<ImageView
android:id="@+id/imageView2"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="15dp"
android:src="@mipmap/ic_min"
android:tint="#0091ea"/>
<TextView
android:id="@+id/temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<ImageView
android:id="@+id/imageView4"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/temp"
android:layout_toStartOf="@+id/temp"
android:src="@mipmap/ic_temp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/right_card_part"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight=".5">
<ImageView
android:id="@+id/weather_image"
android:layout_width="128dp"
android:layout_height="128dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
<TextView
android:id="@+id/wind_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/weather_image"
android:layout_centerHorizontal="true"
android:layout_marginTop="35dp"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<TextView
android:id="@+id/weather_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/weather_image"
android:layout_centerHorizontal="true"
android:layout_marginBottom="25dp"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<ImageView
android:id="@+id/imageView3"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignBottom="@+id/wind_speed"
android:layout_alignLeft="@+id/weather_image"
android:layout_alignStart="@+id/weather_image"
android:src="@mipmap/ic_wind"/>
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/dateText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".4"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@+id/temp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".6"/>
</LinearLayout>

View File

@ -33,4 +33,13 @@
android:layout_centerHorizontal="true"
android:layout_marginTop="37dp"/>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"/>
</RelativeLayout>

View File

@ -6,4 +6,8 @@
<string name="title_activity_details">DetailsActivity</string>
<string name="weather_not_available">This location dosn\'t have any weather.</string>
<string name="weather_get_error">Can\'t get the weather from the API.</string>
<string name="cancel">Cancel</string>
<string name="delete">Delete</string>
<string name="message_remove_from_favs">Do you want to delete this location ?</string>
<string name="title_remove_from_favs">Delete the location ?</string>
</resources>

View File

@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">4dp</dimen>
<dimen name="activity_vertical_margin">4dp</dimen>
</resources>

View File

@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">36dp</dimen>
<dimen name="activity_vertical_margin">36dp</dimen>
</resources>

View File

@ -6,4 +6,8 @@
<string name="title_activity_details" translatable="false">DetailsActivity</string>
<string name="weather_not_available">Pas de prévisions pour cette ville.</string>
<string name="weather_get_error">Erreur lors de la récupération des prévisions</string>
<string name="message_remove_from_favs">Voulez-vous vraiment supprimer cette ville ?</string>
<string name="title_remove_from_favs">Supprimer la ville?</string>
<string name="delete">Supprimer</string>
<string name="cancel">Annuler</string>
</resources>