Commit 0c4b8a92 authored by Sajal Narang's avatar Sajal Narang Committed by GitHub

Merge pull request #160 from pulsejet/design

Fix some design elements
parents 90a8b75f 78eea622
......@@ -26,13 +26,12 @@ ext {
supportLibVersion = '27.1.1'
playServicesVersion = '15.0.1'
butterKnifeVersion = '8.8.1'
appAuthVersion = '0.2.0'
retrofitVersion = '2.3.0'
okhttpVersion = '3.10.0'
picassoVersion = '2.71828'
archRoomVersion = '1.1.1'
circleImageViewVersion = '2.2.0'
markwonVersion = '1.0.4'
markwonVersion = '1.0.6'
}
dependencies {
......@@ -42,7 +41,6 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "com.android.support:appcompat-v7:${supportLibVersion}"
implementation "net.openid:appauth:${appAuthVersion}"
testImplementation "junit:junit:4.12"
implementation "com.android.support:design:${supportLibVersion}"
implementation "com.android.support:support-v4:${supportLibVersion}"
......
......@@ -195,6 +195,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private void initNavigationView() {
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
navigationView.setCheckedItem(R.id.nav_feed);
}
private void updateNavigationView() {
......
......@@ -32,7 +32,7 @@ public class BodyAdapter extends RecyclerView.Adapter<BodyAdapter.ViewHolder> {
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
context = parent.getContext();
View v = LayoutInflater.from(context)
.inflate(R.layout.body_card_view, parent, false);
.inflate(R.layout.feed_card, parent, false);
final ViewHolder postViewHolder = new ViewHolder(v);
v.setOnClickListener(new View.OnClickListener() {
......@@ -67,9 +67,9 @@ public class BodyAdapter extends RecyclerView.Adapter<BodyAdapter.ViewHolder> {
public ViewHolder(View itemView) {
super(itemView);
name = (TextView) itemView.findViewById(R.id.body_card_name);
description = (TextView) itemView.findViewById(R.id.body_card_description);
image = (ImageView) itemView.findViewById(R.id.body_card_avatar);
name = (TextView) itemView.findViewById(R.id.object_title);
description = (TextView) itemView.findViewById(R.id.object_subtitle);
image = (ImageView) itemView.findViewById(R.id.object_picture);
}
}
......
package app.insti.adapter;
import android.content.Context;
import android.media.Image;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
......@@ -22,15 +23,21 @@ import app.insti.data.Venue;
public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
private List<Event> posts;
private List<Event> events;
private Context context;
private ItemClickListener itemClickListener;
public FeedAdapter(List<Event> posts, ItemClickListener itemClickListener) {
this.posts = posts;
public FeedAdapter(List<Event> events, ItemClickListener itemClickListener) {
this.events = events;
this.itemClickListener = itemClickListener;
}
@Override
public int getItemViewType(int position) {
if (position == 0) return 1;
else return 2;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
context = viewGroup.getContext();
......@@ -44,65 +51,69 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
itemClickListener.onItemClick(v, postViewHolder.getAdapterPosition());
}
});
return postViewHolder;
}
@Override
public void onBindViewHolder(ViewHolder viewHolder, int i) {
Event currentEvent = posts.get(i);
Event currentEvent = events.get(i);
viewHolder.eventTitle.setText(currentEvent.getEventName());
// viewHolder.eventDetails.setText(currentEvent.getEventDescription());
String subtitle = "";
Timestamp timestamp = currentEvent.getEventStartTime();
if (timestamp != null) {
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));
subtitle += simpleDateFormatDate.format(Date) + " | " + simpleDateFormatTime.format(Date);
}
StringBuilder eventVenueName = new StringBuilder();
for (Venue venue : currentEvent.getEventVenues()) {
eventVenueName.append(", ").append(venue.getVenueShortName());
}
if (!eventVenueName.toString().equals(""))
viewHolder.eventVenue.setText(eventVenueName.toString().substring(2));
subtitle += " | " + eventVenueName.toString().substring(2);
viewHolder.eventSubtitle.setText(subtitle);
// Fallback to image of first body if event has no image
if (currentEvent.getEventImageURL() == null) {
currentEvent.setEventImageURL(currentEvent.getEventBodies().get(0).getBodyImageURL());
}
Picasso.get().load(currentEvent.getEventImageURL()).into(viewHolder.eventPicture);
if (currentEvent.isEventBigImage()) {
viewHolder.eventBigPicture.setVisibility(View.VISIBLE);
viewHolder.eventPicture.setVisibility(View.GONE);
Picasso.get().load(currentEvent.getEventImageURL()).into(viewHolder.eventBigPicture);
} else {
Picasso.get().load(currentEvent.getEventImageURL()).into(viewHolder.eventPicture);
}
}
@Override
public int getItemCount() {
return posts.size();
return events.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
private ImageView eventPicture;
private TextView eventTitle;
// private TextView eventDetails;
private TextView eventDate;
private TextView eventTime;
private TextView eventVenue;
private ImageView eventEnthu;
private TextView eventSubtitle;
private ImageView eventBigPicture;
public ViewHolder(View itemView) {
super(itemView);
eventPicture = (ImageView) itemView.findViewById(R.id.event_picture);
eventTitle = (TextView) itemView.findViewById(R.id.event_title);
// eventDetails = (TextView) itemView.findViewById(R.id.event_details);
eventDate = (TextView) itemView.findViewById(R.id.event_date);
eventTime = (TextView) itemView.findViewById(R.id.event_time);
eventVenue = (TextView) itemView.findViewById(R.id.event_venue);
eventPicture = (ImageView) itemView.findViewById(R.id.object_picture);
eventTitle = (TextView) itemView.findViewById(R.id.object_title);
eventSubtitle = (TextView) itemView.findViewById(R.id.object_subtitle);
eventBigPicture = (ImageView) itemView.findViewById(R.id.big_object_picture);
}
}
public void setPosts(List<Event> posts) {
this.posts = posts;
public void setEvents(List<Event> events) {
this.events = events;
}
}
......@@ -59,6 +59,13 @@ public class NewsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
itemClickListener.onItemClick(v, postViewHolder.getAdapterPosition());
}
});
postViewHolder.articleContent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
itemClickListener.onItemClick(v, postViewHolder.getAdapterPosition());
}
});
return postViewHolder;
} else {
LayoutInflater inflater = LayoutInflater.from(context);
......
......@@ -34,7 +34,7 @@ public class NotificationsAdapter extends RecyclerView.Adapter<NotificationsAdap
public Viewholder onCreateViewHolder(ViewGroup viewGroup, int i) {
context = viewGroup.getContext();
LayoutInflater inflater = LayoutInflater.from(context);
View notificationView = inflater.inflate(R.layout.body_card_view, viewGroup, false);
View notificationView = inflater.inflate(R.layout.feed_card, viewGroup, false);
final Viewholder notificationsViewHolder = new Viewholder(notificationView);
notificationView.setOnClickListener(new View.OnClickListener() {
......@@ -79,9 +79,9 @@ public class NotificationsAdapter extends RecyclerView.Adapter<NotificationsAdap
public Viewholder(View itemView) {
super(itemView);
notificationPicture = (ImageView) itemView.findViewById(R.id.body_card_avatar);
notificationTitle = (TextView) itemView.findViewById(R.id.body_card_name);
notificationVerb = (TextView) itemView.findViewById(R.id.body_card_description);
notificationPicture = (ImageView) itemView.findViewById(R.id.object_picture);
notificationTitle = (TextView) itemView.findViewById(R.id.object_title);
notificationVerb = (TextView) itemView.findViewById(R.id.object_subtitle);
}
}
}
......@@ -35,7 +35,7 @@ public class RoleAdapter extends RecyclerView.Adapter<RoleAdapter.ViewHolder> {
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
context = parent.getContext();
View v = LayoutInflater.from(context)
.inflate(R.layout.role_card, parent, false);
.inflate(R.layout.feed_card, parent, false);
final ViewHolder postViewHolder = new ViewHolder(v);
v.setOnClickListener(new View.OnClickListener() {
......@@ -71,9 +71,9 @@ public class RoleAdapter extends RecyclerView.Adapter<RoleAdapter.ViewHolder> {
public ViewHolder(View itemView) {
super(itemView);
bodyName = (TextView) itemView.findViewById(R.id.role_card_body);
role = (TextView) itemView.findViewById(R.id.role_card_role);
image = (ImageView) itemView.findViewById(R.id.role_card_avatar);
bodyName = (TextView) itemView.findViewById(R.id.object_title);
role = (TextView) itemView.findViewById(R.id.object_subtitle);
image = (ImageView) itemView.findViewById(R.id.object_picture);
}
......
......@@ -31,7 +31,7 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
context = parent.getContext();
View v = LayoutInflater.from(context)
.inflate(R.layout.role_card, parent, false);
.inflate(R.layout.feed_card, parent, false);
final ViewHolder postViewHolder = new ViewHolder(v);
v.setOnClickListener(new View.OnClickListener() {
......@@ -69,9 +69,9 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
public ViewHolder(View itemView) {
super(itemView);
userName = (TextView) itemView.findViewById(R.id.role_card_body);
role = (TextView) itemView.findViewById(R.id.role_card_role);
image = (ImageView) itemView.findViewById(R.id.role_card_avatar);
userName = (TextView) itemView.findViewById(R.id.object_title);
role = (TextView) itemView.findViewById(R.id.object_subtitle);
image = (ImageView) itemView.findViewById(R.id.object_picture);
}
}
......
......@@ -2,6 +2,7 @@ package app.insti.data;
import android.arch.persistence.room.ColumnInfo;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.Ignore;
import android.arch.persistence.room.PrimaryKey;
import android.support.annotation.NonNull;
......@@ -65,6 +66,9 @@ public class Event {
@SerializedName("user_ues")
int eventUserUes;
@Ignore
boolean eventBigImage = false;
public Event(String eventID, String eventStrID, 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, String eventWebsiteURL, int eventUserUes) {
this.eventID = eventID;
this.eventStrID = eventStrID;
......@@ -216,4 +220,12 @@ public class Event {
public String toString() {
return new Gson().toJson(this);
}
public boolean isEventBigImage() {
return eventBigImage;
}
public void setEventBigImage(boolean eventBigImage) {
this.eventBigImage = eventBigImage;
}
}
package app.insti.fragment;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
......@@ -13,7 +12,6 @@ import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import com.google.gson.Gson;
......@@ -163,7 +161,7 @@ public class ExploreFragment extends Fragment {
// Set adapters data
bodyAdapter.setBodyList(bodies);
eventsAdapter.setPosts(events);
eventsAdapter.setEvents(events);
userAdapter.setUserList(users);
// Notify all adapters
......
......@@ -130,6 +130,11 @@ public class FeedFragment extends BaseFragment {
/* Skip if we're already destroyed */
if (getActivity() == null || getView() == null) return;
/* Make first event image big */
if (events.size() > 1) {
events.get(0).setEventBigImage(true);
}
final FeedAdapter feedAdapter = new FeedAdapter(events, new ItemClickListener() {
@Override
public void onItemClick(View v, int position) {
......
<?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_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
card_view:cardCornerRadius="1dp"
card_view:cardElevation="1dp">
<LinearLayout
android:id="@+id/body_card_layout"
android:layout_width="match_parent"
android:layout_height="80dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/body_card_avatar"
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_gravity="center_vertical"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_weight="3"
android:orientation="vertical">
<TextView
android:id="@+id/body_card_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Organization"
android:textColor="@android:color/black"
android:textSize="18sp" />
<TextView
android:id="@+id/body_card_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Description"
android:scrollHorizontally="true"
android:ellipsize="end"
android:maxLines="1" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
\ No newline at end of file
<?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"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
card_view:cardCornerRadius="1dp"
card_view:cardElevation="1dp">
android:orientation="vertical"
android:background="?android:attr/selectableItemBackground">
<ImageView
android:id="@+id/big_object_picture"
android:layout_width="match_parent"
android:layout_height="230dp"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:paddingBottom="4dp"
android:paddingLeft="18dp"
android:paddingRight="10dp"
android:paddingTop="4dp">
<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"
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/object_picture"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:scaleType="centerCrop" />
......@@ -37,10 +44,10 @@
android:orientation="vertical">
<TextView
android:id="@+id/event_title"
android:id="@+id/object_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Event Title"
android:text="Object Title"
android:textColor="@android:color/black"
android:textSize="18sp" />
......@@ -50,58 +57,18 @@
android:orientation="horizontal">
<TextView
android:id="@+id/event_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="26 May" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" | "
android:textSize="20dp" />
<TextView
android:id="@+id/event_time"
android:id="@+id/object_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6:00 PM" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" | "
android:textSize="20dp" />
<TextView
android:id="@+id/event_venue"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="Subtitle"
android:textSize="16sp"
android:ellipsize="end"
android:text="LH 101"
android:scrollHorizontally="true"
android:maxLines="1"/>
android:maxLines="1" />
</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
</LinearLayout>
\ No newline at end of file
......@@ -105,14 +105,14 @@
android:layout_margin="0dp"
android:layout_weight="1"
android:text="FOLLOW"
android:textColor="@color/secondaryTextColor" />
android:textColor="@color/secondaryTextColor"
android:foreground="?attr/selectableItemBackground"
android:clickable="true" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="#aaa">
</View>
......@@ -125,7 +125,7 @@
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="12dp"
android:textColor="#777"
android:textColor="#333"
android:textSize="16sp" />
<TextView
......
......@@ -158,13 +158,13 @@
android:layout_margin="0dp"
android:layout_weight="1"
android:text="GOING"
android:textColor="@color/secondaryTextColor" />
android:textColor="@color/secondaryTextColor"
android:foreground="?attr/selectableItemBackground"
android:clickable="true" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="6dp"
android:layout_marginTop="10dp"
android:background="#aaa">
</View>
......@@ -178,15 +178,15 @@
android:layout_margin="0dp"
android:layout_weight="1"
android:text="INTERESTED"
android:textColor="@color/secondaryTextColor" />
android:textColor="@color/secondaryTextColor"
android:foreground="?attr/selectableItemBackground"
android:clickable="true" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="#aaa">
</View>
......@@ -199,7 +199,7 @@
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="12dp"
android:textColor="#777"
android:textColor="#333"
android:textSize="16sp" />
<android.support.v7.widget.RecyclerView
......
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container_profile"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@color/colorWhite">
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
......@@ -33,7 +34,8 @@
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:textSize="20sp"
android:textStyle="bold" />
android:fontFamily="sans-serif-light"
android:textColor="@color/secondaryTextColor"/>
<TextView
android:id="@+id/user_rollno_profile"
......
<?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"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
card_view:cardCornerRadius="1dp"
card_view:cardElevation="1dp">
android:background="#f2f2f2">
<LinearLayout
android:layout_width="match_parent"
......@@ -60,4 +58,4 @@
android:textColor="#000000"
android:textColorLink="@color/colorPrimary" />
</LinearLayout>
</android.support.v7.widget.CardView>
\ No newline at end of file
</LinearLayout>
<?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_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
card_view:cardCornerRadius="1dp"
card_view:cardElevation="1dp">
<LinearLayout
android:id="@+id/role_card_layout"
android:layout_width="match_parent"
android:layout_height="80dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/role_card_avatar"
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_gravity="center_vertical"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_weight="3"
android:orientation="vertical">
<TextView
android:id="@+id/role_card_body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Organization"
android:textColor="@android:color/black"
android:textSize="18sp" />
<TextView
android:id="@+id/role_card_role"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Role"
android:scrollHorizontally="true"
android:ellipsize="end"
android:maxLines="1" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
\ 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