Commit ae4dbf50 authored by Sajal Narang's avatar Sajal Narang Committed by GitHub

Merge pull request #41 from OwaisChunawala/classes

Made Design Changes to Feed UI
parents 6d56cdf6 53a13c92
...@@ -56,5 +56,9 @@ dependencies { ...@@ -56,5 +56,9 @@ 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}"
implementation "com.android.support:cardview-v7:${supportLibVersion}"
} }
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("dd MMM");
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;
......
...@@ -12,6 +12,10 @@ import android.widget.TextView; ...@@ -12,6 +12,10 @@ import android.widget.TextView;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.squareup.picasso.Picasso; import com.squareup.picasso.Picasso;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import in.ac.iitb.gymkhana.iitbapp.Constants; import in.ac.iitb.gymkhana.iitbapp.Constants;
import in.ac.iitb.gymkhana.iitbapp.R; import in.ac.iitb.gymkhana.iitbapp.R;
import in.ac.iitb.gymkhana.iitbapp.data.Event; import in.ac.iitb.gymkhana.iitbapp.data.Event;
...@@ -46,13 +50,21 @@ public class EventFragment extends Fragment { ...@@ -46,13 +50,21 @@ public class EventFragment extends Fragment {
private void inflateViews(Event event) { private void inflateViews(Event event) {
ImageView eventPicture = (ImageView) getActivity().findViewById(R.id.event_picture_2); ImageView eventPicture = (ImageView) getActivity().findViewById(R.id.event_picture_2);
TextView eventTitle = (TextView) getActivity().findViewById(R.id.event_title_2); TextView eventTitle = (TextView) getActivity().findViewById(R.id.event_page_title);
TextView eventDetails = (TextView) getActivity().findViewById(R.id.event_details_2); TextView eventDate = (TextView) getActivity().findViewById(R.id.event_page_date);
TextView eventDescription = (TextView) getActivity().findViewById(R.id.event_description_2); TextView eventTime = (TextView) getActivity().findViewById(R.id.event_page_time);
TextView eventVenue = (TextView) getActivity().findViewById(R.id.event_page_venue);
TextView eventDescription = (TextView) getActivity().findViewById(R.id.event_page_description);
Picasso.with(getContext()).load(event.getEventImageURL()).into(eventPicture); Picasso.with(getContext()).load(event.getEventImageURL()).into(eventPicture);
eventTitle.setText(event.getEventName()); eventTitle.setText(event.getEventName());
eventDetails.setText(event.getEventDescription());
eventDescription.setText(event.getEventDescription()); eventDescription.setText(event.getEventDescription());
Timestamp timestamp = event.getEventStartTime();
Date Date = new Date(timestamp.getTime());
SimpleDateFormat simpleDateFormatDate = new SimpleDateFormat("dd MMM");
SimpleDateFormat simpleDateFormatTime = new SimpleDateFormat("HH:mm a");
eventDate.setText(simpleDateFormatDate.format(Date));
eventTime.setText(simpleDateFormatDate.format(Date));
eventVenue.setText(event.getEventVenues().get(0).getVenueName());
} }
} }
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:layout_width="match_parent"
card_view:cardElevation="4dp"
card_view:cardCornerRadius="4dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_marginRight="8dp"
android:layout_marginLeft="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/event_picture"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center"
android:scaleType="centerCrop"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:orientation="vertical"
android:layout_gravity="center_vertical"
android:layout_marginRight="12dp"
android:layout_marginLeft="12dp">
<TextView
android:id="@+id/event_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:textSize="18sp"
android:text="Event Title"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="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>
<!--<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>
</android.support.v7.widget.CardView>
\ No newline at end of file
...@@ -2,56 +2,158 @@ ...@@ -2,56 +2,158 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:orientation="vertical"
tools:context="in.ac.iitb.gymkhana.iitbapp.fragment.EventFragment"> tools:context="in.ac.iitb.gymkhana.iitbapp.fragment.EventFragment">
<ImageView <ImageView
android:id="@+id/event_picture_2" android:id="@+id/event_picture_2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="360dp" android:layout_height="0dp"
android:scaleType="centerCrop" /> android:scaleType="centerCrop"
android:layout_weight="1"/>
<TextView <LinearLayout
android:id="@+id/event_title_2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/colorPrimary">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:orientation="vertical"
android:layout_gravity="center_vertical"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp">
<TextView <TextView
android:id="@+id/event_details_2" android:id="@+id/event_page_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:textSize="28sp"
android:textColor="#fff"
android:text="Event Title"/>
<LinearLayout <LinearLayout
style="?android:attr/buttonBarStyle" android:layout_width="wrap_content"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:orientation="horizontal">
android:background="@color/colorPrimary" <TextView
android:orientation="horizontal"> android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/event_page_date"
android:text="26 May"
android:textSize="16sp"
android:textColor="#fff"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" | "
android:textSize="20dp"
android:textColor="#fff"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/event_page_time"
android:text="6:00 PM"
android:textSize="16sp"
android:textColor="#fff"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" | "
android:textSize="20dp"
android:textColor="#fff"/>
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:id="@+id/event_page_venue"
android:text="LH 101"
android:ellipsize="end"
android:textSize="16sp"
android:textColor="#fff"/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<Button
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Going" />
<Button
style="?android:attr/buttonBarButtonStyle" <LinearLayout
android:layout_width="0dp" style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:orientation="horizontal">
android:text="Interested" />
<Button
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Going"
android:layout_margin="0dp"
android:textColor="@color/colorGray"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#aaa"
android:layout_marginTop="10dp"
android:layout_marginBottom="6dp">
<Button </View>
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp" <Button
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Interested"
android:layout_margin="0dp"
android:textColor="@color/colorGray"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#aaa"
android:layout_marginTop="10dp"
android:layout_marginBottom="6dp">
</View>
<Button
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Not Going"
android:layout_margin="0dp"
android:textColor="@color/colorGray"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#aaa"
android:layout_marginBottom="6dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp">
</View>
<TextView
android:id="@+id/event_page_description"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_marginTop="8dp"
android:text="Not Going" /> android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:textColor="#777"
android:textSize="16sp"/>
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/event_description_2"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout> </LinearLayout>
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<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:paddingTop="8dp"/>
</android.support.v4.widget.SwipeRefreshLayout> </android.support.v4.widget.SwipeRefreshLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="8dp">
<ImageView
android:id="@+id/event_picture"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:orientation="vertical">
<TextView
android:id="@+id/event_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:textSize="24sp" />
<TextView
android:id="@+id/event_details"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</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" />
</LinearLayout>
\ No newline at end of file
...@@ -5,11 +5,13 @@ buildscript { ...@@ -5,11 +5,13 @@ buildscript {
repositories { repositories {
maven { url 'https://maven.google.com' } maven { url 'https://maven.google.com' }
jcenter() jcenter()
google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.0.1' classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0' classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
} }
...@@ -19,6 +21,7 @@ allprojects { ...@@ -19,6 +21,7 @@ allprojects {
repositories { repositories {
jcenter() jcenter()
maven { url 'https://maven.google.com' } maven { url 'https://maven.google.com' }
google()
} }
} }
......
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