Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
baby-monitoring-android-app
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
R24-145
baby-monitoring-android-app
Commits
6cd9fbc3
Commit
6cd9fbc3
authored
Sep 07, 2024
by
Ishankha K.C
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/chamod_dev' into 'master'
Feature/chamod dev See merge request
!2
parents
5619cc28
52101e08
Changes
45
Show whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
3076 additions
and
85 deletions
+3076
-85
.idea/deploymentTargetDropDown.xml
.idea/deploymentTargetDropDown.xml
+1
-14
.idea/gradle.xml
.idea/gradle.xml
+1
-1
.idea/inspectionProfiles/Project_Default.xml
.idea/inspectionProfiles/Project_Default.xml
+1
-1
.idea/vcs.xml
.idea/vcs.xml
+1
-1
app/build.gradle.kts
app/build.gradle.kts
+4
-0
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+8
-0
app/src/main/java/com/kaluwa/enterprises/babycare/MainActivity.java
...in/java/com/kaluwa/enterprises/babycare/MainActivity.java
+1
-12
app/src/main/java/com/kaluwa/enterprises/babycare/activities/BabyDashboardActivity.java
...nterprises/babycare/activities/BabyDashboardActivity.java
+367
-0
app/src/main/java/com/kaluwa/enterprises/babycare/activities/DashboardActivity.java
...wa/enterprises/babycare/activities/DashboardActivity.java
+30
-0
app/src/main/java/com/kaluwa/enterprises/babycare/activities/UserProfileActivity.java
.../enterprises/babycare/activities/UserProfileActivity.java
+224
-6
app/src/main/java/com/kaluwa/enterprises/babycare/activities/auth/LoginActivity.java
...a/enterprises/babycare/activities/auth/LoginActivity.java
+1
-12
app/src/main/java/com/kaluwa/enterprises/babycare/adapter/BabyDashboardAdapter.java
...wa/enterprises/babycare/adapter/BabyDashboardAdapter.java
+120
-0
app/src/main/java/com/kaluwa/enterprises/babycare/config/ApiConfig.java
...ava/com/kaluwa/enterprises/babycare/config/ApiConfig.java
+17
-2
app/src/main/java/com/kaluwa/enterprises/babycare/config/TokenSaver.java
...va/com/kaluwa/enterprises/babycare/config/TokenSaver.java
+1
-1
app/src/main/java/com/kaluwa/enterprises/babycare/dialogs/AddBabyDialog.java
...om/kaluwa/enterprises/babycare/dialogs/AddBabyDialog.java
+260
-0
app/src/main/java/com/kaluwa/enterprises/babycare/dialogs/EditBabyDialog.java
...m/kaluwa/enterprises/babycare/dialogs/EditBabyDialog.java
+303
-0
app/src/main/java/com/kaluwa/enterprises/babycare/dto/BabyDto.java
...ain/java/com/kaluwa/enterprises/babycare/dto/BabyDto.java
+57
-0
app/src/main/java/com/kaluwa/enterprises/babycare/dto/UserDto.java
...ain/java/com/kaluwa/enterprises/babycare/dto/UserDto.java
+3
-0
app/src/main/java/com/kaluwa/enterprises/babycare/dto/responseDto/AuthenticationDto.java
...terprises/babycare/dto/responseDto/AuthenticationDto.java
+1
-1
app/src/main/java/com/kaluwa/enterprises/babycare/dto/responseDto/ResponseDto.java
...uwa/enterprises/babycare/dto/responseDto/ResponseDto.java
+13
-0
app/src/main/java/com/kaluwa/enterprises/babycare/dto/responseDto/TokenDto.java
...kaluwa/enterprises/babycare/dto/responseDto/TokenDto.java
+1
-1
app/src/main/java/com/kaluwa/enterprises/babycare/service/AuthApiService.java
...m/kaluwa/enterprises/babycare/service/AuthApiService.java
+1
-2
app/src/main/java/com/kaluwa/enterprises/babycare/service/BabyApiService.java
...m/kaluwa/enterprises/babycare/service/BabyApiService.java
+25
-0
app/src/main/java/com/kaluwa/enterprises/babycare/service/UserApiService.java
...m/kaluwa/enterprises/babycare/service/UserApiService.java
+12
-0
app/src/main/java/com/kaluwa/enterprises/babycare/utils/Utils.java
...ain/java/com/kaluwa/enterprises/babycare/utils/Utils.java
+187
-0
app/src/main/res/anim/fade_in.xml
app/src/main/res/anim/fade_in.xml
+1
-1
app/src/main/res/anim/fade_out.xml
app/src/main/res/anim/fade_out.xml
+1
-1
app/src/main/res/drawable/baby_profile.jpg
app/src/main/res/drawable/baby_profile.jpg
+0
-0
app/src/main/res/drawable/borders.xml
app/src/main/res/drawable/borders.xml
+8
-0
app/src/main/res/drawable/ic_add_32.xml
app/src/main/res/drawable/ic_add_32.xml
+12
-0
app/src/main/res/drawable/ico_unverified.png
app/src/main/res/drawable/ico_unverified.png
+0
-0
app/src/main/res/drawable/ico_verified.png
app/src/main/res/drawable/ico_verified.png
+0
-0
app/src/main/res/layout/activity_baby_dashboard.xml
app/src/main/res/layout/activity_baby_dashboard.xml
+116
-0
app/src/main/res/layout/activity_login.xml
app/src/main/res/layout/activity_login.xml
+2
-2
app/src/main/res/layout/activity_register.xml
app/src/main/res/layout/activity_register.xml
+6
-6
app/src/main/res/layout/activity_user_profile.xml
app/src/main/res/layout/activity_user_profile.xml
+32
-15
app/src/main/res/layout/add_baby_view_layout.xml
app/src/main/res/layout/add_baby_view_layout.xml
+525
-0
app/src/main/res/layout/baby_rv_item.xml
app/src/main/res/layout/baby_rv_item.xml
+128
-0
app/src/main/res/layout/edit_baby_view_layout.xml
app/src/main/res/layout/edit_baby_view_layout.xml
+544
-0
app/src/main/res/values-night/strings.xml
app/src/main/res/values-night/strings.xml
+12
-0
app/src/main/res/values-night/styles.xml
app/src/main/res/values-night/styles.xml
+13
-0
app/src/main/res/values/strings.xml
app/src/main/res/values/strings.xml
+9
-0
app/src/main/res/values/styles.xml
app/src/main/res/values/styles.xml
+14
-0
app/src/main/res/xml/network_security_config.xml
app/src/main/res/xml/network_security_config.xml
+1
-0
gradle/libs.versions.toml
gradle/libs.versions.toml
+12
-6
No files found.
.idea/deploymentTargetDropDown.xml
View file @
6cd9fbc3
...
...
@@ -3,20 +3,7 @@
<component
name=
"deploymentTargetDropDown"
>
<value>
<entry
key=
"app"
>
<State>
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type
value=
"RUNNING_DEVICE_TARGET"
/>
<deviceKey>
<Key>
<type
value=
"SERIAL_NUMBER"
/>
<value
value=
"adb-AYAV6R3925006878-kh1m4J._adb-tls-connect._tcp"
/>
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown
value=
"2024-05-18T11:27:38.975164100Z"
/>
</State>
<State
/>
</entry>
</value>
</component>
...
...
.idea/gradle.xml
View file @
6cd9fbc3
...
...
@@ -5,7 +5,7 @@
<option
name=
"linkedExternalProjectsSettings"
>
<GradleProjectSettings>
<option
name=
"externalProjectPath"
value=
"$PROJECT_DIR$"
/>
<option
name=
"gradleJvm"
value=
"
#GRADLE_LOCAL_JAVA_HOME
"
/>
<option
name=
"gradleJvm"
value=
"
jbr-17
"
/>
<option
name=
"modules"
>
<set>
<option
value=
"$PROJECT_DIR$"
/>
...
...
.idea/inspectionProfiles/Project_Default.xml
View file @
6cd9fbc3
...
...
@@ -2,7 +2,7 @@
<profile
version=
"1.0"
>
<option
name=
"myName"
value=
"Project Default"
/>
<inspection_tool
class=
"AutoCloseableResource"
enabled=
"true"
level=
"WARNING"
enabled_by_default=
"true"
>
<option
name=
"METHOD_MATCHER_CONFIG"
value=
"java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,retrofit2.Response,errorBody"
/>
<option
name=
"METHOD_MATCHER_CONFIG"
value=
"java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,retrofit2.Response,errorBody
|body
"
/>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
.idea/vcs.xml
View file @
6cd9fbc3
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"
$PROJECT_DIR$
"
vcs=
"Git"
/>
<mapping
directory=
""
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
app/build.gradle.kts
View file @
6cd9fbc3
...
...
@@ -43,6 +43,10 @@ dependencies {
implementation
(
libs
.
retrofit2
)
implementation
(
libs
.
convertor
.
gson
)
implementation
(
libs
.
jackson
.
databind
)
implementation
(
libs
.
ucrop
)
implementation
(
libs
.
swiperefreshlayout
)
implementation
(
libs
.
converter
.
jackson
)
implementation
(
libs
.
jackson
.
datatype
.
jsr310
)
testImplementation
(
libs
.
junit
)
androidTestImplementation
(
libs
.
ext
.
junit
)
androidTestImplementation
(
libs
.
espresso
.
core
)
...
...
app/src/main/AndroidManifest.xml
View file @
6cd9fbc3
...
...
@@ -4,6 +4,7 @@
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.READ_MEDIA_IMAGES"
/>
<application
android:allowBackup=
"true"
...
...
@@ -16,6 +17,13 @@
android:supportsRtl=
"true"
android:theme=
"@style/Theme.BabyCare"
tools:targetApi=
"31"
>
<activity
android:name=
".activities.BabyDashboardActivity"
android:exported=
"false"
/>
<activity
android:name=
"com.yalantis.ucrop.UCropActivity"
android:screenOrientation=
"fullSensor"
android:theme=
"@style/Theme.AppCompat.Light.NoActionBar"
/>
<activity
android:name=
".activities.UserProfileActivity"
android:exported=
"false"
/>
...
...
app/src/main/java/com/kaluwa/enterprises/babycare/MainActivity.java
View file @
6cd9fbc3
...
...
@@ -7,26 +7,15 @@ import android.content.Intent;
import
android.os.Bundle
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.google.android.material.snackbar.Snackbar
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.util.Log
;
import
android.view.View
;
import
androidx.navigation.NavController
;
import
androidx.navigation.Navigation
;
import
androidx.navigation.ui.AppBarConfiguration
;
import
androidx.navigation.ui.NavigationUI
;
import
com.kaluwa.enterprises.babycare.activities.DashboardActivity
;
import
com.kaluwa.enterprises.babycare.activities.auth.LoginActivity
;
import
com.kaluwa.enterprises.babycare.config.TokenSaver
;
import
com.kaluwa.enterprises.babycare.databinding.ActivityMainBinding
;
import
com.kaluwa.enterprises.babycare.dto.AuthenticationDto
;
import
com.kaluwa.enterprises.babycare.dto.responseDto.AuthenticationDto
;
import
android.view.Menu
;
import
android.view.MenuItem
;
import
android.widget.Button
;
import
android.widget.Toast
;
...
...
app/src/main/java/com/kaluwa/enterprises/babycare/activities/BabyDashboardActivity.java
0 → 100644
View file @
6cd9fbc3
package
com.kaluwa.enterprises.babycare.activities
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
config
.
TokenSaver
.
clearToken
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
config
.
TokenSaver
.
getToken
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
animationChanger
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
loader
;
import
android.annotation.SuppressLint
;
import
android.app.AlertDialog
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.Gravity
;
import
android.view.Menu
;
import
android.view.MenuInflater
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.widget.PopupMenu
;
import
androidx.appcompat.widget.Toolbar
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.github.ybq.android.spinkit.SpinKitView
;
import
com.google.android.material.floatingactionbutton.FloatingActionButton
;
import
com.google.gson.Gson
;
import
com.kaluwa.enterprises.babycare.MainActivity
;
import
com.kaluwa.enterprises.babycare.R
;
import
com.kaluwa.enterprises.babycare.adapter.BabyDashboardAdapter
;
import
com.kaluwa.enterprises.babycare.config.ApiConfig
;
import
com.kaluwa.enterprises.babycare.dialogs.AddBabyDialog
;
import
com.kaluwa.enterprises.babycare.dialogs.EditBabyDialog
;
import
com.kaluwa.enterprises.babycare.dto.BabyDto
;
import
com.kaluwa.enterprises.babycare.dto.responseDto.AuthenticationDto
;
import
com.kaluwa.enterprises.babycare.error.ErrorDto
;
import
com.kaluwa.enterprises.babycare.service.BabyApiService
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.List
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
import
retrofit2.Response
;
public
class
BabyDashboardActivity
extends
AppCompatActivity
implements
AddBabyDialog
.
BabyDialogInterface
,
EditBabyDialog
.
EditBabyDialogInterface
{
private
final
static
String
TAG
=
"BabyDashboardActivity"
;
private
SwipeRefreshLayout
swipeContainer
;
private
AuthenticationDto
authDto
;
private
RecyclerView
recyclerView
;
private
FloatingActionButton
floatingAddButton
;
private
TextView
tvNoContent
;
private
View
overlay
;
private
SpinKitView
progressbar
;
private
BabyApiService
babyApiService
;
private
BabyDashboardAdapter
adapter
;
private
List
<
BabyDto
>
babyDtoList
=
new
ArrayList
<>();
@SuppressLint
(
"NewApi"
)
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_baby_dashboard
);
// define actionbar
defineActionbar
();
swipeToRefresh
();
// initialize user api service
try
{
authDto
=
getToken
(
getApplicationContext
());
}
catch
(
JsonProcessingException
e
)
{
Log
.
e
(
TAG
,
"Error: "
+
e
.
getMessage
());
Toast
.
makeText
(
this
,
"Error getting token, Please refresh"
,
Toast
.
LENGTH_SHORT
).
show
();
}
babyApiService
=
ApiConfig
.
getInstance
().
getBabyApi
(
authDto
.
getTokenDto
().
getToken
());
// assign ids here
recyclerView
=
findViewById
(
R
.
id
.
baby_dash_rv
);
floatingAddButton
=
findViewById
(
R
.
id
.
fab_baby_add
);
tvNoContent
=
findViewById
(
R
.
id
.
no_content_message
);
overlay
=
findViewById
(
R
.
id
.
overlay
);
progressbar
=
findViewById
(
R
.
id
.
progress_bar
);
// load data
loadData
();
adapter
=
new
BabyDashboardAdapter
(
this
,
babyDtoList
);
recyclerView
.
setAdapter
(
adapter
);
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
this
));
// add button enable
floatingAddButton
.
setOnClickListener
(
v
->
{
openAddBabyDialog
();
});
}
private
void
loadData
()
{
Call
<
List
<
BabyDto
>>
call
=
babyApiService
.
getAllBabies
();
loader
(
overlay
,
progressbar
,
true
);
noContentCall
();
call
.
enqueue
(
new
Callback
<
List
<
BabyDto
>>()
{
@Override
public
void
onResponse
(
Call
<
List
<
BabyDto
>>
call
,
Response
<
List
<
BabyDto
>>
response
)
{
if
(
response
.
isSuccessful
())
{
List
<
BabyDto
>
newBabyDtoList
=
new
ArrayList
<>();
if
(
response
.
body
()
!=
null
)
{
newBabyDtoList
=
response
.
body
();
}
// Assuming babyDtoList is a class member
// Check for changes and update the list accordingly
if
(
babyDtoList
==
null
)
{
babyDtoList
=
newBabyDtoList
;
adapter
.
notifyItemRangeInserted
(
0
,
newBabyDtoList
.
size
());
}
else
{
// Here, you might want to implement a diffing algorithm
// For simplicity, let's assume you replace the entire list
babyDtoList
.
clear
();
babyDtoList
.
addAll
(
newBabyDtoList
);
adapter
.
notifyDataSetChanged
();
}
noContentCall
();
loader
(
overlay
,
progressbar
,
false
);
}
else
{
try
{
Gson
gson
=
new
Gson
();
assert
response
.
errorBody
()
!=
null
;
String
errorBodyString
=
response
.
errorBody
().
string
();
// Check if the error body is in JSON format
if
(
errorBodyString
.
startsWith
(
"{"
))
{
ErrorDto
errorDto
=
gson
.
fromJson
(
errorBodyString
,
ErrorDto
.
class
);
Toast
.
makeText
(
BabyDashboardActivity
.
this
,
errorDto
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
}
else
{
// If the error body is not in JSON format, display a generic error message
Log
.
e
(
TAG
,
errorBodyString
);
Toast
.
makeText
(
BabyDashboardActivity
.
this
,
"An unexpected error occurred"
,
Toast
.
LENGTH_LONG
).
show
();
}
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"else-error: "
+
e
.
getMessage
());
Toast
.
makeText
(
BabyDashboardActivity
.
this
,
e
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
}
noContentCall
();
loader
(
overlay
,
progressbar
,
false
);
}
}
@Override
public
void
onFailure
(
Call
<
List
<
BabyDto
>>
call
,
Throwable
throwable
)
{
noContentCall
();
Log
.
e
(
TAG
,
throwable
.
getMessage
());
Toast
.
makeText
(
BabyDashboardActivity
.
this
,
"Error to Failure"
,
Toast
.
LENGTH_LONG
).
show
();
loader
(
overlay
,
progressbar
,
false
);
}
});
}
private
void
openAddBabyDialog
()
{
AddBabyDialog
addbabyDialog
=
new
AddBabyDialog
();
addbabyDialog
.
show
(
getSupportFragmentManager
(),
"ADD_BABY_DIALOG"
);
}
private
void
defineActionbar
()
{
Toolbar
toolbar
=
findViewById
(
R
.
id
.
b_care_action_bar
);
setSupportActionBar
(
toolbar
);
if
(
getSupportActionBar
()
!=
null
)
{
getSupportActionBar
().
setDisplayShowTitleEnabled
(
false
);
}
toolbar
.
setNavigationIcon
(
R
.
drawable
.
ico_menu_32
);
toolbar
.
setNavigationOnClickListener
(
v
->
{
// Initializing the popup menu and giving the reference as current context
PopupMenu
popupMenu
=
new
PopupMenu
(
this
,
toolbar
);
popupMenu
.
setGravity
(
Gravity
.
BOTTOM
);
popupMenu
.
getMenuInflater
().
inflate
(
R
.
menu
.
menu_main
,
popupMenu
.
getMenu
());
popupMenu
.
setOnMenuItemClickListener
(
item
->
{
int
id
=
item
.
getItemId
();
if
(
id
==
R
.
id
.
mm_device_setting
)
{
Toast
.
makeText
(
this
,
"You Clicked "
+
item
.
getTitle
(),
Toast
.
LENGTH_SHORT
).
show
();
}
else
if
(
id
==
R
.
id
.
mm_app_setting
)
{
Toast
.
makeText
(
this
,
"You Clicked "
+
item
.
getTitle
(),
Toast
.
LENGTH_SHORT
).
show
();
}
else
if
(
id
==
R
.
id
.
mm_logout
)
{
clearToken
(
getApplicationContext
());
Toast
.
makeText
(
this
,
"Logout successful."
,
Toast
.
LENGTH_SHORT
).
show
();
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
|
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
startActivity
(
intent
);
finish
();
animationChanger
(
this
);
}
return
true
;
});
popupMenu
.
show
();
});
}
private
void
swipeToRefresh
()
{
// Look up for the swipe container
swipeContainer
=
findViewById
(
R
.
id
.
swipeContainer
);
// Setup Refresh Listener which triggers new data loading
swipeContainer
.
setOnRefreshListener
(()
->
{
// Code to refresh goes here. Make sure to call swipeContainer.setRefresh(false) once the refreshed.
startActivity
(
getIntent
());
finish
();
overridePendingTransition
(
0
,
0
);
swipeContainer
.
setRefreshing
(
false
);
});
// Configure refresh colors
swipeContainer
.
setColorSchemeResources
(
android
.
R
.
color
.
holo_blue_bright
,
android
.
R
.
color
.
holo_green_light
,
android
.
R
.
color
.
holo_orange_light
,
android
.
R
.
color
.
holo_red_light
);
}
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
MenuInflater
inflater
=
getMenuInflater
();
inflater
.
inflate
(
R
.
menu
.
user_action_menu
,
menu
);
return
true
;
}
@Override
public
boolean
onOptionsItemSelected
(
@NonNull
MenuItem
item
)
{
int
id
=
item
.
getItemId
();
if
(
id
==
R
.
id
.
user
)
{
Intent
intent
=
new
Intent
(
this
,
UserProfileActivity
.
class
);
startActivity
(
intent
);
animationChanger
(
this
);
}
else
{
Toast
.
makeText
(
this
,
"No item."
,
Toast
.
LENGTH_SHORT
).
show
();
}
return
super
.
onOptionsItemSelected
(
item
);
}
@Override
public
void
onBackPressed
()
{
super
.
onBackPressed
();
animationChanger
(
this
);
}
@Override
public
void
parseValues
(
BabyDto
baby
,
AlertDialog
dialog
,
View
overlay
,
SpinKitView
progressbar
)
{
baby
.
setUserId
(
authDto
.
getUserId
());
Button
positiveBtn
=
dialog
.
getButton
(
DialogInterface
.
BUTTON_POSITIVE
);
Button
negativeBtn
=
dialog
.
getButton
(
DialogInterface
.
BUTTON_NEGATIVE
);
loader
(
overlay
,
progressbar
,
true
);
positiveBtn
.
setEnabled
(
false
);
negativeBtn
.
setEnabled
(
false
);
Call
<
BabyDto
>
call
=
babyApiService
.
addBaby
(
baby
);
call
.
enqueue
(
new
Callback
<
BabyDto
>()
{
@Override
public
void
onResponse
(
Call
<
BabyDto
>
call
,
Response
<
BabyDto
>
response
)
{
if
(
response
.
isSuccessful
())
{
loadData
();
Toast
.
makeText
(
BabyDashboardActivity
.
this
,
"New baby added to your list."
,
Toast
.
LENGTH_SHORT
).
show
();
dialog
.
dismiss
();
loader
(
overlay
,
progressbar
,
false
);
}
else
{
try
{
Gson
gson
=
new
Gson
();
assert
response
.
errorBody
()
!=
null
;
String
errorBodyString
=
response
.
errorBody
().
string
();
// Check if the error body is in JSON format
if
(
errorBodyString
.
startsWith
(
"{"
))
{
ErrorDto
errorDto
=
gson
.
fromJson
(
errorBodyString
,
ErrorDto
.
class
);
Toast
.
makeText
(
BabyDashboardActivity
.
this
,
errorDto
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
}
else
{
// If the error body is not in JSON format, display a generic error message
Log
.
e
(
TAG
,
errorBodyString
);
Toast
.
makeText
(
BabyDashboardActivity
.
this
,
"An unexpected error occurred"
,
Toast
.
LENGTH_LONG
).
show
();
}
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"else-error: "
+
e
.
getMessage
());
Toast
.
makeText
(
BabyDashboardActivity
.
this
,
e
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
}
positiveBtn
.
setEnabled
(
true
);
negativeBtn
.
setEnabled
(
true
);
loader
(
overlay
,
progressbar
,
false
);
}
}
@Override
public
void
onFailure
(
Call
<
BabyDto
>
call
,
Throwable
throwable
)
{
Toast
.
makeText
(
BabyDashboardActivity
.
this
,
"Error to Failure"
,
Toast
.
LENGTH_LONG
).
show
();
positiveBtn
.
setEnabled
(
true
);
negativeBtn
.
setEnabled
(
true
);
loader
(
overlay
,
progressbar
,
false
);
}
});
// TODO
// make photo selector
// make dropdowns
}
@Override
public
void
parseValuesForEdit
(
BabyDto
baby
,
AlertDialog
dialog
,
View
overlay
,
SpinKitView
progressbar
)
{
baby
.
setUserId
(
authDto
.
getUserId
());
Button
positiveBtn
=
dialog
.
getButton
(
DialogInterface
.
BUTTON_POSITIVE
);
Button
negativeBtn
=
dialog
.
getButton
(
DialogInterface
.
BUTTON_NEGATIVE
);
loader
(
overlay
,
progressbar
,
true
);
positiveBtn
.
setEnabled
(
false
);
negativeBtn
.
setEnabled
(
false
);
Call
<
BabyDto
>
call
=
babyApiService
.
updateBaby
(
baby
.
getBabyId
(),
baby
);
call
.
enqueue
(
new
Callback
<
BabyDto
>()
{
@Override
public
void
onResponse
(
Call
<
BabyDto
>
call
,
Response
<
BabyDto
>
response
)
{
if
(
response
.
isSuccessful
())
{
loadData
();
Toast
.
makeText
(
BabyDashboardActivity
.
this
,
"Baby Details were successfully updated."
,
Toast
.
LENGTH_LONG
).
show
();
dialog
.
dismiss
();
loader
(
overlay
,
progressbar
,
false
);
}
else
{
try
{
Gson
gson
=
new
Gson
();
assert
response
.
errorBody
()
!=
null
;
String
errorBodyString
=
response
.
errorBody
().
string
();
// Check if the error body is in JSON format
if
(
errorBodyString
.
startsWith
(
"{"
))
{
ErrorDto
errorDto
=
gson
.
fromJson
(
errorBodyString
,
ErrorDto
.
class
);
Toast
.
makeText
(
BabyDashboardActivity
.
this
,
errorDto
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
}
else
{
// If the error body is not in JSON format, display a generic error message
Log
.
e
(
TAG
,
errorBodyString
);
Toast
.
makeText
(
BabyDashboardActivity
.
this
,
"An unexpected error occurred"
,
Toast
.
LENGTH_LONG
).
show
();
}
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"else-error: "
+
e
.
getMessage
());
Toast
.
makeText
(
BabyDashboardActivity
.
this
,
e
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
}
positiveBtn
.
setEnabled
(
true
);
negativeBtn
.
setEnabled
(
true
);
loader
(
overlay
,
progressbar
,
false
);
}
}
@Override
public
void
onFailure
(
Call
<
BabyDto
>
call
,
Throwable
throwable
)
{
Toast
.
makeText
(
BabyDashboardActivity
.
this
,
throwable
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
positiveBtn
.
setEnabled
(
true
);
negativeBtn
.
setEnabled
(
true
);
loader
(
overlay
,
progressbar
,
false
);
}
});
// TODO
// make photo selector
// make dropdowns
}
void
noContentCall
()
{
if
(
babyDtoList
.
isEmpty
())
{
tvNoContent
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
tvNoContent
.
setVisibility
(
View
.
GONE
);
}
}
}
\ No newline at end of file
app/src/main/java/com/kaluwa/enterprises/babycare/activities/DashboardActivity.java
View file @
6cd9fbc3
...
...
@@ -9,6 +9,7 @@ import android.view.Gravity;
import
android.view.Menu
;
import
android.view.MenuInflater
;
import
android.view.MenuItem
;
import
android.widget.LinearLayout
;
import
android.widget.Toast
;
import
androidx.annotation.NonNull
;
...
...
@@ -22,6 +23,8 @@ import com.kaluwa.enterprises.babycare.activities.auth.LoginActivity;
public
class
DashboardActivity
extends
AppCompatActivity
{
LinearLayout
btn1
,
btn2
,
btn3
,
btn4
,
btn5
,
btn6
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -29,6 +32,33 @@ public class DashboardActivity extends AppCompatActivity {
// define actionbar
defineActionbar
();
btn1
=
findViewById
(
R
.
id
.
btn_camera
);
btn2
=
findViewById
(
R
.
id
.
btn_vocal
);
btn3
=
findViewById
(
R
.
id
.
btn_notifications
);
btn4
=
findViewById
(
R
.
id
.
btn_device_controls
);
btn5
=
findViewById
(
R
.
id
.
btn_about_baby
);
btn6
=
findViewById
(
R
.
id
.
btn_settings
);
btn1
.
setOnClickListener
(
v
->
{
});
btn2
.
setOnClickListener
(
v
->
{
});
btn3
.
setOnClickListener
(
v
->
{
});
btn4
.
setOnClickListener
(
v
->
{
});
btn5
.
setOnClickListener
(
v
->
{
Intent
intent
=
new
Intent
(
this
,
BabyDashboardActivity
.
class
);
startActivity
(
intent
);
});
btn6
.
setOnClickListener
(
v
->
{
});
}
private
void
defineActionbar
()
{
...
...
app/src/main/java/com/kaluwa/enterprises/babycare/activities/UserProfileActivity.java
View file @
6cd9fbc3
...
...
@@ -3,11 +3,19 @@ package com.kaluwa.enterprises.babycare.activities;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
config
.
TokenSaver
.
clearToken
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
config
.
TokenSaver
.
getToken
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
animationChanger
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
convertByteArrayToBitmap
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
disableEditText
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
getDateTimeFormatter
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
loader
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
mobileNumberValidation
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
setUpDOBPicker
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.util.Log
;
...
...
@@ -18,8 +26,11 @@ import android.view.MenuItem;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.ImageView
;
import
android.widget.Toast
;
import
androidx.activity.result.ActivityResultLauncher
;
import
androidx.activity.result.contract.ActivityResultContracts
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.widget.PopupMenu
;
...
...
@@ -27,18 +38,30 @@ import androidx.appcompat.widget.Toolbar;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.github.ybq.android.spinkit.SpinKitView
;
import
com.google.android.material.imageview.ShapeableImageView
;
import
com.google.gson.Gson
;
import
com.kaluwa.enterprises.babycare.MainActivity
;
import
com.kaluwa.enterprises.babycare.R
;
import
com.kaluwa.enterprises.babycare.config.ApiConfig
;
import
com.kaluwa.enterprises.babycare.dto.AuthenticationDto
;
import
com.kaluwa.enterprises.babycare.dto.UserDto
;
import
com.kaluwa.enterprises.babycare.dto.responseDto.AuthenticationDto
;
import
com.kaluwa.enterprises.babycare.dto.responseDto.ResponseDto
;
import
com.kaluwa.enterprises.babycare.error.ErrorDto
;
import
com.kaluwa.enterprises.babycare.service.UserApiService
;
import
com.kaluwa.enterprises.babycare.utils.Utils
;
import
com.yalantis.ucrop.UCrop
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.InputStream
;
import
java.time.LocalDate
;
import
java.util.Objects
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
okhttp3.MediaType
;
import
okhttp3.MultipartBody
;
import
okhttp3.RequestBody
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
import
retrofit2.Response
;
...
...
@@ -46,12 +69,17 @@ import retrofit2.Response;
public
class
UserProfileActivity
extends
AppCompatActivity
{
private
final
static
String
TAG
=
"UserProfileActivity"
;
private
EditText
etFirstName
,
etLastName
,
etType
,
etEmail
,
etMobile
;
private
EditText
etFirstName
,
etLastName
,
etType
,
etEmail
,
etMobile
,
etDob
;
private
ImageView
ivVerifiedStatus
;
private
ShapeableImageView
ivProfilePicture
;
private
Button
btnEdit
,
btnCancel
;
private
SpinKitView
progressBar
;
private
View
overlay
;
private
UserApiService
userApiService
;
private
AuthenticationDto
authDto
;
private
ActivityResultLauncher
<
Intent
>
pickImageLauncher
;
private
ActivityResultLauncher
<
Intent
>
cropImageLauncher
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -64,7 +92,7 @@ public class UserProfileActivity extends AppCompatActivity {
try
{
authDto
=
getToken
(
getApplicationContext
());
}
catch
(
JsonProcessingException
e
)
{
Log
.
e
(
TAG
,
"Error: "
+
e
.
getMessage
());
Log
.
e
(
TAG
,
"Error: "
+
e
.
getMessage
());
Toast
.
makeText
(
this
,
"Error getting token, Please refresh"
,
Toast
.
LENGTH_SHORT
).
show
();
}
userApiService
=
ApiConfig
.
getInstance
().
getUserApi
(
authDto
.
getTokenDto
().
getToken
());
...
...
@@ -78,11 +106,18 @@ public class UserProfileActivity extends AppCompatActivity {
etType
=
findViewById
(
R
.
id
.
up_et_type
);
etEmail
=
findViewById
(
R
.
id
.
up_et_email
);
etMobile
=
findViewById
(
R
.
id
.
up_et_mobile
);
etDob
=
findViewById
(
R
.
id
.
up_et_dob
);
ivVerifiedStatus
=
findViewById
(
R
.
id
.
up_im_email_verification_status
);
ivProfilePicture
=
findViewById
(
R
.
id
.
up_iv_profile_image
);
// buttons
btnEdit
=
findViewById
(
R
.
id
.
l_btn_edit
);
btnCancel
=
findViewById
(
R
.
id
.
l_btn_cancel
);
// register launchers
launcherReg
();
// disable all edit texts
// call custom date-picker
disableET
();
AtomicBoolean
enableEdit
=
new
AtomicBoolean
(
false
);
btnCancel
.
setOnClickListener
(
v
->
{
...
...
@@ -91,6 +126,7 @@ public class UserProfileActivity extends AppCompatActivity {
btnCancel
.
setVisibility
(
View
.
GONE
);
btnEdit
.
setText
(
R
.
string
.
edit_btn_value
);
btnEdit
.
setBackgroundResource
(
R
.
drawable
.
positive_btn_background
);
etDob
.
setOnClickListener
(
null
);
});
btnEdit
.
setOnClickListener
(
v
->
{
if
(!
enableEdit
.
get
())
{
...
...
@@ -99,6 +135,7 @@ public class UserProfileActivity extends AppCompatActivity {
btnCancel
.
setVisibility
(
View
.
VISIBLE
);
btnEdit
.
setText
(
R
.
string
.
update_btn_value
);
btnEdit
.
setBackgroundResource
(
R
.
drawable
.
green_btn_background
);
setUpDOBPicker
(
etDob
,
this
);
}
else
{
// validate text
UserDto
user
=
validate
();
...
...
@@ -108,6 +145,170 @@ public class UserProfileActivity extends AppCompatActivity {
}
}
});
// open image selector
ivProfilePicture
.
setOnClickListener
(
v
->
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_PICK
,
android
.
provider
.
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
);
pickImageLauncher
.
launch
(
intent
);
});
}
private
void
launcherReg
()
{
// Register the ActivityResultLauncher for picking an image
pickImageLauncher
=
registerForActivityResult
(
new
ActivityResultContracts
.
StartActivityForResult
(),
result
->
{
if
(
result
.
getResultCode
()
==
Activity
.
RESULT_OK
)
{
Intent
data
=
result
.
getData
();
if
(
data
!=
null
)
{
Uri
selectedImageUri
=
data
.
getData
();
if
(
selectedImageUri
!=
null
)
{
startCrop
(
selectedImageUri
);
}
}
}
});
// Register the ActivityResultLauncher for cropping the image
cropImageLauncher
=
registerForActivityResult
(
new
ActivityResultContracts
.
StartActivityForResult
(),
result
->
{
if
(
result
.
getResultCode
()
==
Activity
.
RESULT_OK
)
{
Intent
data
=
result
.
getData
();
if
(
data
!=
null
)
{
Uri
resultUri
=
UCrop
.
getOutput
(
data
);
if
(
resultUri
!=
null
)
{
// Upload the cropped image to the server
uploadImageToServer
(
resultUri
);
}
}
}
else
if
(
result
.
getResultCode
()
==
UCrop
.
RESULT_ERROR
)
{
final
Throwable
cropError
=
UCrop
.
getError
(
result
.
getData
());
// Handle the error
Toast
.
makeText
(
this
,
"Something went wrong: "
+
cropError
.
getMessage
(),
Toast
.
LENGTH_SHORT
).
show
();
}
});
}
private
void
uploadImageToServer
(
Uri
imageUri
)
{
Bitmap
originalBitmap
=
BitmapFactory
.
decodeFile
(
imageUri
.
getPath
());
int
maxWidth
=
800
;
// Set your desired maximum width
int
maxHeight
=
800
;
// Set your desired maximum height
Bitmap
resizedBitmap
=
Bitmap
.
createScaledBitmap
(
originalBitmap
,
maxWidth
,
maxHeight
,
true
);
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
resizedBitmap
.
compress
(
Bitmap
.
CompressFormat
.
JPEG
,
80
,
outputStream
);
// Adjust the quality (80 is just an example)
byte
[]
compressedData
=
outputStream
.
toByteArray
();
// Create RequestBody for the compressed image
RequestBody
requestFile
=
RequestBody
.
create
(
MediaType
.
parse
(
"image/jpeg"
),
compressedData
);
MultipartBody
.
Part
body
=
MultipartBody
.
Part
.
createFormData
(
"image"
,
"image.jpg"
,
requestFile
);
Call
<
ResponseDto
>
call
=
userApiService
.
uploadUserImage
(
authDto
.
getUserId
(),
body
);
call
.
enqueue
(
new
Callback
<
ResponseDto
>()
{
@Override
public
void
onResponse
(
Call
<
ResponseDto
>
call
,
Response
<
ResponseDto
>
response
)
{
if
(
response
.
isSuccessful
())
{
loadUserProfileImage
();
loader
(
overlay
,
progressBar
,
false
);
}
else
{
try
{
Gson
gson
=
new
Gson
();
assert
response
.
errorBody
()
!=
null
;
String
errorBodyString
=
response
.
errorBody
().
string
();
// Check if the error body is in JSON format
if
(
errorBodyString
.
startsWith
(
"{"
))
{
ErrorDto
errorDto
=
gson
.
fromJson
(
errorBodyString
,
ErrorDto
.
class
);
Toast
.
makeText
(
UserProfileActivity
.
this
,
errorDto
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
}
else
{
// If the error body is not in JSON format, display a generic error message
Log
.
e
(
TAG
,
errorBodyString
);
Toast
.
makeText
(
UserProfileActivity
.
this
,
"An unexpected error occurred"
,
Toast
.
LENGTH_LONG
).
show
();
}
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"else-error: "
+
e
.
getMessage
());
Toast
.
makeText
(
UserProfileActivity
.
this
,
e
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
}
loader
(
overlay
,
progressBar
,
false
);
}
}
@Override
public
void
onFailure
(
Call
<
ResponseDto
>
call
,
Throwable
t
)
{
Toast
.
makeText
(
UserProfileActivity
.
this
,
"Error to Failure"
,
Toast
.
LENGTH_LONG
).
show
();
loader
(
overlay
,
progressBar
,
false
);
}
});
}
private
void
loadUserProfileImage
()
{
Call
<
ResponseBody
>
call
=
userApiService
.
getImage
(
authDto
.
getUserId
());
call
.
enqueue
(
new
Callback
<
ResponseBody
>()
{
@Override
public
void
onResponse
(
Call
<
ResponseBody
>
call
,
Response
<
ResponseBody
>
response
)
{
if
(
response
.
isSuccessful
())
{
try
{
if
(
response
.
body
()
!=
null
)
{
InputStream
inputStream
=
response
.
body
().
byteStream
();
Bitmap
bitmap
=
convertByteArrayToBitmap
(
inputStream
);
ivProfilePicture
.
setImageBitmap
(
bitmap
);
}
else
{
Log
.
e
(
TAG
,
"Response body is null"
);
}
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"Error occurred: "
+
e
.
getMessage
());
Toast
.
makeText
(
UserProfileActivity
.
this
,
e
.
getMessage
(),
Toast
.
LENGTH_SHORT
).
show
();
}
loader
(
overlay
,
progressBar
,
false
);
}
else
{
try
{
Gson
gson
=
new
Gson
();
assert
response
.
errorBody
()
!=
null
;
String
errorBodyString
=
response
.
errorBody
().
string
();
// Check if the error body is in JSON format
if
(
errorBodyString
.
startsWith
(
"{"
))
{
ErrorDto
errorDto
=
gson
.
fromJson
(
errorBodyString
,
ErrorDto
.
class
);
Toast
.
makeText
(
UserProfileActivity
.
this
,
errorDto
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
}
else
{
// If the error body is not in JSON format, display a generic error message
Log
.
e
(
TAG
,
errorBodyString
);
Toast
.
makeText
(
UserProfileActivity
.
this
,
"An unexpected error occurred"
,
Toast
.
LENGTH_LONG
).
show
();
}
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"else-error: "
+
e
.
getMessage
());
Toast
.
makeText
(
UserProfileActivity
.
this
,
e
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
}
loader
(
overlay
,
progressBar
,
false
);
}
}
@Override
public
void
onFailure
(
Call
<
ResponseBody
>
call
,
Throwable
t
)
{
Toast
.
makeText
(
UserProfileActivity
.
this
,
"Error to Failure"
,
Toast
.
LENGTH_LONG
).
show
();
loader
(
overlay
,
progressBar
,
false
);
}
});
}
private
void
startCrop
(
@NonNull
Uri
uri
)
{
// Generate a unique destination file name based on current time
String
destinationFileName
=
"CroppedImage_"
+
System
.
currentTimeMillis
()
+
".jpg"
;
UCrop
uCrop
=
UCrop
.
of
(
uri
,
Uri
.
fromFile
(
new
File
(
getCacheDir
(),
destinationFileName
)));
uCrop
.
withAspectRatio
(
1
,
1
);
uCrop
.
withOptions
(
getUCropOptions
());
cropImageLauncher
.
launch
(
uCrop
.
getIntent
(
this
));
}
private
UCrop
.
Options
getUCropOptions
()
{
UCrop
.
Options
options
=
new
UCrop
.
Options
();
options
.
setCircleDimmedLayer
(
true
);
options
.
setShowCropFrame
(
false
);
options
.
setShowCropGrid
(
false
);
return
options
;
}
private
void
updateUser
(
UserDto
user
,
AtomicBoolean
enableEdit
)
{
...
...
@@ -122,6 +323,7 @@ public class UserProfileActivity extends AppCompatActivity {
btnCancel
.
setVisibility
(
View
.
GONE
);
btnEdit
.
setText
(
R
.
string
.
edit_btn_value
);
btnEdit
.
setBackgroundResource
(
R
.
drawable
.
positive_btn_background
);
etDob
.
setOnClickListener
(
null
);
Toast
.
makeText
(
UserProfileActivity
.
this
,
"User details successfully updated."
,
Toast
.
LENGTH_SHORT
).
show
();
loader
(
overlay
,
progressBar
,
false
);
}
else
{
...
...
@@ -140,7 +342,7 @@ public class UserProfileActivity extends AppCompatActivity {
Toast
.
makeText
(
UserProfileActivity
.
this
,
"An unexpected error occurred"
,
Toast
.
LENGTH_LONG
).
show
();
}
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
e
.
getMessage
());
Log
.
e
(
TAG
,
"else-error: "
+
e
.
getMessage
());
Toast
.
makeText
(
UserProfileActivity
.
this
,
e
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
}
loader
(
overlay
,
progressBar
,
false
);
...
...
@@ -155,6 +357,7 @@ public class UserProfileActivity extends AppCompatActivity {
});
}
@SuppressLint
(
"NewApi"
)
private
UserDto
validate
()
{
UserDto
userDto
=
new
UserDto
();
String
firstName
,
lastName
,
mobileNumber
;
...
...
@@ -180,6 +383,10 @@ public class UserProfileActivity extends AppCompatActivity {
userDto
.
setFirstName
(
firstName
);
userDto
.
setLastName
(
lastName
);
userDto
.
setPhone
(
mobileNumber
);
if
(!
TextUtils
.
isEmpty
(
etDob
.
getText
().
toString
()))
{
LocalDate
dob
=
LocalDate
.
parse
(
etDob
.
getText
().
toString
(),
getDateTimeFormatter
());
userDto
.
setDob
(
dob
);
}
}
return
userDto
;
...
...
@@ -189,15 +396,23 @@ public class UserProfileActivity extends AppCompatActivity {
loader
(
overlay
,
progressBar
,
true
);
Call
<
UserDto
>
call
=
userApiService
.
getUserById
(
authDto
.
getUserId
());
call
.
enqueue
(
new
Callback
<
UserDto
>()
{
@SuppressLint
(
"NewApi"
)
@Override
public
void
onResponse
(
Call
<
UserDto
>
call
,
Response
<
UserDto
>
response
)
{
if
(
response
.
isSuccessful
())
{
UserDto
user
=
response
.
body
();
etFirstName
.
setText
(
user
.
getFirstName
());
etLastName
.
setText
(
user
.
getLastName
());
etType
.
setText
(!
Objects
.
equals
(
user
.
getRole
(),
"USER"
)
?
user
.
getRole
()
:
"PARENT"
);
etType
.
setText
(!
Objects
.
equals
(
user
.
getRole
(),
"USER"
)
?
user
.
getRole
()
:
"PARENT"
);
etEmail
.
setText
(
user
.
getEmail
());
ivVerifiedStatus
.
setImageDrawable
(
user
.
getStatus
().
equals
(
"NEW"
)
?
getDrawable
(
R
.
drawable
.
ico_unverified
)
:
getDrawable
(
R
.
drawable
.
ico_verified
));
etMobile
.
setText
(
user
.
getPhone
());
if
(
user
.
getDob
()
!=
null
)
{
LocalDate
localDate
=
Utils
.
getLocalDate
(
user
.
getDob
());
if
(
localDate
!=
null
)
{
etDob
.
setText
(
localDate
.
format
(
getDateTimeFormatter
()));
}
}
loader
(
overlay
,
progressBar
,
false
);
}
else
{
try
{
...
...
@@ -224,7 +439,8 @@ public class UserProfileActivity extends AppCompatActivity {
@Override
public
void
onFailure
(
Call
<
UserDto
>
call
,
Throwable
t
)
{
Toast
.
makeText
(
UserProfileActivity
.
this
,
"Error to Failure"
,
Toast
.
LENGTH_LONG
).
show
();
Log
.
e
(
TAG
,
t
.
getMessage
());
Toast
.
makeText
(
UserProfileActivity
.
this
,
"Load data Error to Failure"
,
Toast
.
LENGTH_LONG
).
show
();
loader
(
overlay
,
progressBar
,
false
);
}
});
...
...
@@ -236,6 +452,7 @@ public class UserProfileActivity extends AppCompatActivity {
disableEditText
(
etType
,
false
,
this
);
disableEditText
(
etEmail
,
false
,
this
);
disableEditText
(
etMobile
,
false
,
this
);
disableEditText
(
etDob
,
false
,
this
);
}
private
void
enableET
()
{
...
...
@@ -282,6 +499,7 @@ public class UserProfileActivity extends AppCompatActivity {
super
.
onStart
();
// load data
loadData
();
loadUserProfileImage
();
}
@Override
...
...
app/src/main/java/com/kaluwa/enterprises/babycare/activities/auth/LoginActivity.java
View file @
6cd9fbc3
package
com.kaluwa.enterprises.babycare.activities.auth
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
config
.
TokenSaver
.
getToken
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
config
.
TokenSaver
.
setToken
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
animationChanger
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
emailAddressValidation
;
...
...
@@ -16,29 +15,19 @@ import android.widget.EditText;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
androidx.activity.EdgeToEdge
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.core.graphics.Insets
;
import
androidx.core.view.ViewCompat
;
import
androidx.core.view.WindowInsetsCompat
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.github.ybq.android.spinkit.SpinKitView
;
import
com.google.gson.Gson
;
import
com.kaluwa.enterprises.babycare.R
;
import
com.kaluwa.enterprises.babycare.activities.DashboardActivity
;
import
com.kaluwa.enterprises.babycare.activities.UserProfileActivity
;
import
com.kaluwa.enterprises.babycare.config.ApiConfig
;
import
com.kaluwa.enterprises.babycare.dto.AuthenticationDto
;
import
com.kaluwa.enterprises.babycare.dto.
responseDto.
AuthenticationDto
;
import
com.kaluwa.enterprises.babycare.dto.LoginRequest
;
import
com.kaluwa.enterprises.babycare.dto.UserDto
;
import
com.kaluwa.enterprises.babycare.error.ErrorDto
;
import
com.kaluwa.enterprises.babycare.service.AuthApiService
;
import
java.io.IOException
;
import
java.util.Objects
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
import
retrofit2.Response
;
...
...
app/src/main/java/com/kaluwa/enterprises/babycare/adapter/BabyDashboardAdapter.java
0 → 100644
View file @
6cd9fbc3
package
com.kaluwa.enterprises.babycare.adapter
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
babyAgeCalculate
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
calculateAge
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
convertByteArrayToBitmap
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.Color
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
androidx.annotation.NonNull
;
import
androidx.constraintlayout.widget.ConstraintLayout
;
import
androidx.fragment.app.FragmentActivity
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.google.android.material.imageview.ShapeableImageView
;
import
com.kaluwa.enterprises.babycare.R
;
import
com.kaluwa.enterprises.babycare.activities.UserProfileActivity
;
import
com.kaluwa.enterprises.babycare.dialogs.EditBabyDialog
;
import
com.kaluwa.enterprises.babycare.dto.BabyDto
;
import
java.io.InputStream
;
import
java.time.LocalDate
;
import
java.util.List
;
public
class
BabyDashboardAdapter
extends
RecyclerView
.
Adapter
<
BabyDashboardAdapter
.
BabyDashboardItemHolder
>
{
private
final
static
String
TAG
=
"BabyDashboardAdapter"
;
private
Context
context
;
private
List
<
BabyDto
>
babyList
;
public
BabyDashboardAdapter
(
Context
context
,
List
<
BabyDto
>
babyList
)
{
this
.
context
=
context
;
this
.
babyList
=
babyList
;
}
@NonNull
@Override
public
BabyDashboardAdapter
.
BabyDashboardItemHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
View
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
baby_rv_item
,
parent
,
false
);
return
new
BabyDashboardAdapter
.
BabyDashboardItemHolder
(
view
);
}
@SuppressLint
(
"SetTextI18n"
)
@Override
public
void
onBindViewHolder
(
@NonNull
BabyDashboardAdapter
.
BabyDashboardItemHolder
holder
,
int
position
)
{
BabyDto
babyDto
=
babyList
.
get
(
position
);
String
firstname
=
babyDto
.
getFirstName
();
String
lastname
=
babyDto
.
getLastName
();
LocalDate
dob
=
babyDto
.
getDob
();
String
sex
=
babyDto
.
getSex
();
String
notes
=
babyDto
.
getNotes
();
Boolean
isActive
=
babyDto
.
getIsActive
();
InputStream
imageData
=
babyDto
.
getImageData
();
if
(
lastname
!=
null
)
{
holder
.
tvBabyName
.
setText
(
firstname
+
" "
+
lastname
);
}
else
{
holder
.
tvBabyName
.
setText
(
firstname
);
}
String
age
=
babyAgeCalculate
(
dob
);
holder
.
tvBabyAge
.
setText
(
age
!=
null
?
age
:
"Not Available"
);
holder
.
tvBabySex
.
setText
(
sex
);
if
(!
TextUtils
.
isEmpty
(
notes
))
{
holder
.
tvBabyDDespContent
.
setText
(
notes
);
}
else
{
holder
.
tvBabyDDespTitle
.
setText
(
"Status >"
);
holder
.
tvBabyDDespContent
.
setTextColor
(
isActive
?
context
.
getResources
().
getColor
(
R
.
color
.
success_green
)
:
context
.
getResources
().
getColor
(
R
.
color
.
cancel_red
));
holder
.
tvBabyDDespContent
.
setText
(
isActive
?
"Active"
:
"Inactive"
);
}
if
(
imageData
!=
null
)
{
try
{
Bitmap
bitmap
=
convertByteArrayToBitmap
(
imageData
);
holder
.
ivBabyImage
.
setImageBitmap
(
bitmap
);
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"Error occurred: "
+
e
.
getMessage
());
Toast
.
makeText
(
context
,
e
.
getMessage
(),
Toast
.
LENGTH_SHORT
).
show
();
}
}
// Handle item click
holder
.
clBabyItem
.
setOnClickListener
(
v
->
{
// Open the EditBabyDialog with the selected BabyDto
EditBabyDialog
editBabyDialog
=
new
EditBabyDialog
(
babyDto
);
// Assuming context is an activity, cast it to FragmentActivity to get supportFragmentManager
editBabyDialog
.
show
(((
FragmentActivity
)
context
).
getSupportFragmentManager
(),
"EDIT_BABY_DIALOG"
);
});
}
@Override
public
int
getItemCount
()
{
return
babyList
.
size
();
}
public
static
class
BabyDashboardItemHolder
extends
RecyclerView
.
ViewHolder
{
public
ConstraintLayout
clBabyItem
;
public
TextView
tvBabyName
,
tvBabyAge
,
tvBabySex
,
tvBabyDDespTitle
,
tvBabyDDespContent
;
public
ShapeableImageView
ivBabyImage
;
public
BabyDashboardItemHolder
(
@NonNull
View
view
)
{
super
(
view
);
clBabyItem
=
view
.
findViewById
(
R
.
id
.
baby_item
);
tvBabyName
=
view
.
findViewById
(
R
.
id
.
baby_item_name
);
tvBabyAge
=
view
.
findViewById
(
R
.
id
.
baby_item_tv_age_content
);
tvBabySex
=
view
.
findViewById
(
R
.
id
.
baby_item_tv_sex_content
);
tvBabyDDespTitle
=
view
.
findViewById
(
R
.
id
.
baby_item_tv_desp_title
);
tvBabyDDespContent
=
view
.
findViewById
(
R
.
id
.
baby_item_tv_desp_content
);
ivBabyImage
=
view
.
findViewById
(
R
.
id
.
baby_item_iv_image
);
}
}
}
app/src/main/java/com/kaluwa/enterprises/babycare/config/ApiConfig.java
View file @
6cd9fbc3
...
...
@@ -2,13 +2,18 @@ package com.kaluwa.enterprises.babycare.config;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
config
.
TokenSaver
.
getToken
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
;
import
com.kaluwa.enterprises.babycare.service.AuthApiService
;
import
com.kaluwa.enterprises.babycare.service.BabyApiService
;
import
com.kaluwa.enterprises.babycare.service.UserApiService
;
import
okhttp3.OkHttpClient
;
import
okhttp3.Request
;
import
retrofit2.Retrofit
;
import
retrofit2.converter.gson.GsonConverterFactory
;
import
retrofit2.converter.jackson.JacksonConverterFactory
;
public
class
ApiConfig
{
private
static
final
String
BASE_URL
=
"http://192.168.1.2:8080/api/v1/baby-care/"
;
...
...
@@ -19,9 +24,14 @@ public class ApiConfig {
private
ApiConfig
()
{
OkHttpClient
authHttpClient
=
new
OkHttpClient
.
Builder
().
build
();
ObjectMapper
mapper
=
new
ObjectMapper
();
mapper
.
registerModule
(
new
JavaTimeModule
());
mapper
.
disable
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
);
mapper
.
configure
(
SerializationFeature
.
FAIL_ON_EMPTY_BEANS
,
false
);
retrofitAuth
=
new
Retrofit
.
Builder
()
.
baseUrl
(
BASE_URL
)
.
addConverterFactory
(
GsonConverterFactory
.
create
(
))
.
addConverterFactory
(
JacksonConverterFactory
.
create
(
mapper
))
.
client
(
authHttpClient
)
.
build
();
...
...
@@ -36,7 +46,7 @@ public class ApiConfig {
.
build
();
retrofitOther
=
new
Retrofit
.
Builder
()
.
baseUrl
(
BASE_URL
)
.
addConverterFactory
(
GsonConverterFactory
.
create
(
))
.
addConverterFactory
(
JacksonConverterFactory
.
create
(
mapper
))
.
client
(
otherHttpClient
)
.
build
();
}
...
...
@@ -56,4 +66,9 @@ public class ApiConfig {
AUTH_TOKEN
=
JWTToken
;
return
retrofitOther
.
create
(
UserApiService
.
class
);
}
public
BabyApiService
getBabyApi
(
String
JWTToken
)
{
AUTH_TOKEN
=
JWTToken
;
return
retrofitOther
.
create
(
BabyApiService
.
class
);
}
}
app/src/main/java/com/kaluwa/enterprises/babycare/config/TokenSaver.java
View file @
6cd9fbc3
...
...
@@ -5,7 +5,7 @@ import android.content.SharedPreferences;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.kaluwa.enterprises.babycare.dto.AuthenticationDto
;
import
com.kaluwa.enterprises.babycare.dto.
responseDto.
AuthenticationDto
;
public
class
TokenSaver
{
private
final
static
String
SHARED_PREF_NAME
=
"net.kaluwa.SHARED_PREF_NAME"
;
...
...
app/src/main/java/com/kaluwa/enterprises/babycare/dialogs/AddBabyDialog.java
0 → 100644
View file @
6cd9fbc3
package
com.kaluwa.enterprises.babycare.dialogs
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
dpToPx
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
getDateTimeFormatter
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
setUpDatePicker
;
import
android.annotation.SuppressLint
;
import
android.app.AlertDialog
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.util.DisplayMetrics
;
import
android.view.Gravity
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.WindowManager
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.ImageButton
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.appcompat.app.AppCompatDialogFragment
;
import
androidx.appcompat.widget.SwitchCompat
;
import
com.github.ybq.android.spinkit.SpinKitView
;
import
com.kaluwa.enterprises.babycare.R
;
import
com.kaluwa.enterprises.babycare.dto.BabyDto
;
import
java.time.LocalDate
;
public
class
AddBabyDialog
extends
AppCompatDialogFragment
{
BabyDialogInterface
babyDialogInterface
;
private
EditText
etFirstname
,
etLastname
,
dateDob
,
etSex
,
etWeight
,
etHeight
,
etBloodType
,
etEyeColor
,
etHairColor
,
etAllergies
,
etMediConditions
,
etMedication
,
etVaccinateRecs
,
etDocName
,
etDocContact
,
etHealthInsuranceInfo
,
dateFirstSmile
,
dateFirstTooth
,
dateFirstWord
,
dateFirstStep
,
etFavFoods
,
etDisFoods
,
etPEmergConName
,
etPEmergRelation
,
etPEmergConNumber
,
etSEmergConName
,
etSEmergRelation
,
etSEmergConNumber
,
etNotes
;
private
ImageButton
ibPhoto
;
private
SwitchCompat
switchStatus
;
private
View
overlay
;
private
SpinKitView
progressbar
;
@NonNull
@Override
public
Dialog
onCreateDialog
(
@Nullable
Bundle
savedInstanceState
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
getContext
());
LayoutInflater
inflater
=
getActivity
().
getLayoutInflater
();
View
view
=
inflater
.
inflate
(
R
.
layout
.
add_baby_view_layout
,
null
);
builder
.
setView
(
view
)
.
setNegativeButton
(
"Cancel"
,
(
dialog
,
which
)
->
{
dialog
.
dismiss
();
})
.
setPositiveButton
(
"Save"
,
null
);
TextView
title
=
new
TextView
(
getContext
());
// You Can Customise your Title here
title
.
setText
(
"Add Your Baby's Information"
);
title
.
setBackgroundColor
(
getResources
().
getColor
(
R
.
color
.
purple
));
title
.
setPadding
(
10
,
10
,
10
,
10
);
title
.
setGravity
(
Gravity
.
CENTER
);
title
.
setTextColor
(
Color
.
WHITE
);
title
.
setTextSize
(
20
);
builder
.
setCustomTitle
(
title
);
// find views by id
findViews
(
view
);
AlertDialog
dialog
=
builder
.
create
();
dialog
.
setCanceledOnTouchOutside
(
false
);
// Set button colors after the dialog is shown
dialog
.
setOnShowListener
(
dialogInterface
->
{
Button
positiveButton
=
dialog
.
getButton
(
AlertDialog
.
BUTTON_POSITIVE
);
positiveButton
.
setTextColor
(
getResources
().
getColor
(
R
.
color
.
success_green
));
dialog
.
getButton
(
AlertDialog
.
BUTTON_NEGATIVE
).
setTextColor
(
getResources
().
getColor
(
R
.
color
.
line_outline
));
positiveButton
.
setOnClickListener
(
v
->
{
applyBabyDto
(
dialog
);
});
// Get the display metrics
DisplayMetrics
displayMetrics
=
new
DisplayMetrics
();
getActivity
().
getWindowManager
().
getDefaultDisplay
().
getMetrics
(
displayMetrics
);
int
screenHeight
=
displayMetrics
.
heightPixels
;
// Convert 30dp to pixels
int
margin
=
dpToPx
(
getContext
(),
65
);
// Calculate the available height
int
availableHeight
=
screenHeight
-
(
2
*
margin
);
// Set the dialog height
WindowManager
.
LayoutParams
layoutParams
=
dialog
.
getWindow
().
getAttributes
();
layoutParams
.
height
=
availableHeight
;
dialog
.
getWindow
().
setAttributes
(
layoutParams
);
});
return
dialog
;
}
private
void
applyBabyDto
(
AlertDialog
dialog
)
{
BabyDto
babyDto
=
validateObjects
();
if
(
babyDto
.
isSys_validated
())
{
babyDialogInterface
.
parseValues
(
babyDto
,
dialog
,
overlay
,
progressbar
);
}
}
@SuppressLint
(
"NewApi"
)
private
BabyDto
validateObjects
()
{
BabyDto
baby
=
new
BabyDto
();
baby
.
setSys_validated
(
false
);
String
firstname
,
lastname
,
dob
,
sex
,
weight
,
height
,
bType
,
eyeColor
,
hairColor
,
allergies
,
medicalConditions
,
medications
,
vaccinateRecs
,
docName
,
docContact
,
healthInsuInfo
,
firstSmile
,
firstTooth
,
firstWord
,
firstStep
,
favFoods
,
disFoods
,
pEmergeConName
,
pEmergeRelationship
,
pEmergeContact
,
sEmergeConName
,
sEmergeRelationship
,
sEmergeContact
,
notes
;
firstname
=
etFirstname
.
getText
().
toString
();
lastname
=
etLastname
.
getText
().
toString
();
dob
=
dateDob
.
getText
().
toString
();
sex
=
etSex
.
getText
().
toString
();
weight
=
etWeight
.
getText
().
toString
();
height
=
etHeight
.
getText
().
toString
();
bType
=
etBloodType
.
getText
().
toString
();
eyeColor
=
etEyeColor
.
getText
().
toString
();
hairColor
=
etHairColor
.
getText
().
toString
();
allergies
=
etAllergies
.
getText
().
toString
();
medicalConditions
=
etMediConditions
.
getText
().
toString
();
medications
=
etMedication
.
getText
().
toString
();
vaccinateRecs
=
etVaccinateRecs
.
getText
().
toString
();
docName
=
etDocName
.
getText
().
toString
();
docContact
=
etDocContact
.
getText
().
toString
();
healthInsuInfo
=
etHealthInsuranceInfo
.
getText
().
toString
();
firstSmile
=
dateFirstSmile
.
getText
().
toString
();
firstTooth
=
dateFirstTooth
.
getText
().
toString
();
firstWord
=
dateFirstWord
.
getText
().
toString
();
firstStep
=
dateFirstStep
.
getText
().
toString
();
favFoods
=
etFavFoods
.
getText
().
toString
();
disFoods
=
etDisFoods
.
getText
().
toString
();
pEmergeConName
=
etPEmergConName
.
getText
().
toString
();
pEmergeRelationship
=
etPEmergRelation
.
getText
().
toString
();
pEmergeContact
=
etPEmergConNumber
.
getText
().
toString
();
sEmergeConName
=
etSEmergConName
.
getText
().
toString
();
sEmergeRelationship
=
etSEmergRelation
.
getText
().
toString
();
sEmergeContact
=
etSEmergConNumber
.
getText
().
toString
();
notes
=
etNotes
.
getText
().
toString
();
if
(
TextUtils
.
isEmpty
(
firstname
))
{
etFirstname
.
setError
(
"First name is required."
);
etFirstname
.
requestFocus
();
}
else
if
(
TextUtils
.
isEmpty
(
dob
))
{
dateDob
.
setError
(
"Date of birth is required."
);
dateDob
.
requestFocus
();
}
else
if
(
TextUtils
.
isEmpty
(
sex
))
{
etSex
.
setError
(
"Gender is required."
);
etSex
.
requestFocus
();
}
else
{
baby
.
setFirstName
(
firstname
);
baby
.
setLastName
(
lastname
);
baby
.
setDob
(
LocalDate
.
parse
(
dob
,
getDateTimeFormatter
()));
baby
.
setSex
(
sex
);
baby
.
setIsActive
(
switchStatus
.
isChecked
());
if
(!
TextUtils
.
isEmpty
(
weight
))
{
baby
.
setWeight
(
Float
.
parseFloat
(
weight
));
}
if
(!
TextUtils
.
isEmpty
(
height
))
{
baby
.
setHeight
(
Float
.
parseFloat
(
height
));
}
baby
.
setBloodType
(
bType
);
baby
.
setEyeColor
(
eyeColor
);
baby
.
setHairColor
(
hairColor
);
baby
.
setAllergies
(
allergies
);
baby
.
setMedicalConditions
(
medicalConditions
);
baby
.
setMedications
(
medications
);
baby
.
setVaccinateRecords
(
vaccinateRecs
);
baby
.
setDocName
(
docName
);
baby
.
setDocContactNumber
(
docContact
);
baby
.
setHealthInsuranceInfo
(
healthInsuInfo
);
if
(!
TextUtils
.
isEmpty
(
firstSmile
))
{
baby
.
setFirstSmileDate
(
LocalDate
.
parse
(
firstSmile
,
getDateTimeFormatter
()));
}
if
(!
TextUtils
.
isEmpty
(
firstTooth
))
{
baby
.
setFirstToothDate
(
LocalDate
.
parse
(
firstTooth
,
getDateTimeFormatter
()));
}
if
(!
TextUtils
.
isEmpty
(
firstWord
))
{
baby
.
setFirstWordDate
(
LocalDate
.
parse
(
firstWord
,
getDateTimeFormatter
()));
}
if
(!
TextUtils
.
isEmpty
(
firstStep
))
{
baby
.
setFirstStepDate
(
LocalDate
.
parse
(
firstStep
,
getDateTimeFormatter
()));
}
baby
.
setFavFoods
(
favFoods
);
baby
.
setFoodsDislikes
(
disFoods
);
baby
.
setPrimaryEmergencyContactName
(
pEmergeConName
);
baby
.
setPrimaryEmergencyRelationship
(
pEmergeRelationship
);
baby
.
setPrimaryEmergencyContactNumber
(
pEmergeContact
);
baby
.
setSecondaryEmergencyContactName
(
sEmergeConName
);
baby
.
setSecondaryEmergencyRelationship
(
sEmergeRelationship
);
baby
.
setSecondaryEmergencyContactNumber
(
sEmergeContact
);
baby
.
setNotes
(
notes
);
baby
.
setSys_validated
(
true
);
}
return
baby
;
}
@Override
public
void
onAttach
(
@NonNull
Context
context
)
{
super
.
onAttach
(
context
);
babyDialogInterface
=
(
BabyDialogInterface
)
context
;
}
private
void
findViews
(
View
view
)
{
etFirstname
=
view
.
findViewById
(
R
.
id
.
abv_et_first_name
);
etLastname
=
view
.
findViewById
(
R
.
id
.
abv_et_last_name
);
dateDob
=
view
.
findViewById
(
R
.
id
.
abv_et_dob
);
etSex
=
view
.
findViewById
(
R
.
id
.
abv_et_sex
);
etWeight
=
view
.
findViewById
(
R
.
id
.
abv_et_weight
);
etHeight
=
view
.
findViewById
(
R
.
id
.
abv_et_height
);
etBloodType
=
view
.
findViewById
(
R
.
id
.
abv_dd_blood_type
);
etEyeColor
=
view
.
findViewById
(
R
.
id
.
abv_et_eye_colour
);
etHairColor
=
view
.
findViewById
(
R
.
id
.
abv_et_hair_colour
);
etAllergies
=
view
.
findViewById
(
R
.
id
.
abv_et_allergies
);
etMediConditions
=
view
.
findViewById
(
R
.
id
.
abv_et_medical_conditions
);
etMedication
=
view
.
findViewById
(
R
.
id
.
abv_et_medications
);
etVaccinateRecs
=
view
.
findViewById
(
R
.
id
.
abv_et_vaccination_recs
);
etDocName
=
view
.
findViewById
(
R
.
id
.
abv_et_doc_name
);
etDocContact
=
view
.
findViewById
(
R
.
id
.
abv_et_doc_contact
);
etHealthInsuranceInfo
=
view
.
findViewById
(
R
.
id
.
abv_et_health_insurance_info
);
dateFirstSmile
=
view
.
findViewById
(
R
.
id
.
abv_et_first_smile
);
dateFirstTooth
=
view
.
findViewById
(
R
.
id
.
abv_et_first_tooth
);
dateFirstWord
=
view
.
findViewById
(
R
.
id
.
abv_et_first_word
);
dateFirstStep
=
view
.
findViewById
(
R
.
id
.
abv_et_first_step
);
etFavFoods
=
view
.
findViewById
(
R
.
id
.
abv_et_favourite_foods
);
etDisFoods
=
view
.
findViewById
(
R
.
id
.
abv_et_food_dislikes
);
etPEmergConName
=
view
.
findViewById
(
R
.
id
.
abv_et_p_emergency_con_name
);
etPEmergRelation
=
view
.
findViewById
(
R
.
id
.
abv_et_p_emergency_relationship
);
etPEmergConNumber
=
view
.
findViewById
(
R
.
id
.
abv_et_p_emergency_con_number
);
etSEmergConName
=
view
.
findViewById
(
R
.
id
.
abv_et_s_emergency_con_name
);
etSEmergRelation
=
view
.
findViewById
(
R
.
id
.
abv_et_s_emergency_relationship
);
etSEmergConNumber
=
view
.
findViewById
(
R
.
id
.
abv_et_s_emergency_con_number
);
etNotes
=
view
.
findViewById
(
R
.
id
.
abv_et_notes
);
ibPhoto
=
view
.
findViewById
(
R
.
id
.
abv_ib_photo
);
switchStatus
=
view
.
findViewById
(
R
.
id
.
abv_switch_status
);
progressbar
=
view
.
findViewById
(
R
.
id
.
progress_bar
);
overlay
=
view
.
findViewById
(
R
.
id
.
overlay
);
setUpDatePicker
(
dateDob
,
getContext
());
setUpDatePicker
(
dateFirstSmile
,
getContext
());
setUpDatePicker
(
dateFirstTooth
,
getContext
());
setUpDatePicker
(
dateFirstWord
,
getContext
());
setUpDatePicker
(
dateFirstStep
,
getContext
());
}
public
interface
BabyDialogInterface
{
void
parseValues
(
BabyDto
dto
,
AlertDialog
dialog
,
View
overlay
,
SpinKitView
progressbar
);
}
}
app/src/main/java/com/kaluwa/enterprises/babycare/dialogs/EditBabyDialog.java
0 → 100644
View file @
6cd9fbc3
package
com.kaluwa.enterprises.babycare.dialogs
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
dpToPx
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
getDateTimeFormatter
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
setUpDatePicker
;
import
android.annotation.SuppressLint
;
import
android.app.AlertDialog
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.util.DisplayMetrics
;
import
android.view.Gravity
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.WindowManager
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.ImageButton
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.appcompat.app.AppCompatDialogFragment
;
import
androidx.appcompat.widget.SwitchCompat
;
import
com.github.ybq.android.spinkit.SpinKitView
;
import
com.kaluwa.enterprises.babycare.R
;
import
com.kaluwa.enterprises.babycare.dto.BabyDto
;
import
java.time.LocalDate
;
public
class
EditBabyDialog
extends
AppCompatDialogFragment
{
EditBabyDialogInterface
babyDialogInterface
;
private
EditText
etFirstname
,
etLastname
,
dateDob
,
etSex
,
etWeight
,
etHeight
,
etBloodType
,
etEyeColor
,
etHairColor
,
etAllergies
,
etMediConditions
,
etMedication
,
etVaccinateRecs
,
etDocName
,
etDocContact
,
etHealthInsuranceInfo
,
dateFirstSmile
,
dateFirstTooth
,
dateFirstWord
,
dateFirstStep
,
etFavFoods
,
etDisFoods
,
etPEmergConName
,
etPEmergRelation
,
etPEmergConNumber
,
etSEmergConName
,
etSEmergRelation
,
etSEmergConNumber
,
etNotes
;
private
ImageButton
ibPhoto
;
private
SwitchCompat
switchStatus
;
private
View
overlay
;
private
SpinKitView
progressbar
;
private
BabyDto
babyDto
;
public
EditBabyDialog
(
BabyDto
babyDto
)
{
this
.
babyDto
=
babyDto
;
}
@NonNull
@Override
public
Dialog
onCreateDialog
(
@Nullable
Bundle
savedInstanceState
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
getContext
());
LayoutInflater
inflater
=
getActivity
().
getLayoutInflater
();
View
view
=
inflater
.
inflate
(
R
.
layout
.
edit_baby_view_layout
,
null
);
builder
.
setView
(
view
)
.
setNegativeButton
(
"Cancel"
,
(
dialog
,
which
)
->
dialog
.
dismiss
())
.
setPositiveButton
(
"Update"
,
null
);
TextView
title
=
new
TextView
(
getContext
());
// You Can Customise your Title here
title
.
setText
(
"View Your Baby's Information"
);
title
.
setBackgroundColor
(
getResources
().
getColor
(
R
.
color
.
purple
));
title
.
setPadding
(
10
,
10
,
10
,
10
);
title
.
setGravity
(
Gravity
.
CENTER
);
title
.
setTextColor
(
Color
.
WHITE
);
title
.
setTextSize
(
20
);
builder
.
setCustomTitle
(
title
);
// find views by id
findViews
(
view
);
// Pre-fill data
prefillData
();
AlertDialog
dialog
=
builder
.
create
();
dialog
.
setCanceledOnTouchOutside
(
false
);
// Set button colors after the dialog is shown
dialog
.
setOnShowListener
(
dialogInterface
->
{
Button
positiveButton
=
dialog
.
getButton
(
AlertDialog
.
BUTTON_POSITIVE
);
positiveButton
.
setTextColor
(
getResources
().
getColor
(
R
.
color
.
success_green
));
dialog
.
getButton
(
AlertDialog
.
BUTTON_NEGATIVE
).
setTextColor
(
getResources
().
getColor
(
R
.
color
.
line_outline
));
positiveButton
.
setOnClickListener
(
v
->
{
applyBabyDto
(
dialog
);
});
// Get the display metrics
DisplayMetrics
displayMetrics
=
new
DisplayMetrics
();
getActivity
().
getWindowManager
().
getDefaultDisplay
().
getMetrics
(
displayMetrics
);
int
screenHeight
=
displayMetrics
.
heightPixels
;
// Convert 30dp to pixels
int
margin
=
dpToPx
(
getContext
(),
65
);
// Calculate the available height
int
availableHeight
=
screenHeight
-
(
2
*
margin
);
// Set the dialog height
WindowManager
.
LayoutParams
layoutParams
=
dialog
.
getWindow
().
getAttributes
();
layoutParams
.
height
=
availableHeight
;
dialog
.
getWindow
().
setAttributes
(
layoutParams
);
});
return
dialog
;
}
// Method to pre-fill the data
private
void
prefillData
()
{
if
(
babyDto
!=
null
)
{
etFirstname
.
setText
(
babyDto
.
getFirstName
());
etLastname
.
setText
(
babyDto
.
getLastName
());
dateDob
.
setText
(
babyDto
.
getDob
()
!=
null
?
babyDto
.
getDob
().
toString
()
:
""
);
etSex
.
setText
(
babyDto
.
getSex
());
etWeight
.
setText
(
babyDto
.
getWeight
()
!=
null
&&
babyDto
.
getWeight
()
!=
0
?
String
.
valueOf
(
babyDto
.
getWeight
())
:
""
);
etHeight
.
setText
(
babyDto
.
getHeight
()
!=
null
&&
babyDto
.
getHeight
()
!=
0
?
String
.
valueOf
(
babyDto
.
getHeight
())
:
""
);
etBloodType
.
setText
(
babyDto
.
getBloodType
());
etEyeColor
.
setText
(
babyDto
.
getEyeColor
());
etHairColor
.
setText
(
babyDto
.
getHairColor
());
etAllergies
.
setText
(
babyDto
.
getAllergies
());
etMediConditions
.
setText
(
babyDto
.
getMedicalConditions
());
etMedication
.
setText
(
babyDto
.
getMedications
());
etVaccinateRecs
.
setText
(
babyDto
.
getVaccinateRecords
());
etDocName
.
setText
(
babyDto
.
getDocName
());
etDocContact
.
setText
(
babyDto
.
getDocContactNumber
());
etHealthInsuranceInfo
.
setText
(
babyDto
.
getHealthInsuranceInfo
());
dateFirstSmile
.
setText
(
babyDto
.
getFirstSmileDate
()
!=
null
?
babyDto
.
getFirstSmileDate
().
toString
()
:
""
);
dateFirstTooth
.
setText
(
babyDto
.
getFirstToothDate
()
!=
null
?
babyDto
.
getFirstToothDate
().
toString
()
:
""
);
dateFirstWord
.
setText
(
babyDto
.
getFirstWordDate
()
!=
null
?
babyDto
.
getFirstWordDate
().
toString
()
:
""
);
dateFirstStep
.
setText
(
babyDto
.
getFirstStepDate
()
!=
null
?
babyDto
.
getFirstStepDate
().
toString
()
:
""
);
etFavFoods
.
setText
(
babyDto
.
getFavFoods
());
etDisFoods
.
setText
(
babyDto
.
getFoodsDislikes
());
etPEmergConName
.
setText
(
babyDto
.
getPrimaryEmergencyContactName
());
etPEmergRelation
.
setText
(
babyDto
.
getPrimaryEmergencyRelationship
());
etPEmergConNumber
.
setText
(
babyDto
.
getPrimaryEmergencyContactNumber
());
etSEmergConName
.
setText
(
babyDto
.
getSecondaryEmergencyContactName
());
etSEmergRelation
.
setText
(
babyDto
.
getSecondaryEmergencyRelationship
());
etSEmergConNumber
.
setText
(
babyDto
.
getSecondaryEmergencyContactNumber
());
etNotes
.
setText
(
babyDto
.
getNotes
());
switchStatus
.
setChecked
(
babyDto
.
getIsActive
());
}
}
private
void
applyBabyDto
(
AlertDialog
dialog
)
{
babyDto
=
validateObjects
();
if
(
babyDto
.
isSys_validated
())
{
babyDialogInterface
.
parseValuesForEdit
(
babyDto
,
dialog
,
overlay
,
progressbar
);
}
}
@SuppressLint
(
"NewApi"
)
private
BabyDto
validateObjects
()
{
BabyDto
baby
=
new
BabyDto
();
baby
.
setBabyId
(
babyDto
.
getBabyId
());
baby
.
setSys_validated
(
false
);
String
firstname
,
lastname
,
dob
,
sex
,
weight
,
height
,
bType
,
eyeColor
,
hairColor
,
allergies
,
medicalConditions
,
medications
,
vaccinateRecs
,
docName
,
docContact
,
healthInsuInfo
,
firstSmile
,
firstTooth
,
firstWord
,
firstStep
,
favFoods
,
disFoods
,
pEmergeConName
,
pEmergeRelationship
,
pEmergeContact
,
sEmergeConName
,
sEmergeRelationship
,
sEmergeContact
,
notes
;
firstname
=
etFirstname
.
getText
().
toString
();
lastname
=
etLastname
.
getText
().
toString
();
dob
=
dateDob
.
getText
().
toString
();
sex
=
etSex
.
getText
().
toString
();
weight
=
etWeight
.
getText
().
toString
();
height
=
etHeight
.
getText
().
toString
();
bType
=
etBloodType
.
getText
().
toString
();
eyeColor
=
etEyeColor
.
getText
().
toString
();
hairColor
=
etHairColor
.
getText
().
toString
();
allergies
=
etAllergies
.
getText
().
toString
();
medicalConditions
=
etMediConditions
.
getText
().
toString
();
medications
=
etMedication
.
getText
().
toString
();
vaccinateRecs
=
etVaccinateRecs
.
getText
().
toString
();
docName
=
etDocName
.
getText
().
toString
();
docContact
=
etDocContact
.
getText
().
toString
();
healthInsuInfo
=
etHealthInsuranceInfo
.
getText
().
toString
();
firstSmile
=
dateFirstSmile
.
getText
().
toString
();
firstTooth
=
dateFirstTooth
.
getText
().
toString
();
firstWord
=
dateFirstWord
.
getText
().
toString
();
firstStep
=
dateFirstStep
.
getText
().
toString
();
favFoods
=
etFavFoods
.
getText
().
toString
();
disFoods
=
etDisFoods
.
getText
().
toString
();
pEmergeConName
=
etPEmergConName
.
getText
().
toString
();
pEmergeRelationship
=
etPEmergRelation
.
getText
().
toString
();
pEmergeContact
=
etPEmergConNumber
.
getText
().
toString
();
sEmergeConName
=
etSEmergConName
.
getText
().
toString
();
sEmergeRelationship
=
etSEmergRelation
.
getText
().
toString
();
sEmergeContact
=
etSEmergConNumber
.
getText
().
toString
();
notes
=
etNotes
.
getText
().
toString
();
if
(
TextUtils
.
isEmpty
(
firstname
))
{
etFirstname
.
setError
(
"First name is required."
);
etFirstname
.
requestFocus
();
}
else
if
(
TextUtils
.
isEmpty
(
dob
))
{
dateDob
.
setError
(
"Date of birth is required."
);
dateDob
.
requestFocus
();
}
else
if
(
TextUtils
.
isEmpty
(
sex
))
{
etSex
.
setError
(
"Gender is required."
);
etSex
.
requestFocus
();
}
else
{
baby
.
setFirstName
(
firstname
);
baby
.
setLastName
(
lastname
);
baby
.
setDob
(
LocalDate
.
parse
(
dob
,
getDateTimeFormatter
()));
baby
.
setSex
(
sex
);
baby
.
setIsActive
(
switchStatus
.
isChecked
());
if
(!
TextUtils
.
isEmpty
(
weight
))
{
baby
.
setWeight
(
Float
.
parseFloat
(
weight
));
}
if
(!
TextUtils
.
isEmpty
(
height
))
{
baby
.
setHeight
(
Float
.
parseFloat
(
height
));
}
baby
.
setBloodType
(
bType
);
baby
.
setEyeColor
(
eyeColor
);
baby
.
setHairColor
(
hairColor
);
baby
.
setAllergies
(
allergies
);
baby
.
setMedicalConditions
(
medicalConditions
);
baby
.
setMedications
(
medications
);
baby
.
setVaccinateRecords
(
vaccinateRecs
);
baby
.
setDocName
(
docName
);
baby
.
setDocContactNumber
(
docContact
);
baby
.
setHealthInsuranceInfo
(
healthInsuInfo
);
if
(!
TextUtils
.
isEmpty
(
firstSmile
))
{
baby
.
setFirstSmileDate
(
LocalDate
.
parse
(
firstSmile
,
getDateTimeFormatter
()));
}
if
(!
TextUtils
.
isEmpty
(
firstTooth
))
{
baby
.
setFirstToothDate
(
LocalDate
.
parse
(
firstTooth
,
getDateTimeFormatter
()));
}
if
(!
TextUtils
.
isEmpty
(
firstWord
))
{
baby
.
setFirstWordDate
(
LocalDate
.
parse
(
firstWord
,
getDateTimeFormatter
()));
}
if
(!
TextUtils
.
isEmpty
(
firstStep
))
{
baby
.
setFirstStepDate
(
LocalDate
.
parse
(
firstStep
,
getDateTimeFormatter
()));
}
baby
.
setFavFoods
(
favFoods
);
baby
.
setFoodsDislikes
(
disFoods
);
baby
.
setPrimaryEmergencyContactName
(
pEmergeConName
);
baby
.
setPrimaryEmergencyRelationship
(
pEmergeRelationship
);
baby
.
setPrimaryEmergencyContactNumber
(
pEmergeContact
);
baby
.
setSecondaryEmergencyContactName
(
sEmergeConName
);
baby
.
setSecondaryEmergencyRelationship
(
sEmergeRelationship
);
baby
.
setSecondaryEmergencyContactNumber
(
sEmergeContact
);
baby
.
setNotes
(
notes
);
baby
.
setSys_validated
(
true
);
}
return
baby
;
}
@Override
public
void
onAttach
(
@NonNull
Context
context
)
{
super
.
onAttach
(
context
);
babyDialogInterface
=
(
EditBabyDialogInterface
)
context
;
}
private
void
findViews
(
View
view
)
{
etFirstname
=
view
.
findViewById
(
R
.
id
.
ebv_et_first_name
);
etLastname
=
view
.
findViewById
(
R
.
id
.
ebv_et_last_name
);
dateDob
=
view
.
findViewById
(
R
.
id
.
ebv_et_dob
);
etSex
=
view
.
findViewById
(
R
.
id
.
ebv_et_sex
);
etWeight
=
view
.
findViewById
(
R
.
id
.
ebv_et_weight
);
etHeight
=
view
.
findViewById
(
R
.
id
.
ebv_et_height
);
etBloodType
=
view
.
findViewById
(
R
.
id
.
ebv_dd_blood_type
);
etEyeColor
=
view
.
findViewById
(
R
.
id
.
ebv_et_eye_colour
);
etHairColor
=
view
.
findViewById
(
R
.
id
.
ebv_et_hair_colour
);
etAllergies
=
view
.
findViewById
(
R
.
id
.
ebv_et_allergies
);
etMediConditions
=
view
.
findViewById
(
R
.
id
.
ebv_et_medical_conditions
);
etMedication
=
view
.
findViewById
(
R
.
id
.
ebv_et_medications
);
etVaccinateRecs
=
view
.
findViewById
(
R
.
id
.
ebv_et_vaccination_recs
);
etDocName
=
view
.
findViewById
(
R
.
id
.
ebv_et_doc_name
);
etDocContact
=
view
.
findViewById
(
R
.
id
.
ebv_et_doc_contact
);
etHealthInsuranceInfo
=
view
.
findViewById
(
R
.
id
.
ebv_et_health_insurance_info
);
dateFirstSmile
=
view
.
findViewById
(
R
.
id
.
ebv_et_first_smile
);
dateFirstTooth
=
view
.
findViewById
(
R
.
id
.
ebv_et_first_tooth
);
dateFirstWord
=
view
.
findViewById
(
R
.
id
.
ebv_et_first_word
);
dateFirstStep
=
view
.
findViewById
(
R
.
id
.
ebv_et_first_step
);
etFavFoods
=
view
.
findViewById
(
R
.
id
.
ebv_et_favourite_foods
);
etDisFoods
=
view
.
findViewById
(
R
.
id
.
ebv_et_food_dislikes
);
etPEmergConName
=
view
.
findViewById
(
R
.
id
.
ebv_et_p_emergency_con_name
);
etPEmergRelation
=
view
.
findViewById
(
R
.
id
.
ebv_et_p_emergency_relationship
);
etPEmergConNumber
=
view
.
findViewById
(
R
.
id
.
ebv_et_p_emergency_con_number
);
etSEmergConName
=
view
.
findViewById
(
R
.
id
.
ebv_et_s_emergency_con_name
);
etSEmergRelation
=
view
.
findViewById
(
R
.
id
.
ebv_et_s_emergency_relationship
);
etSEmergConNumber
=
view
.
findViewById
(
R
.
id
.
ebv_et_s_emergency_con_number
);
etNotes
=
view
.
findViewById
(
R
.
id
.
ebv_et_notes
);
// ibPhoto = view.findViewById(R.id.ebv_ib_photo);
switchStatus
=
view
.
findViewById
(
R
.
id
.
ebv_switch_status
);
progressbar
=
view
.
findViewById
(
R
.
id
.
progress_bar
);
overlay
=
view
.
findViewById
(
R
.
id
.
overlay
);
setUpDatePicker
(
dateDob
,
getContext
());
setUpDatePicker
(
dateFirstSmile
,
getContext
());
setUpDatePicker
(
dateFirstTooth
,
getContext
());
setUpDatePicker
(
dateFirstWord
,
getContext
());
setUpDatePicker
(
dateFirstStep
,
getContext
());
}
public
interface
EditBabyDialogInterface
{
void
parseValuesForEdit
(
BabyDto
dto
,
AlertDialog
dialog
,
View
overlay
,
SpinKitView
progressbar
);
}
}
app/src/main/java/com/kaluwa/enterprises/babycare/dto/BabyDto.java
0 → 100644
View file @
6cd9fbc3
package
com.kaluwa.enterprises.babycare.dto
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
java.io.InputStream
;
import
java.time.LocalDate
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
BabyDto
{
private
Long
babyId
;
private
String
firstName
;
private
String
lastName
;
private
LocalDate
dob
;
private
String
sex
;
private
String
status
;
private
Boolean
isActive
;
private
Float
weight
;
private
Float
height
;
private
String
bloodType
;
private
String
eyeColor
;
private
String
hairColor
;
private
String
allergies
;
private
String
medicalConditions
;
private
String
medications
;
private
String
vaccinateRecords
;
private
String
docName
;
private
String
docContactNumber
;
private
String
healthInsuranceInfo
;
private
LocalDate
firstSmileDate
;
private
LocalDate
firstToothDate
;
private
LocalDate
firstWordDate
;
private
LocalDate
firstStepDate
;
private
String
favFoods
;
private
String
foodsDislikes
;
private
String
primaryEmergencyContactName
;
private
String
primaryEmergencyRelationship
;
private
String
primaryEmergencyContactNumber
;
private
String
secondaryEmergencyContactName
;
private
String
secondaryEmergencyRelationship
;
private
String
secondaryEmergencyContactNumber
;
private
String
notes
;
private
UserDto
user
;
private
Long
userId
;
private
Long
documentId
;
@JsonIgnore
private
InputStream
imageData
;
@JsonIgnore
private
boolean
sys_validated
;
}
app/src/main/java/com/kaluwa/enterprises/babycare/dto/UserDto.java
View file @
6cd9fbc3
package
com.kaluwa.enterprises.babycare.dto
;
import
java.time.LocalDate
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
...
...
@@ -15,4 +17,5 @@ public class UserDto {
private
String
phone
;
private
String
role
;
private
String
status
;
private
LocalDate
dob
;
}
\ No newline at end of file
app/src/main/java/com/kaluwa/enterprises/babycare/dto/AuthenticationDto.java
→
app/src/main/java/com/kaluwa/enterprises/babycare/dto/
responseDto/
AuthenticationDto.java
View file @
6cd9fbc3
package
com.kaluwa.enterprises.babycare.dto
;
package
com.kaluwa.enterprises.babycare.dto
.responseDto
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
...
...
app/src/main/java/com/kaluwa/enterprises/babycare/dto/responseDto/ResponseDto.java
0 → 100644
View file @
6cd9fbc3
package
com.kaluwa.enterprises.babycare.dto.responseDto
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
ResponseDto
{
private
Long
id
;
private
String
message
;
}
app/src/main/java/com/kaluwa/enterprises/babycare/dto/TokenDto.java
→
app/src/main/java/com/kaluwa/enterprises/babycare/dto/
responseDto/
TokenDto.java
View file @
6cd9fbc3
package
com.kaluwa.enterprises.babycare.dto
;
package
com.kaluwa.enterprises.babycare.dto
.responseDto
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
...
...
app/src/main/java/com/kaluwa/enterprises/babycare/service/AuthApiService.java
View file @
6cd9fbc3
package
com.kaluwa.enterprises.babycare.service
;
import
com.kaluwa.enterprises.babycare.dto.AuthenticationDto
;
import
com.kaluwa.enterprises.babycare.dto.
responseDto.
AuthenticationDto
;
import
com.kaluwa.enterprises.babycare.dto.LoginRequest
;
import
com.kaluwa.enterprises.babycare.dto.RegisterRequest
;
import
com.kaluwa.enterprises.babycare.dto.UserDto
;
import
retrofit2.Call
;
import
retrofit2.Response
;
import
retrofit2.http.Body
;
import
retrofit2.http.POST
;
...
...
app/src/main/java/com/kaluwa/enterprises/babycare/service/BabyApiService.java
0 → 100644
View file @
6cd9fbc3
package
com.kaluwa.enterprises.babycare.service
;
import
com.kaluwa.enterprises.babycare.dto.BabyDto
;
import
java.util.List
;
import
retrofit2.Call
;
import
retrofit2.http.Body
;
import
retrofit2.http.GET
;
import
retrofit2.http.POST
;
import
retrofit2.http.PUT
;
import
retrofit2.http.Path
;
public
interface
BabyApiService
{
@GET
(
"baby"
)
Call
<
List
<
BabyDto
>>
getAllBabies
();
@POST
(
"baby"
)
Call
<
BabyDto
>
addBaby
(
@Body
BabyDto
baby
);
@PUT
(
"baby/{babyId}"
)
Call
<
BabyDto
>
updateBaby
(
@Path
(
"babyId"
)
Long
babyId
,
@Body
BabyDto
baby
);
}
app/src/main/java/com/kaluwa/enterprises/babycare/service/UserApiService.java
View file @
6cd9fbc3
package
com.kaluwa.enterprises.babycare.service
;
import
com.kaluwa.enterprises.babycare.dto.UserDto
;
import
com.kaluwa.enterprises.babycare.dto.responseDto.ResponseDto
;
import
okhttp3.MultipartBody
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.http.Body
;
import
retrofit2.http.GET
;
import
retrofit2.http.Multipart
;
import
retrofit2.http.PUT
;
import
retrofit2.http.Part
;
import
retrofit2.http.Path
;
public
interface
UserApiService
{
...
...
@@ -16,4 +21,11 @@ public interface UserApiService {
@PUT
(
"user/{userId}"
)
Call
<
UserDto
>
updateUserById
(
@Path
(
"userId"
)
Long
userId
,
@Body
UserDto
user
);
@Multipart
@PUT
(
"user/image/{userId}"
)
Call
<
ResponseDto
>
uploadUserImage
(
@Path
(
"userId"
)
Long
userId
,
@Part
MultipartBody
.
Part
image
);
@GET
(
"user/image/{userId}"
)
Call
<
ResponseBody
>
getImage
(
@Path
(
"userId"
)
Long
userId
);
}
app/src/main/java/com/kaluwa/enterprises/babycare/utils/Utils.java
View file @
6cd9fbc3
package
com.kaluwa.enterprises.babycare.utils
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.app.DatePickerDialog
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.EditText
;
import
com.github.ybq.android.spinkit.SpinKitView
;
import
com.kaluwa.enterprises.babycare.R
;
import
java.io.InputStream
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.Period
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatterBuilder
;
import
java.util.Calendar
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Objects
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
public
class
Utils
{
public
static
final
String
DATE_FORMAT
=
"dd/M/yyyy"
;
public
static
final
int
PICK_IMAGE_REQUEST
=
1
;
private
static
final
String
TAG
=
"Utils"
;
public
static
void
loader
(
View
overlay
,
SpinKitView
spinKitView
,
boolean
status
)
{
if
(
status
)
{
overlay
.
setVisibility
(
View
.
VISIBLE
);
...
...
@@ -52,4 +73,170 @@ public class Utils {
}
}
public
static
void
setUpDOBPicker
(
EditText
editText
,
Context
context
)
{
editText
.
setOnClickListener
(
v
->
{
final
Calendar
calendar
=
Calendar
.
getInstance
();
// Check if EditText is not empty and parse the date
if
(!
TextUtils
.
isEmpty
(
editText
.
getText
().
toString
()))
{
try
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
DATE_FORMAT
,
Locale
.
getDefault
());
calendar
.
setTime
(
Objects
.
requireNonNull
(
sdf
.
parse
(
editText
.
getText
().
toString
())));
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
}
int
day
=
calendar
.
get
(
Calendar
.
DAY_OF_MONTH
);
int
month
=
calendar
.
get
(
Calendar
.
MONTH
);
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
// Calculate the date 18 years ago from today
Calendar
maxDate
=
Calendar
.
getInstance
();
maxDate
.
add
(
Calendar
.
YEAR
,
-
18
);
// Date Picker Dialog
DatePickerDialog
datePicker
=
new
DatePickerDialog
(
context
,
(
view
,
selectedYear
,
selectedMonth
,
selectedDayOfMonth
)
->
{
editText
.
setText
(
selectedDayOfMonth
+
"/"
+
(
selectedMonth
+
1
)
+
"/"
+
selectedYear
);
},
year
,
month
,
day
);
// Set the maximum date (18 years ago)
datePicker
.
getDatePicker
().
setMaxDate
(
maxDate
.
getTimeInMillis
());
// Show the date picker
datePicker
.
show
();
});
}
public
static
void
setUpDatePicker
(
EditText
editText
,
Context
context
)
{
editText
.
setOnClickListener
(
v
->
{
final
Calendar
calendar
=
Calendar
.
getInstance
();
// Check if EditText is not empty and parse the date
if
(!
TextUtils
.
isEmpty
(
editText
.
getText
().
toString
()))
{
try
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
DATE_FORMAT
,
Locale
.
getDefault
());
calendar
.
setTime
(
Objects
.
requireNonNull
(
sdf
.
parse
(
editText
.
getText
().
toString
())));
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
}
int
day
=
calendar
.
get
(
Calendar
.
DAY_OF_MONTH
);
int
month
=
calendar
.
get
(
Calendar
.
MONTH
);
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
// Date Picker Dialog
DatePickerDialog
datePicker
=
new
DatePickerDialog
(
context
,
(
view
,
selectedYear
,
selectedMonth
,
selectedDayOfMonth
)
->
{
editText
.
setText
(
selectedDayOfMonth
+
"/"
+
(
selectedMonth
+
1
)
+
"/"
+
selectedYear
);
},
year
,
month
,
day
);
// Show the date picker
datePicker
.
show
();
});
}
@SuppressLint
(
"NewApi"
)
public
static
LocalDate
getLocalDate
(
Object
dob
)
{
LocalDate
localDate
=
null
;
if
(
dob
instanceof
LocalDate
)
{
localDate
=
(
LocalDate
)
dob
;
}
else
if
(
dob
instanceof
List
)
{
// dob is a List, convert it to LocalDate
List
dobList
=
(
List
)
dob
;
if
(
dobList
.
size
()
==
3
)
{
try
{
int
year
=
((
Double
)
dobList
.
get
(
0
)).
intValue
();
int
month
=
((
Double
)
dobList
.
get
(
1
)).
intValue
();
int
day
=
((
Double
)
dobList
.
get
(
2
)).
intValue
();
localDate
=
LocalDate
.
of
(
year
,
month
,
day
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
else
{
Log
.
e
(
TAG
,
"Unsupported date format"
);
}
}
else
{
// Handle other unexpected types if necessary
Log
.
e
(
TAG
,
"Unsupported date format"
);
}
return
localDate
;
}
@SuppressLint
(
"NewApi"
)
public
static
Double
calculateAge
(
Object
dobObj
,
String
condition
)
{
LocalDate
dob
=
getLocalDate
(
dobObj
);
if
(
dob
==
null
)
{
Log
.
e
(
TAG
,
"Invalid date of birth"
);
return
null
;
}
LocalDate
currentDate
=
LocalDate
.
now
();
Period
period
=
Period
.
between
(
dob
,
currentDate
);
Double
age
=
null
;
if
(
condition
.
equalsIgnoreCase
(
"byYears"
))
{
age
=
(
double
)
period
.
getYears
();
age
=
Math
.
round
(
age
*
10.0
)
/
10.0
;
}
else
if
(
condition
.
equalsIgnoreCase
(
"byMonths"
))
{
age
=
period
.
getYears
()
*
12
+
period
.
getMonths
()
+
(
period
.
getDays
()
/
30.0
);
age
=
Math
.
round
(
age
*
10.0
)
/
10.0
;
}
else
{
Log
.
e
(
TAG
,
"Unsupported Condition"
);
}
return
age
;
}
@SuppressLint
(
"NewApi"
)
public
static
String
babyAgeCalculate
(
LocalDate
dob
)
{
if
(
dob
==
null
)
{
Log
.
e
(
TAG
,
"Invalid date of birth"
);
return
null
;
}
LocalDate
currentDate
=
LocalDate
.
now
();
Period
period
=
Period
.
between
(
dob
,
currentDate
);
int
totalMonths
=
period
.
getYears
()
*
12
+
period
.
getMonths
();
int
totalDays
=
period
.
getDays
();
if
(
totalMonths
<=
12
)
{
return
totalMonths
+
" months "
+
totalDays
+
" days"
;
}
else
{
int
years
=
totalMonths
/
12
;
int
remainingMonths
=
totalMonths
%
12
;
return
years
+
" years "
+
remainingMonths
+
" months "
+
totalDays
+
" days"
;
}
}
public
static
Bitmap
convertByteArrayToBitmap
(
InputStream
stream
)
{
try
{
return
BitmapFactory
.
decodeStream
(
stream
);
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"Error decoding image byte array: "
+
e
.
getMessage
());
throw
new
RuntimeException
(
"Error decoding image byte array"
);
}
}
public
static
int
dpToPx
(
Context
context
,
int
dp
)
{
float
density
=
context
.
getResources
().
getDisplayMetrics
().
density
;
return
Math
.
round
(
dp
*
density
);
}
@SuppressLint
(
"NewApi"
)
public
static
DateTimeFormatter
getDateTimeFormatter
()
{
DateTimeFormatterBuilder
builder
=
new
DateTimeFormatterBuilder
()
.
parseCaseInsensitive
().
parseLenient
()
// .appendPattern("[d/M/yyyy]")
// .appendPattern("[dd MMM yyyy]")
.
appendPattern
(
"[dd/MM/yyyy]"
)
.
appendPattern
(
"[yyyy-MM-dd]"
);
return
builder
.
toFormatter
(
Locale
.
ENGLISH
);
}
}
app/src/main/res/anim/fade_in.xml
View file @
6cd9fbc3
<?xml version="1.0" encoding="utf-8"?>
<alpha
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:duration=
"
5
00"
android:duration=
"
3
00"
android:fromAlpha=
"0.0"
android:toAlpha=
"1.0"
/>
app/src/main/res/anim/fade_out.xml
View file @
6cd9fbc3
<?xml version="1.0" encoding="utf-8"?>
<alpha
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:duration=
"
5
00"
android:duration=
"
3
00"
android:fromAlpha=
"1.0"
android:toAlpha=
"0.0"
/>
app/src/main/res/drawable/baby_profile.jpg
0 → 100644
View file @
6cd9fbc3
1.14 MB
app/src/main/res/drawable/borders.xml
0 → 100644
View file @
6cd9fbc3
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item>
<shape
android:shape=
"rectangle"
>
<stroke
android:width=
"1dp"
android:color=
"@color/purple"
/>
</shape>
</item>
</selector>
\ No newline at end of file
app/src/main/res/drawable/ic_add_32.xml
0 → 100644
View file @
6cd9fbc3
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"48dp"
android:height=
"48dp"
android:tint=
"#FFFFFF"
android:viewportWidth=
"24"
android:viewportHeight=
"24"
>
<path
android:fillColor=
"@android:color/white"
android:pathData=
"M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
/>
</vector>
app/src/main/res/drawable/ico_unverified.png
0 → 100644
View file @
6cd9fbc3
109 KB
app/src/main/res/drawable/ico_verified.png
0 → 100644
View file @
6cd9fbc3
88.9 KB
app/src/main/res/layout/activity_baby_dashboard.xml
0 → 100644
View file @
6cd9fbc3
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/swipeContainer"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".activities.BabyDashboardActivity"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<include
layout=
"@layout/appbar"
/>
<ImageView
android:id=
"@+id/background"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/b_care_action_bar"
app:layout_constraintBottom_toBottomOf=
"parent"
android:src=
"@drawable/background"
android:contentDescription=
"background-image"
android:scaleType=
"centerCrop"
android:alpha=
"0.4"
/>
<RelativeLayout
android:id=
"@+id/rl_header"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/rl_background"
android:backgroundTint=
"#62178F"
app:layout_constraintTop_toTopOf=
"@+id/background"
app:layout_constraintStart_toStartOf=
"@id/background"
app:layout_constraintEnd_toEndOf=
"@id/background"
android:padding=
"8dp"
>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Baby Dash"
android:textAlignment=
"center"
android:textColor=
"@color/white"
android:textAllCaps=
"true"
android:fontFamily=
"@font/inknut_antiqua_regular"
android:textSize=
"20sp"
android:gravity=
"center"
/>
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/baby_dash_rv"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
app:layout_constraintTop_toBottomOf=
"@id/rl_header"
app:layout_constraintBottom_toBottomOf=
"@id/background"
app:layout_constraintEnd_toEndOf=
"@id/background"
app:layout_constraintStart_toStartOf=
"@id/background"
android:scrollbars=
"none"
android:paddingTop=
"6dp"
android:paddingStart=
"15dp"
android:paddingEnd=
"15dp"
android:paddingBottom=
"6dp"
/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id=
"@+id/fab_baby_add"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"@dimen/fab_margin"
android:contentDescription=
"add_own_baby_details"
android:src=
"@drawable/ic_add_32"
app:backgroundTint=
"@color/purple"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:maxImageSize=
"38dp"
/>
<TextView
android:id=
"@+id/no_content_message"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"No content available"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
android:textStyle=
"bold"
android:visibility=
"gone"
/>
<View
android:id=
"@+id/overlay"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#99D5C5DF"
android:visibility=
"gone"
android:clickable=
"true"
android:focusable=
"true"
/>
<com.github.ybq.android.spinkit.SpinKitView
android:id=
"@+id/progress_bar"
style=
"@style/SpinKitView.Large.DoubleBounce"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
app:SpinKit_Color=
"@color/purple"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
android:visibility=
"gone"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
app/src/main/res/layout/activity_login.xml
View file @
6cd9fbc3
...
...
@@ -77,7 +77,7 @@
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"
Email
"
android:text=
"
@string/email_req
"
android:textSize=
"15sp"
android:textColor=
"@color/black"
android:fontFamily=
"@font/adamina_regular"
/>
...
...
@@ -102,7 +102,7 @@
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"
Password
"
android:text=
"
@string/password_req
"
android:textSize=
"15sp"
android:textColor=
"@color/black"
android:fontFamily=
"@font/adamina_regular"
/>
...
...
app/src/main/res/layout/activity_register.xml
View file @
6cd9fbc3
...
...
@@ -77,7 +77,7 @@
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"
First Name
"
android:text=
"
@string/first_name_req
"
android:textSize=
"15sp"
android:textColor=
"@color/black"
android:fontFamily=
"@font/adamina_regular"
/>
...
...
@@ -100,7 +100,7 @@
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"
Last Name
"
android:text=
"
@string/last_name_req
"
android:textSize=
"15sp"
android:textColor=
"@color/black"
android:fontFamily=
"@font/adamina_regular"
/>
...
...
@@ -123,7 +123,7 @@
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"
Mobile Number
"
android:text=
"
@string/mobile_number_req
"
android:textSize=
"15sp"
android:textColor=
"@color/black"
android:fontFamily=
"@font/adamina_regular"
/>
...
...
@@ -146,7 +146,7 @@
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"
Email
"
android:text=
"
@string/email_req
"
android:textSize=
"15sp"
android:textColor=
"@color/black"
android:fontFamily=
"@font/adamina_regular"
/>
...
...
@@ -170,7 +170,7 @@
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"
Password
"
android:text=
"
@string/password_req
"
android:textSize=
"15sp"
android:textColor=
"@color/black"
android:fontFamily=
"@font/adamina_regular"
/>
...
...
@@ -195,7 +195,7 @@
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"
Confirm Password
"
android:text=
"
@string/confirm_password_req
"
android:textSize=
"15sp"
android:textColor=
"@color/black"
android:fontFamily=
"@font/adamina_regular"
/>
...
...
app/src/main/res/layout/activity_user_profile.xml
View file @
6cd9fbc3
...
...
@@ -32,15 +32,17 @@
app:layout_constraintStart_toStartOf=
"@id/background"
app:layout_constraintTop_toTopOf=
"@+id/background"
>
<ImageView
android:id=
"@+id/
forground_img
"
<
com.google.android.material.imageview.Shapeable
ImageView
android:id=
"@+id/
up_iv_profile_image
"
android:layout_width=
"160dp"
android:layout_height=
"160dp"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"20dp"
android:layout_marginBottom=
"20dp"
android:contentDescription=
"foreground-image"
android:src=
"@drawable/icon_alt_user_pic_32"
/>
android:contentDescription=
"user-profile-image"
android:src=
"@drawable/icon_alt_user_pic_32"
app:shapeAppearanceOverlay=
"@style/RoundImage"
android:scaleType=
"centerCrop"
/>
</RelativeLayout>
...
...
@@ -66,13 +68,13 @@
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textAlignment=
"center"
android:fontFamily=
"@font/inknut_antiqua_regular"
android:textSize=
"20sp"
android:layout_marginTop=
"6dp"
android:fontFamily=
"@font/inknut_antiqua_regular"
android:text=
"Profile Details"
android:textAlignment=
"center"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
/>
android:textSize=
"20sp"
android:textStyle=
"bold"
/>
<LinearLayout
android:layout_width=
"match_parent"
...
...
@@ -140,11 +142,13 @@
android:id=
"@+id/up_et_dob"
android:layout_width=
"match_parent"
android:layout_height=
"45dp"
android:inputType=
"
text
"
android:inputType=
"
date
"
android:background=
"@drawable/et_background"
android:padding=
"8dp"
android:fontFamily=
"@font/acme_regular"
android:textColor=
"@color/purple"
/>
android:textColor=
"@color/purple"
android:hint=
"Select your Date of birth (dd/mm/yyyy)*"
android:focusable=
"false"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -176,13 +180,26 @@
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<
TextView
<
LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"@font/inknut_antiqua_regular"
android:text=
"Email Address"
android:textColor=
"@color/black"
android:textSize=
"15sp"
/>
<ImageView
android:id=
"@+id/up_im_email_verification_status"
android:layout_width=
"100dp"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"8dp"
android:contentDescription=
"Email Verification Status"
/>
</LinearLayout>
<EditText
android:id=
"@+id/up_et_email"
...
...
app/src/main/res/layout/add_baby_view_layout.xml
0 → 100644
View file @
6cd9fbc3
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<ScrollView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:padding=
"16dp"
>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Basic Information"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textSize=
"18sp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/dark_purple"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginTop=
"4dp"
android:background=
"@drawable/borders"
android:padding=
"8dp"
>
<EditText
android:id=
"@+id/abv_et_first_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"@string/first_name_req"
android:inputType=
"textPersonName"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_last_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"@string/last_name_label"
android:inputType=
"textPersonName"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_dob"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"@string/birth_date_req"
android:inputType=
"date"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
android:focusable=
"false"
/>
<EditText
android:id=
"@+id/abv_et_sex"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"@string/sex"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textSize=
"16sp"
android:text=
"Photo"
android:fontFamily=
"@font/kanit_regular"
android:paddingStart=
"5dp"
android:paddingEnd=
"2dp"
android:paddingTop=
"6dp"
/>
<ImageButton
android:id=
"@+id/abv_ib_photo"
android:layout_width=
"120dp"
android:layout_height=
"120dp"
android:src=
"@drawable/ic_add_32"
android:contentDescription=
"baby_uploaded_photo"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:layout_marginTop=
"8dp"
>
<androidx.appcompat.widget.SwitchCompat
android:id=
"@+id/abv_switch_status"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:checked=
"true"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Enabled status"
android:layout_marginStart=
"15dp"
android:fontFamily=
"@font/kanit_regular"
android:textSize=
"16sp"
/>
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Physical Information"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textSize=
"18sp"
android:paddingTop=
"12dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/dark_purple"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginTop=
"4dp"
android:background=
"@drawable/borders"
android:padding=
"8dp"
>
<EditText
android:id=
"@+id/abv_et_weight"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Weight (kg)"
android:inputType=
"numberDecimal"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_height"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Height (feet)"
android:inputType=
"numberDecimal"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_dd_blood_type"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Blood type"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
android:contentDescription=
"dropdown"
/>
<EditText
android:id=
"@+id/abv_et_eye_colour"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Eye colour"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_hair_colour"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Hair colour"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
</LinearLayout>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Health Information"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textSize=
"18sp"
android:paddingTop=
"12dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/dark_purple"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginTop=
"4dp"
android:background=
"@drawable/borders"
android:padding=
"8dp"
>
<EditText
android:id=
"@+id/abv_et_allergies"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Allergies"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_medical_conditions"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Medical Conditions"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_medications"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Medications"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_vaccination_recs"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Vaccination Records (rec1 / rec2 / rec3)"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_doc_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Doctor/Pediatrician Name"
android:inputType=
"textPersonName"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_doc_contact"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Doctor/Pediatrician Contact Information"
android:inputType=
"phone"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_health_insurance_info"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Health Insurance Information"
android:inputType=
"textMultiLine"
android:minLines=
"1"
android:maxLines=
"3"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
</LinearLayout>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Development Milestones"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textSize=
"18sp"
android:paddingTop=
"12dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/dark_purple"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginTop=
"4dp"
android:background=
"@drawable/borders"
android:padding=
"8dp"
>
<EditText
android:id=
"@+id/abv_et_first_smile"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"First smile"
android:inputType=
"date"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
android:focusable=
"false"
/>
<EditText
android:id=
"@+id/abv_et_first_tooth"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"First tooth"
android:inputType=
"date"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
android:focusable=
"false"
/>
<EditText
android:id=
"@+id/abv_et_first_word"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"First word"
android:inputType=
"date"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
android:focusable=
"false"
/>
<EditText
android:id=
"@+id/abv_et_first_step"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"First step"
android:inputType=
"date"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
android:focusable=
"false"
/>
</LinearLayout>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Dietary Information"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textSize=
"18sp"
android:paddingTop=
"12dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/dark_purple"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginTop=
"4dp"
android:background=
"@drawable/borders"
android:padding=
"8dp"
>
<EditText
android:id=
"@+id/abv_et_favourite_foods"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Favourite foods"
android:inputType=
"textMultiLine"
android:minLines=
"1"
android:maxLines=
"3"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_food_dislikes"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Food dislikes"
android:inputType=
"textMultiLine"
android:minLines=
"1"
android:maxLines=
"3"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
</LinearLayout>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Emergency Contact Information"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textSize=
"18sp"
android:paddingTop=
"12dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/dark_purple"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginTop=
"4dp"
android:background=
"@drawable/borders"
android:padding=
"8dp"
>
<EditText
android:id=
"@+id/abv_et_p_emergency_con_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Primary emergency contact name"
android:inputType=
"textPersonName"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_p_emergency_relationship"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Primary emergency relationship"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_p_emergency_con_number"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Primary emergency contact phone number"
android:inputType=
"phone"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_s_emergency_con_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Secondary emergency contact name"
android:inputType=
"textPersonName"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_s_emergency_relationship"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Secondary emergency relationship"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/abv_et_s_emergency_con_number"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Secondary emergency contact phone number"
android:inputType=
"phone"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
</LinearLayout>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Additional Information"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textSize=
"18sp"
android:paddingTop=
"12dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/dark_purple"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginTop=
"4dp"
android:background=
"@drawable/borders"
android:padding=
"8dp"
>
<EditText
android:id=
"@+id/abv_et_notes"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Notes"
android:inputType=
"textMultiLine"
android:minLines=
"1"
android:maxLines=
"5"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<View
android:id=
"@+id/overlay"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#99D5C5DF"
android:visibility=
"gone"
android:clickable=
"true"
android:focusable=
"true"
/>
<com.github.ybq.android.spinkit.SpinKitView
android:id=
"@+id/progress_bar"
style=
"@style/SpinKitView.Large.DoubleBounce"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
app:SpinKit_Color=
"@color/purple"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
android:visibility=
"gone"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/baby_rv_item.xml
0 → 100644
View file @
6cd9fbc3
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:cardCornerRadius=
"20dp"
app:cardElevation=
"8dp"
android:layout_marginTop=
"3dp"
android:layout_marginBottom=
"3dp"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/baby_item"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:padding=
"15dp"
android:background=
"@color/white"
>
<TextView
android:id=
"@+id/baby_item_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Baby's Name"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textStyle=
"bold"
android:textColor=
"@color/black"
android:textSize=
"20sp"
android:maxLines=
"1"
android:ellipsize=
"end"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<LinearLayout
android:id=
"@+id/title_box"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"4dp"
android:orientation=
"vertical"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/baby_item_name"
>
<TextView
android:id=
"@+id/baby_item_tv_age_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"@font/acme_regular"
android:text=
"Age >"
android:textSize=
"16sp"
/>
<TextView
android:id=
"@+id/baby_item_tv_sex_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"4dp"
android:fontFamily=
"@font/acme_regular"
android:text=
"Sex >"
android:textSize=
"16sp"
/>
<TextView
android:id=
"@+id/baby_item_tv_desp_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"4dp"
android:fontFamily=
"@font/acme_regular"
android:text=
"Description >"
android:textSize=
"16sp"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/content_box"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"6dp"
android:layout_marginTop=
"4dp"
android:orientation=
"vertical"
app:layout_constraintEnd_toStartOf=
"@+id/baby_item_iv_image"
app:layout_constraintStart_toEndOf=
"@+id/title_box"
app:layout_constraintTop_toBottomOf=
"@id/baby_item_name"
>
<TextView
android:id=
"@+id/baby_item_tv_age_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"@font/acme_regular"
android:text=
"Value"
android:textColor=
"@color/purple"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/baby_item_tv_sex_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"4dp"
android:fontFamily=
"@font/acme_regular"
android:text=
"Value"
android:textColor=
"@color/purple"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/baby_item_tv_desp_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"4dp"
android:ellipsize=
"end"
android:fontFamily=
"@font/acme_regular"
android:maxLines=
"2"
android:text=
"Value"
android:textColor=
"@color/purple"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
</LinearLayout>
<com.google.android.material.imageview.ShapeableImageView
android:id=
"@+id/baby_item_iv_image"
android:layout_width=
"120dp"
android:layout_height=
"120dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
android:src=
"@drawable/foreground"
app:shapeAppearanceOverlay=
"@style/RoundImage"
android:scaleType=
"centerCrop"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
app/src/main/res/layout/edit_baby_view_layout.xml
0 → 100644
View file @
6cd9fbc3
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<ScrollView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:padding=
"16dp"
>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Baby's Picture"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textSize=
"18sp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/dark_purple"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginTop=
"4dp"
android:background=
"@drawable/borders"
android:padding=
"8dp"
>
<ImageButton
android:id=
"@+id/ebv_ib_photo"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:maxHeight=
"200dp"
android:src=
"@drawable/ic_add_32"
android:adjustViewBounds=
"true"
android:scaleType=
"centerInside"
android:layout_gravity=
"center"
android:contentDescription=
"baby_uploaded_photo"
/>
</LinearLayout>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Basic Information"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textSize=
"18sp"
android:paddingTop=
"12dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/dark_purple"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginTop=
"4dp"
android:background=
"@drawable/borders"
android:padding=
"8dp"
>
<EditText
android:id=
"@+id/ebv_et_first_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"@string/first_name_req"
android:inputType=
"textPersonName"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_last_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"@string/last_name_label"
android:inputType=
"textPersonName"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_dob"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"@string/birth_date_req"
android:inputType=
"date"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
android:focusable=
"false"
/>
<EditText
android:id=
"@+id/ebv_et_sex"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"@string/sex"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:layout_marginTop=
"8dp"
>
<androidx.appcompat.widget.SwitchCompat
android:id=
"@+id/ebv_switch_status"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:checked=
"true"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Enabled status"
android:layout_marginStart=
"15dp"
android:fontFamily=
"@font/kanit_regular"
android:textSize=
"16sp"
/>
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Physical Information"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textSize=
"18sp"
android:paddingTop=
"12dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/dark_purple"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginTop=
"4dp"
android:background=
"@drawable/borders"
android:padding=
"8dp"
>
<EditText
android:id=
"@+id/ebv_et_weight"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Weight (kg)"
android:inputType=
"numberDecimal"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_height"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Height (feet)"
android:inputType=
"numberDecimal"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_dd_blood_type"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Blood type"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
android:contentDescription=
"dropdown"
/>
<EditText
android:id=
"@+id/ebv_et_eye_colour"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Eye colour"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_hair_colour"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Hair colour"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
</LinearLayout>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Health Information"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textSize=
"18sp"
android:paddingTop=
"12dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/dark_purple"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginTop=
"4dp"
android:background=
"@drawable/borders"
android:padding=
"8dp"
>
<EditText
android:id=
"@+id/ebv_et_allergies"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Allergies"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_medical_conditions"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Medical Conditions"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_medications"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Medications"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_vaccination_recs"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Vaccination Records (rec1 / rec2 / rec3)"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_doc_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Doctor/Pediatrician Name"
android:inputType=
"textPersonName"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_doc_contact"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Doctor/Pediatrician Contact Information"
android:inputType=
"phone"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_health_insurance_info"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Health Insurance Information"
android:inputType=
"textMultiLine"
android:minLines=
"1"
android:maxLines=
"3"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
</LinearLayout>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Development Milestones"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textSize=
"18sp"
android:paddingTop=
"12dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/dark_purple"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginTop=
"4dp"
android:background=
"@drawable/borders"
android:padding=
"8dp"
>
<EditText
android:id=
"@+id/ebv_et_first_smile"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"First smile"
android:inputType=
"date"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
android:focusable=
"false"
/>
<EditText
android:id=
"@+id/ebv_et_first_tooth"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"First tooth"
android:inputType=
"date"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
android:focusable=
"false"
/>
<EditText
android:id=
"@+id/ebv_et_first_word"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"First word"
android:inputType=
"date"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
android:focusable=
"false"
/>
<EditText
android:id=
"@+id/ebv_et_first_step"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"First step"
android:inputType=
"date"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
android:focusable=
"false"
/>
</LinearLayout>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Dietary Information"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textSize=
"18sp"
android:paddingTop=
"12dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/dark_purple"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginTop=
"4dp"
android:background=
"@drawable/borders"
android:padding=
"8dp"
>
<EditText
android:id=
"@+id/ebv_et_favourite_foods"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Favourite foods"
android:inputType=
"textMultiLine"
android:minLines=
"1"
android:maxLines=
"3"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_food_dislikes"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Food dislikes"
android:inputType=
"textMultiLine"
android:minLines=
"1"
android:maxLines=
"3"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
</LinearLayout>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Emergency Contact Information"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textSize=
"18sp"
android:paddingTop=
"12dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/dark_purple"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginTop=
"4dp"
android:background=
"@drawable/borders"
android:padding=
"8dp"
>
<EditText
android:id=
"@+id/ebv_et_p_emergency_con_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Primary emergency contact name"
android:inputType=
"textPersonName"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_p_emergency_relationship"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Primary emergency relationship"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_p_emergency_con_number"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Primary emergency contact phone number"
android:inputType=
"phone"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_s_emergency_con_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Secondary emergency contact name"
android:inputType=
"textPersonName"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_s_emergency_relationship"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Secondary emergency relationship"
android:inputType=
"text"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
<EditText
android:id=
"@+id/ebv_et_s_emergency_con_number"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Secondary emergency contact phone number"
android:inputType=
"phone"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
</LinearLayout>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Additional Information"
android:textColor=
"@color/purple"
android:textStyle=
"bold"
android:fontFamily=
"@font/jeju_gothic_regular"
android:textSize=
"18sp"
android:paddingTop=
"12dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/dark_purple"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginTop=
"4dp"
android:background=
"@drawable/borders"
android:padding=
"8dp"
>
<EditText
android:id=
"@+id/ebv_et_notes"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Notes"
android:inputType=
"textMultiLine"
android:minLines=
"1"
android:maxLines=
"5"
android:textSize=
"16sp"
android:fontFamily=
"@font/kanit_regular"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<View
android:id=
"@+id/overlay"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#99D5C5DF"
android:visibility=
"gone"
android:clickable=
"true"
android:focusable=
"true"
/>
<com.github.ybq.android.spinkit.SpinKitView
android:id=
"@+id/progress_bar"
style=
"@style/SpinKitView.Large.DoubleBounce"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
app:SpinKit_Color=
"@color/purple"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
android:visibility=
"gone"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/values-night/strings.xml
0 → 100644
View file @
6cd9fbc3
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string
name=
"first_name_req"
>
First name
<font
color=
"#FF0000"
>
*
</font></string>
<string
name=
"email_req"
>
Email
<font
color=
"#FF0000"
>
*
</font></string>
<string
name=
"password_req"
>
Password
<font
color=
"#FF0000"
>
*
</font></string>
<string
name=
"last_name_req"
>
Last name
<font
color=
"#FF0000"
>
*
</font></string>
<string
name=
"mobile_number_req"
>
Mobile number
<font
color=
"#FF0000"
>
*
</font></string>
<string
name=
"confirm_password_req"
>
Confirm password
<font
color=
"#FF0000"
>
*
</font></string>
<string
name=
"last_name_label"
>
Last name
</string>
<string
name=
"birth_date_req"
>
Birth date
<font
color=
"#FF0000"
>
*
</font></string>
<string
name=
"sex"
>
Sex
<font
color=
"#FF0000"
>
*
</font></string>
</resources>
\ No newline at end of file
app/src/main/res/values-night/styles.xml
0 → 100644
View file @
6cd9fbc3
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style
name=
"RoundImage"
parent=
"ShapeAppearance.MaterialComponents.SmallComponent"
>
<item
name=
"cornerFamily"
>
rounded
</item>
<item
name=
"cornerSize"
>
50%
</item>
</style>
<style
name=
"CustomDialogAnimation"
>
<!-- Define your custom enter animation here -->
<item
name=
"android:windowEnterAnimation"
>
@anim/fade_in
</item>
<!-- You can add more animations like scale, translate, etc. -->
</style>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
6cd9fbc3
...
...
@@ -11,4 +11,13 @@
<string
name=
"login"
><u>
Login
</u></string>
<string
name=
"edit_btn_value"
>
Edit
</string>
<string
name=
"update_btn_value"
>
Update
</string>
<string
name=
"first_name_req"
>
First name
<font
color=
"#FF0000"
>
*
</font></string>
<string
name=
"email_req"
>
Email
<font
color=
"#FF0000"
>
*
</font></string>
<string
name=
"password_req"
>
Password
<font
color=
"#FF0000"
>
*
</font></string>
<string
name=
"last_name_req"
>
Last name
<font
color=
"#FF0000"
>
*
</font></string>
<string
name=
"mobile_number_req"
>
Mobile number
<font
color=
"#FF0000"
>
*
</font></string>
<string
name=
"confirm_password_req"
>
Confirm password
<font
color=
"#FF0000"
>
*
</font></string>
<string
name=
"last_name_label"
>
Last name
</string>
<string
name=
"birth_date_req"
>
Birth date
<font
color=
"#FF0000"
>
*
</font></string>
<string
name=
"sex"
>
Sex
<font
color=
"#FF0000"
>
*
</font></string>
</resources>
\ No newline at end of file
app/src/main/res/values/styles.xml
0 → 100644
View file @
6cd9fbc3
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style
name=
"RoundImage"
parent=
"ShapeAppearance.MaterialComponents.SmallComponent"
>
<item
name=
"cornerFamily"
>
rounded
</item>
<item
name=
"cornerSize"
>
50%
</item>
</style>
<style
name=
"CustomDialogAnimation"
>
<!-- Define your custom enter animation here -->
<item
name=
"android:windowEnterAnimation"
>
@anim/fade_in
</item>
<!-- You can add more animations like scale, translate, etc. -->
</style>
</resources>
\ No newline at end of file
app/src/main/res/xml/network_security_config.xml
View file @
6cd9fbc3
...
...
@@ -2,5 +2,6 @@
<network-security-config>
<domain-config
cleartextTrafficPermitted=
"true"
>
<domain
includeSubdomains=
"true"
>
192.168.1.2
</domain>
<domain
includeSubdomains=
"true"
>
192.168.1.6
</domain>
</domain-config>
</network-security-config>
gradle/libs.versions.toml
View file @
6cd9fbc3
...
...
@@ -4,32 +4,38 @@ junit = "4.13.2"
junitVersion
=
"1.1.5"
espressoCore
=
"3.5.1"
appcompat
=
"1.6.1"
material
=
"1.12.0"
constraintlayout
=
"2.1.4"
navigationFragment
=
"2.7.7"
navigationUi
=
"2.7.7"
activity
=
"1.9.0"
androidSpinkit
=
"1.4.0"
projectLombok
=
"1.18.32"
retrofit2
=
"2.9.0"
retrofit2Convertor
=
"2.9.0"
retrofit2
=
"2.11.0"
jacksonDatabind
=
"2.17.1"
materialVersion
=
"1.13.0-alpha02"
swiperefreshlayout
=
"1.2.0-alpha01"
converterJackson
=
"2.11.0"
jacksonDatatypeJsr310
=
"2.17.1"
[libraries]
junit
=
{
group
=
"junit"
,
name
=
"junit"
,
version.ref
=
"junit"
}
ext-junit
=
{
group
=
"androidx.test.ext"
,
name
=
"junit"
,
version.ref
=
"junitVersion"
}
espresso-core
=
{
group
=
"androidx.test.espresso"
,
name
=
"espresso-core"
,
version.ref
=
"espressoCore"
}
appcompat
=
{
group
=
"androidx.appcompat"
,
name
=
"appcompat"
,
version.ref
=
"appcompat"
}
material
=
{
group
=
"com.google.android.material"
,
name
=
"material"
,
version.ref
=
"material"
}
material
=
{
group
=
"com.google.android.material"
,
name
=
"material"
,
version.ref
=
"material
Version
"
}
constraintlayout
=
{
group
=
"androidx.constraintlayout"
,
name
=
"constraintlayout"
,
version.ref
=
"constraintlayout"
}
navigation-fragment
=
{
group
=
"androidx.navigation"
,
name
=
"navigation-fragment"
,
version.ref
=
"navigationFragment"
}
navigation-ui
=
{
group
=
"androidx.navigation"
,
name
=
"navigation-ui"
,
version.ref
=
"navigationUi"
}
activity
=
{
group
=
"androidx.activity"
,
name
=
"activity"
,
version.ref
=
"activity"
}
android-spinkit
=
{
group
=
"com.github.ybq"
,
name
=
"Android-SpinKit"
,
version.ref
=
"androidSpinkit"
}
projectlombok
=
{
group
=
"org.projectlombok"
,
name
=
"lombok"
,
version.ref
=
"projectLombok"
}
retrofit2
=
{
group
=
"com.squareup.retrofit2"
,
name
=
"retrofit"
,
version
.ref
=
"retrofit2
"
}
convertor-gson
=
{
group
=
"com.squareup.retrofit2"
,
name
=
"converter-gson"
,
version.ref
=
"retrofit2
Convertor
"
}
retrofit2
=
{
group
=
"com.squareup.retrofit2"
,
name
=
"retrofit"
,
version
=
"2.11.0
"
}
convertor-gson
=
{
group
=
"com.squareup.retrofit2"
,
name
=
"converter-gson"
,
version.ref
=
"retrofit2"
}
jackson-databind
=
{
group
=
"com.fasterxml.jackson.core"
,
name
=
"jackson-databind"
,
version.ref
=
"jacksonDatabind"
}
ucrop
=
{
group
=
"com.github.yalantis"
,
name
=
"ucrop"
,
version
=
"2.2.9"
}
swiperefreshlayout
=
{
group
=
"androidx.swiperefreshlayout"
,
name
=
"swiperefreshlayout"
,
version.ref
=
"swiperefreshlayout"
}
converter-jackson
=
{
group
=
"com.squareup.retrofit2"
,
name
=
"converter-jackson"
,
version.ref
=
"converterJackson"
}
jackson-datatype-jsr310
=
{
group
=
"com.fasterxml.jackson.datatype"
,
name
=
"jackson-datatype-jsr310"
,
version.ref
=
"jacksonDatatypeJsr310"
}
[plugins]
androidApplication
=
{
id
=
"com.android.application"
,
version.ref
=
"agp"
}
...
...
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