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
bc0784b1
Commit
bc0784b1
authored
Feb 08, 2022
by
W.D.R.P. Sandeepa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create function audioInit and checkPermission
parent
10763492
Changes
2
Show 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 @
bc0784b1
...
...
@@ -16,7 +16,7 @@ const Stack = createNativeStackNavigator();
const
AppRouter
=
()
=>
{
return
(
<
NavigationContainer
>
<
Stack
.
Navigator
initialRouteName
=
"
Splash
"
>
<
Stack
.
Navigator
initialRouteName
=
"
Color
"
>
<
Stack
.
Screen
options
=
{{
headerShown
:
false
}}
name
=
"
Home
"
...
...
frontend/src/screen/activity/Blue.js
View file @
bc0784b1
...
...
@@ -28,6 +28,9 @@ export default function Blue(color) {
const
backColor
=
color
.
route
.
params
.
color
;
React
.
useEffect
(()
=>
{
audioInit
();
const
unsubscribe
=
navigation
.
addListener
(
"
focus
"
,
()
=>
{
// The screen is focused
// Call any action
...
...
@@ -38,9 +41,42 @@ export default function Blue(color) {
return
unsubscribe
;
},
[
navigation
]);
return
(
// audioInit
function
audioInit
()
{
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
>
<
View
style
=
{{
flexDirection
:
"
column
"
}}
>
<
View
style
=
{{
flexDirection
:
"
column
"
}}
>
<
ImageBackground
style
=
{
styles
.
image
}
source
=
{
require
(
"
../../assets/game/gameback.png
"
)}
>
<
View
>
...
...
@@ -57,15 +93,15 @@ export default function Blue(color) {
<
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
style
=
{{
flexDirection
:
"
row
"
,
marginLeft
:
480
}}
>
<
Button
style
=
{
styles
.
button
}
title
=
"
Recode
"
/>
<
Button
title
=
"
Return
"
color
=
"
#1DCE92
"
/>
<
Button
title
=
"
Exit
"
color
=
"
#841584
"
/>
<
View
style
=
{{
flexDirection
:
"
row
"
,
marginLeft
:
480
}}
>
<
Button
style
=
{
styles
.
button
}
title
=
"
Recode
"
/>
<
Button
title
=
"
Return
"
color
=
"
#1DCE92
"
/>
<
Button
title
=
"
Exit
"
color
=
"
#841584
"
/>
<
/View
>
<
/ImageBackground
>
...
...
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