Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
21_22-J 38
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
21_22-J 38
21_22-J 38
Commits
95855a73
Commit
95855a73
authored
Feb 08, 2022
by
W.D.R.P. Sandeepa
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'it18218640' into 'master'
create function audioInit and checkPermission See merge request
!108
parents
10763492
bc0784b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
17 deletions
+53
-17
frontend/src/router/router.js
frontend/src/router/router.js
+1
-1
frontend/src/screen/activity/Blue.js
frontend/src/screen/activity/Blue.js
+52
-16
No files found.
frontend/src/router/router.js
View file @
95855a73
...
@@ -16,7 +16,7 @@ const Stack = createNativeStackNavigator();
...
@@ -16,7 +16,7 @@ const Stack = createNativeStackNavigator();
const
AppRouter
=
()
=>
{
const
AppRouter
=
()
=>
{
return
(
return
(
<
NavigationContainer
>
<
NavigationContainer
>
<
Stack
.
Navigator
initialRouteName
=
"
Splash
"
>
<
Stack
.
Navigator
initialRouteName
=
"
Color
"
>
<
Stack
.
Screen
<
Stack
.
Screen
options
=
{{
headerShown
:
false
}}
options
=
{{
headerShown
:
false
}}
name
=
"
Home
"
name
=
"
Home
"
...
...
frontend/src/screen/activity/Blue.js
View file @
95855a73
...
@@ -28,23 +28,59 @@ export default function Blue(color) {
...
@@ -28,23 +28,59 @@ export default function Blue(color) {
const
backColor
=
color
.
route
.
params
.
color
;
const
backColor
=
color
.
route
.
params
.
color
;
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
audioInit
();
const
unsubscribe
=
navigation
.
addListener
(
"
focus
"
,
()
=>
{
const
unsubscribe
=
navigation
.
addListener
(
"
focus
"
,
()
=>
{
// The screen is focused
// The screen is focused
// Call any action
// Call any action
Orientation
.
unlockAllOrientations
();
Orientation
.
unlockAllOrientations
();
Orientation
.
lockToLandscape
();
Orientation
.
lockToLandscape
();
});
});
return
unsubscribe
;
return
unsubscribe
;
},
[
navigation
]);
},
[
navigation
]);
// audioInit
function
audioInit
()
{
return
(
console
.
log
(
'
audioInit
'
);
const
colorAudio
=
{
sampleRate
:
16000
,
channels
:
1
,
bitsPerSample
:
16
,
wavFile
:
'
color.wav
'
,
// thise wave file name
};
AudioRecord
.
init
(
colorAudio
);
}
// checkPermission
async
function
checkPermission
()
{
console
.
log
(
'
checkPermission
'
);
const
p
=
await
Permissions
.
check
(
'
microphone
'
);
console
.
log
(
p
);
console
.
log
(
'
permission check
'
,
p
);
if
(
p
===
'
authorized
'
)
{
console
.
log
(
'
if
'
);
//audio start
audioStart
();
}
else
{
console
.
log
(
'
else
'
);
return
requestPermission
();
}
}
return
(
<
SafeAreaView
>
<
SafeAreaView
>
<
View
style
=
{{
flexDirection
:
"
column
"
}}
>
<
View
style
=
{{
flexDirection
:
"
column
"
}}
>
<
ImageBackground
style
=
{
styles
.
image
}
source
=
{
require
(
"
../../assets/game/gameback.png
"
)}
>
<
ImageBackground
style
=
{
styles
.
image
}
source
=
{
require
(
"
../../assets/game/gameback.png
"
)}
>
<
View
>
<
View
>
<
View
style
=
{
styles
.
textBody
}
>
<
View
style
=
{
styles
.
textBody
}
>
<
Text
style
=
{
styles
.
text
}
>
Say
the
name
of
this
color
?
<
/Text
>
<
Text
style
=
{
styles
.
text
}
>
Say
the
name
of
this
color
?
<
/Text
>
<
/View
>
<
/View
>
...
@@ -57,21 +93,21 @@ export default function Blue(color) {
...
@@ -57,21 +93,21 @@ export default function Blue(color) {
<
Image
style
=
{
styles
.
blackboard
}
source
=
{
require
(
"
../../assets/game/blackboard.png
"
)}
><
/Image
>
<
Image
style
=
{
styles
.
blackboard
}
source
=
{
require
(
"
../../assets/game/blackboard.png
"
)}
><
/Image
>
<
View
style
=
{{
width
:
180
,
height
:
180
,
backgroundColor
:
backColor
,
marginTop
:
-
370
,
marginLeft
:
455
,
borderRadius
:
100
}}
>
<
View
style
=
{{
width
:
180
,
height
:
180
,
backgroundColor
:
backColor
,
marginTop
:
-
370
,
marginLeft
:
455
,
borderRadius
:
100
}}
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
View
style
=
{{
flexDirection
:
"
row
"
,
marginLeft
:
480
}}
>
<
View
style
=
{{
flexDirection
:
"
row
"
,
marginLeft
:
480
}}
>
<
Button
style
=
{
styles
.
button
}
title
=
"
Recode
"
/>
<
Button
style
=
{
styles
.
button
}
title
=
"
Recode
"
/>
<
Button
title
=
"
Return
"
color
=
"
#1DCE92
"
/>
<
Button
title
=
"
Return
"
color
=
"
#1DCE92
"
/>
<
Button
title
=
"
Exit
"
color
=
"
#841584
"
/>
<
Button
title
=
"
Exit
"
color
=
"
#841584
"
/>
<
/View>
<
/View
>
<
/ImageBackground
>
<
/ImageBackground
>
<
/View
>
<
/View
>
<
/SafeAreaView
>
<
/SafeAreaView
>
)
)
}
}
const
styles
=
StyleSheet
.
create
({
const
styles
=
StyleSheet
.
create
({
...
...
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