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
9ef3abdd
Commit
9ef3abdd
authored
Oct 28, 2024
by
Ishankha K.C
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use multiple devices
parent
d73d445b
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
482 additions
and
2 deletions
+482
-2
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+3
-0
app/src/main/java/com/kaluwa/enterprises/babycare/activities/BabyCamListActivity.java
.../enterprises/babycare/activities/BabyCamListActivity.java
+243
-0
app/src/main/java/com/kaluwa/enterprises/babycare/activities/DashboardActivity.java
...wa/enterprises/babycare/activities/DashboardActivity.java
+1
-1
app/src/main/java/com/kaluwa/enterprises/babycare/activities/LiveFeedActivity.java
...uwa/enterprises/babycare/activities/LiveFeedActivity.java
+6
-1
app/src/main/java/com/kaluwa/enterprises/babycare/adapter/BabyCamListAdapter.java
...luwa/enterprises/babycare/adapter/BabyCamListAdapter.java
+125
-0
app/src/main/res/layout/activity_baby_cam_list.xml
app/src/main/res/layout/activity_baby_cam_list.xml
+104
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
9ef3abdd
...
...
@@ -18,6 +18,9 @@
android:supportsRtl=
"true"
android:theme=
"@style/Theme.BabyCare"
tools:targetApi=
"31"
>
<activity
android:name=
".activities.BabyCamListActivity"
android:exported=
"false"
/>
<activity
android:name=
".activities.LiveVocalActivity"
android:exported=
"false"
/>
...
...
app/src/main/java/com/kaluwa/enterprises/babycare/activities/BabyCamListActivity.java
0 → 100644
View file @
9ef3abdd
This diff is collapsed.
Click to expand it.
app/src/main/java/com/kaluwa/enterprises/babycare/activities/DashboardActivity.java
View file @
9ef3abdd
...
...
@@ -40,7 +40,7 @@ public class DashboardActivity extends AppCompatActivity {
btn6
=
findViewById
(
R
.
id
.
btn_settings
);
btn1
.
setOnClickListener
(
v
->
{
Intent
intent
=
new
Intent
(
this
,
LiveFeed
Activity
.
class
);
Intent
intent
=
new
Intent
(
this
,
BabyCamList
Activity
.
class
);
startActivity
(
intent
);
animationChanger
(
this
);
});
...
...
app/src/main/java/com/kaluwa/enterprises/babycare/activities/LiveFeedActivity.java
View file @
9ef3abdd
...
...
@@ -56,7 +56,7 @@ public class LiveFeedActivity extends AppCompatActivity {
private
Handler
handler
=
new
Handler
();
private
Runnable
updateRunnable
;
private
WebSocket
webSocket
;
private
String
deviceUid
=
"
8563efa6
"
;
private
String
deviceUid
=
""
;
private
AuthenticationDto
authDto
;
...
...
@@ -74,6 +74,11 @@ public class LiveFeedActivity extends AppCompatActivity {
Toast
.
makeText
(
this
,
"Error getting token, Please refresh"
,
Toast
.
LENGTH_SHORT
).
show
();
}
// get extra
if
(
getIntent
().
hasExtra
(
"deviceUid"
))
{
deviceUid
=
getIntent
().
getStringExtra
(
"deviceUid"
);
}
// Replace the device UID in the URLs
LIVE_FEED_URL
=
LIVE_FEED_URL
.
replace
(
"{device_uid}"
,
deviceUid
);
...
...
app/src/main/java/com/kaluwa/enterprises/babycare/adapter/BabyCamListAdapter.java
0 → 100644
View file @
9ef3abdd
package
com.kaluwa.enterprises.babycare.adapter
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
animationChanger
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
babyAgeCalculate
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
convertByteArrayToBitmap
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
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.BabyCamListActivity
;
import
com.kaluwa.enterprises.babycare.activities.LiveFeedActivity
;
import
com.kaluwa.enterprises.babycare.dialogs.EditBabyDialog
;
import
com.kaluwa.enterprises.babycare.dto.BabyDto
;
import
java.time.LocalDate
;
import
java.util.List
;
public
class
BabyCamListAdapter
extends
RecyclerView
.
Adapter
<
BabyCamListAdapter
.
BabyCamListItemHolder
>
{
private
final
static
String
TAG
=
"BabyCamListAdapter"
;
private
Context
context
;
private
List
<
BabyDto
>
babyList
;
public
BabyCamListAdapter
(
BabyCamListActivity
context
,
List
<
BabyDto
>
babyList
)
{
this
.
context
=
context
;
this
.
babyList
=
babyList
;
}
@NonNull
@Override
public
BabyCamListAdapter
.
BabyCamListItemHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
View
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
baby_rv_item
,
parent
,
false
);
return
new
BabyCamListItemHolder
(
view
);
}
@Override
public
void
onBindViewHolder
(
@NonNull
BabyCamListAdapter
.
BabyCamListItemHolder
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
();
byte
[]
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 live feed activity
if
(
babyDto
.
getDeviceUid
()
==
null
||
babyDto
.
getDeviceUid
().
isEmpty
())
{
Toast
.
makeText
(
context
,
"No device is associated with this baby."
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
Toast
.
makeText
(
context
,
"Opening live feed for "
+
babyDto
.
getFirstName
(),
Toast
.
LENGTH_SHORT
).
show
();
Intent
intent
=
new
Intent
(
context
,
LiveFeedActivity
.
class
);
intent
.
putExtra
(
"deviceUid"
,
babyDto
.
getDeviceUid
());
context
.
startActivity
(
intent
);
animationChanger
((
Activity
)
context
);
}
});
}
@Override
public
int
getItemCount
()
{
return
babyList
.
size
();
}
public
static
class
BabyCamListItemHolder
extends
RecyclerView
.
ViewHolder
{
public
ConstraintLayout
clBabyItem
;
public
TextView
tvBabyName
,
tvBabyAge
,
tvBabySex
,
tvBabyDDespTitle
,
tvBabyDDespContent
;
public
ShapeableImageView
ivBabyImage
;
public
BabyCamListItemHolder
(
@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/res/layout/activity_baby_cam_list.xml
0 → 100644
View file @
9ef3abdd
<?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.BabyCamListActivity"
>
<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 Cam List"
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/bcl_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"
/>
<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>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment