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
b6c2fd89
Commit
b6c2fd89
authored
Oct 21, 2024
by
Ishankha K.C
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify activity logs view
parent
6a3bcfe2
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
131 additions
and
58 deletions
+131
-58
app/src/main/java/com/kaluwa/enterprises/babycare/activities/ActivityLogsActivity.java
...enterprises/babycare/activities/ActivityLogsActivity.java
+32
-0
app/src/main/java/com/kaluwa/enterprises/babycare/activities/DashboardActivity.java
...wa/enterprises/babycare/activities/DashboardActivity.java
+4
-0
app/src/main/java/com/kaluwa/enterprises/babycare/adapter/ActivityLogsAdapter.java
...uwa/enterprises/babycare/adapter/ActivityLogsAdapter.java
+19
-6
app/src/main/res/color/icon_color_selector.xml
app/src/main/res/color/icon_color_selector.xml
+5
-0
app/src/main/res/drawable/ico_delete.xml
app/src/main/res/drawable/ico_delete.xml
+7
-0
app/src/main/res/drawable/noti_recycler_view_background.xml
app/src/main/res/drawable/noti_recycler_view_background.xml
+8
-0
app/src/main/res/drawable/ripple_effect.xml
app/src/main/res/drawable/ripple_effect.xml
+7
-0
app/src/main/res/layout/activity_logs.xml
app/src/main/res/layout/activity_logs.xml
+36
-45
app/src/main/res/layout/item_activity_log.xml
app/src/main/res/layout/item_activity_log.xml
+13
-7
No files found.
app/src/main/java/com/kaluwa/enterprises/babycare/activities/ActivityLogsActivity.java
View file @
b6c2fd89
...
...
@@ -12,7 +12,9 @@ import android.view.Gravity;
import
android.view.Menu
;
import
android.view.MenuInflater
;
import
android.view.MenuItem
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
...
...
@@ -21,6 +23,7 @@ import androidx.annotation.NonNull;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.widget.PopupMenu
;
import
androidx.appcompat.widget.Toolbar
;
import
androidx.core.content.ContextCompat
;
import
androidx.core.graphics.Insets
;
import
androidx.core.view.ViewCompat
;
import
androidx.core.view.WindowInsetsCompat
;
...
...
@@ -94,6 +97,35 @@ public class ActivityLogsActivity extends AppCompatActivity {
recyclerView
.
setAdapter
(
adapter
);
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
this
));
ImageView
clearIcon
=
findViewById
(
R
.
id
.
clear_icon
);
clearIcon
.
setOnTouchListener
((
v
,
event
)
->
{
switch
(
event
.
getAction
())
{
case
MotionEvent
.
ACTION_DOWN
:
// Apply the pressed color tint
clearIcon
.
setColorFilter
(
ContextCompat
.
getColor
(
getApplicationContext
(),
R
.
color
.
cancel_red
));
break
;
case
MotionEvent
.
ACTION_UP
:
// Revert to the default color
clearIcon
.
setColorFilter
(
ContextCompat
.
getColor
(
getApplicationContext
(),
R
.
color
.
purple
));
// Call performClick() to handle the click action properly
clearIcon
.
performClick
();
break
;
case
MotionEvent
.
ACTION_CANCEL
:
// Revert to the default color
clearIcon
.
setColorFilter
(
ContextCompat
.
getColor
(
getApplicationContext
(),
R
.
color
.
purple
));
break
;
}
return
true
;
// Return true to indicate the touch event is consumed
});
// Override performClick to provide click handling
clearIcon
.
setOnClickListener
(
v
->
{
// Handle the click action here
// You can add your click handling logic here
});
}
private
void
loadData
()
{
...
...
app/src/main/java/com/kaluwa/enterprises/babycare/activities/DashboardActivity.java
View file @
b6c2fd89
...
...
@@ -42,6 +42,7 @@ public class DashboardActivity extends AppCompatActivity {
btn1
.
setOnClickListener
(
v
->
{
Intent
intent
=
new
Intent
(
this
,
LiveFeedActivity
.
class
);
startActivity
(
intent
);
animationChanger
(
this
);
});
btn2
.
setOnClickListener
(
v
->
{
...
...
@@ -49,6 +50,7 @@ public class DashboardActivity extends AppCompatActivity {
btn3
.
setOnClickListener
(
v
->
{
Intent
intent
=
new
Intent
(
this
,
ActivityLogsActivity
.
class
);
startActivity
(
intent
);
animationChanger
(
this
);
});
btn4
.
setOnClickListener
(
v
->
{
Intent
intent
=
new
Intent
(
this
,
DeviceControlsActivity
.
class
);
...
...
@@ -58,10 +60,12 @@ public class DashboardActivity extends AppCompatActivity {
btn5
.
setOnClickListener
(
v
->
{
Intent
intent
=
new
Intent
(
this
,
BabyDashboardActivity
.
class
);
startActivity
(
intent
);
animationChanger
(
this
);
});
btn6
.
setOnClickListener
(
v
->
{
Intent
intent
=
new
Intent
(
this
,
SettingsActivity
.
class
);
startActivity
(
intent
);
animationChanger
(
this
);
});
}
...
...
app/src/main/java/com/kaluwa/enterprises/babycare/adapter/ActivityLogsAdapter.java
View file @
b6c2fd89
package
com.kaluwa.enterprises.babycare.adapter
;
import
static
com
.
kaluwa
.
enterprises
.
babycare
.
utils
.
Utils
.
getDateTimeFormatter
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.os.Build
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -13,6 +16,9 @@ import androidx.recyclerview.widget.RecyclerView;
import
com.kaluwa.enterprises.babycare.R
;
import
com.kaluwa.enterprises.babycare.dto.ActivityLogDto
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatterBuilder
;
import
java.util.List
;
public
class
ActivityLogsAdapter
extends
RecyclerView
.
Adapter
<
ActivityLogsAdapter
.
ActivityLogItemHolder
>
{
...
...
@@ -35,12 +41,19 @@ public class ActivityLogsAdapter extends RecyclerView.Adapter<ActivityLogsAdapte
@SuppressLint
(
"SetTextI18n"
)
@Override
public
void
onBindViewHolder
(
@NonNull
ActivityLog
sAdapter
.
ActivityLog
ItemHolder
holder
,
int
position
)
{
public
void
onBindViewHolder
(
@NonNull
ActivityLogItemHolder
holder
,
int
position
)
{
ActivityLogDto
activityLogDto
=
activityLogList
.
get
(
position
);
holder
.
tvActivityLogId
.
setText
(
activityLogDto
.
getActivityLogId
().
toString
());
holder
.
tvActivityType
.
setText
(
activityLogDto
.
getActivityLogType
());
// holder.tvActivityLogId.setText(activityLogDto.getActivityLogId().toString());
if
(
activityLogDto
.
getActivityLogType
().
equals
(
"EMOTION"
))
{
holder
.
tvActivityType
.
setText
(
"MOOD"
);
}
else
{
holder
.
tvActivityType
.
setText
(
activityLogDto
.
getActivityLogType
());
}
holder
.
tvDescription
.
setText
(
activityLogDto
.
getActivityLogDescription
());
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
holder
.
tvLogTime
.
setText
(
LocalDateTime
.
now
().
format
(
formatter
));
}
}
@Override
...
...
@@ -50,11 +63,11 @@ public class ActivityLogsAdapter extends RecyclerView.Adapter<ActivityLogsAdapte
public
static
class
ActivityLogItemHolder
extends
RecyclerView
.
ViewHolder
{
public
TextView
tv
ActivityLogId
,
tvActivityType
,
tvDescription
;
public
TextView
tv
LogTime
,
tvActivityType
,
tvDescription
;
public
ActivityLogItemHolder
(
@NonNull
View
view
)
{
super
(
view
);
tv
ActivityLogId
=
view
.
findViewById
(
R
.
id
.
tvActivityLogId
);
tv
LogTime
=
view
.
findViewById
(
R
.
id
.
tvLogTime
);
tvActivityType
=
view
.
findViewById
(
R
.
id
.
tvActivityType
);
tvDescription
=
view
.
findViewById
(
R
.
id
.
tvDescription
);
}
...
...
app/src/main/res/color/icon_color_selector.xml
0 → 100644
View file @
b6c2fd89
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_pressed=
"true"
android:color=
"@color/cancel_red"
/>
<!-- Pressed state -->
<item
android:color=
"@color/purple"
/>
<!-- Default state -->
</selector>
app/src/main/res/drawable/ico_delete.xml
0 → 100644
View file @
b6c2fd89
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:height=
"32dp"
android:viewportHeight=
"72"
android:viewportWidth=
"72"
android:width=
"32dp"
>
<path
android:fillColor=
"@android:color/black"
android:pathData=
"M34.3,8c-0.5,1.8 -1.4,2 -7.4,2 -3.8,-0 -7.9,0.5 -9.2,1.2 -1.2,0.6 -2.8,1.4 -3.5,1.7 -0.8,0.3 -1.3,1 -1.3,1.6 0.1,0.6 8.5,1 23.1,1 14.6,-0 23,-0.4 23.1,-1 0,-0.6 -0.5,-1.3 -1.3,-1.6 -0.7,-0.3 -2.3,-1.1 -3.5,-1.7 -1.3,-0.7 -5.4,-1.2 -9.2,-1.2 -6,-0 -6.9,-0.2 -7.4,-2 -0.3,-1.1 -1,-2 -1.7,-2 -0.7,-0 -1.4,0.9 -1.7,2z"
android:strokeColor=
"#00000000"
/>
<path
android:fillColor=
"@android:color/black"
android:pathData=
"M15.4,25.2c0.3,1.8 1.3,10.3 2.1,18.8 1.2,11.9 2,15.8 3.2,16.7 1.2,0.9 6,1.3 15.4,1.3 11.2,-0 14.1,-0.3 15.3,-1.6 0.9,-0.8 1.6,-1.8 1.6,-2 0,-1.1 3,-29.1 3.5,-32.7l0.5,-3.7 -21,-0 -21.1,-0 0.5,3.2z"
android:strokeColor=
"#00000000"
/>
</vector>
app/src/main/res/drawable/noti_recycler_view_background.xml
0 → 100644
View file @
b6c2fd89
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"@android:color/white"
/>
<!-- Background color -->
<corners
android:radius=
"16dp"
/>
<!-- Adjust the radius for the corners -->
</shape>
app/src/main/res/drawable/ripple_effect.xml
0 → 100644
View file @
b6c2fd89
<?xml version="1.0" encoding="utf-8"?>
<ripple
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:color=
"@color/cancel_red"
>
<item
android:id=
"@android:id/mask"
>
<color
android:color=
"@android:color/white"
/>
</item>
</ripple>
app/src/main/res/layout/activity_logs.xml
View file @
b6c2fd89
...
...
@@ -51,55 +51,12 @@
</RelativeLayout>
<!-- Header Row for the Table -->
<LinearLayout
android:id=
"@+id/headerRow"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:background=
"@color/gray"
android:paddingTop=
"6dp"
android:paddingStart=
"15dp"
android:paddingEnd=
"15dp"
android:paddingBottom=
"6dp"
app:layout_constraintTop_toBottomOf=
"@id/rl_header"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"0.8"
android:text=
"Id"
android:textSize=
"16sp"
android:textStyle=
"bold"
android:textColor=
"@color/black"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"2"
android:text=
"Activity Type"
android:textSize=
"16sp"
android:textStyle=
"bold"
android:textColor=
"@color/black"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"3"
android:text=
"Description"
android:textSize=
"16sp"
android:textStyle=
"bold"
android:textColor=
"@color/black"
/>
</LinearLayout>
<!-- RecyclerView for the Table Content -->
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_activity_notifications"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
app:layout_constraintTop_toBottomOf=
"@id/
headerRow
"
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"
...
...
@@ -107,7 +64,41 @@
android:paddingTop=
"6dp"
android:paddingStart=
"15dp"
android:paddingEnd=
"15dp"
android:paddingBottom=
"6dp"
/>
android:paddingBottom=
"6dp"
android:background=
"@drawable/noti_recycler_view_background"
android:layout_marginTop=
"8dp"
android:layout_marginStart=
"8dp"
android:layout_marginEnd=
"8dp"
android:layout_marginBottom=
"8dp"
/>
<!-- Notification Icon -->
<ImageView
android:id=
"@+id/notification_icon"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:layout_marginTop=
"16dp"
android:src=
"@drawable/ico_notifications_active_32"
android:contentDescription=
"Notification Icon"
app:layout_constraintTop_toTopOf=
"@id/rv_activity_notifications"
app:layout_constraintEnd_toEndOf=
"@id/rv_activity_notifications"
android:layout_gravity=
"end"
app:tint=
"@color/purple"
/>
<!-- Clear Icon -->
<ImageView
android:id=
"@+id/clear_icon"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:layout_marginBottom=
"16dp"
android:src=
"@drawable/ico_delete"
android:contentDescription=
"Clear History Icon"
app:layout_constraintBottom_toBottomOf=
"@id/rv_activity_notifications"
app:layout_constraintEnd_toEndOf=
"@id/rv_activity_notifications"
android:layout_gravity=
"end"
app:tint=
"@color/icon_color_selector"
/>
<TextView
android:id=
"@+id/no_content_message"
...
...
app/src/main/res/layout/item_activity_log.xml
View file @
b6c2fd89
...
...
@@ -6,21 +6,25 @@
android:padding=
"8dp"
>
<TextView
android:id=
"@+id/tv
ActivityLogId
"
android:id=
"@+id/tv
LogTime
"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"
0.8
"
android:text=
"
Id
"
android:layout_weight=
"
2
"
android:text=
"
Date & Time
"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
android:paddingRight=
"4dp"
android:textColor=
"@color/black"
android:fontFamily=
"@font/acme_regular"
/>
<TextView
android:id=
"@+id/tvActivityType"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"
2
"
android:layout_weight=
"
1.6
"
android:text=
"Activity Type"
android:textSize=
"16sp"
/>
android:textSize=
"16sp"
android:paddingRight=
"4dp"
/>
<TextView
android:id=
"@+id/tvDescription"
...
...
@@ -28,6 +32,8 @@
android:layout_height=
"wrap_content"
android:layout_weight=
"3"
android:text=
"Description"
android:textSize=
"16sp"
/>
android:textSize=
"16sp"
android:textColor=
"@color/black"
android:fontFamily=
"@font/acme_regular"
/>
</LinearLayout>
\ 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