Commit 8efb1d9a authored by lumisce's avatar lumisce

Minor fixes, add image in DishView

parent 3c7398ff
......@@ -4,11 +4,8 @@ import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import com.testapp.entities.Dish;
import com.testapp.entities.DishReview;
import java.util.ArrayList;
......@@ -39,7 +36,7 @@ public class DishReviewAdapter extends BaseAdapter {
@Override
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 rating = (TextView) v.findViewById(R.id.drv_rating);
TextView body = (TextView) v.findViewById(R.id.drv_body);
......
......@@ -6,9 +6,11 @@ import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import com.testapp.entities.DishReview;
import java.util.ArrayList;
......@@ -43,6 +45,8 @@ public class DishViewActivity extends AppCompatActivity {
dishPrice.setText(i.getStringExtra("PRICE"));
TextView dishDesc = (TextView) findViewById(R.id.dish_desc);
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.setText(i.getStringExtra("STALLNAME"));
......@@ -84,9 +88,9 @@ public class DishViewActivity extends AppCompatActivity {
call.enqueue(new Callback<List<DishReview>>() {
@Override
public void onResponse(Call<List<DishReview>> call, Response<List<DishReview>> response) {
List<DishReview> newDishes = response.body();
List<DishReview> newReviews = response.body();
reviews.clear();
reviews.addAll(newDishes);
reviews.addAll(newReviews);
adapter.notifyDataSetChanged();
}
......
......@@ -97,7 +97,6 @@ public class NavDrawerActivity extends AppCompatActivity implements NavigationVi
i.putExtra("PRICE", d.getPrice());
i.putExtra("IMAGE", d.getImagePath());
i.putExtra("DESCRIPTION", d.getDescription());
// TODO i.putExtra("LOCATION", getStall(stallname).getLocation)?????????????
i.putExtra("STALLNAME", d.getStallName());
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