Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InstiApp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
RAHUL SHARMA
InstiApp
Commits
0579a87e
Commit
0579a87e
authored
Jul 28, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use single card layout for all adapters
parent
8259c219
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
47 additions
and
194 deletions
+47
-194
app/src/main/java/app/insti/adapter/BodyAdapter.java
app/src/main/java/app/insti/adapter/BodyAdapter.java
+4
-4
app/src/main/java/app/insti/adapter/FeedAdapter.java
app/src/main/java/app/insti/adapter/FeedAdapter.java
+10
-15
app/src/main/java/app/insti/adapter/NotificationsAdapter.java
...src/main/java/app/insti/adapter/NotificationsAdapter.java
+4
-4
app/src/main/java/app/insti/adapter/RoleAdapter.java
app/src/main/java/app/insti/adapter/RoleAdapter.java
+4
-4
app/src/main/java/app/insti/adapter/UserAdapter.java
app/src/main/java/app/insti/adapter/UserAdapter.java
+4
-4
app/src/main/res/layout/body_card_view.xml
app/src/main/res/layout/body_card_view.xml
+0
-54
app/src/main/res/layout/feed_card.xml
app/src/main/res/layout/feed_card.xml
+21
-55
app/src/main/res/layout/role_card.xml
app/src/main/res/layout/role_card.xml
+0
-54
No files found.
app/src/main/java/app/insti/adapter/BodyAdapter.java
View file @
0579a87e
...
...
@@ -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_nam
e
);
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_titl
e
);
description
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
object_subtitle
);
image
=
(
ImageView
)
itemView
.
findViewById
(
R
.
id
.
object_picture
);
}
}
...
...
app/src/main/java/app/insti/adapter/FeedAdapter.java
View file @
0579a87e
...
...
@@ -51,22 +51,24 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
public
void
onBindViewHolder
(
ViewHolder
viewHolder
,
int
i
)
{
Event
currentEvent
=
posts
.
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
)
{
...
...
@@ -84,21 +86,14 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
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
;
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
);
}
}
...
...
app/src/main/java/app/insti/adapter/NotificationsAdapter.java
View file @
0579a87e
...
...
@@ -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_nam
e
);
notificationVerb
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
body_card_description
);
notificationPicture
=
(
ImageView
)
itemView
.
findViewById
(
R
.
id
.
object_picture
);
notificationTitle
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
object_titl
e
);
notificationVerb
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
object_subtitle
);
}
}
}
app/src/main/java/app/insti/adapter/RoleAdapter.java
View file @
0579a87e
...
...
@@ -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_ro
le
);
image
=
(
ImageView
)
itemView
.
findViewById
(
R
.
id
.
role_card_avatar
);
bodyName
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
object_title
);
role
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
object_subtit
le
);
image
=
(
ImageView
)
itemView
.
findViewById
(
R
.
id
.
object_picture
);
}
...
...
app/src/main/java/app/insti/adapter/UserAdapter.java
View file @
0579a87e
...
...
@@ -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_ro
le
);
image
=
(
ImageView
)
itemView
.
findViewById
(
R
.
id
.
role_card_avatar
);
userName
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
object_title
);
role
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
object_subtit
le
);
image
=
(
ImageView
)
itemView
.
findViewById
(
R
.
id
.
object_picture
);
}
}
...
...
app/src/main/res/layout/body_card_view.xml
deleted
100644 → 0
View file @
8259c219
<?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
app/src/main/res/layout/feed_card.xml
View file @
0579a87e
...
...
@@ -2,15 +2,24 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:paddingBottom=
"4dp"
android:paddingLeft=
"18dp"
android:paddingRight=
"10dp"
android:paddingTop=
"4dp"
>
android:orientation=
"vertical"
>
<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"
...
...
@@ -18,7 +27,7 @@
android:orientation=
"horizontal"
>
<de.hdodenhof.circleimageview.CircleImageView
android:id=
"@+id/
even
t_picture"
android:id=
"@+id/
objec
t_picture"
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:layout_gravity=
"center"
...
...
@@ -34,10 +43,10 @@
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/
even
t_title"
android:id=
"@+id/
objec
t_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"
Even
t Title"
android:text=
"
Objec
t Title"
android:textColor=
"@android:color/black"
android:textSize=
"18sp"
/>
...
...
@@ -47,61 +56,18 @@
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/event_date"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"26 May"
android:textSize=
"16sp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
" | "
android:textSize=
"16sp"
/>
<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"
android:textSize=
"16sp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
" | "
android:textSize=
"16sp"
/>
<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:textSize=
"16sp"
/>
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>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/role_card.xml
deleted
100644 → 0
View file @
8259c219
<?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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment