Commit 7d3f6359 authored by Owais Chunawala's avatar Owais Chunawala

alignment changes feed UI

parent 541de811
...@@ -56,5 +56,7 @@ dependencies { ...@@ -56,5 +56,7 @@ dependencies {
compile "com.android.support:customtabs:${supportLibVersion}" compile "com.android.support:customtabs:${supportLibVersion}"
compile "android.arch.persistence.room:runtime:${archRoomVersion}" compile "android.arch.persistence.room:runtime:${archRoomVersion}"
annotationProcessor "android.arch.persistence.room:compiler:${archRoomVersion}" annotationProcessor "android.arch.persistence.room:compiler:${archRoomVersion}"
compile 'de.hdodenhof:circleimageview:2.2.0'
} }
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
...@@ -10,7 +10,14 @@ import android.widget.TextView; ...@@ -10,7 +10,14 @@ import android.widget.TextView;
import com.squareup.picasso.Picasso; import com.squareup.picasso.Picasso;
import org.w3c.dom.Text;
import java.sql.Time;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.logging.SimpleFormatter;
import in.ac.iitb.gymkhana.iitbapp.ItemClickListener; import in.ac.iitb.gymkhana.iitbapp.ItemClickListener;
import in.ac.iitb.gymkhana.iitbapp.R; import in.ac.iitb.gymkhana.iitbapp.R;
...@@ -31,7 +38,7 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> { ...@@ -31,7 +38,7 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
context = viewGroup.getContext(); context = viewGroup.getContext();
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
View postView = inflater.inflate(R.layout.post, viewGroup, false); View postView = inflater.inflate(R.layout.feed_card, viewGroup, false);
final ViewHolder postViewHolder = new ViewHolder(postView); final ViewHolder postViewHolder = new ViewHolder(postView);
postView.setOnClickListener(new View.OnClickListener() { postView.setOnClickListener(new View.OnClickListener() {
...@@ -47,7 +54,16 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> { ...@@ -47,7 +54,16 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
public void onBindViewHolder(ViewHolder viewHolder, int i) { public void onBindViewHolder(ViewHolder viewHolder, int i) {
Event currentEvent = posts.get(i); Event currentEvent = posts.get(i);
viewHolder.eventTitle.setText(currentEvent.getEventName()); viewHolder.eventTitle.setText(currentEvent.getEventName());
viewHolder.eventDetails.setText(currentEvent.getEventDescription()); // viewHolder.eventDetails.setText(currentEvent.getEventDescription());
Timestamp timestamp = currentEvent.getEventStartTime();
Date Date = new Date(timestamp.getTime());
SimpleDateFormat simpleDateFormatDate = new SimpleDateFormat("MM/dd/yyyy");
SimpleDateFormat simpleDateFormatTime = new SimpleDateFormat("HH:mm a");
viewHolder.eventDate.setText(simpleDateFormatDate.format(Date));
viewHolder.eventTime.setText(simpleDateFormatTime.format(Date));
viewHolder.eventVenue.setText(currentEvent.getEventVenues().get(0).getVenueName());
Picasso.with(context).load(currentEvent.getEventImageURL()).into(viewHolder.eventPicture); Picasso.with(context).load(currentEvent.getEventImageURL()).into(viewHolder.eventPicture);
} }
...@@ -59,7 +75,10 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> { ...@@ -59,7 +75,10 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
public class ViewHolder extends RecyclerView.ViewHolder { public class ViewHolder extends RecyclerView.ViewHolder {
private ImageView eventPicture; private ImageView eventPicture;
private TextView eventTitle; private TextView eventTitle;
private TextView eventDetails; // private TextView eventDetails;
private TextView eventDate;
private TextView eventTime;
private TextView eventVenue;
private ImageView eventEnthu; private ImageView eventEnthu;
public ViewHolder(View itemView) { public ViewHolder(View itemView) {
...@@ -67,8 +86,10 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> { ...@@ -67,8 +86,10 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
eventPicture = (ImageView) itemView.findViewById(R.id.event_picture); eventPicture = (ImageView) itemView.findViewById(R.id.event_picture);
eventTitle = (TextView) itemView.findViewById(R.id.event_title); eventTitle = (TextView) itemView.findViewById(R.id.event_title);
eventDetails = (TextView) itemView.findViewById(R.id.event_details); // eventDetails = (TextView) itemView.findViewById(R.id.event_details);
eventEnthu = (ImageView) itemView.findViewById(R.id.event_enthu); eventDate = (TextView) itemView.findViewById(R.id.event_date);
eventTime = (TextView) itemView.findViewById(R.id.event_time);
eventVenue = (TextView) itemView.findViewById(R.id.event_venue);
} }
} }
} }
...@@ -4,6 +4,7 @@ import android.arch.persistence.room.ColumnInfo; ...@@ -4,6 +4,7 @@ import android.arch.persistence.room.ColumnInfo;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import java.sql.Timestamp;
import java.util.List; import java.util.List;
public class Event { public class Event {
...@@ -21,10 +22,10 @@ public class Event { ...@@ -21,10 +22,10 @@ public class Event {
String eventImageURL; String eventImageURL;
@ColumnInfo(name = "start_time") @ColumnInfo(name = "start_time")
@SerializedName("start_time") @SerializedName("start_time")
String eventStartTime; Timestamp eventStartTime;
@ColumnInfo(name = "end_time") @ColumnInfo(name = "end_time")
@SerializedName("end_time") @SerializedName("end_time")
String eventEndTime; Timestamp eventEndTime;
@ColumnInfo(name = "all_day") @ColumnInfo(name = "all_day")
@SerializedName("all_day") @SerializedName("all_day")
boolean allDayEvent; boolean allDayEvent;
...@@ -47,7 +48,7 @@ public class Event { ...@@ -47,7 +48,7 @@ public class Event {
@SerializedName("going") @SerializedName("going")
List<User> eventGoing; List<User> eventGoing;
public Event(String eventID, String eventName, String eventDescription, String eventImageURL, String eventStartTime, String eventEndTime, boolean allDayEvent, List<Venue> eventVenues, List<Body> eventBodies, int eventInterestedCount, int eventGoingCount, List<User> eventInterested, List<User> eventGoing) { public Event(String eventID, String eventName, String eventDescription, String eventImageURL, Timestamp eventStartTime, Timestamp eventEndTime, boolean allDayEvent, List<Venue> eventVenues, List<Body> eventBodies, int eventInterestedCount, int eventGoingCount, List<User> eventInterested, List<User> eventGoing) {
this.eventID = eventID; this.eventID = eventID;
this.eventName = eventName; this.eventName = eventName;
this.eventDescription = eventDescription; this.eventDescription = eventDescription;
...@@ -95,19 +96,19 @@ public class Event { ...@@ -95,19 +96,19 @@ public class Event {
this.eventImageURL = eventImageURL; this.eventImageURL = eventImageURL;
} }
public String getEventStartTime() { public Timestamp getEventStartTime() {
return eventStartTime; return eventStartTime;
} }
public void setEventStartTime(String eventStartTime) { public void setEventStartTime(Timestamp eventStartTime) {
this.eventStartTime = eventStartTime; this.eventStartTime = eventStartTime;
} }
public String getEventEndTime() { public Timestamp getEventEndTime() {
return eventEndTime; return eventEndTime;
} }
public void setEventEndTime(String eventEndTime) { public void setEventEndTime(Timestamp eventEndTime) {
this.eventEndTime = eventEndTime; this.eventEndTime = eventEndTime;
} }
......
...@@ -4,7 +4,7 @@ import android.arch.persistence.room.ColumnInfo; ...@@ -4,7 +4,7 @@ import android.arch.persistence.room.ColumnInfo;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
class Venue { public class Venue {
@ColumnInfo(name = "id") @ColumnInfo(name = "id")
@SerializedName("id") @SerializedName("id")
String venueID; String venueID;
......
...@@ -2,40 +2,89 @@ ...@@ -2,40 +2,89 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="8dp"> android:layout_marginBottom="12dp"
android:layout_marginTop="12dp">
<ImageView <ImageView
android:id="@+id/event_picture" android:id="@+id/event_picture"
android:layout_width="0dp" android:layout_width="80dp"
android:layout_height="50dp" android:layout_height="80dp"
android:layout_weight="1" /> android:layout_gravity="center"
android:scaleType="centerCrop"
android:layout_marginLeft="12dp"/>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="3" android:layout_weight="3"
android:orientation="vertical"> android:orientation="vertical"
android:layout_gravity="center_vertical"
android:layout_marginRight="12dp"
android:layout_marginLeft="12dp">
<TextView <TextView
android:id="@+id/event_title" android:id="@+id/event_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:textSize="24sp" /> android:textSize="18sp"
android:text="Event Title"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView <TextView
android:id="@+id/event_details" android:layout_width="wrap_content"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" /> android:id="@+id/event_date"
android:text="26 May"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" | "
android:textSize="20dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/event_time"
android:text="6:00 PM"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" | "
android:textSize="20dp"/>
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:id="@+id/event_venue"
android:text="LH 101"
android:ellipsize="end"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
<ImageView
android:id="@+id/event_enthu"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_input_add" />
<!--<ImageView-->
<!--android:id="@+id/event_enthu"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_marginRight="20dp"-->
<!--android:layout_height="wrap_content"-->
<!--android:src="@drawable/ic_action_add"-->
<!--android:layout_gravity="center_vertical"/>-->
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#adfff6"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
</View>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/feed_recycler_view" android:id="@+id/feed_recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent"/>
</android.support.v4.widget.SwipeRefreshLayout> </android.support.v4.widget.SwipeRefreshLayout>
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