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
ccd159e2
Commit
ccd159e2
authored
May 19, 2024
by
Chamod Ishankha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
complete user profile with image upload option
parent
1ca662d8
Changes
17
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
264 additions
and
45 deletions
+264
-45
app/build.gradle.kts
app/build.gradle.kts
+1
-0
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+6
-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/UserProfileActivity.java
.../enterprises/babycare/activities/UserProfileActivity.java
+198
-5
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/config/ApiConfig.java
...ava/com/kaluwa/enterprises/babycare/config/ApiConfig.java
+1
-1
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/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/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
+1
-0
app/src/main/res/layout/activity_user_profile.xml
app/src/main/res/layout/activity_user_profile.xml
+6
-4
app/src/main/res/values-night/styles.xml
app/src/main/res/values-night/styles.xml
+7
-0
app/src/main/res/values/styles.xml
app/src/main/res/values/styles.xml
+7
-0
gradle/libs.versions.toml
gradle/libs.versions.toml
+6
-6
No files found.
app/build.gradle.kts
View file @
ccd159e2
...
...
@@ -43,6 +43,7 @@ dependencies {
implementation
(
libs
.
retrofit2
)
implementation
(
libs
.
convertor
.
gson
)
implementation
(
libs
.
jackson
.
databind
)
implementation
(
libs
.
ucrop
)
testImplementation
(
libs
.
junit
)
androidTestImplementation
(
libs
.
ext
.
junit
)
androidTestImplementation
(
libs
.
espresso
.
core
)
...
...
app/src/main/AndroidManifest.xml
View file @
ccd159e2
...
...
@@ -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,11 @@
android:supportsRtl=
"true"
android:theme=
"@style/Theme.BabyCare"
tools:targetApi=
"31"
>
<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 @
ccd159e2
...
...
@@ -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/UserProfileActivity.java
View file @
ccd159e2
This diff is collapsed.
Click to expand it.
app/src/main/java/com/kaluwa/enterprises/babycare/activities/auth/LoginActivity.java
View file @
ccd159e2
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/config/ApiConfig.java
View file @
ccd159e2
...
...
@@ -11,7 +11,7 @@ import retrofit2.Retrofit;
import
retrofit2.converter.gson.GsonConverterFactory
;
public
class
ApiConfig
{
private
static
final
String
BASE_URL
=
"http://192.168.1.
6
:8080/api/v1/baby-care/"
;
private
static
final
String
BASE_URL
=
"http://192.168.1.
2
:8080/api/v1/baby-care/"
;
private
static
ApiConfig
instance
;
private
static
Retrofit
retrofitAuth
=
null
;
private
static
Retrofit
retrofitOther
=
null
;
...
...
app/src/main/java/com/kaluwa/enterprises/babycare/config/TokenSaver.java
View file @
ccd159e2
...
...
@@ -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/dto/AuthenticationDto.java
→
app/src/main/java/com/kaluwa/enterprises/babycare/dto/
responseDto/
AuthenticationDto.java
View file @
ccd159e2
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 @
ccd159e2
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 @
ccd159e2
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 @
ccd159e2
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/UserApiService.java
View file @
ccd159e2
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 @
ccd159e2
...
...
@@ -26,6 +26,7 @@ public class Utils {
private
static
final
String
TAG
=
"Utils"
;
public
static
final
String
DATE_FORMAT
=
"dd/M/yyyy"
;
public
static
final
int
PICK_IMAGE_REQUEST
=
1
;
public
static
void
loader
(
View
overlay
,
SpinKitView
spinKitView
,
boolean
status
)
{
if
(
status
)
{
...
...
app/src/main/res/layout/activity_user_profile.xml
View file @
ccd159e2
...
...
@@ -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>
...
...
app/src/main/res/values-night/styles.xml
0 → 100644
View file @
ccd159e2
<?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>
</resources>
\ No newline at end of file
app/src/main/res/values/styles.xml
0 → 100644
View file @
ccd159e2
<?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>
</resources>
\ No newline at end of file
gradle/libs.versions.toml
View file @
ccd159e2
...
...
@@ -4,32 +4,32 @@ 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"
[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"
}
[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