final frag

This commit is contained in:
aminecmi 2015-07-12 18:04:50 +02:00
parent 8340bbb48c
commit 348fd6866c
12 changed files with 413 additions and 308 deletions

View File

@ -2,25 +2,9 @@ package com.amine.myterio.app;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
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;
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 {
@ -31,105 +15,6 @@ public class DetailsActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details);
String cityName = getIntent().getExtras().getString("city_name");
WeatherAdapters adapters = new WeatherAdapters();
final Forecast[] f = {null};
final RecyclerView list = (RecyclerView) findViewById(R.id.weekForecast);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
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>() {
@Override
public void success(Forecast forecast, Response response) {
f[0] = forecast;
list.setAdapter(new ForecastAdapter(DetailsActivity.this, f[0]));
}
@Override
public void failure(RetrofitError error) {
Toast.makeText(getApplicationContext(), getString(R.string.weather_not_available), Toast.LENGTH_SHORT).show();
}
});
WeatherApis.WeatherLocationApi sWeather = adapters.getWeatherLocationAdapter();
sWeather.locationWeather(cityName, Config.country, new Callback<City>() {
@Override
public void success(City c, Response response) {
ImageView image = (ImageView) findViewById(R.id.weatherImage);
image.setImageDrawable(c.getWeather().get(0).getIconDrawable(DetailsActivity.this, DetailsActivity.this.getPackageName()));
}
@Override
public void failure(RetrofitError error) {
Toast.makeText(DetailsActivity.this, getString(R.string.weather_get_error), Toast.LENGTH_SHORT).show();
}
});
} 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>() {
@Override
public void success(Forecast forecast, Response response) {
f[0] = forecast;
list.setAdapter(new ForecastAdapter(DetailsActivity.this, f[0]));
}
@Override
public void failure(RetrofitError error) {
Toast.makeText(getApplicationContext(), getString(R.string.weather_not_available), Toast.LENGTH_SHORT).show();
}
});
WeatherApis.WeatherCityApi sWeather = adapters.getWeatherCityAdapter();
sWeather.cityWeather(city.getCityIdentifier(), Config.country, new Callback<City>() {
@Override
public void success(City c, Response response) {
ImageView image = (ImageView) findViewById(R.id.weatherImage);
image.setImageDrawable(c.getWeather().get(0).getIconDrawable(DetailsActivity.this, DetailsActivity.this.getPackageName()));
}
@Override
public void failure(RetrofitError error) {
Toast.makeText(DetailsActivity.this, getString(R.string.weather_get_error), Toast.LENGTH_SHORT).show();
}
});
}
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

@ -0,0 +1,141 @@
package com.amine.myterio.app.fragments;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
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.R;
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 DetailsFragment extends Fragment {
static boolean isFav = true;
static FloatingActionButton fab;
private Activity mActivity;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
mActivity = activity;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View fragView = inflater.inflate(R.layout.details_fragment, null, false);
String cityName = getActivity().getIntent().getExtras().getString("city_name");
WeatherAdapters adapters = new WeatherAdapters();
final Forecast[] f = {null};
final RecyclerView list = (RecyclerView) fragView.findViewById(R.id.weekForecast);
LinearLayoutManager layoutManager = new LinearLayoutManager(mActivity);
list.setLayoutManager(layoutManager);
list.setHasFixedSize(true);
CityDAO dao = CityDAO.getInstance(mActivity);
if (cityName != null) {
isFav = dao.getCity(cityName) != null;
WeatherApis.WeatherDailyForecastLocationApi s = adapters.getWeatherForecastLocationAdapter();
s.cityForecast(cityName, Config.country, new Callback<Forecast>() {
@Override
public void success(Forecast forecast, Response response) {
f[0] = forecast;
list.setAdapter(new ForecastAdapter(mActivity, f[0]));
}
@Override
public void failure(RetrofitError error) {
Toast.makeText(mActivity, getString(R.string.weather_not_available), Toast.LENGTH_SHORT).show();
}
});
WeatherApis.WeatherLocationApi sWeather = adapters.getWeatherLocationAdapter();
sWeather.locationWeather(cityName, Config.country, new Callback<City>() {
@Override
public void success(City c, Response response) {
ImageView image = (ImageView) fragView.findViewById(R.id.weatherImage);
image.setImageDrawable(c.getWeather().get(0).getIconDrawable(mActivity, mActivity.getPackageName()));
}
@Override
public void failure(RetrofitError error) {
Toast.makeText(mActivity, getString(R.string.weather_get_error), Toast.LENGTH_SHORT).show();
}
});
} else {
City city = getActivity().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>() {
@Override
public void success(Forecast forecast, Response response) {
f[0] = forecast;
list.setAdapter(new ForecastAdapter(mActivity, f[0]));
}
@Override
public void failure(RetrofitError error) {
Toast.makeText(mActivity, getString(R.string.weather_not_available), Toast.LENGTH_SHORT).show();
}
});
WeatherApis.WeatherCityApi sWeather = adapters.getWeatherCityAdapter();
sWeather.cityWeather(city.getCityIdentifier(), Config.country, new Callback<City>() {
@Override
public void success(City c, Response response) {
ImageView image = (ImageView) fragView.findViewById(R.id.weatherImage);
image.setImageDrawable(c.getWeather().get(0).getIconDrawable(mActivity, mActivity.getPackageName()));
}
@Override
public void failure(RetrofitError error) {
Toast.makeText(mActivity, getString(R.string.weather_get_error), Toast.LENGTH_SHORT).show();
}
});
}
TextView name = (TextView) fragView.findViewById(R.id.cityName);
name.setText(cityName);
fab = (FloatingActionButton) fragView.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(mActivity);
if (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);
}
}
});
return fragView;
}
}

View File

@ -1,4 +1,4 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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"
@ -8,38 +8,12 @@
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"/>
<fragment
android:id="@+id/details_frag"
android:name="com.amine.myterio.app.fragments.DetailsFragment"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
tools:layout="@layout/details_fragment"/>
<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>
</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="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

@ -1,45 +1,15 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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"/>
<fragment
android:id="@+id/details_frag"
android:name="com.amine.myterio.app.fragments.DetailsFragment"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
tools:layout="@layout/details_fragment"/>
<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>
</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

@ -1,47 +1,15 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
<LinearLayout 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"/>
<fragment
android:id="@+id/details_frag"
android:name="com.amine.myterio.app.fragments.DetailsFragment"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
tools:layout="@layout/details_fragment"/>
<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>
</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

@ -1,45 +1,15 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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"/>
<fragment
android:id="@+id/details_frag"
android:name="com.amine.myterio.app.fragments.DetailsFragment"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
tools:layout="@layout/details_fragment"/>
<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>
</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

@ -1,45 +1,15 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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"/>
<fragment
android:id="@+id/details_frag"
android:name="com.amine.myterio.app.fragments.DetailsFragment"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
tools:layout="@layout/details_fragment"/>
<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>
</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>