Commit 8738564c authored by Muthumal S.A.D.M.'s avatar Muthumal S.A.D.M.

Merge remote-tracking branch 'origin/master' into it18227314

parents 450658e5 d3b03468
...@@ -11,7 +11,7 @@ def get_reading_result(userId): ...@@ -11,7 +11,7 @@ def get_reading_result(userId):
def save_activity_details(userId, word, token, level, triedCount): def save_activity_details(userId, word, token, level, triedCount):
qry = 'INSERT INTO reading (id,userId,word,token,triedCount,level) VALUES (NULL, %s, %s, %s, %s, %s)' qry = 'INSERT INTO reading (id,userId,word,token,triedCount,level) VALUES (NULL, %s, %s, %s, %s, %s)'
args = (userId, word, token, level, triedCount) args = (userId, word, token, triedCount, level)
result = insert(qry, args) result = insert(qry, args)
return result return result
......
This diff is collapsed.
...@@ -10,7 +10,7 @@ export const ImagePaths = { ...@@ -10,7 +10,7 @@ export const ImagePaths = {
backgroundAdvancedDog: require('../image/dogbb.jpg'), backgroundAdvancedDog: require('../image/dogbb.jpg'),
backgroundAdvancedBird: require('../image/birdb.jpg'), backgroundAdvancedBird: require('../image/birdb.jpg'),
backgroundAdvancedFish: require('../image/fishbb.jpg'), backgroundAdvancedFish: require('../image/fishbb.jpg'),
resultBackground: require('../image/rersultBacground.jpeg'), resultBackground: require('../image/table.jpeg'),
no: require('../image/no.png'), no: require('../image/no.png'),
go: require('../image/go.png'), go: require('../image/go.png'),
he: require('../image/he.png'), he: require('../image/he.png'),
......
...@@ -34,7 +34,7 @@ export default function ReadModal(props) { ...@@ -34,7 +34,7 @@ export default function ReadModal(props) {
> >
<View style={styles.centeredView2}> <View style={styles.centeredView2}>
<View style={styles.modalView2}> <View style={styles.modalView2}>
<Image style={styles.alert2} source={ImagePaths.bird1}></Image> <Image style={styles.alert2} source={imagePath}></Image>
<Text style={styles.headStyle2}>{caption}</Text> <Text style={styles.headStyle2}>{caption}</Text>
<Text style={styles.head2Style2}>{validity}</Text> <Text style={styles.head2Style2}>{validity}</Text>
...@@ -76,7 +76,7 @@ const styles = StyleSheet.create({ ...@@ -76,7 +76,7 @@ const styles = StyleSheet.create({
textBody: { textBody: {
marginTop: 150, marginTop: 150,
marginLeft: 95, marginLeft: 95,
backgroundColor: '#1DCE92', // backgroundColor: '#1DCE92',
width: 200, width: 200,
borderRadius: 50, borderRadius: 50,
padding: 5, padding: 5,
...@@ -128,13 +128,13 @@ const styles = StyleSheet.create({ ...@@ -128,13 +128,13 @@ const styles = StyleSheet.create({
borderRadius: 20, borderRadius: 20,
padding: 35, padding: 35,
borderWidth: 5, borderWidth: 5,
borderColor: '#red', // borderColor: '#red',
alignItems: 'center', alignItems: 'center',
shadowColor: 'red', // shadowColor: 'red',
shadowOffset: { // shadowOffset: {
width: 0, // width: 0,
height: 2, // height: 2,
}, // },
shadowOpacity: 0.25, shadowOpacity: 0.25,
shadowRadius: 4, shadowRadius: 4,
elevation: 5, elevation: 5,
...@@ -182,69 +182,5 @@ const styles = StyleSheet.create({ ...@@ -182,69 +182,5 @@ const styles = StyleSheet.create({
marginTop: -80, marginTop: -80,
}, },
centeredView3: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
marginTop: -20,
},
modalView3: {
margin: 20,
backgroundColor: '#FFFFFF',
borderRadius: 20,
padding: 20,
borderWidth: 5,
borderColor: '#1DCE92',
alignItems: 'center',
shadowColor: 'red',
shadowOffset: {
width: 0,
height: 2,
},
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5,
},
button3: {
borderRadius: 20,
padding: 10,
elevation: 2,
},
buttonOpen3: {
backgroundColor: '#F194FF',
},
buttonClose3: {
backgroundColor: '#1DCE92',
},
textStyle3: {
color: 'white',
fontWeight: 'bold',
textAlign: 'center',
},
headStyle3: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 5,
},
head2Style3: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 20,
},
modalText3: {
marginBottom: 15,
textAlign: 'center',
},
alert3: {
backgroundColor: 'white',
borderRadius: 50,
width: 100,
height: 100,
marginBottom: 20,
marginTop: -65,
},
}); });
...@@ -15,7 +15,7 @@ import {useNavigation} from '@react-navigation/native'; ...@@ -15,7 +15,7 @@ import {useNavigation} from '@react-navigation/native';
import {ImagePaths} from '../../assets/read/data/ReadData'; import {ImagePaths} from '../../assets/read/data/ReadData';
export default function ReadModalFailed(props) { export default function ReadModalFailed(props) {
const {caption, validity, visibility, path} = props; const {caption, validity, visibility, imagePath} = props;
const navigation = useNavigation(); const navigation = useNavigation();
const [modalVisible, setModalVisible] = useState(visibility); const [modalVisible, setModalVisible] = useState(visibility);
...@@ -26,13 +26,12 @@ export default function ReadModalFailed(props) { ...@@ -26,13 +26,12 @@ export default function ReadModalFailed(props) {
transparent={true} transparent={true}
hidden={true} hidden={true}
visible={modalVisible} visible={modalVisible}
// onRequestClose={() => {
// setModalVisible3(!modalVisible3);
// }}
> >
<View style={styles.centeredView3}> <View style={styles.centeredView3}>
<View style={styles.modalView3}> <View style={styles.modalView3}>
<Image style={styles.alert3} source={ImagePaths.robot1}></Image> <Image
style={styles.alert3}
source={imagePath}></Image>
<Text style={styles.headStyle3}>Your answer is</Text> <Text style={styles.headStyle3}>Your answer is</Text>
<Text style={styles.head2Style3}>Incorect.</Text> <Text style={styles.head2Style3}>Incorect.</Text>
...@@ -111,72 +110,6 @@ const styles = StyleSheet.create({ ...@@ -111,72 +110,6 @@ const styles = StyleSheet.create({
elevation: 2, elevation: 2,
}, },
centeredView2: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
marginTop: 22,
},
modalView2: {
marginTop: -10,
margin: 20,
backgroundColor: '#FFFFFFEF',
borderRadius: 20,
padding: 35,
borderWidth: 5,
borderColor: '#red',
alignItems: 'center',
shadowColor: 'red',
shadowOffset: {
width: 0,
height: 2,
},
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5,
},
button2: {
borderRadius: 20,
padding: 10,
elevation: 2,
},
buttonOpen2: {
backgroundColor: '#F194FF',
},
buttonClose2: {
// backgroundColor: "#1DCE92",
},
textStyle2: {
color: 'white',
fontWeight: 'bold',
textAlign: 'center',
},
modalText2: {
marginBottom: 15,
textAlign: 'center',
},
headStyle2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 5,
},
head2Style2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 20,
},
alert2: {
backgroundColor: 'white',
borderRadius: 50,
width: 100,
height: 100,
marginBottom: 20,
marginTop: -80,
},
centeredView3: { centeredView3: {
flex: 1, flex: 1,
...@@ -190,13 +123,13 @@ const styles = StyleSheet.create({ ...@@ -190,13 +123,13 @@ const styles = StyleSheet.create({
borderRadius: 20, borderRadius: 20,
padding: 20, padding: 20,
borderWidth: 5, borderWidth: 5,
borderColor: '#1DCE92', // borderColor: '#1DCE92',
alignItems: 'center', alignItems: 'center',
shadowColor: 'red', // shadowColor: 'red',
shadowOffset: { // shadowOffset: {
width: 0, // width: 0,
height: 2, // height: 2,
}, // },
shadowOpacity: 0.25, shadowOpacity: 0.25,
shadowRadius: 4, shadowRadius: 4,
elevation: 5, elevation: 5,
......
import React, {useEffect, useState} from 'react';
import {
Text,
TouchableOpacity,
StyleSheet,
View,
Modal,
Image,
} from 'react-native';
import {useNavigation} from '@react-navigation/native';
import {ImagePaths} from '../../assets/read/data/ReadData';
export default function ReadModalNotice(props) {
const {caption, validity, visibility, imagePath} = props;
const [modalVisible, setModalVisible] = useState(visibility);
const navigate = () => {};
return (
<Modal
animationType="fade"
transparent={true}
hidden={true}
visible={modalVisible}>
<View style={styles.centeredView2}>
<View style={styles.modalView2}>
<Text style={styles.headStyle2}>Press The Button</Text>
<Text style={styles.head2Style2}>And Pronounce</Text>
<TouchableOpacity
style={[styles.buttonClose2]}
onPress={() => setModalVisible(false)}>
<Image
source={ImagePaths.correct}
resizeMode="contain"
style={{width: 100, height: 70, marginBottom: -10}}
/>
</TouchableOpacity>
</View>
</View>
</Modal>
);
}
const styles = StyleSheet.create({
body: {
flex: 1,
},
image: {
width: '100%',
height: '100%',
},
blackboard: {
marginTop: -420,
marginLeft: 240,
width: '70%',
height: 500,
},
robo: {
marginTop: -70,
marginLeft: -5,
width: 150,
height: 200,
},
textBody: {
marginTop: 150,
marginLeft: 95,
backgroundColor: '#1DCE92',
width: 200,
borderRadius: 50,
padding: 5,
},
text: {
fontSize: 25,
justifyContent: 'center',
alignItems: 'center',
color: 'white',
textAlign: 'center',
fontWeight: 'bold',
},
button: {
padding: 10,
marginRight: 50,
color: '#000000',
marginLeft: 50,
},
centeredView: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
marginTop: -90,
marginLeft: -100,
},
modalView: {
marginRight: 20,
backgroundColor: '#00000000',
borderRadius: 20,
padding: 35,
alignItems: 'center',
},
button: {
borderRadius: 20,
padding: 10,
elevation: 2,
},
centeredView3: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
marginTop: -20,
},
modalView3: {
margin: 20,
backgroundColor: '#FFFFFF',
borderRadius: 20,
padding: 20,
borderWidth: 5,
// borderColor: '#1DCE92',
alignItems: 'center',
// shadowColor: 'red',
// shadowOffset: {
// width: 0,
// height: 2,
// },
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5,
},
button3: {
borderRadius: 20,
padding: 10,
elevation: 2,
},
buttonOpen3: {
backgroundColor: '#F194FF',
},
buttonClose3: {
backgroundColor: '#1DCE92',
},
textStyle3: {
color: 'white',
fontWeight: 'bold',
textAlign: 'center',
},
headStyle3: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 5,
},
head2Style3: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 20,
},
modalText3: {
marginBottom: 15,
textAlign: 'center',
},
alert3: {
backgroundColor: 'rgba(255, 0, 0, 0.74)',
borderRadius: 50,
width: 100,
height: 100,
marginBottom: 20,
marginTop: -65,
},
centeredView2: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
marginTop: 22,
},
modalView2: {
marginTop: -10,
margin: 20,
backgroundColor: '#FFFFFFEF',
borderRadius: 20,
padding: 35,
borderWidth: 5,
// borderColor: '#red',
alignItems: 'center',
// shadowColor: 'red',
// shadowOffset: {
// width: 0,
// height: 2,
// },
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5,
},
button2: {
borderRadius: 20,
padding: 10,
elevation: 2,
},
buttonOpen2: {
backgroundColor: '#F194FF',
},
buttonClose2: {
// backgroundColor: "#1DCE92",
},
textStyle2: {
color: 'white',
fontWeight: 'bold',
textAlign: 'center',
},
modalText2: {
marginBottom: 15,
textAlign: 'center',
},
headStyle2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 5,
},
head2Style2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 20,
},
alert2: {
// backgroundColor: 'rgba(0, 181, 0, 0.45)',
borderRadius: 50,
width: 100,
height: 100,
marginBottom: 20,
marginTop: -80,
},
});
...@@ -35,7 +35,7 @@ export default function TableList() { ...@@ -35,7 +35,7 @@ export default function TableList() {
Client.get('result/' + userId) Client.get('result/' + userId)
.then(response => { .then(response => {
setTableData({ setTableData({
tableHead: ['Word', 'Count', 'Level'], tableHead: ['Word', 'Try Count', 'Level'],
data: response.data.data, data: response.data.data,
}); });
}) })
...@@ -54,14 +54,14 @@ export default function TableList() { ...@@ -54,14 +54,14 @@ export default function TableList() {
<Table borderStyle={{borderWidth: 3, borderColor: '#fff'}}> <Table borderStyle={{borderWidth: 3, borderColor: '#fff'}}>
<Row <Row
data={tableData.tableHead} data={tableData.tableHead}
flexArr={[ 1, 1, 1.5]} flexArr={[ 1, 1.4, 1.3]}
style={styles.head} style={styles.head}
textStyle={styles.text} textStyle={styles.text}
/> />
<TableWrapper style={styles.wrapper}> <TableWrapper style={styles.wrapper}>
<Rows <Rows
data={tableData.data} data={tableData.data}
flexArr={[1, 1, 1.5]} flexArr={[1, 1.4, 1.3]}
style={styles.row} style={styles.row}
textStyle={styles.text} textStyle={styles.text}
/> />
...@@ -80,7 +80,7 @@ const styles = StyleSheet.create({ ...@@ -80,7 +80,7 @@ const styles = StyleSheet.create({
paddingRight: 60, paddingRight: 60,
marginTop: 0, marginTop: 0,
}, },
head: {height: 60, backgroundColor: '#f1f8ff'}, head: {height: 60, backgroundColor: 'green'},
wrapper: { wrapper: {
flexDirection: 'row', flexDirection: 'row',
backgroundColor: '#f1f8ff', backgroundColor: '#f1f8ff',
......
...@@ -44,7 +44,7 @@ export default function Home({ navigation }){ ...@@ -44,7 +44,7 @@ export default function Home({ navigation }){
<View style={styles.imageView}> <View style={styles.imageView}>
<Image <Image
style={styles.image} style={styles.image}
source={require('../assets/color/background.png')} source={require('../memory/images/assets/mh.jpg')}
resizeMode="contain"></Image> resizeMode="contain"></Image>
<ImageButton path="GameList" title="Memory Activities" /> <ImageButton path="GameList" title="Memory Activities" />
</View> </View>
......
...@@ -31,6 +31,8 @@ export default function Black() { ...@@ -31,6 +31,8 @@ export default function Black() {
audioInit(); audioInit();
Tts.speak('Hello child, Say the name of this color');
const unsubscribe = navigation.addListener("focus", () => { const unsubscribe = navigation.addListener("focus", () => {
Orientation.unlockAllOrientations(); Orientation.unlockAllOrientations();
...@@ -154,7 +156,7 @@ export default function Black() { ...@@ -154,7 +156,7 @@ export default function Black() {
console.log('Your Answer is Incorrect', value); console.log('Your Answer is Incorrect', value);
setModalVisible3(true); setModalVisible3(true);
Tts.speak('Hey child, Your Answer is Incorrect. Please try again');
} }
...@@ -192,6 +194,8 @@ export default function Black() { ...@@ -192,6 +194,8 @@ export default function Black() {
console.log(response.data); console.log(response.data);
stopRecording(); stopRecording();
setModalVisible2(true); setModalVisible2(true);
Tts.speak('Hey child congratulations, Your Answer is Correct');
Tts.speak('Completed first round');
// navigation.navigate("Green"); // navigation.navigate("Green");
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
......
...@@ -21,6 +21,8 @@ export default function Blue(color) { ...@@ -21,6 +21,8 @@ export default function Blue(color) {
audioInit(); audioInit();
Tts.speak('Hello child, Say the name of this color');
const unsubscribe = navigation.addListener("focus", () => { const unsubscribe = navigation.addListener("focus", () => {
// The screen is focused // The screen is focused
// Call any action // Call any action
......
...@@ -28,6 +28,7 @@ export default function Blue2() { ...@@ -28,6 +28,7 @@ export default function Blue2() {
StatusBar.setHidden(true); StatusBar.setHidden(true);
audioInit(); audioInit();
Tts.speak('Hello child, Say the name of this color');
const unsubscribe = navigation.addListener("focus", () => { const unsubscribe = navigation.addListener("focus", () => {
...@@ -153,6 +154,7 @@ export default function Blue2() { ...@@ -153,6 +154,7 @@ export default function Blue2() {
console.log('Your Answer is Incorrect', value); console.log('Your Answer is Incorrect', value);
setModalVisible3(true); setModalVisible3(true);
Tts.speak('Hey child, Your Answer is Incorrect. Please try again');
} }
...@@ -191,6 +193,7 @@ export default function Blue2() { ...@@ -191,6 +193,7 @@ export default function Blue2() {
console.log(response.data); console.log(response.data);
stopRecording(); stopRecording();
setModalVisible2(true); setModalVisible2(true);
Tts.speak('Hey child congratulations, Your Answer is Correct');
// navigation.navigate("Green"); // navigation.navigate("Green");
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
......
...@@ -7,6 +7,7 @@ import axios from "axios"; ...@@ -7,6 +7,7 @@ import axios from "axios";
import CountDown from 'react-native-countdown-component'; import CountDown from 'react-native-countdown-component';
import { secondColor } from '../../assets/color/color'; import { secondColor } from '../../assets/color/color';
import client from "../client/Client"; import client from "../client/Client";
import Tts from 'react-native-tts';
import Voice from '@react-native-voice/voice'; import Voice from '@react-native-voice/voice';
import AsyncStorage from '@react-native-async-storage/async-storage'; import AsyncStorage from '@react-native-async-storage/async-storage';
import AudioRecord from 'react-native-audio-record'; import AudioRecord from 'react-native-audio-record';
...@@ -30,6 +31,8 @@ export default function Green({ navigation }) { ...@@ -30,6 +31,8 @@ export default function Green({ navigation }) {
audioInit(); audioInit();
Tts.speak('Hello child, Say the name of this color');
const unsubscribe = navigation.addListener("focus", () => { const unsubscribe = navigation.addListener("focus", () => {
Orientation.unlockAllOrientations(); Orientation.unlockAllOrientations();
...@@ -152,6 +155,7 @@ export default function Green({ navigation }) { ...@@ -152,6 +155,7 @@ export default function Green({ navigation }) {
console.log('Your Answer is Incorrect', value); console.log('Your Answer is Incorrect', value);
setModalVisible3(true); setModalVisible3(true);
Tts.speak('Hey child, Your Answer is Incorrect. Please try again');
} }
...@@ -190,6 +194,7 @@ export default function Green({ navigation }) { ...@@ -190,6 +194,7 @@ export default function Green({ navigation }) {
console.log(response.data); console.log(response.data);
stopRecording(); stopRecording();
setModalVisible2(true); setModalVisible2(true);
Tts.speak('Hey child congratulations, Your Answer is Correct');
// navigation.navigate("Green"); // navigation.navigate("Green");
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
......
...@@ -30,7 +30,7 @@ export default function Red({ navigation }) { ...@@ -30,7 +30,7 @@ export default function Red({ navigation }) {
audioInit(); audioInit();
Tts.speak('Hello child, Say the name of this color');
const unsubscribe = navigation.addListener("focus", () => { const unsubscribe = navigation.addListener("focus", () => {
...@@ -148,13 +148,14 @@ export default function Red({ navigation }) { ...@@ -148,13 +148,14 @@ export default function Red({ navigation }) {
sendData(mainColor[0]); sendData(mainColor[0]);
// audioStart(); audioStart();
} else { } else {
console.log('Your Answer is Incorrect', value); console.log('Your Answer is Incorrect', value);
setModalVisible3(true); setModalVisible3(true);
Tts.speak('Hey child, Your Answer is Incorrect. Please try again');
} }
...@@ -221,6 +222,7 @@ export default function Red({ navigation }) { ...@@ -221,6 +222,7 @@ export default function Red({ navigation }) {
console.log(response.data); console.log(response.data);
stopRecording(); stopRecording();
setModalVisible2(true); setModalVisible2(true);
Tts.speak('Hey child congratulations, Your Answer is Correct');
// navigation.navigate("Green"); // navigation.navigate("Green");
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
......
...@@ -7,6 +7,7 @@ import axios from "axios"; ...@@ -7,6 +7,7 @@ import axios from "axios";
import { secondColor } from '../../assets/color/color'; import { secondColor } from '../../assets/color/color';
import CountDown from 'react-native-countdown-component'; import CountDown from 'react-native-countdown-component';
import client from "../client/Client"; import client from "../client/Client";
import Tts from 'react-native-tts';
import AudioRecord from 'react-native-audio-record'; import AudioRecord from 'react-native-audio-record';
import Voice from '@react-native-voice/voice'; import Voice from '@react-native-voice/voice';
import AsyncStorage from '@react-native-async-storage/async-storage'; import AsyncStorage from '@react-native-async-storage/async-storage';
...@@ -28,6 +29,7 @@ export default function White() { ...@@ -28,6 +29,7 @@ export default function White() {
StatusBar.setHidden(true); StatusBar.setHidden(true);
audioInit(); audioInit();
Tts.speak('Hello child, Say the name of this color');
const unsubscribe = navigation.addListener("focus", () => { const unsubscribe = navigation.addListener("focus", () => {
...@@ -152,7 +154,7 @@ export default function White() { ...@@ -152,7 +154,7 @@ export default function White() {
console.log('Your Answer is Incorrect', value); console.log('Your Answer is Incorrect', value);
setModalVisible3(true); setModalVisible3(true);
Tts.speak('Hey child, Your Answer is Incorrect. Please try again');
} }
...@@ -190,6 +192,8 @@ export default function White() { ...@@ -190,6 +192,8 @@ export default function White() {
console.log(response.data); console.log(response.data);
stopRecording(); stopRecording();
setModalVisible2(true); setModalVisible2(true);
Tts.speak('Hey child congratulations, Your Answer is Correct');
Tts.speak('Completed second round');
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}) })
......
...@@ -7,6 +7,7 @@ import axios from "axios"; ...@@ -7,6 +7,7 @@ import axios from "axios";
import CountDown from 'react-native-countdown-component'; import CountDown from 'react-native-countdown-component';
import { mainColor } from '../../assets/color/color'; import { mainColor } from '../../assets/color/color';
import client from "../client/Client"; import client from "../client/Client";
import Tts from 'react-native-tts';
import Voice from '@react-native-voice/voice'; import Voice from '@react-native-voice/voice';
import AudioRecord from 'react-native-audio-record'; import AudioRecord from 'react-native-audio-record';
import AsyncStorage from '@react-native-async-storage/async-storage'; import AsyncStorage from '@react-native-async-storage/async-storage';
...@@ -28,6 +29,8 @@ export default function Yellow() { ...@@ -28,6 +29,8 @@ export default function Yellow() {
audioInit(); audioInit();
Tts.speak('Hello child, Say the name of this color');
const unsubscribe = navigation.addListener("focus", () => { const unsubscribe = navigation.addListener("focus", () => {
Orientation.unlockAllOrientations(); Orientation.unlockAllOrientations();
...@@ -151,6 +154,7 @@ export default function Yellow() { ...@@ -151,6 +154,7 @@ export default function Yellow() {
console.log('Your Answer is Incorrect', value); console.log('Your Answer is Incorrect', value);
setModalVisible3(true); setModalVisible3(true);
Tts.speak('Hey child, Your Answer is Incorrect. Please try again');
} }
...@@ -189,7 +193,8 @@ export default function Yellow() { ...@@ -189,7 +193,8 @@ export default function Yellow() {
console.log(response.data); console.log(response.data);
stopRecording(); stopRecording();
setModalVisible2(true); setModalVisible2(true);
// navigation.navigate("Green"); Tts.speak('Hey child congratulations, Your Answer is Correct');
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}) })
......
...@@ -93,9 +93,14 @@ const GameOverScreen = ({navigation}) => { ...@@ -93,9 +93,14 @@ const GameOverScreen = ({navigation}) => {
// <Text style={styles.resultText}> // <Text style={styles.resultText}>
// <Text>Child's disorder level is </Text> <Text style={styles.highlight}>{disorderLevel}</Text> // <Text>Child's disorder level is </Text> <Text style={styles.highlight}>{disorderLevel}</Text>
// </Text> // </Text>
<View>
<Text style={styles.resultText}> <Text style={styles.resultText}>
{disorderLevel == 'High' ? `Hmm...It looks like you have to keep remember more...` : disorderLevel == 'Medium' ? `Hey...nicely played! Good!` : 'Wow! You are Excellent!'} {disorderLevel == 'High' ? `Hmm...It looks like you have to keep remember more...` : disorderLevel == 'Medium' ? `Hey...nicely played! Good!` : 'Wow! You are Excellent!'}
</Text> </Text>
<Text style={styles.resultTextDown}>
( <Text>Child's disorder level is </Text> <Text style={styles.highlight}>{disorderLevel}</Text> )
</Text>
</View>
); );
} }
...@@ -164,6 +169,11 @@ const styles = StyleSheet.create({ ...@@ -164,6 +169,11 @@ const styles = StyleSheet.create({
fontSize: 22, fontSize: 22,
fontWeight: 'bold' fontWeight: 'bold'
}, },
resultTextDown: {
textAlign: 'center',
fontSize: 18,
fontWeight: 'bold'
},
buttonContainer: { buttonContainer: {
flexDirection: 'row', flexDirection: 'row',
width: 300, width: 300,
......
...@@ -4,7 +4,7 @@ import {View, Text, StyleSheet} from 'react-native'; ...@@ -4,7 +4,7 @@ import {View, Text, StyleSheet} from 'react-native';
const MemoryResult = () => { const MemoryResult = () => {
return( return(
<View style={styles.screen}> <View style={styles.screen}>
<Text>Result Screen</Text>
</View> </View>
); );
} }
......
...@@ -14,6 +14,7 @@ const GameScreenFive = ({navigation}) => { ...@@ -14,6 +14,7 @@ const GameScreenFive = ({navigation}) => {
style={styles.image} style={styles.image}
/> />
</View> </View>
<Text style={styles.imageText}>Fish</Text>
<CountDown <CountDown
size={40} size={40}
until={Countdown.elementry} until={Countdown.elementry}
...@@ -27,7 +28,7 @@ const GameScreenFive = ({navigation}) => { ...@@ -27,7 +28,7 @@ const GameScreenFive = ({navigation}) => {
timeLabels={{s: 'Seconds'}} timeLabels={{s: 'Seconds'}}
style={styles.counter} style={styles.counter}
/> />
<Text style={styles.imageText}>Fish</Text>
</View> </View>
); );
} }
...@@ -57,7 +58,7 @@ const GameScreenFive = ({navigation}) => { ...@@ -57,7 +58,7 @@ const GameScreenFive = ({navigation}) => {
height: '100%' height: '100%'
}, },
imageText: { imageText: {
fontSize: 24, fontSize: 36,
fontWeight: 'bold', fontWeight: 'bold',
marginTop: 30 marginTop: 30
}, },
......
...@@ -57,7 +57,7 @@ const GameScreenFour = ({navigation}) => { ...@@ -57,7 +57,7 @@ const GameScreenFour = ({navigation}) => {
height: '100%' height: '100%'
}, },
imageText: { imageText: {
fontSize: 24, fontSize: 36,
fontWeight: 'bold', fontWeight: 'bold',
marginTop: 30 marginTop: 30
}, },
......
...@@ -72,7 +72,7 @@ const styles = StyleSheet.create({ ...@@ -72,7 +72,7 @@ const styles = StyleSheet.create({
height: '100%' height: '100%'
}, },
imageText: { imageText: {
fontSize: 24, fontSize: 36,
fontWeight: 'bold', fontWeight: 'bold',
marginTop: 30 marginTop: 30
}, },
......
...@@ -14,7 +14,7 @@ const GameScreenSix = ({navigation}) => { ...@@ -14,7 +14,7 @@ const GameScreenSix = ({navigation}) => {
style={styles.image} style={styles.image}
/> />
</View> </View>
<Text style={styles.imageText}>Pencil</Text> <Text style={styles.imageText}>Kite</Text>
<CountDown <CountDown
size={40} size={40}
until={Countdown.elementry} until={Countdown.elementry}
...@@ -57,7 +57,7 @@ const GameScreenSix = ({navigation}) => { ...@@ -57,7 +57,7 @@ const GameScreenSix = ({navigation}) => {
height: '100%' height: '100%'
}, },
imageText: { imageText: {
fontSize: 24, fontSize: 36,
fontWeight: 'bold', fontWeight: 'bold',
marginTop: 30 marginTop: 30
}, },
......
...@@ -57,7 +57,7 @@ const GameScreenThree = ({navigation}) => { ...@@ -57,7 +57,7 @@ const GameScreenThree = ({navigation}) => {
height: '100%' height: '100%'
}, },
imageText: { imageText: {
fontSize: 24, fontSize: 36,
fontWeight: 'bold', fontWeight: 'bold',
marginTop: 30 marginTop: 30
}, },
......
...@@ -57,7 +57,7 @@ const GameScreenTwo = ({navigation}) => { ...@@ -57,7 +57,7 @@ const GameScreenTwo = ({navigation}) => {
height: '100%' height: '100%'
}, },
imageText: { imageText: {
fontSize: 24, fontSize: 36,
fontWeight: 'bold', fontWeight: 'bold',
marginTop: 30 marginTop: 30
}, },
......
...@@ -58,7 +58,7 @@ const MediumGameScreenFive = ({navigation}) => { ...@@ -58,7 +58,7 @@ const MediumGameScreenFive = ({navigation}) => {
height: '100%' height: '100%'
}, },
imageText: { imageText: {
fontSize: 24, fontSize: 36,
fontWeight: 'bold', fontWeight: 'bold',
marginTop: 30 marginTop: 30
}, },
......
...@@ -57,7 +57,7 @@ const MediumGameScreenFour = ({navigation}) => { ...@@ -57,7 +57,7 @@ const MediumGameScreenFour = ({navigation}) => {
height: '100%' height: '100%'
}, },
imageText: { imageText: {
fontSize: 24, fontSize: 36,
fontWeight: 'bold', fontWeight: 'bold',
marginTop: 30 marginTop: 30
}, },
......
...@@ -72,7 +72,7 @@ const styles = StyleSheet.create({ ...@@ -72,7 +72,7 @@ const styles = StyleSheet.create({
height: '100%' height: '100%'
}, },
imageText: { imageText: {
fontSize: 24, fontSize: 36,
fontWeight: 'bold', fontWeight: 'bold',
marginTop: 30 marginTop: 30
}, },
......
...@@ -57,7 +57,7 @@ const MediumGameScreenSix = ({navigation}) => { ...@@ -57,7 +57,7 @@ const MediumGameScreenSix = ({navigation}) => {
height: '100%' height: '100%'
}, },
imageText: { imageText: {
fontSize: 24, fontSize: 36,
fontWeight: 'bold', fontWeight: 'bold',
marginTop: 30 marginTop: 30
}, },
......
...@@ -57,7 +57,7 @@ const MediumGameScreenThree = ({navigation}) => { ...@@ -57,7 +57,7 @@ const MediumGameScreenThree = ({navigation}) => {
height: '100%' height: '100%'
}, },
imageText: { imageText: {
fontSize: 24, fontSize: 36,
fontWeight: 'bold', fontWeight: 'bold',
marginTop: 30 marginTop: 30
}, },
......
...@@ -57,7 +57,7 @@ const MediumGameScreenTwo = ({navigation}) => { ...@@ -57,7 +57,7 @@ const MediumGameScreenTwo = ({navigation}) => {
height: '100%' height: '100%'
}, },
imageText: { imageText: {
fontSize: 24, fontSize: 36,
fontWeight: 'bold', fontWeight: 'bold',
marginTop: 30 marginTop: 30
}, },
......
...@@ -9,7 +9,7 @@ import { ...@@ -9,7 +9,7 @@ import {
ImageButton, ImageButton,
SafeAreaView, SafeAreaView,
ImageBackground, ImageBackground,
Button, Modal,
Image, Image,
TouchableHighlight, TouchableHighlight,
} from 'react-native'; } from 'react-native';
...@@ -20,6 +20,7 @@ import {Authorize} from '../../auth/AuthenticateUser'; ...@@ -20,6 +20,7 @@ import {Authorize} from '../../auth/AuthenticateUser';
import Client from '../../client/Client'; import Client from '../../client/Client';
import ReadModal from '../../../component/reading/ReadModal'; import ReadModal from '../../../component/reading/ReadModal';
import ReadModalFailed from '../../../component/reading/ReadModalFailed'; import ReadModalFailed from '../../../component/reading/ReadModalFailed';
import ReadModalNotice from '../../../component/reading/ReadModalNotice';
export default function ReadActivityBird() { export default function ReadActivityBird() {
const navigation = useNavigation(); const navigation = useNavigation();
...@@ -29,8 +30,22 @@ export default function ReadActivityBird() { ...@@ -29,8 +30,22 @@ export default function ReadActivityBird() {
const [modalVisible2, setModalVisible2] = useState(false); const [modalVisible2, setModalVisible2] = useState(false);
const [modalVisible3, setModalVisible3] = useState(false); const [modalVisible3, setModalVisible3] = useState(false);
useEffect(() => { React.useEffect(() => {
Voice.destroy().then(Voice.removeAllListeners); Voice.destroy().then(Voice.removeAllListeners);
// StatusBar.setHidden(true);
//
setModalVisible(true);
const unsubscribe = navigation.addListener('focus', () => {
Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
});
return unsubscribe;
}, [navigation]);
useEffect(() => {
}, []); }, []);
useEffect(() => { useEffect(() => {
...@@ -64,14 +79,18 @@ export default function ReadActivityBird() { ...@@ -64,14 +79,18 @@ export default function ReadActivityBird() {
}; };
const onSpeechResultsHandler = e => { const onSpeechResultsHandler = e => {
setCount(count + 1);
const result = e.value; const result = e.value;
if (result.includes('bird')) {
// console.log(result+"hfghdfghfhgf");
if (result.includes('Bird')) {
AsyncStorage.getItem('userId') AsyncStorage.getItem('userId')
.then(userId => { .then(userId => {
const data = { const data = {
word: 'Bird', word: 'Bird',
userId: userId, userId: userId,
level: 'Advance', level: 'Advanced',
triedCount: count, triedCount: count,
}; };
getToken(data); getToken(data);
...@@ -80,36 +99,34 @@ export default function ReadActivityBird() { ...@@ -80,36 +99,34 @@ export default function ReadActivityBird() {
console.log(error); console.log(error);
}); });
} else { } else {
setCount(count + 1);
setModalVisible3(true); setModalVisible3(true);
startRecording();
} }
}; };
const onSpeechError = e => { const onSpeechError = e => {
console.log('onSpeechError: ', e); // console.log('onSpeechError: ', e);
const result = DummyReadResult.value; // const result = DummyReadResult.value;
if (result.includes('hello')) { // if (result.includes('hello')) {
AsyncStorage.getItem('userId') // AsyncStorage.getItem('userId')
.then(userId => { // .then(userId => {
const data = { // const data = {
word: 'bird', // word: 'bird',
userId: userId, // userId: userId,
level: 1, // level: 1,
triedCount: count, // triedCount: count,
}; // };
getToken(data); // getToken(data);
}) // })
.catch(error => { // .catch(error => {
console.log(error); // console.log(error);
}); // });
} else { // } else {
setCount(count + 1); // setCount(count + 1);
Voice.start('en-US'); // }
} // console.log('count', count);
console.log('count', count);
console.log('count', count); // console.log('count', count);
}; };
const getToken = data => { const getToken = data => {
...@@ -142,7 +159,10 @@ export default function ReadActivityBird() { ...@@ -142,7 +159,10 @@ export default function ReadActivityBird() {
/> />
)} )}
{modalVisible3 && <ReadModalFailed visible="true" />} {modalVisible3 && (
<ReadModalFailed visible="true" imagePath={ImagePaths.bird1} />
)}
{modalVisible && <ReadModalNotice visible="true" />}
<View style={{flexDirection: 'column'}}> <View style={{flexDirection: 'column'}}>
<ImageBackground <ImageBackground
style={styles.image} style={styles.image}
...@@ -250,4 +270,71 @@ const styles = StyleSheet.create({ ...@@ -250,4 +270,71 @@ const styles = StyleSheet.create({
marginLeft: 135, marginLeft: 135,
padding: 0, padding: 0,
}, },
centeredView2: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
marginTop: 22,
},
modalView2: {
marginTop: -10,
margin: 20,
backgroundColor: '#FFFFFFEF',
borderRadius: 20,
padding: 35,
borderWidth: 5,
// borderColor: '#red',
alignItems: 'center',
// shadowColor: 'red',
// shadowOffset: {
// width: 0,
// height: 2,
// },
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5,
},
button2: {
borderRadius: 20,
padding: 10,
elevation: 2,
},
buttonOpen2: {
backgroundColor: '#F194FF',
},
buttonClose2: {
// backgroundColor: "#1DCE92",
},
textStyle2: {
color: 'white',
fontWeight: 'bold',
textAlign: 'center',
},
modalText2: {
marginBottom: 15,
textAlign: 'center',
},
headStyle2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 5,
},
head2Style2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 20,
},
alert2: {
// backgroundColor: 'rgba(0, 181, 0, 0.45)',
borderRadius: 50,
width: 100,
height: 100,
marginBottom: 20,
marginTop: -80,
},
}); });
...@@ -9,7 +9,7 @@ import { ...@@ -9,7 +9,7 @@ import {
ImageButton, ImageButton,
SafeAreaView, SafeAreaView,
ImageBackground, ImageBackground,
Button, Modal,
Image, Image,
TouchableHighlight, TouchableHighlight,
} from 'react-native'; } from 'react-native';
...@@ -20,6 +20,7 @@ import {Authorize} from '../../auth/AuthenticateUser'; ...@@ -20,6 +20,7 @@ import {Authorize} from '../../auth/AuthenticateUser';
import Client from '../../client/Client'; import Client from '../../client/Client';
import ReadModal from '../../../component/reading/ReadModal'; import ReadModal from '../../../component/reading/ReadModal';
import ReadModalFailed from '../../../component/reading/ReadModalFailed'; import ReadModalFailed from '../../../component/reading/ReadModalFailed';
import ReadModalNotice from '../../../component/reading/ReadModalNotice';
export default function ReadActivityDog() { export default function ReadActivityDog() {
const navigation = useNavigation(); const navigation = useNavigation();
...@@ -29,6 +30,19 @@ export default function ReadActivityDog() { ...@@ -29,6 +30,19 @@ export default function ReadActivityDog() {
const [modalVisible2, setModalVisible2] = useState(false); const [modalVisible2, setModalVisible2] = useState(false);
const [modalVisible3, setModalVisible3] = useState(false); const [modalVisible3, setModalVisible3] = useState(false);
React.useEffect(() => {
// StatusBar.setHidden(true);
//
setModalVisible(true);
const unsubscribe = navigation.addListener('focus', () => {
Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
});
return unsubscribe;
}, [navigation]);
useEffect(() => { useEffect(() => {
Voice.destroy().then(Voice.removeAllListeners); Voice.destroy().then(Voice.removeAllListeners);
}, []); }, []);
...@@ -64,6 +78,7 @@ export default function ReadActivityDog() { ...@@ -64,6 +78,7 @@ export default function ReadActivityDog() {
}; };
const onSpeechResultsHandler = e => { const onSpeechResultsHandler = e => {
setCount(count + 1);
const result = e.value; const result = e.value;
if (result.includes('dog')) { if (result.includes('dog')) {
AsyncStorage.getItem('userId') AsyncStorage.getItem('userId')
...@@ -71,7 +86,7 @@ export default function ReadActivityDog() { ...@@ -71,7 +86,7 @@ export default function ReadActivityDog() {
const data = { const data = {
word: 'Dog', word: 'Dog',
userId: userId, userId: userId,
level: 'Advance', level: 'Advanced',
triedCount: count, triedCount: count,
}; };
getToken(data); getToken(data);
...@@ -80,36 +95,35 @@ export default function ReadActivityDog() { ...@@ -80,36 +95,35 @@ export default function ReadActivityDog() {
console.log(error); console.log(error);
}); });
} else { } else {
setCount(count + 1);
setModalVisible3(true); setModalVisible3(true);
startRecording();
} }
}; };
const onSpeechError = e => { const onSpeechError = e => {
console.log('onSpeechError: ', e); // console.log('onSpeechError: ', e);
const result = DummyReadResult.value; // const result = DummyReadResult.value;
if (result.includes('hello')) { // if (result.includes('hello')) {
AsyncStorage.getItem('userId') // AsyncStorage.getItem('userId')
.then(userId => { // .then(userId => {
const data = { // const data = {
word: 'dog', // word: 'dog',
userId: userId, // userId: userId,
level: 1, // level: 1,
triedCount: count, // triedCount: count,
}; // };
getToken(data); // getToken(data);
}) // })
.catch(error => { // .catch(error => {
console.log(error); // console.log(error);
}); // });
} else { // } else {
setCount(count + 1); // setCount(count + 1);
Voice.start('en-US'); // Voice.start('en-US');
} // }
console.log('count', count); // console.log('count', count);
console.log('count', count); // console.log('count', count);
}; };
const getToken = data => { const getToken = data => {
...@@ -142,7 +156,12 @@ export default function ReadActivityDog() { ...@@ -142,7 +156,12 @@ export default function ReadActivityDog() {
/> />
)} )}
{modalVisible3 && <ReadModalFailed visible="true" />} {modalVisible3 && (
<ReadModalFailed visible="true" imagePath={ImagePaths.bird1} />
)}
{modalVisible && <ReadModalNotice visible="true" />}
<View style={{flexDirection: 'column'}}> <View style={{flexDirection: 'column'}}>
<ImageBackground <ImageBackground
style={styles.image} style={styles.image}
...@@ -250,4 +269,71 @@ const styles = StyleSheet.create({ ...@@ -250,4 +269,71 @@ const styles = StyleSheet.create({
marginLeft: 135, marginLeft: 135,
padding: 0, padding: 0,
}, },
centeredView2: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
marginTop: 22,
},
modalView2: {
marginTop: -10,
margin: 20,
backgroundColor: '#FFFFFFEF',
borderRadius: 20,
padding: 35,
borderWidth: 5,
// borderColor: '#red',
alignItems: 'center',
// shadowColor: 'red',
// shadowOffset: {
// width: 0,
// height: 2,
// },
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5,
},
button2: {
borderRadius: 20,
padding: 10,
elevation: 2,
},
buttonOpen2: {
backgroundColor: '#F194FF',
},
buttonClose2: {
// backgroundColor: "#1DCE92",
},
textStyle2: {
color: 'white',
fontWeight: 'bold',
textAlign: 'center',
},
modalText2: {
marginBottom: 15,
textAlign: 'center',
},
headStyle2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 5,
},
head2Style2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 20,
},
alert2: {
// backgroundColor: 'rgba(0, 181, 0, 0.45)',
borderRadius: 50,
width: 100,
height: 100,
marginBottom: 20,
marginTop: -80,
},
}); });
...@@ -9,7 +9,7 @@ import { ...@@ -9,7 +9,7 @@ import {
ImageButton, ImageButton,
SafeAreaView, SafeAreaView,
ImageBackground, ImageBackground,
Button, Modal,
Image, Image,
TouchableHighlight, TouchableHighlight,
} from 'react-native'; } from 'react-native';
...@@ -20,6 +20,7 @@ import {Authorize} from '../../auth/AuthenticateUser'; ...@@ -20,6 +20,7 @@ import {Authorize} from '../../auth/AuthenticateUser';
import Client from '../../client/Client'; import Client from '../../client/Client';
import ReadModal from '../../../component/reading/ReadModal'; import ReadModal from '../../../component/reading/ReadModal';
import ReadModalFailed from '../../../component/reading/ReadModalFailed'; import ReadModalFailed from '../../../component/reading/ReadModalFailed';
import ReadModalNotice from '../../../component/reading/ReadModalNotice';
export default function ReadActivityFish() { export default function ReadActivityFish() {
const navigation = useNavigation(); const navigation = useNavigation();
...@@ -29,6 +30,19 @@ export default function ReadActivityFish() { ...@@ -29,6 +30,19 @@ export default function ReadActivityFish() {
const [modalVisible2, setModalVisible2] = useState(false); const [modalVisible2, setModalVisible2] = useState(false);
const [modalVisible3, setModalVisible3] = useState(false); const [modalVisible3, setModalVisible3] = useState(false);
React.useEffect(() => {
// StatusBar.setHidden(true);
//
setModalVisible(true);
const unsubscribe = navigation.addListener('focus', () => {
Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
});
return unsubscribe;
}, [navigation]);
useEffect(() => { useEffect(() => {
Voice.destroy().then(Voice.removeAllListeners); Voice.destroy().then(Voice.removeAllListeners);
}, []); }, []);
...@@ -77,14 +91,21 @@ export default function ReadActivityFish() { ...@@ -77,14 +91,21 @@ export default function ReadActivityFish() {
}; };
const onSpeechStartHandler = e => { const onSpeechStartHandler = e => {
};
const onSpeechResultsHandler = e => {
setCount(count + 1);
const result = e.value; const result = e.value;
// console.log(result+"hfghdfghfhgf");
if (result.includes('fish')) { if (result.includes('fish')) {
AsyncStorage.getItem('userId') AsyncStorage.getItem('userId')
.then(userId => { .then(userId => {
const data = { const data = {
word: 'Fish', word: 'Fish',
userId: userId, userId: userId,
level: 'Advance', level: 'Advanced',
triedCount: count, triedCount: count,
}; };
getToken(data); getToken(data);
...@@ -93,40 +114,34 @@ export default function ReadActivityFish() { ...@@ -93,40 +114,34 @@ export default function ReadActivityFish() {
console.log(error); console.log(error);
}); });
} else { } else {
setCount(count + 1);
setModalVisible3(true); setModalVisible3(true);
startRecording();
} }
}; };
const onSpeechResultsHandler = e => {
console.log('result handler =>> ', e);
};
const onSpeechError = e => { const onSpeechError = e => {
console.log('onSpeechError: ', e); // console.log('onSpeechError: ', e);
const result = DummyReadResult.value; // const result = DummyReadResult.value;
if (result.includes('hello')) { // if (result.includes('hello')) {
AsyncStorage.getItem('userId') // AsyncStorage.getItem('userId')
.then(userId => { // .then(userId => {
const data = { // const data = {
word: 'fish', // word: 'fish',
userId: userId, // userId: userId,
level: 1, // level: 1,
triedCount: count, // triedCount: count,
}; // };
getToken(data); // getToken(data);
}) // })
.catch(error => { // .catch(error => {
console.log(error); // console.log(error);
}); // });
} else { // } else {
setCount(count + 1); // setCount(count + 1);
Voice.start('en-US'); // Voice.start('en-US');
} // }
console.log('count', count); // console.log('count', count);
console.log('count', count); // console.log('count', count);
}; };
const getToken = data => { const getToken = data => {
...@@ -159,7 +174,12 @@ export default function ReadActivityFish() { ...@@ -159,7 +174,12 @@ export default function ReadActivityFish() {
/> />
)} )}
{modalVisible3 && <ReadModalFailed visible="true" />} {modalVisible3 && (
<ReadModalFailed visible="true" imagePath={ImagePaths.bird1} />
)}
{modalVisible && <ReadModalNotice visible="true" />}
<View style={{flexDirection: 'column'}}> <View style={{flexDirection: 'column'}}>
<ImageBackground <ImageBackground
style={styles.image} style={styles.image}
...@@ -267,4 +287,75 @@ const styles = StyleSheet.create({ ...@@ -267,4 +287,75 @@ const styles = StyleSheet.create({
marginLeft: 135, marginLeft: 135,
padding: 0, padding: 0,
}, },
//////////
centeredView2: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
marginTop: 22,
},
modalView2: {
marginTop: -10,
margin: 20,
backgroundColor: '#FFFFFFEF',
borderRadius: 20,
padding: 35,
borderWidth: 5,
// borderColor: '#red',
alignItems: 'center',
// shadowColor: 'red',
// shadowOffset: {
// width: 0,
// height: 2,
// },
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5,
},
button2: {
borderRadius: 20,
padding: 10,
elevation: 2,
},
buttonOpen2: {
backgroundColor: '#F194FF',
},
buttonClose2: {
// backgroundColor: "#1DCE92",
},
textStyle2: {
color: 'white',
fontWeight: 'bold',
textAlign: 'center',
},
modalText2: {
marginBottom: 15,
textAlign: 'center',
},
headStyle2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 5,
},
head2Style2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 20,
},
alert2: {
// backgroundColor: 'rgba(0, 181, 0, 0.45)',
borderRadius: 50,
width: 100,
height: 100,
marginBottom: 20,
marginTop: -80,
},
}); });
...@@ -9,7 +9,7 @@ import { ...@@ -9,7 +9,7 @@ import {
ImageButton, ImageButton,
SafeAreaView, SafeAreaView,
ImageBackground, ImageBackground,
Button, Modal,
Image, Image,
TouchableHighlight, TouchableHighlight,
} from 'react-native'; } from 'react-native';
...@@ -20,15 +20,29 @@ import {Authorize} from '../../auth/AuthenticateUser'; ...@@ -20,15 +20,29 @@ import {Authorize} from '../../auth/AuthenticateUser';
import Client from '../../client/Client'; import Client from '../../client/Client';
import ReadModal from '../../../component/reading/ReadModal'; import ReadModal from '../../../component/reading/ReadModal';
import ReadModalFailed from '../../../component/reading/ReadModalFailed'; import ReadModalFailed from '../../../component/reading/ReadModalFailed';
import ReadModalNotice from '../../../component/reading/ReadModalNotice';
export default function ReadActivityGo() { export default function ReadActivityGo() {
const navigation = useNavigation(); const navigation = useNavigation();
const [count, setCount] = useState(1); const [count, setCount] = useState(0);
const [modalVisible, setModalVisible] = useState(false); const [modalVisible, setModalVisible] = useState(false);
const [modalVisible2, setModalVisible2] = useState(false); const [modalVisible2, setModalVisible2] = useState(false);
const [modalVisible3, setModalVisible3] = useState(false); const [modalVisible3, setModalVisible3] = useState(false);
React.useEffect(() => {
// StatusBar.setHidden(true);
//
setModalVisible(true);
const unsubscribe = navigation.addListener('focus', () => {
Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
});
return unsubscribe;
}, [navigation]);
useEffect(() => { useEffect(() => {
Voice.destroy().then(Voice.removeAllListeners); Voice.destroy().then(Voice.removeAllListeners);
}, []); }, []);
...@@ -64,6 +78,7 @@ export default function ReadActivityGo() { ...@@ -64,6 +78,7 @@ export default function ReadActivityGo() {
}; };
const onSpeechResultsHandler = e => { const onSpeechResultsHandler = e => {
setCount(count + 1);
const result = e.value; const result = e.value;
if (result.includes('go')) { if (result.includes('go')) {
AsyncStorage.getItem('userId') AsyncStorage.getItem('userId')
...@@ -80,22 +95,21 @@ export default function ReadActivityGo() { ...@@ -80,22 +95,21 @@ export default function ReadActivityGo() {
console.log(error); console.log(error);
}); });
} else { } else {
setCount(count + 1);
setModalVisible3(true); setModalVisible3(true);
startRecording();
} }
}; };
const onSpeechError = e => { const onSpeechError = e => {
console.log('onSpeechError: ', e); setCount(count + 1);
const result = DummyReadResult.value; const result = e.value;
if (result.includes('hello')) { if (result.includes('go')) {
AsyncStorage.getItem('userId') AsyncStorage.getItem('userId')
.then(userId => { .then(userId => {
const data = { const data = {
word: 'go', word: 'Go',
userId: userId, userId: userId,
level: 1, level: 'Basic',
triedCount: count, triedCount: count,
}; };
getToken(data); getToken(data);
...@@ -104,12 +118,8 @@ export default function ReadActivityGo() { ...@@ -104,12 +118,8 @@ export default function ReadActivityGo() {
console.log(error); console.log(error);
}); });
} else { } else {
setCount(count + 1); setModalVisible3(true);
Voice.start('en-US');
} }
console.log('count', count);
console.log('count', count);
}; };
const getToken = data => { const getToken = data => {
...@@ -138,10 +148,15 @@ export default function ReadActivityGo() { ...@@ -138,10 +148,15 @@ export default function ReadActivityGo() {
validity="Pronunciation." validity="Pronunciation."
visible="true" visible="true"
path="ReadActivityHe" path="ReadActivityHe"
imagePath={ImagePaths.robot1}
/> />
)} )}
{modalVisible3 && <ReadModalFailed visible="true" />} {modalVisible3 && (
<ReadModalFailed visible="true" imagePath={ImagePaths.robot1} />
)}
{modalVisible && <ReadModalNotice visible="true" />}
<View style={{flexDirection: 'column'}}> <View style={{flexDirection: 'column'}}>
<ImageBackground <ImageBackground
style={styles.image} style={styles.image}
...@@ -153,7 +168,7 @@ export default function ReadActivityGo() { ...@@ -153,7 +168,7 @@ export default function ReadActivityGo() {
</View> </View>
</View> </View>
<View style={styles.textBody}> <View style={styles.textBody}>
<Text style={styles.text}>Pronounce this Word!</Text> <Text style={styles.text}>Pronounce This Word!</Text>
</View> </View>
</View> </View>
...@@ -250,4 +265,71 @@ const styles = StyleSheet.create({ ...@@ -250,4 +265,71 @@ const styles = StyleSheet.create({
marginLeft: 50, marginLeft: 50,
padding: 7, padding: 7,
}, },
centeredView2: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
marginTop: 22,
},
modalView2: {
marginTop: -10,
margin: 20,
backgroundColor: '#FFFFFFEF',
borderRadius: 20,
padding: 35,
borderWidth: 5,
// borderColor: '#red',
alignItems: 'center',
// shadowColor: 'red',
// shadowOffset: {
// width: 0,
// height: 2,
// },
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5,
},
button2: {
borderRadius: 20,
padding: 10,
elevation: 2,
},
buttonOpen2: {
backgroundColor: '#F194FF',
},
buttonClose2: {
// backgroundColor: "#1DCE92",
},
textStyle2: {
color: 'white',
fontWeight: 'bold',
textAlign: 'center',
},
modalText2: {
marginBottom: 15,
textAlign: 'center',
},
headStyle2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 5,
},
head2Style2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 20,
},
alert2: {
// backgroundColor: 'rgba(0, 181, 0, 0.45)',
borderRadius: 50,
width: 100,
height: 100,
marginBottom: 20,
marginTop: -80,
},
}); });
...@@ -9,7 +9,7 @@ import { ...@@ -9,7 +9,7 @@ import {
ImageButton, ImageButton,
SafeAreaView, SafeAreaView,
ImageBackground, ImageBackground,
Button, Modal,
Image, Image,
TouchableHighlight, TouchableHighlight,
} from 'react-native'; } from 'react-native';
...@@ -20,15 +20,29 @@ import {Authorize} from '../../auth/AuthenticateUser'; ...@@ -20,15 +20,29 @@ import {Authorize} from '../../auth/AuthenticateUser';
import Client from '../../client/Client'; import Client from '../../client/Client';
import ReadModal from '../../../component/reading/ReadModal'; import ReadModal from '../../../component/reading/ReadModal';
import ReadModalFailed from '../../../component/reading/ReadModalFailed'; import ReadModalFailed from '../../../component/reading/ReadModalFailed';
import ReadModalNotice from '../../../component/reading/ReadModalNotice';
export default function ReadActivityHe() { export default function ReadActivityHe() {
const navigation = useNavigation(); const navigation = useNavigation();
const [count, setCount] = useState(1); const [count, setCount] = useState(0);
const [modalVisible, setModalVisible] = useState(false); const [modalVisible, setModalVisible] = useState(false);
const [modalVisible2, setModalVisible2] = useState(false); const [modalVisible2, setModalVisible2] = useState(false);
const [modalVisible3, setModalVisible3] = useState(false); const [modalVisible3, setModalVisible3] = useState(false);
React.useEffect(() => {
// StatusBar.setHidden(true);
//
setModalVisible(true);
const unsubscribe = navigation.addListener('focus', () => {
Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
});
return unsubscribe;
}, [navigation]);
useEffect(() => { useEffect(() => {
Voice.destroy().then(Voice.removeAllListeners); Voice.destroy().then(Voice.removeAllListeners);
}, []); }, []);
...@@ -82,8 +96,9 @@ export default function ReadActivityHe() { ...@@ -82,8 +96,9 @@ export default function ReadActivityHe() {
}; };
const onSpeechResultsHandler = e => { const onSpeechResultsHandler = e => {
setCount(count + 1);
const result = e.value; const result = e.value;
if (result.includes('He')) { if (result.includes('he')) {
AsyncStorage.getItem('userId') AsyncStorage.getItem('userId')
.then(userId => { .then(userId => {
const data = { const data = {
...@@ -98,36 +113,33 @@ export default function ReadActivityHe() { ...@@ -98,36 +113,33 @@ export default function ReadActivityHe() {
console.log(error); console.log(error);
}); });
} else { } else {
setCount(count + 1);
setModalVisible3(true); setModalVisible3(true);
startRecording();
} }
}; };
const onSpeechError = e => { const onSpeechError = e => {
console.log('onSpeechError: ', e); // console.log('onSpeechError: ', e);
const result = DummyReadResult.value; // const result = DummyReadResult.value;
if (result.includes('hello')) { // if (result.includes('hello')) {
AsyncStorage.getItem('userId') // AsyncStorage.getItem('userId')
.then(userId => { // .then(userId => {
const data = { // const data = {
word: 'he', // word: 'he',
userId: userId, // userId: userId,
level: 1, // level: 1,
triedCount: count, // triedCount: count,
}; // };
getToken(data); // getToken(data);
}) // })
.catch(error => { // .catch(error => {
console.log(error); // console.log(error);
}); // });
} else { // } else {
setCount(count + 1); // setCount(count + 1);
Voice.start('en-US'); // Voice.start('en-US');
} // }
console.log('count', count); // console.log('count', count);
// console.log('count', count);
console.log('count', count);
}; };
const getToken = data => { const getToken = data => {
...@@ -152,15 +164,21 @@ export default function ReadActivityHe() { ...@@ -152,15 +164,21 @@ export default function ReadActivityHe() {
<SafeAreaView> <SafeAreaView>
{modalVisible2 && ( {modalVisible2 && (
<ReadModal <ReadModal
caption="Basic" caption="Basic Level"
validity="Level Completed." validity=" Completed."
visible="true" visible="true"
path="Read" path="Read"
imagePath={ImagePaths.robot1}
/> />
)} )}
{modalVisible3 && <ReadModalFailed visible="true" />} {modalVisible3 && (
<View style={{flexDirection: 'column'}}> <ReadModalFailed visible="true" imagePath={ImagePaths.robot1} />
)}
{modalVisible && <ReadModalNotice visible="true" />}
<View style={{ flexDirection: 'column' }}>
<ImageBackground <ImageBackground
style={styles.image} style={styles.image}
source={ImagePaths.backgroundBasic}> source={ImagePaths.backgroundBasic}>
...@@ -268,4 +286,71 @@ const styles = StyleSheet.create({ ...@@ -268,4 +286,71 @@ const styles = StyleSheet.create({
marginLeft: 50, marginLeft: 50,
padding: 7, padding: 7,
}, },
centeredView2: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
marginTop: 22,
},
modalView2: {
marginTop: -10,
margin: 20,
backgroundColor: '#FFFFFFEF',
borderRadius: 20,
padding: 35,
borderWidth: 5,
// borderColor: '#red',
alignItems: 'center',
// shadowColor: 'red',
// shadowOffset: {
// width: 0,
// height: 2,
// },
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5,
},
button2: {
borderRadius: 20,
padding: 10,
elevation: 2,
},
buttonOpen2: {
backgroundColor: '#F194FF',
},
buttonClose2: {
// backgroundColor: "#1DCE92",
},
textStyle2: {
color: 'white',
fontWeight: 'bold',
textAlign: 'center',
},
modalText2: {
marginBottom: 15,
textAlign: 'center',
},
headStyle2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 5,
},
head2Style2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 20,
},
alert2: {
// backgroundColor: 'rgba(0, 181, 0, 0.45)',
borderRadius: 50,
width: 100,
height: 100,
marginBottom: 20,
marginTop: -80,
},
}); });
...@@ -22,11 +22,12 @@ import CountDown from 'react-native-countdown-component'; ...@@ -22,11 +22,12 @@ import CountDown from 'react-native-countdown-component';
import Client from '../../client/Client'; import Client from '../../client/Client';
import ReadModal from '../../../component/reading/ReadModal'; import ReadModal from '../../../component/reading/ReadModal';
import ReadModalFailed from '../../../component/reading/ReadModalFailed'; import ReadModalFailed from '../../../component/reading/ReadModalFailed';
import ReadModalNotice from '../../../component/reading/ReadModalNotice';
export default function ReadActivityNo() { export default function ReadActivityNo() {
const navigation = useNavigation(); const navigation = useNavigation();
const [count, setCount] = useState(1); const [count, setCount] = useState(0);
const [modalVisible, setModalVisible] = useState(false); const [modalVisible, setModalVisible] = useState(false);
const [modalVisible2, setModalVisible2] = useState(false); const [modalVisible2, setModalVisible2] = useState(false);
const [modalVisible3, setModalVisible3] = useState(false); const [modalVisible3, setModalVisible3] = useState(false);
...@@ -34,6 +35,7 @@ export default function ReadActivityNo() { ...@@ -34,6 +35,7 @@ export default function ReadActivityNo() {
React.useEffect(() => { React.useEffect(() => {
// StatusBar.setHidden(true); // StatusBar.setHidden(true);
// //
setModalVisible(true);
audioInit(); audioInit();
const unsubscribe = navigation.addListener('focus', () => { const unsubscribe = navigation.addListener('focus', () => {
...@@ -55,15 +57,14 @@ export default function ReadActivityNo() { ...@@ -55,15 +57,14 @@ export default function ReadActivityNo() {
}, []); }, []);
function audioInit() { function audioInit() {
// console.log('audioInit'); const pronounceAudio = {
const colorAudio = {
sampleRate: 16000, sampleRate: 16000,
channels: 1, channels: 1,
bitsPerSample: 16, bitsPerSample: 16,
wavFile: 'color.wav', // thise wave file name wavFile: 'no.wav', // thise wave file name
}; };
AudioRecord.init(colorAudio); AudioRecord.init(pronounceAudio);
} }
async function audioStart() { async function audioStart() {
...@@ -141,7 +142,7 @@ export default function ReadActivityNo() { ...@@ -141,7 +142,7 @@ export default function ReadActivityNo() {
userId: 1, userId: 1,
token: 'f53af164ca2511ecbdc562bc611c4f50', token: 'f53af164ca2511ecbdc562bc611c4f50',
}; };
Client.post('reading/no' , JSON.stringify(datas), { Client.post('reading/no', JSON.stringify(datas), {
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
...@@ -162,6 +163,7 @@ export default function ReadActivityNo() { ...@@ -162,6 +163,7 @@ export default function ReadActivityNo() {
}; };
const onSpeechResultsHandler = e => { const onSpeechResultsHandler = e => {
setCount(count + 1);
const result = e.value; const result = e.value;
if (result.includes('no')) { if (result.includes('no')) {
AsyncStorage.getItem('userId') AsyncStorage.getItem('userId')
...@@ -178,23 +180,21 @@ export default function ReadActivityNo() { ...@@ -178,23 +180,21 @@ export default function ReadActivityNo() {
console.log(error); console.log(error);
}); });
} else { } else {
setCount(count + 1);
setModalVisible3(true); setModalVisible3(true);
startRecording();
} }
console.log('count', count); console.log('count', count);
}; };
const onSpeechError = e => { const onSpeechError = e => {
console.log('onSpeechError: ', e); setCount(count + 1);
const result = DummyReadResult.value; const result = DummyReadResult.value;
if (result.includes('helloddd')) { if (result.includes('no')) {
AsyncStorage.getItem('userId') AsyncStorage.getItem('userId')
.then(userId => { .then(userId => {
const data = { const data = {
word: 'no', word: 'No',
userId: userId, userId: userId,
level: 1, level: 'Basic',
triedCount: count, triedCount: count,
}; };
getToken(data); getToken(data);
...@@ -203,11 +203,9 @@ export default function ReadActivityNo() { ...@@ -203,11 +203,9 @@ export default function ReadActivityNo() {
console.log(error); console.log(error);
}); });
} else { } else {
setCount(count + 1);
setModalVisible3(true); setModalVisible3(true);
console.log(count);
startRecording();
} }
console.log('count', count);
}; };
const getToken = data => { const getToken = data => {
...@@ -236,10 +234,17 @@ export default function ReadActivityNo() { ...@@ -236,10 +234,17 @@ export default function ReadActivityNo() {
validity="Pronunciation." validity="Pronunciation."
visible="true" visible="true"
path="ReadActivityGo" path="ReadActivityGo"
imagePath={ImagePaths.robot1}
/> />
)} )}
{modalVisible3 && <ReadModalFailed visible="true" />} {modalVisible3 && (
<ReadModalFailed visible="true" imagePath={ImagePaths.robot1} />
)}
{modalVisible && (
<ReadModalNotice visible="true" />
)}
<View style={{flexDirection: 'column'}}> <View style={{flexDirection: 'column'}}>
<ImageBackground <ImageBackground
...@@ -350,4 +355,70 @@ const styles = StyleSheet.create({ ...@@ -350,4 +355,70 @@ const styles = StyleSheet.create({
padding: 7, padding: 7,
}, },
centeredView2: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
marginTop: 22,
},
modalView2: {
marginTop: -10,
margin: 20,
backgroundColor: '#FFFFFFEF',
borderRadius: 20,
padding: 35,
borderWidth: 5,
// borderColor: '#red',
alignItems: 'center',
// shadowColor: 'red',
// shadowOffset: {
// width: 0,
// height: 2,
// },
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5,
},
button2: {
borderRadius: 20,
padding: 10,
elevation: 2,
},
buttonOpen2: {
backgroundColor: '#F194FF',
},
buttonClose2: {
// backgroundColor: "#1DCE92",
},
textStyle2: {
color: 'white',
fontWeight: 'bold',
textAlign: 'center',
},
modalText2: {
marginBottom: 15,
textAlign: 'center',
},
headStyle2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 5,
},
head2Style2: {
color: 'black',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 30,
marginBottom: 20,
},
alert2: {
// backgroundColor: 'rgba(0, 181, 0, 0.45)',
borderRadius: 50,
width: 100,
height: 100,
marginBottom: 20,
marginTop: -80,
},
}); });
...@@ -70,6 +70,9 @@ export default function ReadResults() { ...@@ -70,6 +70,9 @@ export default function ReadResults() {
<TableList /> <TableList />
{/* </View> */} {/* </View> */}
</View> </View>
<View>
<Image style={styles.temp} source={ImagePaths.chart}></Image>
</View>
</ImageBackground> </ImageBackground>
</View> </View>
</SafeAreaView> </SafeAreaView>
...@@ -114,4 +117,13 @@ const styles = StyleSheet.create({ ...@@ -114,4 +117,13 @@ const styles = StyleSheet.create({
textAlign: 'center', textAlign: 'center',
fontWeight: 'bold', fontWeight: 'bold',
}, },
temp: {
marginTop: 100,
marginLeft: 80,
// backgroundColor: '#00008B',
width: 220,
height: 200,
borderRadius: 50,
padding: 5,
},
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment