Commit b63e073a authored by Willard's avatar Willard

Improvements to review row

parent 5251bdb6
......@@ -4,9 +4,12 @@ import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.Toast;
import com.testapp.entities.DishReview;
import com.testapp.entities.StallReview;
import java.util.ArrayList;
......@@ -37,15 +40,17 @@ public class DishReviewAdapter extends BaseAdapter {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
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);
TextView username = (TextView) v.findViewById(R.id.drv_username);
TextView title = (TextView) v.findViewById(R.id.title);
RatingBar rating = (RatingBar) v.findViewById(R.id.rating);
TextView body = (TextView) v.findViewById(R.id.body);
TextView username = (TextView) v.findViewById(R.id.user);
DishReview dr = dishReviews.get(position);
title.setText(dr.getTitle());
rating.setText(dr.getRating() + "");
rating.setRating(dr.getRating());
body.setText(dr.getBody());
Toast.makeText(v.getContext(), dr.getBody(), Toast.LENGTH_SHORT).show();
// TODO set username
return v;
}
......
......@@ -4,6 +4,7 @@ import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RatingBar;
import android.widget.TextView;
import com.testapp.entities.StallReview;
......@@ -37,15 +38,16 @@ public class StallReviewAdapter extends BaseAdapter {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
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);
TextView username = (TextView) v.findViewById(R.id.drv_username);
TextView title = (TextView) v.findViewById(R.id.title);
RatingBar rating = (RatingBar) v.findViewById(R.id.rating);
TextView body = (TextView) v.findViewById(R.id.body);
TextView username = (TextView) v.findViewById(R.id.user);
StallReview dr = stallReviews.get(position);
title.setText(dr.getTitle());
rating.setText(dr.getRating());
rating.setRating(dr.getRating());
body.setText(dr.getBody());
username.setText(dr.getUser());
// TODO set username
return v;
}
......
......@@ -6,17 +6,19 @@ public class DishReview {
String title;
String body;
float rating;
String user;
int user_id;
int dish_id;
public DishReview() {
}
public DishReview(int id, String title, String body, float rating, int user_id, int dish_id) {
public DishReview(int id, String title, String body, float rating, String user, int user_id, int dish_id) {
this.id = id;
this.title = title;
this.body = body;
this.rating = rating;
this.user = user;
this.user_id = user_id;
this.dish_id = dish_id;
}
......@@ -37,6 +39,14 @@ public class DishReview {
public void setRating(float rating) { this.rating = rating; }
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public int getUserId() { return user_id; }
public void setUserId(int user_id) { this.user_id = user_id; }
......
......@@ -6,14 +6,16 @@ public class StallReview {
String title;
String body;
int rating;
String user;
int user_id;
int stall_id;
public StallReview(int id, String title, String body, int rating, int user_id, int stall_id) {
public StallReview(int id, String title, String body, String user, int rating, int user_id, int stall_id) {
this.id = id;
this.title = title;
this.body = body;
this.rating = rating;
this.user = user;
this.user_id = user_id;
this.stall_id = stall_id;
}
......@@ -34,6 +36,14 @@ public class StallReview {
public void setRating(int rating) { this.rating = rating; }
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public int getUserId() { return user_id; }
public void setUserId(int user_id) { this.user_id = user_id; }
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
</vector>
......@@ -9,39 +9,37 @@
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Title"
android:id="@+id/drv_title"
android:id="@+id/title"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Rating"
android:id="@+id/drv_rating"
android:id="@+id/rating"
style="?android:attr/ratingBarStyleIndicator"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
android:layout_alignParentEnd="true"/>
<TextView
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/drv_body"
android:layout_below="@+id/drv_title"
android:text="username"
android:id="@+id/user"
android:layout_below="@+id/title"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:inputType="textMultiLine" />
android:layout_alignParentStart="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="username"
android:id="@+id/drv_username"
android:layout_below="@+id/drv_body"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
android:text="New Text"
android:id="@+id/body"
android:inputType="textMultiLine"
android:textSize="18sp"
android:layout_below="@+id/user"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
</RelativeLayout>
\ No newline at end of file
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