Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ChildRescue
Android Volunteer App
Commits
5973733f
Commit
5973733f
authored
Mar 29, 2021
by
George Vafiadis
Browse files
feat: added functionalities of sending feed to org manager
parent
3a803c3d
Pipeline
#830
failed with stages
in 4 minutes and 1 second
Changes
14
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
134 additions
and
61 deletions
+134
-61
app/src/main/java/eu/ubitech/childrescue/volunteer/CollaborationSpaceActivity.java
...ech/childrescue/volunteer/CollaborationSpaceActivity.java
+3
-0
app/src/main/java/eu/ubitech/childrescue/volunteer/ConfirmProvideActivity.java
...ubitech/childrescue/volunteer/ConfirmProvideActivity.java
+54
-14
app/src/main/java/eu/ubitech/childrescue/volunteer/ProvidePostActivity.java
...eu/ubitech/childrescue/volunteer/ProvidePostActivity.java
+4
-4
app/src/main/java/eu/ubitech/childrescue/volunteer/adapter/CaseCardListAdapter.java
...ch/childrescue/volunteer/adapter/CaseCardListAdapter.java
+6
-8
app/src/main/java/eu/ubitech/childrescue/volunteer/adapter/FollowedCaseListAdapter.java
...hildrescue/volunteer/adapter/FollowedCaseListAdapter.java
+4
-4
app/src/main/java/eu/ubitech/childrescue/volunteer/adapter/PostsListAdapter.java
...itech/childrescue/volunteer/adapter/PostsListAdapter.java
+2
-2
app/src/main/java/eu/ubitech/childrescue/volunteer/adapter/TimelineAdapter.java
...bitech/childrescue/volunteer/adapter/TimelineAdapter.java
+3
-1
app/src/main/java/eu/ubitech/childrescue/volunteer/entity/Case.java
...in/java/eu/ubitech/childrescue/volunteer/entity/Case.java
+6
-0
app/src/main/java/eu/ubitech/childrescue/volunteer/fragment/CaseCardListFragment.java
.../childrescue/volunteer/fragment/CaseCardListFragment.java
+28
-24
app/src/main/java/eu/ubitech/childrescue/volunteer/fragment/DashboardFragment.java
...ech/childrescue/volunteer/fragment/DashboardFragment.java
+1
-1
app/src/main/java/eu/ubitech/childrescue/volunteer/fragment/FollowedCaseListFragment.java
...ldrescue/volunteer/fragment/FollowedCaseListFragment.java
+1
-1
app/src/main/java/eu/ubitech/childrescue/volunteer/fragment/TimelineFragment.java
...tech/childrescue/volunteer/fragment/TimelineFragment.java
+4
-2
app/src/main/java/eu/ubitech/childrescue/volunteer/rest/IChildRescueAPI.java
...u/ubitech/childrescue/volunteer/rest/IChildRescueAPI.java
+1
-0
app/src/main/java/eu/ubitech/childrescue/volunteer/util/Util.java
...main/java/eu/ubitech/childrescue/volunteer/util/Util.java
+17
-0
No files found.
app/src/main/java/eu/ubitech/childrescue/volunteer/CollaborationSpaceActivity.java
View file @
5973733f
...
...
@@ -9,6 +9,8 @@ import android.support.v7.widget.Toolbar;
import
android.util.Log
;
import
android.view.MenuItem
;
import
net.danlew.android.joda.JodaTimeAndroid
;
import
eu.ubitech.childrescue.volunteer.adapter.CollaborationTabAdapter
;
import
eu.ubitech.childrescue.volunteer.controller.AppController
;
import
eu.ubitech.childrescue.volunteer.fragment.PostFragment
;
...
...
@@ -25,6 +27,7 @@ public class CollaborationSpaceActivity extends AppCompatActivity {
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
JodaTimeAndroid
.
init
(
this
);
Bundle
bundle
=
getIntent
().
getExtras
();
if
(
bundle
!=
null
&&
bundle
.
containsKey
(
"message"
))
{
...
...
app/src/main/java/eu/ubitech/childrescue/volunteer/ConfirmProvideActivity.java
View file @
5973733f
package
eu.ubitech.childrescue.volunteer
;
import
android.app.ProgressDialog
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
...
...
@@ -11,12 +10,12 @@ import android.support.v7.app.AppCompatActivity;
import
android.util.Log
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
java.io.File
;
import
java.io.IOException
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
...
...
@@ -29,6 +28,7 @@ import eu.ubitech.childrescue.volunteer.entity.ProvidedFeedback;
import
eu.ubitech.childrescue.volunteer.pref.PreferenceManagement
;
import
eu.ubitech.childrescue.volunteer.rest.ChildRescueAPIClient
;
import
eu.ubitech.childrescue.volunteer.rest.IChildRescueAPI
;
import
eu.ubitech.childrescue.volunteer.util.Util
;
import
okhttp3.MediaType
;
import
okhttp3.MultipartBody
;
import
okhttp3.RequestBody
;
...
...
@@ -73,11 +73,15 @@ public class ConfirmProvideActivity extends AppCompatActivity {
RequestBody
description_rb
;
RequestBody
dateTime_rb
;
RequestBody
address_rb
;
RequestBody
address_feed_rb
;
MultipartBody
.
Part
image_mb
;
MultipartBody
.
Part
image_feed_mb
;
RequestBody
latitude_rb
;
RequestBody
longitude_rb
;
RequestBody
tag_rb
;
String
picturePath
=
null
;
String
picturePathFeed
=
null
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -144,7 +148,6 @@ public class ConfirmProvideActivity extends AppCompatActivity {
String
userLat
=
null
;
Double
caseLong
=
null
;
Double
caseLat
=
null
;
String
picturePath
;
Integer
userId
=
null
;
// properties needed by ProvideInformationActivity in order to properly handle submit.
...
...
@@ -163,11 +166,14 @@ public class ConfirmProvideActivity extends AppCompatActivity {
// properties needed by ProvidePostActivity in order to properly handle submit.
else
{
txtDescription
=
getIntent
().
getStringExtra
(
"txtDescription"
);
picturePath
=
getIntent
().
getStringExtra
(
"picturePath"
);
picturePath
Feed
=
getIntent
().
getStringExtra
(
"picturePath
Feed
"
);
}
Double
longitude
;
Double
latitude
;
Double
feedLongitude
=
null
;
Double
feedLatitude
=
null
;
String
feedAddress
=
null
;
Double
longitudeOnMapClick
=
null
;
Double
latitudeOnMapClick
=
null
;
String
isChecked
=
null
;
...
...
@@ -186,6 +192,20 @@ public class ConfirmProvideActivity extends AppCompatActivity {
longitude
=
getIntent
().
getDoubleExtra
(
"longitude"
,
0.0
);
latitude
=
getIntent
().
getDoubleExtra
(
"latitude"
,
0.0
);
isChecked
=
getIntent
().
getStringExtra
(
"isChecked"
);
if
(
isChecked
.
equals
(
"true"
))
{
feedLongitude
=
getIntent
().
getDoubleExtra
(
"longitude"
,
0.0
);
feedLatitude
=
getIntent
().
getDoubleExtra
(
"latitude"
,
0.0
);
try
{
feedAddress
=
Util
.
getAddress
(
feedLatitude
,
feedLongitude
,
this
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
else
{
feedLongitude
=
0.0
;
feedLatitude
=
0.0
;
feedAddress
=
""
;
}
}
//Get input location
...
...
@@ -231,11 +251,12 @@ public class ConfirmProvideActivity extends AppCompatActivity {
caseLat_rb
=
RequestBody
.
create
(
MediaType
.
parse
(
"text/plain"
),
String
.
valueOf
(
caseLat
));
}
else
{
longitude_rb
=
RequestBody
.
create
(
MediaType
.
parse
(
"text/plain"
),
String
.
valueOf
(
longitude
));
latitude_rb
=
RequestBody
.
create
(
MediaType
.
parse
(
"text/plain"
),
String
.
valueOf
(
latitude
));
longitude_rb
=
RequestBody
.
create
(
MediaType
.
parse
(
"text/plain"
),
String
.
valueOf
(
feedLongitude
));
latitude_rb
=
RequestBody
.
create
(
MediaType
.
parse
(
"text/plain"
),
String
.
valueOf
(
feedLatitude
));
address_feed_rb
=
RequestBody
.
create
(
MediaType
.
parse
(
"text/plain"
),
feedAddress
);
}
//Get path and rest info of the image
//Get path and rest info of the image
for feedback
if
(
picturePath
!=
null
&&
!
picturePath
.
isEmpty
())
{
//Create a file object using file path of image
File
file
=
new
File
(
picturePath
);
...
...
@@ -249,6 +270,20 @@ public class ConfirmProvideActivity extends AppCompatActivity {
image
.
setImageBitmap
(
myBitmap
);
}
//Get path and rest info of the image for post
if
(
picturePathFeed
!=
null
&&
!
picturePathFeed
.
isEmpty
())
{
//Create a file object using file path of image
File
file
=
new
File
(
picturePathFeed
);
// Create a request body with file and image media type
RequestBody
fileReqBody
=
RequestBody
.
create
(
MediaType
.
parse
(
"multipart/form-data"
),
file
);
// Create MultipartBody.Part using file request-body,file name and part name
image_feed_mb
=
MultipartBody
.
Part
.
createFormData
(
"image"
,
file
.
getName
(),
fileReqBody
);
// set image view placeholder to display the image
Bitmap
myBitmap
=
BitmapFactory
.
decodeFile
(
new
File
(
picturePathFeed
).
getAbsolutePath
());
image
.
setImageBitmap
(
myBitmap
);
}
// Create proper onClickListener based on which screen led us here...
if
(
from
.
equals
(
"ProvideInformationActivity"
))
{
String
finalUserLong
=
userLong
;
...
...
@@ -283,7 +318,7 @@ public class ConfirmProvideActivity extends AppCompatActivity {
tag_rb
=
RequestBody
.
create
(
MediaType
.
parse
(
"text/plain"
),
getIntent
().
getStringExtra
(
"tag"
));
if
(
preferenceManagement
!=
null
)
{
if
((
txtDescription
!=
null
&&
!
txtDescription
.
isEmpty
())
||
(
latitude
!=
null
&&
longitude
!=
null
))
{
provideFeed
(
longitude_rb
,
latitude_rb
,
tag_rb
,
description_rb
,
image
_mb
);
provideFeed
(
longitude_rb
,
latitude_rb
,
tag_rb
,
description_rb
,
address_feed_rb
,
image_feed
_mb
);
}
else
{
Toast
.
makeText
(
getApplicationContext
(),
"Please provide either description or location"
,
Toast
.
LENGTH_LONG
).
show
();
}
...
...
@@ -329,6 +364,9 @@ public class ConfirmProvideActivity extends AppCompatActivity {
else
{
String
finalIsChecked
=
isChecked
;
Double
finalFeedLongitude
=
feedLongitude
;
Double
finalFeedLatitude
=
feedLatitude
;
String
finalFeedAddress
=
feedAddress
;
btnCancel
.
setOnClickListener
(
view
->
{
// Go back to ProvidePostActivity
Intent
intent
=
new
Intent
(
...
...
@@ -340,9 +378,10 @@ public class ConfirmProvideActivity extends AppCompatActivity {
intent
.
putExtra
(
"description"
,
description_field
.
getText
());
intent
.
putExtra
(
"picturePath"
,
picturePath
);
intent
.
putExtra
(
"longitude"
,
longitude
);
intent
.
putExtra
(
"latitude"
,
latitude
);
intent
.
putExtra
(
"picturePathFeed"
,
picturePathFeed
);
intent
.
putExtra
(
"longitude"
,
finalFeedLongitude
);
intent
.
putExtra
(
"latitude"
,
finalFeedLatitude
);
intent
.
putExtra
(
"address"
,
finalFeedAddress
);
intent
.
putExtra
(
"txtDescription"
,
txtDescription
);
intent
.
putExtra
(
"isChecked"
,
finalIsChecked
);
...
...
@@ -424,11 +463,12 @@ public class ConfirmProvideActivity extends AppCompatActivity {
/**
* Function to send feed for a specific case(userId, caseId,
* userLong, userLat, tag, description, image)
* userLong, userLat, tag, description,
address ,
image)
*/
private
void
provideFeed
(
final
RequestBody
userLong
,
final
RequestBody
userLat
,
final
RequestBody
tag
,
final
RequestBody
description
,
final
MultipartBody
.
Part
image
)
{
final
RequestBody
description
,
final
RequestBody
address
,
final
MultipartBody
.
Part
image
)
{
PreferenceManagement
preferenceManagement
=
new
PreferenceManagement
();
apiService
=
ChildRescueAPIClient
.
getClient
(
preferenceManagement
.
getUserAuthToken
(
getApplicationContext
())).
create
(
IChildRescueAPI
.
class
);
...
...
@@ -439,7 +479,7 @@ public class ConfirmProvideActivity extends AppCompatActivity {
dialog
.
show
();
dialog
.
setIndeterminate
(
true
);
dialog
.
setIndeterminateDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
progressbar_handler
));
apiService
.
provideFeed
(
caseID
,
userLong
,
userLat
,
tag
,
description
,
image
).
enqueue
(
new
Callback
<
Post
>()
{
apiService
.
provideFeed
(
caseID
,
userLong
,
userLat
,
tag
,
description
,
address
,
image
).
enqueue
(
new
Callback
<
Post
>()
{
@Override
public
void
onResponse
(
Call
<
Post
>
call
,
retrofit2
.
Response
<
Post
>
response
)
{
...
...
app/src/main/java/eu/ubitech/childrescue/volunteer/ProvidePostActivity.java
View file @
5973733f
...
...
@@ -148,14 +148,14 @@ public class ProvidePostActivity extends AppCompatActivity implements AdapterVie
sendInfoData
();
if
(
getIntent
().
hasExtra
(
"from"
)){
picturePath
=
getIntent
().
getStringExtra
(
"picturePath"
);
picturePath
=
getIntent
().
getStringExtra
(
"picturePath
Feed
"
);
textDescription
=
getIntent
().
getStringExtra
(
"txtDescription"
);
txtDescription
.
setText
(
getIntent
().
getStringExtra
(
"txtDescription"
));
longitude
=
RequestBody
.
create
(
MediaType
.
parse
(
"text/plain"
),
String
.
valueOf
(
getIntent
().
getDoubleExtra
(
"longitude"
,
0.0
)));
latitude
=
RequestBody
.
create
(
MediaType
.
parse
(
"text/plain"
),
String
.
valueOf
(
getIntent
().
getDoubleExtra
(
"latitude"
,
0.0
)));
if
(
getIntent
().
getStringExtra
(
"picturePath"
)
!=
null
&&
!
getIntent
().
getStringExtra
(
"picturePath"
).
isEmpty
())
imageToUpload
.
setImageBitmap
(
BitmapFactory
.
decodeFile
(
new
File
(
getIntent
().
getStringExtra
(
"picturePath"
)).
getAbsolutePath
()));
if
(
getIntent
().
getStringExtra
(
"picturePath
Feed
"
)
!=
null
&&
!
getIntent
().
getStringExtra
(
"picturePath
Feed
"
).
isEmpty
())
imageToUpload
.
setImageBitmap
(
BitmapFactory
.
decodeFile
(
new
File
(
getIntent
().
getStringExtra
(
"picturePath
Feed
"
)).
getAbsolutePath
()));
}
}
...
...
@@ -229,7 +229,7 @@ public class ProvidePostActivity extends AppCompatActivity implements AdapterVie
intent
.
putExtra
(
"name"
,
name
);
intent
.
putExtra
(
"caseID"
,
caseID
);
intent
.
putExtra
(
"txtDescription"
,
txtDescription
.
getText
().
toString
().
trim
());
intent
.
putExtra
(
"picturePath"
,
picturePath
);
intent
.
putExtra
(
"picturePath
Feed
"
,
picturePath
);
intent
.
putExtra
(
"longitude"
,
Double
.
valueOf
(
preferenceManagement
.
getLongitude
(
getApplicationContext
())));
intent
.
putExtra
(
"latitude"
,
Double
.
valueOf
(
preferenceManagement
.
getLatitude
(
getApplicationContext
())));
intent
.
putExtra
(
"isChecked"
,
((
com
.
suke
.
widget
.
SwitchButton
)
findViewById
(
R
.
id
.
switch_button
)).
isChecked
()?
"true"
:
"false"
);
...
...
app/src/main/java/eu/ubitech/childrescue/volunteer/adapter/CaseCardListAdapter.java
View file @
5973733f
...
...
@@ -47,12 +47,15 @@ public class CaseCardListAdapter extends RecyclerView.Adapter<CaseCardListAdapte
this
.
context
=
context
;
this
.
casesList
=
new
ArrayList
<
Case
>();
this
.
origList
=
casesList
;
for
(
Case
c
:
origList
){
if
(
filter
[
c
.
getOrganization
()
-
1
]){
for
(
Case
c
:
origList
)
{
if
(
filter
[
c
.
getOrganization
()
-
1
])
{
casesList
.
add
(
c
);
}
}
}
public
Case
getPos
(
int
position
){
return
casesList
.
get
(
position
);
}
public
void
filterData
(
boolean
[]
filter
){
...
...
@@ -76,12 +79,7 @@ public class CaseCardListAdapter extends RecyclerView.Adapter<CaseCardListAdapte
public
void
onBindViewHolder
(
MyViewHolder
holder
,
final
int
position
)
{
final
Case
retrievedCase
=
casesList
.
get
(
position
);
if
(
retrievedCase
.
getFirstName
()
!=
null
&&
!
retrievedCase
.
getFirstName
().
isEmpty
()
&&
retrievedCase
.
getLastName
()
!=
null
&&
!
retrievedCase
.
getLastName
().
isEmpty
())
{
holder
.
name
.
setText
(
retrievedCase
.
getFirstName
()
+
" "
+
retrievedCase
.
getLastName
());
}
else
{
holder
.
name
.
setText
(
"Full name not available"
);
}
holder
.
name
.
setText
(
retrievedCase
.
getCustomName
());
if
(
null
!=
retrievedCase
.
getImage
()
&&
!
retrievedCase
.
getImage
().
isEmpty
())
{
Picasso
.
get
().
load
(
retrievedCase
.
getImage
())
...
...
app/src/main/java/eu/ubitech/childrescue/volunteer/adapter/FollowedCaseListAdapter.java
View file @
5973733f
...
...
@@ -106,10 +106,10 @@ public class FollowedCaseListAdapter extends RecyclerView.Adapter<FollowedCaseLi
public
void
onBindViewHolder
(
MyViewHolder
holder
,
final
int
position
)
{
final
Case
retrievedCase
=
casesList
.
get
(
position
);
if
(
retrievedCase
.
get
First
Name
()
!=
null
&&
!
retrievedCase
.
get
First
Name
().
isEmpty
()
&&
retrievedCase
.
getLastName
()
!=
null
&&
!
retrievedCase
.
getLastName
().
isEmpty
())
{
holder
.
name
.
setText
(
retrievedCase
.
getFirstName
()
+
" "
+
retrievedCase
.
getLastName
());
}
else
{
if
(
retrievedCase
.
get
Custom
Name
()
!=
null
&&
!
retrievedCase
.
get
Custom
Name
().
isEmpty
()
)
{
holder
.
name
.
setText
(
retrievedCase
.
getCustomName
());
}
else
{
holder
.
name
.
setText
(
"Full name not available"
);
}
...
...
app/src/main/java/eu/ubitech/childrescue/volunteer/adapter/PostsListAdapter.java
View file @
5973733f
...
...
@@ -72,7 +72,7 @@ public class PostsListAdapter extends RecyclerView.Adapter<PostsListAdapter.MyVi
if
(
null
!=
info
.
getImage
()
&&
!
info
.
getImage
().
isEmpty
())
{
Picasso
.
get
()
.
load
(
"https://childrescuedemo.s5labs.eu/media/"
+
info
.
getImage
())
.
load
(
info
.
getImage
())
.
networkPolicy
(
NetworkPolicy
.
OFFLINE
)
.
into
(
holder
.
thumbnail
,
new
Callback
()
{
@Override
...
...
@@ -84,7 +84,7 @@ public class PostsListAdapter extends RecyclerView.Adapter<PostsListAdapter.MyVi
public
void
onError
(
Exception
e
)
{
//Try again online if cache failed
Picasso
.
get
()
.
load
(
"https://childrescuedemo.s5labs.eu/media/"
+
info
.
getImage
())
.
load
(
info
.
getImage
())
.
into
(
holder
.
thumbnail
,
new
Callback
()
{
@Override
public
void
onSuccess
()
{
...
...
app/src/main/java/eu/ubitech/childrescue/volunteer/adapter/TimelineAdapter.java
View file @
5973733f
...
...
@@ -17,6 +17,7 @@ import com.github.vipulasri.timelineview.TimelineView;
import
com.google.android.gms.maps.model.BitmapDescriptorFactory
;
import
org.joda.time.DateTime
;
import
org.joda.time.DateTimeZone
;
import
org.joda.time.MutableDateTime
;
import
org.joda.time.format.DateTimeFormat
;
import
org.joda.time.format.DateTimeFormatter
;
...
...
@@ -25,6 +26,7 @@ import com.squareup.picasso.NetworkPolicy;
import
com.squareup.picasso.Picasso
;
import
java.util.List
;
import
java.util.TimeZone
;
import
eu.ubitech.childrescue.volunteer.R
;
import
eu.ubitech.childrescue.volunteer.entity.Post
;
...
...
@@ -57,7 +59,7 @@ public class TimelineAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
MutableDateTime
test
=
MutableDateTime
.
parse
(
postList
.
get
(
position
).
getUpdated
());
DateTimeFormatter
fmt
=
DateTimeFormat
.
forPattern
(
"HH:mm dd/MM/yyyy"
);
DateTimeFormatter
fmt
=
DateTimeFormat
.
forPattern
(
"HH:mm dd/MM/yyyy"
)
.
withZone
(
DateTimeZone
.
forTimeZone
(
TimeZone
.
getDefault
()))
;
((
ViewHolder
)
holder
).
textViewTime
.
setText
(
fmt
.
print
(
test
));
...
...
app/src/main/java/eu/ubitech/childrescue/volunteer/entity/Case.java
View file @
5973733f
...
...
@@ -12,6 +12,8 @@ public class Case implements Serializable {
@SerializedName
(
"id"
)
Integer
id
;
@SerializedName
(
"custom_name"
)
String
customName
;
@SerializedName
(
"profile_photo"
)
String
image
;
@SerializedName
(
"description"
)
...
...
@@ -51,6 +53,10 @@ public class Case implements Serializable {
public
Case
()
{
}
public
String
getCustomName
(){
return
customName
;
}
public
Integer
getId
()
{
return
id
;
}
...
...
app/src/main/java/eu/ubitech/childrescue/volunteer/fragment/CaseCardListFragment.java
View file @
5973733f
...
...
@@ -104,8 +104,9 @@ public class CaseCardListFragment extends Fragment {
ItemClickSupport
.
addTo
(
recyclerView
)
.
setOnItemClickListener
((
recyclerView
,
position
,
v
)
->
{
Case
cur
=
mAdapter
.
getPos
(
position
);
Intent
intent
=
new
Intent
(
v
.
getContext
(),
CaseActivity
.
class
);
String
name
=
mAdapter
.
getCase
(
position
).
get
FirstName
()
+
" "
+
mAdapter
.
getCase
(
position
).
getLast
Name
();
String
name
=
mAdapter
.
getCase
(
position
).
get
Custom
Name
();
String
childHeight
=
mAdapter
.
getCase
(
position
).
getHeight
();
String
weight
=
mAdapter
.
getCase
(
position
).
getWeight
();
String
stature
=
mAdapter
.
getCase
(
position
).
getStature
();
...
...
@@ -258,17 +259,18 @@ public class CaseCardListFragment extends Fragment {
call
.
enqueue
(
new
Callback
<
List
<
Case
>>()
{
@Override
public
void
onResponse
(
Call
<
List
<
Case
>>
call
,
Response
<
List
<
Case
>>
response
)
{
List
<
Case
>
activeCases
=
new
ArrayList
<>();
List
<
Case
>
cases
=
response
.
body
();
if
(
cases
!=
null
&&
!
cases
.
isEmpty
())
{
//Sort post by date
Collections
.
sort
(
cases
,
(
lhs
,
rhs
)
->
{
// -1 - less than, 1 - greater than, 0 - equal, all inversed for descending
return
lhs
.
getId
()
>
rhs
.
getId
()
?
-
1
:
(
lhs
.
getId
()
<
rhs
.
getId
())
?
1
:
0
;
});
for
(
Case
retrievedCase
:
cases
)
{
if
(
retrievedCase
.
getStatus
().
equals
(
"active"
))
{
try
{
List
<
Case
>
activeCases
=
new
ArrayList
<>();
List
<
Case
>
cases
=
response
.
body
();
if
(
cases
!=
null
&&
!
cases
.
isEmpty
())
{
//Sort post by date
Collections
.
sort
(
cases
,
(
lhs
,
rhs
)
->
{
// -1 - less than, 1 - greater than, 0 - equal, all inversed for descending
return
lhs
.
getId
()
>
rhs
.
getId
()
?
-
1
:
(
lhs
.
getId
()
<
rhs
.
getId
())
?
1
:
0
;
});
for
(
Case
retrievedCase
:
cases
)
{
if
(
retrievedCase
.
getStatus
().
equals
(
"active"
))
{
activeCases
.
add
(
retrievedCase
);
// adding activities to cart list
...
...
@@ -278,21 +280,23 @@ public class CaseCardListFragment extends Fragment {
// refreshing recycler view
mAdapter
.
notifyDataSetChanged
();
// stop animating Shimmer and hide the layout
mShimmerViewContainer
.
stopShimmerAnimation
();
mShimmerViewContainer
.
setVisibility
(
View
.
GONE
);
// stop animating Shimmer and hide the layout
mShimmerViewContainer
.
stopShimmerAnimation
();
mShimmerViewContainer
.
setVisibility
(
View
.
GONE
);
}
}
}
else
{
emptyCard
=
view
.
findViewById
(
R
.
id
.
card_view_no_case
);
emptyCard
.
setVisibility
(
View
.
VISIBLE
);
//Toast.makeText(view.getContext(), R.string.message_no_alerts, Toast.LENGTH_LONG).show();
// stop animating Shimmer and hide the layout
mShimmerViewContainer
.
stopShimmerAnimation
();
mShimmerViewContainer
.
setVisibility
(
View
.
GONE
);
}
}
else
{
emptyCard
=
view
.
findViewById
(
R
.
id
.
card_view_no_case
);
emptyCard
.
setVisibility
(
View
.
VISIBLE
);
//Toast.makeText(view.getContext(), R.string.message_no_alerts, Toast.LENGTH_LONG).show();
// stop animating Shimmer and hide the layout
mShimmerViewContainer
.
stopShimmerAnimation
();
mShimmerViewContainer
.
setVisibility
(
View
.
GONE
);
progressDialog
.
dismiss
();
//dialog.dismiss();
}
progressDialog
.
dismiss
();
//dialog.dismiss();
catch
(
Error
ignored
){}
}
@Override
...
...
app/src/main/java/eu/ubitech/childrescue/volunteer/fragment/DashboardFragment.java
View file @
5973733f
...
...
@@ -208,7 +208,7 @@ public class DashboardFragment extends Fragment {
return
;
}
Intent
intent
=
new
Intent
(
v
.
getContext
(),
CaseActivity
.
class
);
String
name
=
clickedCase
.
get
FirstName
()
+
" "
+
clickedCase
.
getLast
Name
();
String
name
=
clickedCase
.
get
Custom
Name
();
String
childHeight
=
clickedCase
.
getHeight
();
String
weight
=
clickedCase
.
getWeight
();
String
stature
=
clickedCase
.
getStature
();
...
...
app/src/main/java/eu/ubitech/childrescue/volunteer/fragment/FollowedCaseListFragment.java
View file @
5973733f
...
...
@@ -99,7 +99,7 @@ public class FollowedCaseListFragment extends Fragment {
ItemClickSupport
.
addTo
(
recyclerView
)
.
setOnItemClickListener
((
recyclerView
,
position
,
v
)
->
{
Intent
intent
=
new
Intent
(
v
.
getContext
(),
CaseActivity
.
class
);
String
name
=
casesListActive
.
get
(
position
).
get
FirstName
()
+
" "
+
casesListActive
.
get
(
position
).
getLast
Name
();
String
name
=
casesListActive
.
get
(
position
).
get
Custom
Name
();
String
height
=
casesListActive
.
get
(
position
).
getHeight
();
String
weight
=
casesListActive
.
get
(
position
).
getWeight
();
String
eyeColor
=
casesListActive
.
get
(
position
).
getEyeColor
();
...
...
app/src/main/java/eu/ubitech/childrescue/volunteer/fragment/TimelineFragment.java
View file @
5973733f
...
...
@@ -28,6 +28,7 @@ import com.google.android.gms.maps.model.LatLngBounds;
import
com.google.android.gms.maps.model.Marker
;
import
com.google.android.gms.maps.model.MarkerOptions
;
import
org.joda.time.DateTimeZone
;
import
org.joda.time.MutableDateTime
;
import
org.joda.time.format.DateTimeFormat
;
import
org.joda.time.format.DateTimeFormatter
;
...
...
@@ -35,6 +36,7 @@ import org.joda.time.format.DateTimeFormatter;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.TimeZone
;
import
java.util.Timer
;
import
java.util.TimerTask
;
...
...
@@ -304,7 +306,7 @@ public class TimelineFragment extends Fragment implements OnMapReadyCallback, On
//Get long and lat
if
(
longitude
!=
null
&&
latitude
!=
null
&&
retrievedPost
.
getUpdated
()
!=
null
&&
radius
!=
null
)
{
MutableDateTime
time
=
MutableDateTime
.
parse
(
retrievedPost
.
getUpdated
());
DateTimeFormatter
fmt
=
DateTimeFormat
.
forPattern
(
"HH:mm dd/MM/yyyy"
);
DateTimeFormatter
fmt
=
DateTimeFormat
.
forPattern
(
"HH:mm dd/MM/yyyy"
)
.
withZone
(
DateTimeZone
.
forTimeZone
(
TimeZone
.
getDefault
()))
;
String
updated
=
fmt
.
print
((
time
));
...
...
@@ -422,7 +424,7 @@ public class TimelineFragment extends Fragment implements OnMapReadyCallback, On
//Get long and lat
if
(
longitude
!=
null
&&
latitude
!=
null
&&
retrievedPost
.
getUpdated
()
!=
null
&&
radius
!=
null
)
{
MutableDateTime
time
=
MutableDateTime
.
parse
(
retrievedPost
.
getUpdated
());
DateTimeFormatter
fmt
=
DateTimeFormat
.
forPattern
(
"HH:mm dd/MM/yyyy"
);
DateTimeFormatter
fmt
=
DateTimeFormat
.
forPattern
(
"HH:mm dd/MM/yyyy"
)
.
withZone
(
DateTimeZone
.
forTimeZone
(
TimeZone
.
getDefault
()))
;
String
updated
=
fmt
.
print
((
time
));
...
...
app/src/main/java/eu/ubitech/childrescue/volunteer/rest/IChildRescueAPI.java
View file @
5973733f
...
...
@@ -158,6 +158,7 @@ public interface IChildRescueAPI {
@Part
(
"latitude"
)
RequestBody
userLat
,
@Part
(
"tag"
)
RequestBody
tag
,
@Part
(
"description"
)
RequestBody
description
,
@Part
(
"address"
)
RequestBody
address
,
@Part
MultipartBody
.
Part
image
);
}
app/src/main/java/eu/ubitech/childrescue/volunteer/util/Util.java
View file @
5973733f
...
...
@@ -7,6 +7,8 @@ import android.content.Context;
import
android.content.Intent
;
import
android.content.res.Configuration
;
import
android.content.res.Resources
;
import
android.location.Address
;
import
android.location.Geocoder
;
import
android.location.Location
;
import
android.os.Build
;
import
android.support.v4.app.Fragment
;
...
...
@@ -468,6 +470,21 @@ public class Util {
preferenceManagement
.
storeCurrentLanguage
(
context
,
localeName
);
}
/**
* Get Address
*/
public
static
String
getAddress
(
Double
latitude
,
Double
longitude
,
Context
context
)
throws
IOException
{
Geocoder
geocoder
;
List
<
Address
>
addresses
;
geocoder
=
new
Geocoder
(
context
,
Locale
.
getDefault
());
addresses
=
geocoder
.
getFromLocation
(
latitude
,
longitude
,
1
);
String
address
=
addresses
.
get
(
0
).
getAddressLine
(
0
);
return
address
;
}
/**
* Check if user is currently followed
*/
...
...
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