Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022 – 144
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
1
Merge Requests
1
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
Ganepola G.A.S.L IT19050386
2022 – 144
Commits
6334b47e
Commit
6334b47e
authored
Oct 10, 2022
by
Ravishani W.M.S
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
57ba1e22
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
Home.java
Home.java
+48
-0
No files found.
Home.java
0 → 100644
View file @
6334b47e
package
com.example.smart_pillow
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.cardview.widget.CardView
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.view.View
;
public
class
Home
extends
AppCompatActivity
implements
View
.
OnClickListener
{
private
CardView
alarm_card
,
sleep_card
,
music_card
,
light_card
,
health_card
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_home
);
// define the cards
alarm_card
=
(
CardView
)
findViewById
(
R
.
id
.
alarmCardID
);
sleep_card
=
(
CardView
)
findViewById
(
R
.
id
.
sleepCardID
);
music_card
=
(
CardView
)
findViewById
(
R
.
id
.
musicCardID
);
light_card
=
(
CardView
)
findViewById
(
R
.
id
.
lightCardID
);
health_card
=
(
CardView
)
findViewById
(
R
.
id
.
healthCardID
);
//add click listener to cards
alarm_card
.
setOnClickListener
(
this
);
sleep_card
.
setOnClickListener
(
this
);
music_card
.
setOnClickListener
(
this
);
light_card
.
setOnClickListener
(
this
);
health_card
.
setOnClickListener
(
this
);
}
@Override
public
void
onClick
(
View
view
)
{
Intent
i
;
switch
(
view
.
getId
())
{
case
R
.
id
.
musicCardID
:
i
=
new
Intent
(
this
,
Music
.
class
);
startActivity
(
i
);
break
;
case
R
.
id
.
lightCardID
:
i
=
new
Intent
(
this
,
Light
.
class
);
startActivity
(
i
);
break
;
default
:
break
;
}
}
}
\ 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