Commit 90fc95cf authored by W.D.R.P. Sandeepa's avatar W.D.R.P. Sandeepa

change

parents 5b48d7b4 7570bf37
...@@ -228,18 +228,31 @@ def reading_result(userId): ...@@ -228,18 +228,31 @@ def reading_result(userId):
return make_response(body) return make_response(body)
# @app.route("/result", methods=['GET']) # Predict route
# def reading_result(): @app.route("/predictPronounce/<FPFN>", methods=["POST"])
# req = request.get_json() def predict_pronounce(FPFN):
# userId = req['userId'] assert FPFN == request.view_args['FPFN']
# result = get_reading_result(userId) data = request.get_json()
# response = { print((f"{data}"))
# "data": result,
# "message": "Success", try:
# "status": 200
# } audioFile ="temp/no.wav"
# body = jsonify(response)
# return make_response(body) result = predictData(audioFile, FPFN)
response = {
"data": result,
"message": "Success",
"status": 200
}
# resp = make_response(response)
# resp.headers['Access-Control-Allow-Origin'] = '*'
# resp.headers['Content-Type'] = 'application/json'
body = jsonify(response)
return make_response(body)
except ValueError:
print(ValueError)
if __name__ == "__main__": if __name__ == "__main__":
......
from API.db.dbConnection import * from API.db.dbConnection import *
from flask import jsonify from flask import jsonify
from API.util.util import getUUID from API.util.util import getUUID
from API.service.reading import pronounce_spotting_service
def get_reading_result(userId): def get_reading_result(userId):
...@@ -31,3 +32,30 @@ def update_session_status(token): ...@@ -31,3 +32,30 @@ def update_session_status(token):
def get_completed_levels_by_user(userId): def get_completed_levels_by_user(userId):
qry = 'SELECT status FROM readingSession WHERE userId = "{}"'.format(userId) qry = 'SELECT status FROM readingSession WHERE userId = "{}"'.format(userId)
return get_data(qry) return get_data(qry)
def predictData(audioFile, name):
# print(f"{name}")
# path = "test/green.wav"
# print(f"{path}")
new_predict_file_name = name.split(".")
FPFN = new_predict_file_name[0]
# invoke keyword spotting service
#kss = pronounce_spotting_service()
# make a prediction
# predicted_keyword = kss.predict(audioFile)
# remove the audio file
# os.remove(file_name)
# send back the predicted keyword in json format
data = {"Predicted Keyword": FPFN}
print(f"data: {data}")
return data
import tensorflow.keras as keras
import numpy as np
import librosa
MODEL_PATH = "model.h5"
NUM_SAMPLES_TO_CONSIDER = 22050 # 1 sec
class _Keyword_Spotting_Service:
model = None
_mappings = [
"no",
"go",
"he",
"dog",
"bird",
"fish",
]
_instance = None
def predict(self, file_path):
# extract MFCCs
MFCCs = self.preprocess(file_path) # (# segment, # coefficients)
# convert 2d MFCCs array into 4d array -> (# samples, # segment, # coefficients, # channels)
MFCCs = MFCCs[np.newaxis, ..., np.newaxis]
# make prediction
predictions = self.model.predict(MFCCs)
predicted_index = np.argmax(predictions)
predicted_keyword = self._mappings[predicted_index]
# return predicted_keyword
new_file_path = file_path.split("/")
new_file_paths = new_file_path[1].split(".")
print(f"1-{predicted_keyword}")
print(f"2-{new_file_paths[0]}")
if predicted_keyword == new_file_paths[0]:
return predicted_keyword
else:
return "No Prediction"
def preprocess(self, file_path, n_mfcc=13, n_fft=2048, hop_length=512):
# load audio file
signal, sr = librosa.load(file_path)
# ensure consistency in the audio file length
if len(signal) > NUM_SAMPLES_TO_CONSIDER:
signal = signal[:NUM_SAMPLES_TO_CONSIDER]
# extract MFCCs
MFCCs = librosa.feature.mfcc(signal, n_mfcc=n_mfcc, n_fft=n_fft, hop_length=hop_length)
return MFCCs.T
def Keyword_Spotting_service():
# ensure that we only have 1 instance of KSS
if _Keyword_Spotting_Service._instance is None:
_Keyword_Spotting_Service._instance = _Keyword_Spotting_Service()
_Keyword_Spotting_Service.model = keras.models.load_model(MODEL_PATH)
return _Keyword_Spotting_Service._instance
if __name__ == "__main__":
kss = Keyword_Spotting_service()
keyword1 = kss.predict("temp/bird.wav")
# keyword2 = kss.predict("test/blu7.wav")
print(f"Predicted Keywords: {keyword1}")
# print(f"Predicted Keywords: {keyword2}")
\ No newline at end of file
...@@ -10,15 +10,12 @@ class _Keyword_Spotting_Service: ...@@ -10,15 +10,12 @@ class _Keyword_Spotting_Service:
model = None model = None
_mappings = [ _mappings = [
"go",
"no", "no",
"yes", "go",
"wow", "he",
"dog", "dog",
"bed",
"bird", "bird",
"left", "fish",
"eight"
] ]
_instance = None _instance = None
......
This diff is collapsed.
...@@ -6,6 +6,10 @@ export const ImagePaths = { ...@@ -6,6 +6,10 @@ export const ImagePaths = {
robot1: require('../image/robot1.png'), robot1: require('../image/robot1.png'),
robot2: require('../image/activity-2-rob.png'), robot2: require('../image/activity-2-rob.png'),
backgroundBasic: require('../image/activity-2-backg.jpeg'), backgroundBasic: require('../image/activity-2-backg.jpeg'),
backgroundAdvanced: require('../image/backgroundAdvanced.jpeg'),
backgroundAdvancedDog: require('../image/dogbb.jpg'),
backgroundAdvancedBird: require('../image/birdb.jpg'),
backgroundAdvancedFish: require('../image/fishbb.jpg'),
resultBackground: require('../image/rersultBacground.jpeg'), resultBackground: require('../image/rersultBacground.jpeg'),
no: require('../image/no.png'), no: require('../image/no.png'),
go: require('../image/go.png'), go: require('../image/go.png'),
...@@ -13,10 +17,14 @@ export const ImagePaths = { ...@@ -13,10 +17,14 @@ export const ImagePaths = {
bird: require('../image/bird.png'), bird: require('../image/bird.png'),
dog: require('../image/dog.png'), dog: require('../image/dog.png'),
fish: require('../image/fish.png'), fish: require('../image/fish.png'),
bird1: require('../image/bird1.png'),
dog1: require('../image/dog1.png'),
fish1: require('../image/fish1.png'),
retry: require('../image/retry.png'), retry: require('../image/retry.png'),
wrong: require('../image/wrong.png'), wrong: require('../image/wrong.png'),
correct: require('../image/correct.png'), correct: require('../image/correct.png'),
chart: require('../image/chart.png'), chart: require('../image/chart.png'),
record: require('../image/record.png'),
}; };
export const DummyReadResult = { export const DummyReadResult = {
......
...@@ -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 ReadModal(props) { export default function ReadModal(props) {
const {caption, validity, visibility, path} = props; const {caption, validity, visibility, path,imagePath} = props;
const navigation = useNavigation(); const navigation = useNavigation();
...@@ -34,9 +34,9 @@ export default function ReadModal(props) { ...@@ -34,9 +34,9 @@ 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.robot1}></Image> <Image style={styles.alert2} source={ImagePaths.bird1}></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>
<TouchableOpacity <TouchableOpacity
style={[styles.buttonClose2]} style={[styles.buttonClose2]}
...@@ -174,7 +174,7 @@ const styles = StyleSheet.create({ ...@@ -174,7 +174,7 @@ const styles = StyleSheet.create({
marginBottom: 20, marginBottom: 20,
}, },
alert2: { alert2: {
backgroundColor: 'rgba(0, 181, 0, 0.45)', // backgroundColor: 'rgba(0, 181, 0, 0.45)',
borderRadius: 50, borderRadius: 50,
width: 100, width: 100,
height: 100, height: 100,
......
...@@ -75,7 +75,7 @@ export default function TableList() { ...@@ -75,7 +75,7 @@ export default function TableList() {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 0, flex: 0,
paddingTop: 70, paddingTop: 40,
paddingLeft: 60, paddingLeft: 60,
paddingRight: 60, paddingRight: 60,
marginTop: 0, marginTop: 0,
......
...@@ -210,7 +210,7 @@ const AppRouter = () => { ...@@ -210,7 +210,7 @@ const AppRouter = () => {
options={{ options={{
title: 'Memory Games', title: 'Memory Games',
headerTintColor: 'white', headerTintColor: 'white',
headerStyle: {backgroundColor: '#5fcf93'} headerStyle: {backgroundColor: '#5fcf93'},
}} }}
/> />
<Stack.Screen <Stack.Screen
...@@ -301,7 +301,7 @@ const AppRouter = () => { ...@@ -301,7 +301,7 @@ const AppRouter = () => {
title: 'Results', title: 'Results',
headerTintColor: 'white', headerTintColor: 'white',
headerStyle: {backgroundColor: '#5fcf93'}, headerStyle: {backgroundColor: '#5fcf93'},
}} }}
/> />
<Stack.Screen <Stack.Screen
name="GameLevel" name="GameLevel"
...@@ -311,7 +311,7 @@ const AppRouter = () => { ...@@ -311,7 +311,7 @@ const AppRouter = () => {
title: 'Levels', title: 'Levels',
headerTintColor: 'white', headerTintColor: 'white',
headerStyle: {backgroundColor: '#5fcf93'}, headerStyle: {backgroundColor: '#5fcf93'},
}} }}
/> />
<Stack.Screen <Stack.Screen
name="MediumLevelStart" name="MediumLevelStart"
...@@ -321,7 +321,7 @@ const AppRouter = () => { ...@@ -321,7 +321,7 @@ const AppRouter = () => {
title: 'Medium Level', title: 'Medium Level',
headerTintColor: 'white', headerTintColor: 'white',
headerStyle: {backgroundColor: '#5fcf93'}, headerStyle: {backgroundColor: '#5fcf93'},
}} }}
/> />
<Stack.Screen <Stack.Screen
name="AdvanceLevelStart" name="AdvanceLevelStart"
...@@ -331,7 +331,7 @@ const AppRouter = () => { ...@@ -331,7 +331,7 @@ const AppRouter = () => {
title: 'Advance Level', title: 'Advance Level',
headerTintColor: 'white', headerTintColor: 'white',
headerStyle: {backgroundColor: '#5fcf93'}, headerStyle: {backgroundColor: '#5fcf93'},
}} }}
/> />
<Stack.Screen <Stack.Screen
options={{headerShown: false}} options={{headerShown: false}}
......
...@@ -72,7 +72,8 @@ const styles = StyleSheet.create({ ...@@ -72,7 +72,8 @@ const styles = StyleSheet.create({
imageContainer:{ imageContainer:{
flexDirection: "row", flexDirection: "row",
marginTop: 70, marginTop: 70,
}, },
imageView: { imageView: {
width: 180, width: 180,
......
...@@ -121,7 +121,7 @@ const styles = StyleSheet.create({ ...@@ -121,7 +121,7 @@ const styles = StyleSheet.create({
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
padding: 20, padding: 20,
backgroundColor: '#ffff', backgroundColor: 'rgba(216, 216, 216, 0.22)',
}, },
imageContainer: { imageContainer: {
flexDirection: 'row', flexDirection: 'row',
......
...@@ -138,6 +138,7 @@ export default function ReadActivityBird() { ...@@ -138,6 +138,7 @@ export default function ReadActivityBird() {
validity="Pronunciation." validity="Pronunciation."
visible="true" visible="true"
path="ReadActivityFish" path="ReadActivityFish"
imagePath={ImagePaths.bird1}
/> />
)} )}
...@@ -145,7 +146,7 @@ export default function ReadActivityBird() { ...@@ -145,7 +146,7 @@ export default function ReadActivityBird() {
<View style={{flexDirection: 'column'}}> <View style={{flexDirection: 'column'}}>
<ImageBackground <ImageBackground
style={styles.image} style={styles.image}
source={ImagePaths.backgroundBasic}> source={ImagePaths.backgroundAdvancedBird}>
<View style={styles.imageContainer}> <View style={styles.imageContainer}>
<View style={styles.imageView}> <View style={styles.imageView}>
<View style={styles.robo}> <View style={styles.robo}>
...@@ -162,12 +163,7 @@ export default function ReadActivityBird() { ...@@ -162,12 +163,7 @@ export default function ReadActivityBird() {
</View> </View>
<View style={styles.horizontalView}> <View style={styles.horizontalView}>
<TouchableHighlight onPress={startRecording}> <TouchableHighlight onPress={startRecording}>
<Image <Image style={styles.imageButton} source={ImagePaths.record} />
style={styles.imageButton}
source={{
uri: 'https://raw.githubusercontent.com/AboutReact/sampleresource/master/microphone.png',
}}
/>
</TouchableHighlight> </TouchableHighlight>
</View> </View>
</ImageBackground> </ImageBackground>
...@@ -230,7 +226,7 @@ const styles = StyleSheet.create({ ...@@ -230,7 +226,7 @@ const styles = StyleSheet.create({
alignItems: 'center', alignItems: 'center',
color: '#00008B', color: '#00008B',
borderRadius: 10, borderRadius: 10,
backgroundColor: 'rgba(2, 202, 106, 0.17)', backgroundColor: 'rgba(2, 202, 106, 0.99)',
textAlign: 'center', textAlign: 'center',
fontWeight: 'bold', fontWeight: 'bold',
}, },
...@@ -241,18 +237,17 @@ const styles = StyleSheet.create({ ...@@ -241,18 +237,17 @@ const styles = StyleSheet.create({
color: '#000000', color: '#000000',
}, },
imageButton: { imageButton: {
width: 50, width: 100,
height: 50, height: 100,
}, },
horizontalView: { horizontalView: {
backgroundColor: 'rgba(23, 0, 245, 0.17)', // backgroundColor: 'rgba(23, 0, 245, 0.1)',
borderRadius: 50,
flexDirection: 'row', flexDirection: 'row',
position: 'absolute', position: 'absolute',
bottom: 0, bottom: 0,
flexDirection: 'row', flexDirection: 'row',
marginBottom: 140, marginBottom: 80,
marginLeft: 50, marginLeft: 135,
padding: 7, padding: 0,
}, },
}); });
...@@ -138,6 +138,7 @@ export default function ReadActivityDog() { ...@@ -138,6 +138,7 @@ export default function ReadActivityDog() {
validity="Pronunciation." validity="Pronunciation."
visible="true" visible="true"
path="ReadActivityBird" path="ReadActivityBird"
imagePath={ImagePaths.dog1}
/> />
)} )}
...@@ -145,7 +146,7 @@ export default function ReadActivityDog() { ...@@ -145,7 +146,7 @@ export default function ReadActivityDog() {
<View style={{flexDirection: 'column'}}> <View style={{flexDirection: 'column'}}>
<ImageBackground <ImageBackground
style={styles.image} style={styles.image}
source={ImagePaths.backgroundBasic}> source={ImagePaths.backgroundAdvancedDog}>
<View style={styles.imageContainer}> <View style={styles.imageContainer}>
<View style={styles.imageView}> <View style={styles.imageView}>
<View style={styles.robo}> <View style={styles.robo}>
...@@ -162,12 +163,7 @@ export default function ReadActivityDog() { ...@@ -162,12 +163,7 @@ export default function ReadActivityDog() {
</View> </View>
<View style={styles.horizontalView}> <View style={styles.horizontalView}>
<TouchableHighlight onPress={startRecording}> <TouchableHighlight onPress={startRecording}>
<Image <Image style={styles.imageButton} source={ImagePaths.record} />
style={styles.imageButton}
source={{
uri: 'https://raw.githubusercontent.com/AboutReact/sampleresource/master/microphone.png',
}}
/>
</TouchableHighlight> </TouchableHighlight>
</View> </View>
</ImageBackground> </ImageBackground>
...@@ -179,7 +175,7 @@ export default function ReadActivityDog() { ...@@ -179,7 +175,7 @@ export default function ReadActivityDog() {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
imageContainer: { imageContainer: {
flexDirection: 'row', flexDirection: 'row',
marginTop: 70, marginTop: 80,
}, },
imageView: { imageView: {
width: 180, width: 180,
...@@ -230,7 +226,7 @@ const styles = StyleSheet.create({ ...@@ -230,7 +226,7 @@ const styles = StyleSheet.create({
alignItems: 'center', alignItems: 'center',
color: '#00008B', color: '#00008B',
borderRadius: 10, borderRadius: 10,
backgroundColor: 'rgba(2, 202, 106, 0.17)', backgroundColor: 'rgba(2, 202, 106, 0.99)',
textAlign: 'center', textAlign: 'center',
fontWeight: 'bold', fontWeight: 'bold',
}, },
...@@ -241,18 +237,17 @@ const styles = StyleSheet.create({ ...@@ -241,18 +237,17 @@ const styles = StyleSheet.create({
color: '#000000', color: '#000000',
}, },
imageButton: { imageButton: {
width: 50, width: 100,
height: 50, height: 100,
}, },
horizontalView: { horizontalView: {
backgroundColor: 'rgba(23, 0, 245, 0.17)', // backgroundColor: 'rgba(23, 0, 245, 0.1)',
borderRadius: 50,
flexDirection: 'row', flexDirection: 'row',
position: 'absolute', position: 'absolute',
bottom: 0, bottom: 0,
flexDirection: 'row', flexDirection: 'row',
marginBottom: 140, marginBottom: 80,
marginLeft: 50, marginLeft: 135,
padding: 7, padding: 0,
}, },
}); });
...@@ -155,6 +155,7 @@ export default function ReadActivityFish() { ...@@ -155,6 +155,7 @@ export default function ReadActivityFish() {
validity="Advanced Level Completed." validity="Advanced Level Completed."
visible="true" visible="true"
path="Read" path="Read"
imagePath={ImagePaths.fish1}
/> />
)} )}
...@@ -162,7 +163,7 @@ export default function ReadActivityFish() { ...@@ -162,7 +163,7 @@ export default function ReadActivityFish() {
<View style={{flexDirection: 'column'}}> <View style={{flexDirection: 'column'}}>
<ImageBackground <ImageBackground
style={styles.image} style={styles.image}
source={ImagePaths.backgroundBasic}> source={ImagePaths.backgroundAdvancedFish}>
<View style={styles.imageContainer}> <View style={styles.imageContainer}>
<View style={styles.imageView}> <View style={styles.imageView}>
<View style={styles.robo}> <View style={styles.robo}>
...@@ -179,12 +180,7 @@ export default function ReadActivityFish() { ...@@ -179,12 +180,7 @@ export default function ReadActivityFish() {
</View> </View>
<View style={styles.horizontalView}> <View style={styles.horizontalView}>
<TouchableHighlight onPress={startRecording}> <TouchableHighlight onPress={startRecording}>
<Image <Image style={styles.imageButton} source={ImagePaths.record} />
style={styles.imageButton}
source={{
uri: 'https://raw.githubusercontent.com/AboutReact/sampleresource/master/microphone.png',
}}
/>
</TouchableHighlight> </TouchableHighlight>
</View> </View>
</ImageBackground> </ImageBackground>
...@@ -247,7 +243,7 @@ const styles = StyleSheet.create({ ...@@ -247,7 +243,7 @@ const styles = StyleSheet.create({
alignItems: 'center', alignItems: 'center',
color: '#00008B', color: '#00008B',
borderRadius: 10, borderRadius: 10,
backgroundColor: 'rgba(2, 202, 106, 0.17)', backgroundColor: 'rgba(2, 202, 106, 0.99)',
textAlign: 'center', textAlign: 'center',
fontWeight: 'bold', fontWeight: 'bold',
}, },
...@@ -258,18 +254,17 @@ const styles = StyleSheet.create({ ...@@ -258,18 +254,17 @@ const styles = StyleSheet.create({
color: '#000000', color: '#000000',
}, },
imageButton: { imageButton: {
width: 50, width: 100,
height: 50, height: 100,
}, },
horizontalView: { horizontalView: {
backgroundColor: 'rgba(23, 0, 245, 0.17)', // backgroundColor: 'rgba(23, 0, 245, 0.1)',
borderRadius: 50,
flexDirection: 'row', flexDirection: 'row',
position: 'absolute', position: 'absolute',
bottom: 0, bottom: 0,
flexDirection: 'row', flexDirection: 'row',
marginBottom: 140, marginBottom: 80,
marginLeft: 50, marginLeft: 135,
padding: 7, padding: 0,
}, },
}); });
...@@ -162,12 +162,7 @@ export default function ReadActivityGo() { ...@@ -162,12 +162,7 @@ export default function ReadActivityGo() {
</View> </View>
<View style={styles.horizontalView}> <View style={styles.horizontalView}>
<TouchableHighlight onPress={startRecording}> <TouchableHighlight onPress={startRecording}>
<Image <Image style={styles.imageButton} source={ImagePaths.record} />
style={styles.imageButton}
source={{
uri: 'https://raw.githubusercontent.com/AboutReact/sampleresource/master/microphone.png',
}}
/>
</TouchableHighlight> </TouchableHighlight>
</View> </View>
</ImageBackground> </ImageBackground>
...@@ -241,11 +236,11 @@ const styles = StyleSheet.create({ ...@@ -241,11 +236,11 @@ const styles = StyleSheet.create({
color: '#000000', color: '#000000',
}, },
imageButton: { imageButton: {
width: 50, width: 80,
height: 50, height: 80,
}, },
horizontalView: { horizontalView: {
backgroundColor: 'rgba(23, 0, 245, 0.17)', // backgroundColor: 'rgba(23, 0, 245, 0.17)',
borderRadius: 50, borderRadius: 50,
flexDirection: 'row', flexDirection: 'row',
position: 'absolute', position: 'absolute',
......
...@@ -180,12 +180,7 @@ export default function ReadActivityHe() { ...@@ -180,12 +180,7 @@ export default function ReadActivityHe() {
</View> </View>
<View style={styles.horizontalView}> <View style={styles.horizontalView}>
<TouchableHighlight onPress={startRecording}> <TouchableHighlight onPress={startRecording}>
<Image <Image style={styles.imageButton} source={ImagePaths.record} />
style={styles.imageButton}
source={{
uri: 'https://raw.githubusercontent.com/AboutReact/sampleresource/master/microphone.png',
}}
/>
</TouchableHighlight> </TouchableHighlight>
</View> </View>
</ImageBackground> </ImageBackground>
...@@ -259,11 +254,11 @@ const styles = StyleSheet.create({ ...@@ -259,11 +254,11 @@ const styles = StyleSheet.create({
color: '#000000', color: '#000000',
}, },
imageButton: { imageButton: {
width: 50, width: 80,
height: 50, height: 80,
}, },
horizontalView: { horizontalView: {
backgroundColor: 'rgba(23, 0, 245, 0.17)', // backgroundColor: 'rgba(23, 0, 245, 0.17)',
borderRadius: 50, borderRadius: 50,
flexDirection: 'row', flexDirection: 'row',
position: 'absolute', position: 'absolute',
......
...@@ -33,7 +33,7 @@ export default function ReadActivityNo() { ...@@ -33,7 +33,7 @@ export default function ReadActivityNo() {
React.useEffect(() => { React.useEffect(() => {
// StatusBar.setHidden(true); // StatusBar.setHidden(true);
// //
audioInit(); audioInit();
const unsubscribe = navigation.addListener('focus', () => { const unsubscribe = navigation.addListener('focus', () => {
...@@ -127,6 +127,8 @@ export default function ReadActivityNo() { ...@@ -127,6 +127,8 @@ export default function ReadActivityNo() {
}) })
.then(res => { .then(res => {
setModalVisible2(true); setModalVisible2(true);
startAudio();
// navigation.navigate('ReadActivityGo'); // navigation.navigate('ReadActivityGo');
}) })
.catch(error => { .catch(error => {
...@@ -134,6 +136,27 @@ export default function ReadActivityNo() { ...@@ -134,6 +136,27 @@ export default function ReadActivityNo() {
}); });
}; };
function startAudio() {
const datas = {
userId: 1,
token: 'f53af164ca2511ecbdc562bc611c4f50',
};
Client.post('reading/no' , JSON.stringify(datas), {
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
})
.then(res => {
setModalVisible2(true);
// navigation.navigate('ReadActivityGo');
})
.catch(error => {
console.log(error);
});
}
const onSpeechStartHandler = e => { const onSpeechStartHandler = e => {
console.log('start handler =>> ', e); console.log('start handler =>> ', e);
}; };
...@@ -216,11 +239,7 @@ export default function ReadActivityNo() { ...@@ -216,11 +239,7 @@ export default function ReadActivityNo() {
/> />
)} )}
{modalVisible3 && ( {modalVisible3 && <ReadModalFailed visible="true" />}
<ReadModalFailed
visible="true"
/>
)}
<View style={{flexDirection: 'column'}}> <View style={{flexDirection: 'column'}}>
<ImageBackground <ImageBackground
...@@ -242,12 +261,7 @@ export default function ReadActivityNo() { ...@@ -242,12 +261,7 @@ export default function ReadActivityNo() {
</View> </View>
<View style={styles.horizontalView}> <View style={styles.horizontalView}>
<TouchableHighlight onPress={startRecording}> <TouchableHighlight onPress={startRecording}>
<Image <Image style={styles.imageButton} source={ImagePaths.record} />
style={styles.imageButton}
source={{
uri: 'https://raw.githubusercontent.com/AboutReact/sampleresource/master/microphone.png',
}}
/>
</TouchableHighlight> </TouchableHighlight>
</View> </View>
</ImageBackground> </ImageBackground>
...@@ -321,11 +335,11 @@ const styles = StyleSheet.create({ ...@@ -321,11 +335,11 @@ const styles = StyleSheet.create({
color: '#000000', color: '#000000',
}, },
imageButton: { imageButton: {
width: 50, width: 80,
height: 50, height: 80,
}, },
horizontalView: { horizontalView: {
backgroundColor: 'rgba(23, 0, 245, 0.17)', // backgroundColor: 'rgba(23, 0, 245, 0.17)',
borderRadius: 50, borderRadius: 50,
flexDirection: 'row', flexDirection: 'row',
position: 'absolute', position: 'absolute',
...@@ -336,156 +350,4 @@ const styles = StyleSheet.create({ ...@@ -336,156 +350,4 @@ const styles = StyleSheet.create({
padding: 7, padding: 7,
}, },
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,
},
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: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
marginTop: -20,
},
modalView3: {
margin: 20,
backgroundColor: '#FFFFFF',
borderRadius: 20,
padding: 20,
borderWidth: 5,
borderColor: '#red',
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: 'red',
},
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,
},
}); });
...@@ -61,9 +61,13 @@ export default function ReadResults() { ...@@ -61,9 +61,13 @@ export default function ReadResults() {
<ImageBackground <ImageBackground
style={styles.image} style={styles.image}
source={ImagePaths.resultBackground}> source={ImagePaths.resultBackground}>
<View style={styles.textBody}>
<Text style={styles.text}>Your Results</Text>
</View>
<View style={styles.imageContainer}> <View style={styles.imageContainer}>
{/* <View style={styles.imageView}> */} {/* <View > */}
<TableList />
<TableList />
{/* </View> */} {/* </View> */}
</View> </View>
</ImageBackground> </ImageBackground>
...@@ -90,6 +94,24 @@ const styles = StyleSheet.create({ ...@@ -90,6 +94,24 @@ const styles = StyleSheet.create({
}, },
imageContainer: { imageContainer: {
flexDirection: 'row', flexDirection: 'row',
marginTop: 70, marginTop: 1,
},
textBody: {
marginTop: 10,
marginLeft: 90,
// backgroundColor: '#00008B',
width: 220,
borderRadius: 50,
padding: 5,
},
text: {
fontSize: 35,
justifyContent: 'center',
alignItems: 'center',
color: 'black',
borderRadius: 10,
backgroundColor: 'rgba(2, 202, 106, 0.17)',
textAlign: 'center',
fontWeight: 'bold',
}, },
}); });
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