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
b3143ebe
Commit
b3143ebe
authored
Oct 11, 2018
by
Preetam Ozarde
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing Codacy Issues
parent
a64b37ec
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
68 additions
and
143 deletions
+68
-143
app/src/main/java/app/insti/adapter/CommentsAdapter.java
app/src/main/java/app/insti/adapter/CommentsAdapter.java
+13
-13
app/src/main/java/app/insti/adapter/ComplaintDetailsPagerAdapter.java
.../java/app/insti/adapter/ComplaintDetailsPagerAdapter.java
+1
-7
app/src/main/java/app/insti/adapter/ComplaintFragmentViewPagerAdapter.java
.../app/insti/adapter/ComplaintFragmentViewPagerAdapter.java
+1
-4
app/src/main/java/app/insti/adapter/ImageViewPagerAdapter.java
...rc/main/java/app/insti/adapter/ImageViewPagerAdapter.java
+2
-7
app/src/main/java/app/insti/adapter/UpVotesAdapter.java
app/src/main/java/app/insti/adapter/UpVotesAdapter.java
+4
-19
app/src/main/java/app/insti/adapter/UserAdapter.java
app/src/main/java/app/insti/adapter/UserAdapter.java
+10
-9
app/src/main/java/app/insti/api/model/Venter.java
app/src/main/java/app/insti/api/model/Venter.java
+0
-15
app/src/main/java/app/insti/fragment/ComplaintDetailsFragment.java
...ain/java/app/insti/fragment/ComplaintDetailsFragment.java
+2
-5
app/src/main/java/app/insti/fragment/ComplaintFragment.java
app/src/main/java/app/insti/fragment/ComplaintFragment.java
+19
-18
app/src/main/java/app/insti/fragment/ComplaintsFragment.java
app/src/main/java/app/insti/fragment/ComplaintsFragment.java
+4
-13
app/src/main/java/app/insti/fragment/ComplaintsHomeFragment.java
.../main/java/app/insti/fragment/ComplaintsHomeFragment.java
+2
-5
app/src/main/java/app/insti/fragment/ComplaintsMeFragment.java
...rc/main/java/app/insti/fragment/ComplaintsMeFragment.java
+2
-5
app/src/main/java/app/insti/fragment/FileComplaintFragment.java
...c/main/java/app/insti/fragment/FileComplaintFragment.java
+2
-1
app/src/main/java/app/insti/fragment/ImageFragment.java
app/src/main/java/app/insti/fragment/ImageFragment.java
+3
-5
app/src/main/java/app/insti/fragment/RelevantComplaintsFragment.java
...n/java/app/insti/fragment/RelevantComplaintsFragment.java
+2
-15
app/src/main/java/app/insti/utils/DateTimeUtil.java
app/src/main/java/app/insti/utils/DateTimeUtil.java
+1
-2
No files found.
app/src/main/java/app/insti/adapter/CommentsAdapter.java
View file @
b3143ebe
package
app.insti.adapter
;
package
app.insti.adapter
;
import
android.app.Activity
;
import
android.content.ClipData
;
import
android.content.ClipData
;
import
android.content.ClipboardManager
;
import
android.content.ClipboardManager
;
import
android.content.Context
;
import
android.content.Context
;
...
@@ -43,19 +42,15 @@ public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
...
@@ -43,19 +42,15 @@ public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
private
Context
context
;
private
Context
context
;
private
LayoutInflater
inflater
;
private
LayoutInflater
inflater
;
private
String
sessionId
,
userId
;
private
String
sessionId
,
userId
;
private
Activity
activity
;
private
TextView
textViewCommentLabel
;
private
Fragment
fragment
;
private
Fragment
fragment
;
private
List
<
Venter
.
Comment
>
commentList
=
new
ArrayList
<>();
private
List
<
Venter
.
Comment
>
commentList
=
new
ArrayList
<>();
public
CommentsAdapter
(
Activity
activity
,
Context
context
,
String
sessionId
,
String
userId
,
TextView
textViewCommentLabel
,
Fragment
fragment
)
{
public
CommentsAdapter
(
Context
context
,
String
sessionId
,
String
userId
,
Fragment
fragment
)
{
this
.
context
=
context
;
this
.
context
=
context
;
this
.
sessionId
=
sessionId
;
this
.
sessionId
=
sessionId
;
this
.
userId
=
userId
;
this
.
userId
=
userId
;
inflater
=
LayoutInflater
.
from
(
context
);
inflater
=
LayoutInflater
.
from
(
context
);
this
.
activity
=
activity
;
this
.
textViewCommentLabel
=
textViewCommentLabel
;
this
.
fragment
=
fragment
;
this
.
fragment
=
fragment
;
}
}
...
@@ -68,7 +63,7 @@ public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
...
@@ -68,7 +63,7 @@ public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
private
TextView
textViewComment
;
private
TextView
textViewComment
;
private
final
RetrofitInterface
retrofitInterface
=
Utils
.
getRetrofitInterface
();
private
final
RetrofitInterface
retrofitInterface
=
Utils
.
getRetrofitInterface
();
public
CommentsViewHolder
(
View
itemView
)
{
CommentsViewHolder
(
View
itemView
)
{
super
(
itemView
);
super
(
itemView
);
cardView
=
itemView
.
findViewById
(
R
.
id
.
cardViewComment
);
cardView
=
itemView
.
findViewById
(
R
.
id
.
cardViewComment
);
textViewName
=
itemView
.
findViewById
(
R
.
id
.
textViewUserComment
);
textViewName
=
itemView
.
findViewById
(
R
.
id
.
textViewUserComment
);
...
@@ -77,7 +72,7 @@ public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
...
@@ -77,7 +72,7 @@ public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
circleImageView
=
itemView
.
findViewById
(
R
.
id
.
circleImageViewUserImage
);
circleImageView
=
itemView
.
findViewById
(
R
.
id
.
circleImageViewUserImage
);
}
}
public
void
bindHolder
(
final
int
position
)
{
void
bindHolder
(
final
int
position
)
{
final
Venter
.
Comment
comment
=
commentList
.
get
(
position
);
final
Venter
.
Comment
comment
=
commentList
.
get
(
position
);
try
{
try
{
...
@@ -89,7 +84,7 @@ public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
...
@@ -89,7 +84,7 @@ public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
}
}
try
{
try
{
textViewName
.
setText
(
comment
.
getUser
().
getUserName
());
textViewName
.
setText
(
comment
.
getUser
().
getUserName
());
String
time
=
DateTimeUtil
.
getDate
(
comment
.
getTime
()
.
toString
()
);
String
time
=
DateTimeUtil
.
getDate
(
comment
.
getTime
());
Log
.
i
(
TAG
,
"time: "
+
time
);
Log
.
i
(
TAG
,
"time: "
+
time
);
textViewCommentTime
.
setText
(
time
);
textViewCommentTime
.
setText
(
time
);
textViewComment
.
setText
(
comment
.
getText
());
textViewComment
.
setText
(
comment
.
getText
());
...
@@ -111,9 +106,11 @@ public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
...
@@ -111,9 +106,11 @@ public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
public
boolean
onMenuItemClick
(
MenuItem
item
)
{
public
boolean
onMenuItemClick
(
MenuItem
item
)
{
switch
(
item
.
getItemId
())
{
switch
(
item
.
getItemId
())
{
case
R
.
id
.
copy_comment_option
:
case
R
.
id
.
copy_comment_option
:
ClipboardManager
clipboardManager
=
(
ClipboardManager
)
context
.
getSystemService
(
c
ontext
.
CLIPBOARD_SERVICE
);
ClipboardManager
clipboardManager
=
(
ClipboardManager
)
context
.
getSystemService
(
C
ontext
.
CLIPBOARD_SERVICE
);
ClipData
clipData
=
ClipData
.
newPlainText
(
"Text Copied"
,
textViewComment
.
getText
().
toString
());
ClipData
clipData
=
ClipData
.
newPlainText
(
"Text Copied"
,
textViewComment
.
getText
().
toString
());
clipboardManager
.
setPrimaryClip
(
clipData
);
if
(
clipboardManager
!=
null
)
{
clipboardManager
.
setPrimaryClip
(
clipData
);
}
Toast
.
makeText
(
context
,
"Comment Copied"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
context
,
"Comment Copied"
,
Toast
.
LENGTH_SHORT
).
show
();
break
;
break
;
case
R
.
id
.
delete_comment_option
:
case
R
.
id
.
delete_comment_option
:
...
@@ -138,10 +135,13 @@ public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
...
@@ -138,10 +135,13 @@ public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
break
;
break
;
default
:
default
:
clipboardManager
=
(
ClipboardManager
)
context
.
getSystemService
(
c
ontext
.
CLIPBOARD_SERVICE
);
clipboardManager
=
(
ClipboardManager
)
context
.
getSystemService
(
C
ontext
.
CLIPBOARD_SERVICE
);
clipData
=
ClipData
.
newPlainText
(
"Text Copied"
,
textViewComment
.
getText
().
toString
());
clipData
=
ClipData
.
newPlainText
(
"Text Copied"
,
textViewComment
.
getText
().
toString
());
clipboardManager
.
setPrimaryClip
(
clipData
);
if
(
clipboardManager
!=
null
)
{
clipboardManager
.
setPrimaryClip
(
clipData
);
}
Toast
.
makeText
(
context
,
"Comment Copied"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
context
,
"Comment Copied"
,
Toast
.
LENGTH_SHORT
).
show
();
break
;
}
}
return
true
;
return
true
;
}
}
...
...
app/src/main/java/app/insti/adapter/ComplaintDetailsPagerAdapter.java
View file @
b3143ebe
package
app.insti.adapter
;
package
app.insti.adapter
;
import
android.content.Context
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.FragmentManager
;
import
android.support.v4.app.FragmentManager
;
import
android.support.v4.app.FragmentPagerAdapter
;
import
android.support.v4.app.FragmentPagerAdapter
;
import
app.insti.api.model.Venter
;
import
app.insti.fragment.ComplaintDetailsFragment
;
import
app.insti.fragment.ComplaintDetailsFragment
;
/**
/**
...
@@ -14,14 +12,10 @@ import app.insti.fragment.ComplaintDetailsFragment;
...
@@ -14,14 +12,10 @@ import app.insti.fragment.ComplaintDetailsFragment;
public
class
ComplaintDetailsPagerAdapter
extends
FragmentPagerAdapter
{
public
class
ComplaintDetailsPagerAdapter
extends
FragmentPagerAdapter
{
private
Venter
.
Complaint
detailedComplaint
;
private
Context
context
;
private
String
sessionid
,
complaintid
,
userid
,
userProfileUrl
;
private
String
sessionid
,
complaintid
,
userid
,
userProfileUrl
;
public
ComplaintDetailsPagerAdapter
(
FragmentManager
fm
,
Venter
.
Complaint
detailedComplaint
,
Context
context
,
String
sessionid
,
String
complaintid
,
String
userid
,
String
userProfileUrl
)
{
public
ComplaintDetailsPagerAdapter
(
FragmentManager
fm
,
String
sessionid
,
String
complaintid
,
String
userid
,
String
userProfileUrl
)
{
super
(
fm
);
super
(
fm
);
this
.
context
=
context
;
this
.
detailedComplaint
=
detailedComplaint
;
this
.
sessionid
=
sessionid
;
this
.
sessionid
=
sessionid
;
this
.
complaintid
=
complaintid
;
this
.
complaintid
=
complaintid
;
this
.
userid
=
userid
;
this
.
userid
=
userid
;
...
...
app/src/main/java/app/insti/adapter/ComplaintFragmentViewPagerAdapter.java
View file @
b3143ebe
package
app.insti.adapter
;
package
app.insti.adapter
;
import
android.content.Context
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.FragmentManager
;
import
android.support.v4.app.FragmentManager
;
...
@@ -15,12 +14,10 @@ import app.insti.fragment.ComplaintsMeFragment;
...
@@ -15,12 +14,10 @@ import app.insti.fragment.ComplaintsMeFragment;
public
class
ComplaintFragmentViewPagerAdapter
extends
FragmentStatePagerAdapter
{
public
class
ComplaintFragmentViewPagerAdapter
extends
FragmentStatePagerAdapter
{
private
Context
context
;
private
String
userID
,
sessionID
,
userProfileUrl
;
private
String
userID
,
sessionID
,
userProfileUrl
;
public
ComplaintFragmentViewPagerAdapter
(
FragmentManager
fm
,
Context
context
,
String
userID
,
String
sessionID
,
String
userProfileUrl
)
{
public
ComplaintFragmentViewPagerAdapter
(
FragmentManager
fm
,
String
userID
,
String
sessionID
,
String
userProfileUrl
)
{
super
(
fm
);
super
(
fm
);
this
.
context
=
context
;
this
.
userID
=
userID
;
this
.
userID
=
userID
;
this
.
sessionID
=
sessionID
;
this
.
sessionID
=
sessionID
;
this
.
userProfileUrl
=
userProfileUrl
;
this
.
userProfileUrl
=
userProfileUrl
;
...
...
app/src/main/java/app/insti/adapter/ImageViewPagerAdapter.java
View file @
b3143ebe
...
@@ -20,7 +20,6 @@ public class ImageViewPagerAdapter extends FragmentPagerAdapter {
...
@@ -20,7 +20,6 @@ public class ImageViewPagerAdapter extends FragmentPagerAdapter {
private
static
final
String
TAG
=
ImageViewPagerAdapter
.
class
.
getSimpleName
();
private
static
final
String
TAG
=
ImageViewPagerAdapter
.
class
.
getSimpleName
();
private
List
<
String
>
images
=
new
ArrayList
<>();
private
List
<
String
>
images
=
new
ArrayList
<>();
private
Venter
.
Complaint
detailedComplaint
;
public
ImageViewPagerAdapter
(
FragmentManager
fragmentManager
,
List
<
String
>
images
)
{
public
ImageViewPagerAdapter
(
FragmentManager
fragmentManager
,
List
<
String
>
images
)
{
super
(
fragmentManager
);
super
(
fragmentManager
);
...
@@ -29,11 +28,7 @@ public class ImageViewPagerAdapter extends FragmentPagerAdapter {
...
@@ -29,11 +28,7 @@ public class ImageViewPagerAdapter extends FragmentPagerAdapter {
public
ImageViewPagerAdapter
(
FragmentManager
fragmentManager
,
Venter
.
Complaint
detailedComplaint
){
public
ImageViewPagerAdapter
(
FragmentManager
fragmentManager
,
Venter
.
Complaint
detailedComplaint
){
super
(
fragmentManager
);
super
(
fragmentManager
);
this
.
detailedComplaint
=
detailedComplaint
;
images
.
addAll
(
detailedComplaint
.
getImages
());
for
(
String
image:
detailedComplaint
.
getImages
()){
images
.
add
(
image
);
}
}
}
@Override
@Override
...
@@ -54,7 +49,7 @@ public class ImageViewPagerAdapter extends FragmentPagerAdapter {
...
@@ -54,7 +49,7 @@ public class ImageViewPagerAdapter extends FragmentPagerAdapter {
return
new
AddImageFragment
();
return
new
AddImageFragment
();
}
else
{
}
else
{
Log
.
i
(
TAG
,
"calling 2"
);
Log
.
i
(
TAG
,
"calling 2"
);
return
ImageFragment
.
newInstance
(
images
.
get
(
position
)
,
position
);
return
ImageFragment
.
newInstance
(
images
.
get
(
position
));
}
}
}
}
}
}
\ No newline at end of file
app/src/main/java/app/insti/adapter/UpVotesAdapter.java
View file @
b3143ebe
package
app.insti.adapter
;
package
app.insti.adapter
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Context
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.NonNull
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
...
@@ -10,7 +9,6 @@ import android.util.Log;
...
@@ -10,7 +9,6 @@ import android.util.Log;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.squareup.picasso.Picasso
;
import
com.squareup.picasso.Picasso
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -23,25 +21,14 @@ import de.hdodenhof.circleimageview.CircleImageView;
...
@@ -23,25 +21,14 @@ import de.hdodenhof.circleimageview.CircleImageView;
public
class
UpVotesAdapter
extends
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>
{
public
class
UpVotesAdapter
extends
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>
{
private
static
final
String
TAG
=
CommentsAdapter
.
class
.
getSimpleName
();
private
static
final
String
TAG
=
CommentsAdapter
.
class
.
getSimpleName
();
private
Context
context
;
private
LayoutInflater
inflater
;
private
LayoutInflater
inflater
;
private
String
sessionId
,
userId
;
private
Activity
activity
;
private
TextView
textViewUserUpVoteName
;
private
Fragment
fragment
;
private
Fragment
fragment
;
private
LinearLayout
layoutUpVote
;
private
List
<
User
>
userList
=
new
ArrayList
<>();
private
List
<
User
>
userList
=
new
ArrayList
<>();
public
UpVotesAdapter
(
Activity
activity
,
Context
context
,
String
sessionId
,
String
userId
,
TextView
textViewUserUpVoteName
,
Fragment
fragment
)
{
public
UpVotesAdapter
(
Fragment
fragment
,
Context
context
)
{
this
.
context
=
context
;
this
.
sessionId
=
sessionId
;
this
.
userId
=
userId
;
inflater
=
LayoutInflater
.
from
(
context
);
inflater
=
LayoutInflater
.
from
(
context
);
this
.
activity
=
activity
;
this
.
textViewUserUpVoteName
=
textViewUserUpVoteName
;
this
.
fragment
=
fragment
;
this
.
fragment
=
fragment
;
}
}
...
@@ -51,7 +38,7 @@ public class UpVotesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
...
@@ -51,7 +38,7 @@ public class UpVotesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
private
CircleImageView
circleImageView
;
private
CircleImageView
circleImageView
;
private
TextView
textViewName
;
private
TextView
textViewName
;
public
UpVotesViewHolder
(
View
itemView
)
{
UpVotesViewHolder
(
View
itemView
)
{
super
(
itemView
);
super
(
itemView
);
cardView
=
itemView
.
findViewById
(
R
.
id
.
cardViewUpVote
);
cardView
=
itemView
.
findViewById
(
R
.
id
.
cardViewUpVote
);
textViewName
=
itemView
.
findViewById
(
R
.
id
.
textViewUserUpVoteName
);
textViewName
=
itemView
.
findViewById
(
R
.
id
.
textViewUserUpVoteName
);
...
@@ -64,7 +51,7 @@ public class UpVotesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
...
@@ -64,7 +51,7 @@ public class UpVotesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
});
});
}
}
public
void
bindHolder
(
final
int
position
)
{
void
bindHolder
(
final
int
position
)
{
final
User
user
=
userList
.
get
(
position
);
final
User
user
=
userList
.
get
(
position
);
try
{
try
{
...
@@ -82,9 +69,7 @@ public class UpVotesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
...
@@ -82,9 +69,7 @@ public class UpVotesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
@Override
@Override
public
RecyclerView
.
ViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
viewGroup
,
int
i
)
{
public
RecyclerView
.
ViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
viewGroup
,
int
i
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
vote_up_card
,
viewGroup
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
vote_up_card
,
viewGroup
,
false
);
final
UpVotesViewHolder
upVotesViewHolder
=
new
UpVotesViewHolder
(
view
);
return
new
UpVotesViewHolder
(
view
);
layoutUpVote
=
view
.
findViewById
(
R
.
id
.
layoutUpVote
);
return
upVotesViewHolder
;
}
}
@Override
@Override
...
...
app/src/main/java/app/insti/adapter/UserAdapter.java
View file @
b3143ebe
package
app.insti.adapter
;
package
app.insti.adapter
;
import
android.content.Context
;
import
android.content.Context
;
import
android.support.annotation.NonNull
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
...
@@ -20,7 +21,6 @@ import app.insti.api.model.User;
...
@@ -20,7 +21,6 @@ import app.insti.api.model.User;
public
class
UserAdapter
extends
RecyclerView
.
Adapter
<
UserAdapter
.
ViewHolder
>
{
public
class
UserAdapter
extends
RecyclerView
.
Adapter
<
UserAdapter
.
ViewHolder
>
{
private
List
<
User
>
userList
;
private
List
<
User
>
userList
;
private
Context
context
;
private
Fragment
fragment
;
private
Fragment
fragment
;
public
UserAdapter
(
List
<
User
>
userList
,
Fragment
mFragment
)
{
public
UserAdapter
(
List
<
User
>
userList
,
Fragment
mFragment
)
{
...
@@ -28,9 +28,10 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
...
@@ -28,9 +28,10 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
fragment
=
mFragment
;
fragment
=
mFragment
;
}
}
@NonNull
@Override
@Override
public
ViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
public
ViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
context
=
parent
.
getContext
();
Context
context
=
parent
.
getContext
();
View
v
=
LayoutInflater
.
from
(
context
)
View
v
=
LayoutInflater
.
from
(
context
)
.
inflate
(
R
.
layout
.
feed_card
,
parent
,
false
);
.
inflate
(
R
.
layout
.
feed_card
,
parent
,
false
);
final
ViewHolder
postViewHolder
=
new
ViewHolder
(
v
);
final
ViewHolder
postViewHolder
=
new
ViewHolder
(
v
);
...
@@ -46,7 +47,7 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
...
@@ -46,7 +47,7 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
}
}
@Override
@Override
public
void
onBindViewHolder
(
ViewHolder
holder
,
int
position
)
{
public
void
onBindViewHolder
(
@NonNull
ViewHolder
holder
,
int
position
)
{
User
user
=
userList
.
get
(
position
);
User
user
=
userList
.
get
(
position
);
holder
.
userName
.
setText
(
user
.
getUserName
());
holder
.
userName
.
setText
(
user
.
getUserName
());
if
(
user
.
getCurrentRole
()
==
null
||
user
.
getCurrentRole
().
equals
(
""
))
{
if
(
user
.
getCurrentRole
()
==
null
||
user
.
getCurrentRole
().
equals
(
""
))
{
...
@@ -72,15 +73,15 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
...
@@ -72,15 +73,15 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
}
}
public
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
public
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
public
TextView
userName
;
TextView
userName
;
public
TextView
role
;
TextView
role
;
public
ImageView
image
;
public
ImageView
image
;
public
ViewHolder
(
View
itemView
)
{
public
ViewHolder
(
View
itemView
)
{
super
(
itemView
);
super
(
itemView
);
userName
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
object_title
);
userName
=
itemView
.
findViewById
(
R
.
id
.
object_title
);
role
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
object_subtitle
);
role
=
itemView
.
findViewById
(
R
.
id
.
object_subtitle
);
image
=
(
ImageView
)
itemView
.
findViewById
(
R
.
id
.
object_picture
);
image
=
itemView
.
findViewById
(
R
.
id
.
object_picture
);
}
}
}
}
}
}
app/src/main/java/app/insti/api/model/Venter.java
View file @
b3143ebe
...
@@ -37,21 +37,6 @@ public class Venter {
...
@@ -37,21 +37,6 @@ public class Venter {
private
List
<
Comment
>
comment
;
private
List
<
Comment
>
comment
;
private
int
voteCount
;
private
int
voteCount
;
public
Complaint
(
@NonNull
String
complaintID
,
User
complaintCreatedBy
,
String
description
,
String
complaintReportDate
,
String
status
,
Float
latitude
,
Float
longitude
,
String
locationDescription
,
List
<
TagUri
>
tags
,
List
<
User
>
usersUpVoted
,
List
<
String
>
images
,
List
<
Comment
>
comment
)
{
this
.
complaintID
=
complaintID
;
this
.
complaintCreatedBy
=
complaintCreatedBy
;
this
.
description
=
description
;
this
.
complaintReportDate
=
complaintReportDate
;
this
.
status
=
status
;
this
.
latitude
=
latitude
;
this
.
longitude
=
longitude
;
this
.
locationDescription
=
locationDescription
;
this
.
tags
=
tags
;
this
.
usersUpVoted
=
usersUpVoted
;
this
.
images
=
images
;
this
.
comment
=
comment
;
}
@NonNull
@NonNull
public
String
getComplaintID
()
{
public
String
getComplaintID
()
{
return
complaintID
;
return
complaintID
;
...
...
app/src/main/java/app/insti/fragment/ComplaintDetailsFragment.java
View file @
b3143ebe
...
@@ -67,8 +67,6 @@ public class ComplaintDetailsFragment extends Fragment {
...
@@ -67,8 +67,6 @@ public class ComplaintDetailsFragment extends Fragment {
private
List
<
Venter
.
Comment
>
commentList
;
private
List
<
Venter
.
Comment
>
commentList
;
private
List
<
User
>
upVotesList
;
private
List
<
User
>
upVotesList
;
private
LinearLayout
linearLayoutTags
;
private
LinearLayout
linearLayoutTags
;
private
TextView
textViewUserUpVoteName
;
private
List
<
String
>
tagsList
;
public
static
ComplaintDetailsFragment
getInstance
(
String
sessionid
,
String
complaintid
,
String
userid
,
String
userProfileUrl
)
{
public
static
ComplaintDetailsFragment
getInstance
(
String
sessionid
,
String
complaintid
,
String
userid
,
String
userProfileUrl
)
{
sId
=
sessionid
;
sId
=
sessionid
;
...
@@ -87,10 +85,9 @@ public class ComplaintDetailsFragment extends Fragment {
...
@@ -87,10 +85,9 @@ public class ComplaintDetailsFragment extends Fragment {
initialiseViews
(
view
);
initialiseViews
(
view
);
upVotesList
=
new
ArrayList
<>();
upVotesList
=
new
ArrayList
<>();
tagsList
=
new
ArrayList
<>();
commentListAdapter
=
new
CommentsAdapter
(
getContext
(),
sId
,
uId
,
this
);
commentListAdapter
=
new
CommentsAdapter
(
getActivity
(),
getContext
(),
sId
,
uId
,
textViewCommentLabel
,
this
);
LinearLayoutManager
linearLayoutManager
=
new
LinearLayoutManager
(
getContext
());
LinearLayoutManager
linearLayoutManager
=
new
LinearLayoutManager
(
getContext
());
upVotesAdapter
=
new
UpVotesAdapter
(
getActivity
(),
getContext
(),
sId
,
uId
,
textViewUserUpVoteName
,
this
);
upVotesAdapter
=
new
UpVotesAdapter
(
this
,
getContext
()
);
recyclerViewComments
.
setLayoutManager
(
linearLayoutManager
);
recyclerViewComments
.
setLayoutManager
(
linearLayoutManager
);
recyclerViewUpVotes
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
()));
recyclerViewUpVotes
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
()));
recyclerViewComments
.
setHasFixedSize
(
true
);
recyclerViewComments
.
setHasFixedSize
(
true
);
...
...
app/src/main/java/app/insti/fragment/ComplaintFragment.java
View file @
b3143ebe
...
@@ -15,7 +15,9 @@ import android.view.LayoutInflater;
...
@@ -15,7 +15,9 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
import
java.util.Objects
;
import
java.util.Objects
;
import
app.insti.R
;
import
app.insti.R
;
import
app.insti.Utils
;
import
app.insti.Utils
;
import
app.insti.adapter.ComplaintDetailsPagerAdapter
;
import
app.insti.adapter.ComplaintDetailsPagerAdapter
;
...
@@ -35,11 +37,10 @@ public class ComplaintFragment extends Fragment {
...
@@ -35,11 +37,10 @@ public class ComplaintFragment extends Fragment {
private
ViewPager
viewPager
;
private
ViewPager
viewPager
;
private
View
mview
;
private
View
mview
;
private
String
complaintId
,
sessionID
,
userId
,
userProfileUrl
;
private
String
complaintId
,
sessionID
,
userId
,
userProfileUrl
;
private
ComplaintDetailsPagerAdapter
complaintDetailsPagerAdapter
;
private
CircleIndicator
circleIndicator
;
private
CircleIndicator
circleIndicator
;
@Override
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_complaint
,
container
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_complaint
,
container
,
false
);
...
@@ -60,13 +61,11 @@ public class ComplaintFragment extends Fragment {
...
@@ -60,13 +61,11 @@ public class ComplaintFragment extends Fragment {
super
.
onViewCreated
(
view
,
savedInstanceState
);
super
.
onViewCreated
(
view
,
savedInstanceState
);
Bundle
bundle
=
getArguments
();
Bundle
bundle
=
getArguments
();
complaintId
=
bundle
.
getString
(
"id"
);
sessionID
=
bundle
.
getString
(
"sessionId"
);
userId
=
bundle
.
getString
(
"userId"
);
userProfileUrl
=
bundle
.
getString
(
"userProfileUrl"
);
if
(
bundle
!=
null
)
{
if
(
bundle
!=
null
)
{
Log
.
i
(
TAG
,
"bundle != null"
);
complaintId
=
bundle
.
getString
(
"id"
);
sessionID
=
bundle
.
getString
(
"sessionId"
);
userId
=
bundle
.
getString
(
"userId"
);
userProfileUrl
=
bundle
.
getString
(
"userProfileUrl"
);
callServerToGetDetailedComplaint
();
callServerToGetDetailedComplaint
();
}
}
}
}
...
@@ -79,11 +78,13 @@ public class ComplaintFragment extends Fragment {
...
@@ -79,11 +78,13 @@ public class ComplaintFragment extends Fragment {
public
void
onResponse
(
Call
<
Venter
.
Complaint
>
call
,
Response
<
Venter
.
Complaint
>
response
)
{
public
void
onResponse
(
Call
<
Venter
.
Complaint
>
call
,
Response
<
Venter
.
Complaint
>
response
)
{
if
(
response
.
body
()
!=
null
)
{
if
(
response
.
body
()
!=
null
)
{
Venter
.
Complaint
complaint
=
response
.
body
();
Venter
.
Complaint
complaint
=
response
.
body
();
for
(
User
currentUser
:
complaint
.
getUsersUpVoted
())
{
if
(
complaint
!=
null
)
{
if
(
currentUser
.
getUserID
().
equals
(
userId
))
{
for
(
User
currentUser
:
complaint
.
getUsersUpVoted
())
{
complaint
.
setVoteCount
(
1
);
if
(
currentUser
.
getUserID
().
equals
(
userId
))
{
}
else
{
complaint
.
setVoteCount
(
1
);
complaint
.
setVoteCount
(
0
);
}
else
{
complaint
.
setVoteCount
(
0
);
}
}
}
}
}
initViewPagerForImages
(
complaint
);
initViewPagerForImages
(
complaint
);
...
@@ -110,7 +111,7 @@ public class ComplaintFragment extends Fragment {
...
@@ -110,7 +111,7 @@ public class ComplaintFragment extends Fragment {
viewPager
.
setAdapter
(
imageFragmentPagerAdapter
);
viewPager
.
setAdapter
(
imageFragmentPagerAdapter
);
circleIndicator
.
setViewPager
(
viewPager
);
circleIndicator
.
setViewPager
(
viewPager
);
imageFragmentPagerAdapter
.
registerDataSetObserver
(
circleIndicator
.
getDataSetObserver
());
imageFragmentPagerAdapter
.
registerDataSetObserver
(
circleIndicator
.
getDataSetObserver
());
viewPager
.
getAdapter
(
).
notifyDataSetChanged
();
Objects
.
requireNonNull
(
viewPager
.
getAdapter
()
).
notifyDataSetChanged
();
synchronized
(
viewPager
)
{
synchronized
(
viewPager
)
{
viewPager
.
notifyAll
();
viewPager
.
notifyAll
();
}
}
...
@@ -127,7 +128,7 @@ public class ComplaintFragment extends Fragment {
...
@@ -127,7 +128,7 @@ public class ComplaintFragment extends Fragment {
viewPager
=
mview
.
findViewById
(
R
.
id
.
tab_viewpager_details
);
viewPager
=
mview
.
findViewById
(
R
.
id
.
tab_viewpager_details
);
if
(
viewPager
!=
null
)
{
if
(
viewPager
!=
null
)
{
Log
.
i
(
TAG
,
"viewPager != null"
);
Log
.
i
(
TAG
,
"viewPager != null"
);
complaintDetailsPagerAdapter
=
new
ComplaintDetailsPagerAdapter
(
getChildFragmentManager
(),
detailedComplaint
,
getContext
(),
sessionID
,
complaintId
,
userId
,
userProfileUrl
);
ComplaintDetailsPagerAdapter
complaintDetailsPagerAdapter
=
new
ComplaintDetailsPagerAdapter
(
getChildFragmentManager
(),
sessionID
,
complaintId
,
userId
,
userProfileUrl
);
viewPager
.
setAdapter
(
complaintDetailsPagerAdapter
);
viewPager
.
setAdapter
(
complaintDetailsPagerAdapter
);
slidingTabLayout
.
setupWithViewPager
(
viewPager
);
slidingTabLayout
.
setupWithViewPager
(
viewPager
);
...
@@ -145,7 +146,7 @@ public class ComplaintFragment extends Fragment {
...
@@ -145,7 +146,7 @@ public class ComplaintFragment extends Fragment {
final
TypedArray
styledAttributes
=
Objects
.
requireNonNull
(
ComplaintFragment
.
this
.
getActivity
()).
getTheme
().
obtainStyledAttributes
(
final
TypedArray
styledAttributes
=
Objects
.
requireNonNull
(
ComplaintFragment
.
this
.
getActivity
()).
getTheme
().
obtainStyledAttributes
(
new
int
[]{
android
.
R
.
attr
.
actionBarSize
});
new
int
[]{
android
.
R
.
attr
.
actionBarSize
});
int
mActionBarSize
=
(
int
)
styledAttributes
.
getDimension
(
0
,
0
);
// int mActionBarSize = (int) styledAttributes.getDimension(0, 0); For future Uae
styledAttributes
.
recycle
();
styledAttributes
.
recycle
();
// Replace second parameter to mActionBarSize after adding "Relevant Complaints"
// Replace second parameter to mActionBarSize after adding "Relevant Complaints"
...
@@ -170,12 +171,12 @@ public class ComplaintFragment extends Fragment {
...
@@ -170,12 +171,12 @@ public class ComplaintFragment extends Fragment {
@Override
@Override
public
void
onTabUnselected
(
TabLayout
.
Tab
tab
)
{
public
void
onTabUnselected
(
TabLayout
.
Tab
tab
)
{
//on Tab Unselected
}
}
@Override
@Override
public
void
onTabReselected
(
TabLayout
.
Tab
tab
)
{
public
void
onTabReselected
(
TabLayout
.
Tab
tab
)
{
//on Tab Reselected
}
}
});
});
...
...
app/src/main/java/app/insti/fragment/ComplaintsFragment.java
View file @
b3143ebe
package
app.insti.fragment
;
package
app.insti.fragment
;
import
android.content.Context
;
import
android.content.res.TypedArray
;
import
android.content.res.TypedArray
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.design.widget.AppBarLayout
;
import
android.support.design.widget.AppBarLayout
;
...
@@ -22,11 +21,7 @@ import app.insti.adapter.ComplaintFragmentViewPagerAdapter;
...
@@ -22,11 +21,7 @@ import app.insti.adapter.ComplaintFragmentViewPagerAdapter;
public
class
ComplaintsFragment
extends
BaseFragment
{
public
class
ComplaintsFragment
extends
BaseFragment
{
private
String
userID
,
userProfileUrl
;
private
String
userID
,
userProfileUrl
;
private
Context
context
;
private
Button
buttonVentIssues
;
private
ViewPager
viewPager
;
private
TabLayout
slidingTabLayout
;
private
TabLayout
slidingTabLayout
;
private
CollapsingToolbarLayout
collapsingToolbarLayout
;
@Override
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
...
@@ -39,15 +34,13 @@ public class ComplaintsFragment extends BaseFragment {
...
@@ -39,15 +34,13 @@ public class ComplaintsFragment extends BaseFragment {
Bundle
bundle
=
getArguments
();
Bundle
bundle
=
getArguments
();
userID
=
bundle
.
getString
(
Constants
.
USER_ID
);
userID
=
bundle
.
getString
(
Constants
.
USER_ID
);
userProfileUrl
=
bundle
.
getString
(
Constants
.
CURRENT_USER_PROFILE_PICTURE
);
userProfileUrl
=
bundle
.
getString
(
Constants
.
CURRENT_USER_PROFILE_PICTURE
);
collapsingToolbarLayout
=
view
.
findViewById
(
R
.
id
.
collapsing_toolbar
);
CollapsingToolbarLayout
collapsingToolbarLayout
=
view
.
findViewById
(
R
.
id
.
collapsing_toolbar
);
collapsingToolbarLayout
.
setTitleEnabled
(
false
);
collapsingToolbarLayout
.
setTitleEnabled
(
false
);
viewPager
=
(
ViewPager
)
view
.
findViewById
(
R
.
id
.
tab_viewpager
);
ViewPager
viewPager
=
(
ViewPager
)
view
.
findViewById
(
R
.
id
.
tab_viewpager
);
slidingTabLayout
=
(
TabLayout
)
view
.
findViewById
(
R
.
id
.
sliding_tab_layout
);
slidingTabLayout
=
(
TabLayout
)
view
.
findViewById
(
R
.
id
.
sliding_tab_layout
);
context
=
getContext
();
Button
buttonVentIssues
=
view
.
findViewById
(
R
.
id
.
buttonVentIssues
);
buttonVentIssues
=
view
.
findViewById
(
R
.
id
.
buttonVentIssues
);
buttonVentIssues
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
buttonVentIssues
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
...
@@ -60,8 +53,6 @@ public class ComplaintsFragment extends BaseFragment {
...
@@ -60,8 +53,6 @@ public class ComplaintsFragment extends BaseFragment {
}
}
});
});
viewPager
=
view
.
findViewById
(
R
.
id
.
tab_viewpager
);
slidingTabLayout
=
view
.
findViewById
(
R
.
id
.
sliding_tab_layout
);
slidingTabLayout
=
view
.
findViewById
(
R
.
id
.
sliding_tab_layout
);
if
(
viewPager
!=
null
)
{
if
(
viewPager
!=
null
)
{
...
@@ -73,7 +64,7 @@ public class ComplaintsFragment extends BaseFragment {
...
@@ -73,7 +64,7 @@ public class ComplaintsFragment extends BaseFragment {
private
void
setupViewPager
(
final
ViewPager
viewPager
)
{
private
void
setupViewPager
(
final
ViewPager
viewPager
)
{
viewPager
.
setAdapter
(
new
ComplaintFragmentViewPagerAdapter
(
getChildFragmentManager
(),
getContext
(),
userID
,
getArguments
().
getString
(
Constants
.
SESSION_ID
),
userProfileUrl
));
viewPager
.
setAdapter
(
new
ComplaintFragmentViewPagerAdapter
(
getChildFragmentManager
(),
userID
,
getArguments
().
getString
(
Constants
.
SESSION_ID
),
userProfileUrl
));
slidingTabLayout
.
setupWithViewPager
(
viewPager
);
slidingTabLayout
.
setupWithViewPager
(
viewPager
);
slidingTabLayout
.
post
(
new
Runnable
()
{
slidingTabLayout
.
post
(
new
Runnable
()
{
@Override
@Override
...
...
app/src/main/java/app/insti/fragment/ComplaintsHomeFragment.java
View file @
b3143ebe
package
app.insti.fragment
;
package
app.insti.fragment
;
import
android.app.Activity
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.NonNull
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
...
@@ -24,9 +23,7 @@ import retrofit2.Response;
...
@@ -24,9 +23,7 @@ import retrofit2.Response;
public
class
ComplaintsHomeFragment
extends
Fragment
{
public
class
ComplaintsHomeFragment
extends
Fragment
{
private
Activity
activity
;
private
ComplaintsAdapter
homeListAdapter
;
private
ComplaintsAdapter
homeListAdapter
;
private
RecyclerView
recyclerViewHome
;
private
SwipeRefreshLayout
swipeContainer
;
private
SwipeRefreshLayout
swipeContainer
;
private
static
String
TAG
=
ComplaintsHomeFragment
.
class
.
getSimpleName
();
private
static
String
TAG
=
ComplaintsHomeFragment
.
class
.
getSimpleName
();
...
@@ -57,12 +54,12 @@ public class ComplaintsHomeFragment extends Fragment {
...
@@ -57,12 +54,12 @@ public class ComplaintsHomeFragment extends Fragment {
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
ViewGroup
container
,
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_complaints_home
,
container
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_complaints_home
,
container
,
false
);
recyclerViewHome
=
(
RecyclerView
)
view
.
findViewById
(
R
.
id
.
recyclerViewHome
);
RecyclerView
recyclerViewHome
=
(
RecyclerView
)
view
.
findViewById
(
R
.
id
.
recyclerViewHome
);
homeListAdapter
=
new
ComplaintsAdapter
(
getActivity
(),
sID
,
uID
,
uProfileUrl
);
homeListAdapter
=
new
ComplaintsAdapter
(
getActivity
(),
sID
,
uID
,
uProfileUrl
);
swipeContainer
=
(
SwipeRefreshLayout
)
view
.
findViewById
(
R
.
id
.
swipeContainer
);
swipeContainer
=
(
SwipeRefreshLayout
)
view
.
findViewById
(
R
.
id
.
swipeContainer
);
error_message_home
=
view
.
findViewById
(
R
.
id
.
error_message_home
);
error_message_home
=
view
.
findViewById
(
R
.
id
.
error_message_home
);
LinearLayoutManager
llm
=
new
LinearLayoutManager
(
activity
);
LinearLayoutManager
llm
=
new
LinearLayoutManager
(
getActivity
()
);
recyclerViewHome
.
setLayoutManager
(
llm
);
recyclerViewHome
.
setLayoutManager
(
llm
);
recyclerViewHome
.
setHasFixedSize
(
true
);
recyclerViewHome
.
setHasFixedSize
(
true
);
...
...
app/src/main/java/app/insti/fragment/ComplaintsMeFragment.java
View file @
b3143ebe
package
app.insti.fragment
;
package
app.insti.fragment
;
import
android.app.Activity
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.NonNull
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
...
@@ -25,8 +24,6 @@ import retrofit2.Response;
...
@@ -25,8 +24,6 @@ import retrofit2.Response;
public
class
ComplaintsMeFragment
extends
Fragment
{
public
class
ComplaintsMeFragment
extends
Fragment
{
private
static
String
uID
,
sID
,
uProfileUrl
;
private
static
String
uID
,
sID
,
uProfileUrl
;
private
Activity
activity
;
private
RecyclerView
recyclerViewMe
;
private
ComplaintsAdapter
meListAdapter
;
private
ComplaintsAdapter
meListAdapter
;
private
TextView
error_message_me
;
private
TextView
error_message_me
;
private
SwipeRefreshLayout
swipeContainer
;
private
SwipeRefreshLayout
swipeContainer
;
...
@@ -57,12 +54,12 @@ public class ComplaintsMeFragment extends Fragment {
...
@@ -57,12 +54,12 @@ public class ComplaintsMeFragment extends Fragment {
Bundle
savedInstanceState
)
{
Bundle
savedInstanceState
)
{
// Inflate the layout for this fragment
// Inflate the layout for this fragment
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_complaints_me
,
container
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_complaints_me
,
container
,
false
);
recyclerViewMe
=
view
.
findViewById
(
R
.
id
.
recyclerViewMe
);
RecyclerView
recyclerViewMe
=
view
.
findViewById
(
R
.
id
.
recyclerViewMe
);
meListAdapter
=
new
ComplaintsAdapter
(
getActivity
(),
sID
,
uID
,
uProfileUrl
);
meListAdapter
=
new
ComplaintsAdapter
(
getActivity
(),
sID
,
uID
,
uProfileUrl
);
swipeContainer
=
view
.
findViewById
(
R
.
id
.
swipeContainer
);
swipeContainer
=
view
.
findViewById
(
R
.
id
.
swipeContainer
);
error_message_me
=
view
.
findViewById
(
R
.
id
.
error_message_me
);
error_message_me
=
view
.
findViewById
(
R
.
id
.
error_message_me
);
LinearLayoutManager
llm
=
new
LinearLayoutManager
(
activity
);
LinearLayoutManager
llm
=
new
LinearLayoutManager
(
getActivity
()
);
recyclerViewMe
.
setLayoutManager
(
llm
);
recyclerViewMe
.
setLayoutManager
(
llm
);
recyclerViewMe
.
setHasFixedSize
(
true
);
recyclerViewMe
.
setHasFixedSize
(
true
);
recyclerViewMe
.
setAdapter
(
meListAdapter
);
recyclerViewMe
.
setAdapter
(
meListAdapter
);
...
...
app/src/main/java/app/insti/fragment/FileComplaintFragment.java
View file @
b3143ebe
...
@@ -524,6 +524,7 @@ public class FileComplaintFragment extends Fragment {
...
@@ -524,6 +524,7 @@ public class FileComplaintFragment extends Fragment {
break
;
break
;
default
:
default
:
Toast
.
makeText
(
getContext
(),
getString
(
R
.
string
.
GPS_not_enables
),
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
getContext
(),
getString
(
R
.
string
.
GPS_not_enables
),
Toast
.
LENGTH_LONG
).
show
();
break
;
}
}
}
}
}
}
...
@@ -753,7 +754,7 @@ public class FileComplaintFragment extends Fragment {
...
@@ -753,7 +754,7 @@ public class FileComplaintFragment extends Fragment {
}
}
Intent
intent
=
new
Intent
(
MediaStore
.
ACTION_IMAGE_CAPTURE
);
Intent
intent
=
new
Intent
(
MediaStore
.
ACTION_IMAGE_CAPTURE
);
if
(
intent
.
resolveActivity
(
getActivity
().
getPackageManager
())
!=
null
)
{
if
(
intent
.
resolveActivity
(
getActivity
().
getPackageManager
())
!=
null
)
{
startActivityForResult
(
intent
,
Constants
.
REQUEST_CAMERA_INT_ID
);
startActivityForResult
(
intent
,
REQUEST_CAMERA_INT_ID
);
}
}
}
else
if
(
items
[
item
].
equals
(
getString
(
R
.
string
.
choose_from_library
)))
{
}
else
if
(
items
[
item
].
equals
(
getString
(
R
.
string
.
choose_from_library
)))
{
if
(
ContextCompat
.
checkSelfPermission
(
getContext
(),
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
if
(
ContextCompat
.
checkSelfPermission
(
getContext
(),
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
...
...
app/src/main/java/app/insti/fragment/ImageFragment.java
View file @
b3143ebe
package
app.insti.fragment
;
package
app.insti.fragment
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
...
@@ -16,13 +17,11 @@ public class ImageFragment extends BaseFragment {
...
@@ -16,13 +17,11 @@ public class ImageFragment extends BaseFragment {
private
static
final
String
TAG
=
ImageFragment
.
class
.
getSimpleName
();
private
static
final
String
TAG
=
ImageFragment
.
class
.
getSimpleName
();
private
String
image
;
private
String
image
;
private
int
indexChosen
;
public
static
ImageFragment
newInstance
(
String
image
,
int
index
)
{
public
static
ImageFragment
newInstance
(
String
image
)
{
ImageFragment
fragment
=
new
ImageFragment
();
ImageFragment
fragment
=
new
ImageFragment
();
Bundle
args
=
new
Bundle
();
Bundle
args
=
new
Bundle
();
args
.
putString
(
"image"
,
image
);
args
.
putString
(
"image"
,
image
);
args
.
putInt
(
"index"
,
index
);
fragment
.
setArguments
(
args
);
fragment
.
setArguments
(
args
);
return
fragment
;
return
fragment
;
}
}
...
@@ -33,13 +32,12 @@ public class ImageFragment extends BaseFragment {
...
@@ -33,13 +32,12 @@ public class ImageFragment extends BaseFragment {
Log
.
i
(
TAG
,
"getArguments in ImageFragment"
+
getArguments
());
Log
.
i
(
TAG
,
"getArguments in ImageFragment"
+
getArguments
());
if
(
getArguments
()
!=
null
)
{
if
(
getArguments
()
!=
null
)
{
image
=
getArguments
().
getString
(
"image"
);
image
=
getArguments
().
getString
(
"image"
);
indexChosen
=
getArguments
().
getInt
(
"index"
,
0
);
}
}
}
}
@Nullable
@Nullable
@Override
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_image
,
container
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_image
,
container
,
false
);
ImageView
imageView
=
view
.
findViewById
(
R
.
id
.
imageView
);
ImageView
imageView
=
view
.
findViewById
(
R
.
id
.
imageView
);
Picasso
.
get
().
load
(
image
).
into
(
imageView
);
Picasso
.
get
().
load
(
image
).
into
(
imageView
);
...
...
app/src/main/java/app/insti/fragment/RelevantComplaintsFragment.java
View file @
b3143ebe
package
app.insti.fragment
;
package
app.insti.fragment
;
import
android.app.Activity
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.widget.SwipeRefreshLayout
;
import
android.support.v4.widget.SwipeRefreshLayout
;
...
@@ -9,19 +8,13 @@ import android.support.v7.widget.RecyclerView;
...
@@ -9,19 +8,13 @@ import android.support.v7.widget.RecyclerView;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
import
java.util.List
;
import
app.insti.R
;
import
app.insti.R
;
import
app.insti.adapter.ComplaintsAdapter
;
import
app.insti.adapter.ComplaintsAdapter
;
import
app.insti.api.model.Venter
;
public
class
RelevantComplaintsFragment
extends
Fragment
{
public
class
RelevantComplaintsFragment
extends
Fragment
{
private
Activity
activity
;
private
ComplaintsAdapter
relevantComplaintsAdapter
;
private
ComplaintsAdapter
relevantComplaintsAdapter
;
private
RecyclerView
recyclerViewRelevantComplaints
;
private
SwipeRefreshLayout
swipeContainer
;
private
SwipeRefreshLayout
swipeContainer
;
private
boolean
isCalled
=
false
;
private
boolean
isCalled
=
false
;
private
static
String
sID
,
uID
;
private
static
String
sID
,
uID
;
...
@@ -54,12 +47,11 @@ public class RelevantComplaintsFragment extends Fragment {
...
@@ -54,12 +47,11 @@ public class RelevantComplaintsFragment extends Fragment {
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_relevant_complaints
,
container
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_relevant_complaints
,
container
,
false
);
recyclerViewRelevantComplaints
=
(
RecyclerView
)
view
.
findViewById
(
R
.
id
.
recyclerViewRelevantComplaints
);
RecyclerView
recyclerViewRelevantComplaints
=
(
RecyclerView
)
view
.
findViewById
(
R
.
id
.
recyclerViewRelevantComplaints
);
relevantComplaintsAdapter
=
new
ComplaintsAdapter
(
getActivity
(),
sID
,
uID
,
""
);
//Change userProfileUrl to the current user Profile Pic
relevantComplaintsAdapter
=
new
ComplaintsAdapter
(
getActivity
(),
sID
,
uID
,
""
);
//Change userProfileUrl to the current user Profile Pic
swipeContainer
=
(
SwipeRefreshLayout
)
view
.
findViewById
(
R
.
id
.
swipeContainer
);
swipeContainer
=
(
SwipeRefreshLayout
)
view
.
findViewById
(
R
.
id
.
swipeContainer
);
TextView
error_message_relevant_complaints
=
view
.
findViewById
(
R
.
id
.
error_message_relevant_complaints
);
LinearLayoutManager
llm
=
new
LinearLayoutManager
(
activity
);
LinearLayoutManager
llm
=
new
LinearLayoutManager
(
getActivity
()
);
recyclerViewRelevantComplaints
.
setLayoutManager
(
llm
);
recyclerViewRelevantComplaints
.
setLayoutManager
(
llm
);
recyclerViewRelevantComplaints
.
setHasFixedSize
(
true
);
recyclerViewRelevantComplaints
.
setHasFixedSize
(
true
);
...
@@ -91,9 +83,4 @@ public class RelevantComplaintsFragment extends Fragment {
...
@@ -91,9 +83,4 @@ public class RelevantComplaintsFragment extends Fragment {
private
void
callServerToGetRelevantComplaints
(){
private
void
callServerToGetRelevantComplaints
(){
//Get Relevant Complaints from Server
//Get Relevant Complaints from Server
}
}
private
void
initialiseRecyclerView
(
List
<
Venter
.
Complaint
>
list
)
{
relevantComplaintsAdapter
.
setcomplaintList
(
list
);
relevantComplaintsAdapter
.
notifyDataSetChanged
();
}
}
}
app/src/main/java/app/insti/utils/DateTimeUtil.java
View file @
b3143ebe
...
@@ -7,8 +7,6 @@ import java.util.concurrent.TimeUnit;
...
@@ -7,8 +7,6 @@ import java.util.concurrent.TimeUnit;
public
class
DateTimeUtil
{
public
class
DateTimeUtil
{
private
static
String
time_ago
=
""
;
public
static
String
getDate
(
String
dtStart
)
{
public
static
String
getDate
(
String
dtStart
)
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss.SSS'+05:30'"
);
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss.SSS'+05:30'"
);
try
{
try
{
...
@@ -18,6 +16,7 @@ public class DateTimeUtil {
...
@@ -18,6 +16,7 @@ public class DateTimeUtil {
long
seconds
=
TimeUnit
.
MILLISECONDS
.
toSeconds
(
now
.
getTime
()
-
date
.
getTime
());
long
seconds
=
TimeUnit
.
MILLISECONDS
.
toSeconds
(
now
.
getTime
()
-
date
.
getTime
());
long
minutes
=
TimeUnit
.
MILLISECONDS
.
toMinutes
(
now
.
getTime
()
-
date
.
getTime
());
long
minutes
=
TimeUnit
.
MILLISECONDS
.
toMinutes
(
now
.
getTime
()
-
date
.
getTime
());
long
hours
=
TimeUnit
.
MILLISECONDS
.
toHours
(
now
.
getTime
()
-
date
.
getTime
());
long
hours
=
TimeUnit
.
MILLISECONDS
.
toHours
(
now
.
getTime
()
-
date
.
getTime
());
String
time_ago
=
""
;
if
(
seconds
<=
0
)
{
if
(
seconds
<=
0
)
{
return
time_ago
=
"now"
;
return
time_ago
=
"now"
;
}
else
if
(
seconds
==
1
){
}
else
if
(
seconds
==
1
){
...
...
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