Commit 8efb1d9a authored by lumisce's avatar lumisce

Minor fixes, add image in DishView

parent 3c7398ff
...@@ -4,11 +4,8 @@ import android.app.Activity; ...@@ -4,11 +4,8 @@ import android.app.Activity;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.squareup.picasso.Picasso;
import com.testapp.entities.Dish;
import com.testapp.entities.DishReview; import com.testapp.entities.DishReview;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -39,7 +36,7 @@ public class DishReviewAdapter extends BaseAdapter { ...@@ -39,7 +36,7 @@ public class DishReviewAdapter extends BaseAdapter {
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
View v = context.getLayoutInflater().inflate(R.layout.dish_review_row, null); View v = context.getLayoutInflater().inflate(R.layout.review_row, null);
TextView title = (TextView) v.findViewById(R.id.drv_title); TextView title = (TextView) v.findViewById(R.id.drv_title);
TextView rating = (TextView) v.findViewById(R.id.drv_rating); TextView rating = (TextView) v.findViewById(R.id.drv_rating);
TextView body = (TextView) v.findViewById(R.id.drv_body); TextView body = (TextView) v.findViewById(R.id.drv_body);
......
...@@ -6,9 +6,11 @@ import android.support.v7.app.AppCompatActivity; ...@@ -6,9 +6,11 @@ import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import com.squareup.picasso.Picasso;
import com.testapp.entities.DishReview; import com.testapp.entities.DishReview;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -43,6 +45,8 @@ public class DishViewActivity extends AppCompatActivity { ...@@ -43,6 +45,8 @@ public class DishViewActivity extends AppCompatActivity {
dishPrice.setText(i.getStringExtra("PRICE")); dishPrice.setText(i.getStringExtra("PRICE"));
TextView dishDesc = (TextView) findViewById(R.id.dish_desc); TextView dishDesc = (TextView) findViewById(R.id.dish_desc);
dishDesc.setText(i.getStringExtra("DESCRIPTION")); dishDesc.setText(i.getStringExtra("DESCRIPTION"));
ImageView image = (ImageView) findViewById(R.id.dish_pic);
Picasso.with(this).load("http://" + getResources().getString(R.string.server_ip) + ":5000/static/uploads/"+ i.getStringExtra("IMAGE")).fit().centerCrop().into(image);
dishStall = (TextView) findViewById(R.id.dish_stall); dishStall = (TextView) findViewById(R.id.dish_stall);
dishStall.setText(i.getStringExtra("STALLNAME")); dishStall.setText(i.getStringExtra("STALLNAME"));
...@@ -84,9 +88,9 @@ public class DishViewActivity extends AppCompatActivity { ...@@ -84,9 +88,9 @@ public class DishViewActivity extends AppCompatActivity {
call.enqueue(new Callback<List<DishReview>>() { call.enqueue(new Callback<List<DishReview>>() {
@Override @Override
public void onResponse(Call<List<DishReview>> call, Response<List<DishReview>> response) { public void onResponse(Call<List<DishReview>> call, Response<List<DishReview>> response) {
List<DishReview> newDishes = response.body(); List<DishReview> newReviews = response.body();
reviews.clear(); reviews.clear();
reviews.addAll(newDishes); reviews.addAll(newReviews);
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} }
......
...@@ -97,7 +97,6 @@ public class NavDrawerActivity extends AppCompatActivity implements NavigationVi ...@@ -97,7 +97,6 @@ public class NavDrawerActivity extends AppCompatActivity implements NavigationVi
i.putExtra("PRICE", d.getPrice()); i.putExtra("PRICE", d.getPrice());
i.putExtra("IMAGE", d.getImagePath()); i.putExtra("IMAGE", d.getImagePath());
i.putExtra("DESCRIPTION", d.getDescription()); i.putExtra("DESCRIPTION", d.getDescription());
// TODO i.putExtra("LOCATION", getStall(stallname).getLocation)?????????????
i.putExtra("STALLNAME", d.getStallName()); i.putExtra("STALLNAME", d.getStallName());
startActivity(i); startActivity(i);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment