Browse Source

update graphic

feature/upgrade_sdk
Dslak 6 years ago
parent
commit
074f96ba4d
  1. BIN
      screenshots/Screenshot_20191022-123656_VDS Quiz.jpg
  2. BIN
      screenshots/Screenshot_20191022-123700_VDS Quiz.jpg
  3. BIN
      screenshots/Screenshot_20191022-123704_VDS Quiz.jpg
  4. BIN
      screenshots/Screenshot_20191022-123710_VDS Quiz.jpg
  5. BIN
      screenshots/Screenshot_20191022-123725_VDS Quiz.jpg
  6. BIN
      screenshots/Screenshot_20191022-123730_VDS Quiz.jpg
  7. BIN
      screenshots/Screenshot_20191106-183306_Expo.jpg
  8. BIN
      screenshots/Screenshot_20191106-183334_Expo.jpg
  9. BIN
      screenshots/Screenshot_20191106-183350_Expo.jpg
  10. BIN
      screenshots/Screenshot_20191107-112642_Expo.jpg
  11. BIN
      screenshots/Screenshot_20191107-112650_MTP application.jpg
  12. BIN
      screenshots/Screenshot_20191130-144754_Expo.jpg
  13. BIN
      screenshots/Screenshot_20191130-144817_Expo.jpg
  14. BIN
      screenshots/Screenshot_20191130-144827_Expo.jpg
  15. BIN
      screenshots/Screenshot_20191130-144855_Expo.jpg
  16. BIN
      screenshots/Screenshot_20191130-144912_Expo.jpg
  17. BIN
      screenshots/Screenshot_20191130-144935_Expo.jpg
  18. BIN
      screenshots/Screenshot_20191130-144955_Expo.jpg
  19. BIN
      screenshots/Screenshot_20191130-145006_Expo.jpg
  20. BIN
      screenshots/Screenshot_20191130-145010_Expo.jpg
  21. BIN
      screenshots/Screenshot_20191130-145026_Expo.jpg
  22. BIN
      screenshots/Screenshot_20191130-145035_Expo.jpg
  23. BIN
      screenshots/Screenshot_20191130-145447_Expo.jpg
  24. BIN
      screenshots/Screenshot_20191130-145600_Expo.jpg
  25. BIN
      screenshots/Screenshot_20191130-145607_Expo.jpg
  26. BIN
      screenshots/g927-8.png
  27. BIN
      screenshots/g933-1.png
  28. BIN
      screenshots/g980-4.png
  29. BIN
      screenshots/header.png
  30. 920
      screenshots/header.svg
  31. BIN
      screenshots/ok/Screenshot_20191130-144754_Expo.jpg
  32. BIN
      screenshots/ok/Screenshot_20191130-144817_Expo.jpg
  33. BIN
      screenshots/ok/Screenshot_20191130-144827_Expo.jpg
  34. BIN
      screenshots/ok/Screenshot_20191130-144955_Expo.jpg
  35. BIN
      screenshots/ok/Screenshot_20191130-145010_Expo.jpg
  36. BIN
      screenshots/ok/Screenshot_20191130-145026_Expo.jpg
  37. BIN
      screenshots/ok/Screenshot_20191130-145600_Expo.jpg
  38. BIN
      screenshots/ok/Screenshot_20191130-145607_Expo.jpg
  39. 791
      svg/header.svg
  40. 844
      svg/results.svg
  41. BIN
      vds-app/App/assets/bg.jpg
  42. BIN
      vds-app/App/assets/header.png
  43. 53
      vds-app/App/components/Button.js
  44. 39
      vds-app/App/components/RowItem.js
  45. 47
      vds-app/App/components/TrueFalseQuestions.js
  46. 15
      vds-app/App/components/Variables.js
  47. 2
      vds-app/App/data/flightSafety.js
  48. 8
      vds-app/App/data/physiopathology.js
  49. 76
      vds-app/App/index.js
  50. 63
      vds-app/App/screens/Dictionary.js
  51. 9
      vds-app/App/screens/Exam.js
  52. 22
      vds-app/App/screens/Info.js
  53. 74
      vds-app/App/screens/Quiz.js
  54. 154
      vds-app/App/screens/QuizIndex.js
  55. 13
      vds-app/App/screens/Recap.js
  56. 193
      vds-app/App/screens/RecapTrueFalse.js
  57. 4
      vds-app/App/screens/Results.js
  58. 230
      vds-app/App/screens/ResultsTrueFalse.js
  59. 36
      vds-app/App/screens/Splash.js
  60. 260
      vds-app/App/screens/TrueFalse.js

BIN
screenshots/Screenshot_20191022-123656_VDS Quiz.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 KiB

BIN
screenshots/Screenshot_20191022-123700_VDS Quiz.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

BIN
screenshots/Screenshot_20191022-123704_VDS Quiz.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

BIN
screenshots/Screenshot_20191022-123710_VDS Quiz.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 KiB

BIN
screenshots/Screenshot_20191022-123725_VDS Quiz.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 KiB

BIN
screenshots/Screenshot_20191022-123730_VDS Quiz.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 KiB

BIN
screenshots/Screenshot_20191106-183306_Expo.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 KiB

BIN
screenshots/Screenshot_20191106-183334_Expo.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 KiB

BIN
screenshots/Screenshot_20191106-183350_Expo.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 KiB

BIN
screenshots/Screenshot_20191107-112642_Expo.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 KiB

BIN
screenshots/Screenshot_20191107-112650_MTP application.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 KiB

BIN
screenshots/Screenshot_20191130-144754_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 KiB

BIN
screenshots/Screenshot_20191130-144817_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 KiB

BIN
screenshots/Screenshot_20191130-144827_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB

BIN
screenshots/Screenshot_20191130-144855_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 KiB

BIN
screenshots/Screenshot_20191130-144912_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 KiB

BIN
screenshots/Screenshot_20191130-144935_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 KiB

BIN
screenshots/Screenshot_20191130-144955_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 KiB

BIN
screenshots/Screenshot_20191130-145006_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 694 KiB

BIN
screenshots/Screenshot_20191130-145010_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 678 KiB

BIN
screenshots/Screenshot_20191130-145026_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 KiB

BIN
screenshots/Screenshot_20191130-145035_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 KiB

BIN
screenshots/Screenshot_20191130-145447_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 KiB

BIN
screenshots/Screenshot_20191130-145600_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 KiB

BIN
screenshots/Screenshot_20191130-145607_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 KiB

BIN
screenshots/g927-8.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

BIN
screenshots/g933-1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

BIN
screenshots/g980-4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 KiB

BIN
screenshots/header.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 219 KiB

920
screenshots/header.svg

File diff suppressed because it is too large

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 18 KiB

BIN
screenshots/ok/Screenshot_20191130-144754_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 KiB

BIN
screenshots/ok/Screenshot_20191130-144817_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 KiB

BIN
screenshots/ok/Screenshot_20191130-144827_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB

BIN
screenshots/ok/Screenshot_20191130-144955_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 KiB

BIN
screenshots/ok/Screenshot_20191130-145010_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 678 KiB

BIN
screenshots/ok/Screenshot_20191130-145026_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 KiB

BIN
screenshots/ok/Screenshot_20191130-145600_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 KiB

BIN
screenshots/ok/Screenshot_20191130-145607_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 KiB

791
svg/header.svg

File diff suppressed because it is too large

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 18 KiB

844
svg/results.svg

File diff suppressed because it is too large

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 16 KiB

BIN
vds-app/App/assets/bg.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 24 KiB

BIN
vds-app/App/assets/header.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 808 KiB

53
vds-app/App/components/Button.js

@ -8,8 +8,8 @@ const styles = StyleSheet.create({
borderWidth: 4, borderWidth: 4,
borderColor: 'transparent', borderColor: 'transparent',
borderRadius: 10, borderRadius: 10,
paddingHorizontal: 10,
paddingVertical: 13,
paddingHorizontal: 20,
paddingVertical: 15,
alignItems: "center", alignItems: "center",
justifyContent: "center", justifyContent: "center",
width: "100%", width: "100%",
@ -25,6 +25,11 @@ const styles = StyleSheet.create({
fontSize: 15, fontSize: 15,
textAlign: "center" textAlign: "center"
}, },
shadow: {
textShadowColor: 'rgba(0, 0, 0, 0.45)',
textShadowOffset: {width: -1, height: 1},
textShadowRadius: 2
},
buttonContainer: { buttonContainer: {
flexDirection: "row", flexDirection: "row",
flexWrap: "wrap", flexWrap: "wrap",
@ -35,13 +40,14 @@ const styles = StyleSheet.create({
} }
}) })
export const Button = ({ text, subtitle = null, isBig = false, colorize = false, color = false, noPadding = false, noBorder = false, onPress = () => {} }) => {
export const Button = ({ text, subtitle = null, isBig = false, colorize = false, color = false, noPadding = false, noBorder = false, halfSize = false, hasShadow = false, onPress = false }) => {
const buttonBig = isBig ? {fontSize: 25} : {} const buttonBig = isBig ? {fontSize: 25} : {}
const isClicked = colorize.clicked == colorize.id const isClicked = colorize.clicked == colorize.id
let buttonColor = {backgroundColor: colors.white_alpha} let buttonColor = {backgroundColor: colors.white_alpha}
let planeButton = noPadding ? { borderRadius: 0, marginTop: 0, borderWidth: 0, borderBottomWidth: 1, borderColor: colors.white_alpha} : {} let planeButton = noPadding ? { borderRadius: 0, marginTop: 0, borderWidth: 0, borderBottomWidth: 1, borderColor: colors.white_alpha} : {}
let noBorderButton = noBorder ? { borderWidth: 0, borderBottomWidth: 0} : {} let noBorderButton = noBorder ? { borderWidth: 0, borderBottomWidth: 0} : {}
let isHalf = halfSize ? { width: "48%", marginHorizontal: "1%"} : {}
if(colorize && colorize.answered) { if(colorize && colorize.answered) {
@ -58,19 +64,36 @@ export const Button = ({ text, subtitle = null, isBig = false, colorize = false,
buttonColor = {backgroundColor: color, borderColor: 'transparent'} buttonColor = {backgroundColor: color, borderColor: 'transparent'}
} }
if(subtitle) {
return (
<TouchableOpacity onPress={onPress} style={[styles.button, buttonColor, planeButton, noBorderButton]}>
<Text style={[styles.text, buttonBig]}>{text}</Text>
<Text style={styles.subtitle}>{subtitle}</Text>
</TouchableOpacity>
)
if(onPress) {
if(subtitle) {
return (
<TouchableOpacity onPress={onPress} style={[styles.button, buttonColor, planeButton, noBorderButton, isHalf]}>
<Text style={[styles.text, buttonBig, hasShadow ? styles.shadow : '', {fontWeight: "500"}]}>{text}</Text>
<Text style={[styles.subtitle, hasShadow ? styles.shadow : '']}>{subtitle}</Text>
</TouchableOpacity>
)
} else {
return (
<TouchableOpacity onPress={onPress} style={[styles.button, buttonColor, planeButton, noBorderButton, isHalf]}>
<Text style={[styles.text, buttonBig, hasShadow ? styles.shadow : '']}>{text}</Text>
</TouchableOpacity>
)
}
} else { } else {
return (
<TouchableOpacity onPress={onPress} style={[styles.button, buttonColor, planeButton, noBorderButton]}>
<Text style={[styles.text, buttonBig]}>{text}</Text>
</TouchableOpacity>
)
if(subtitle) {
return (
<View style={[styles.button, buttonColor, planeButton, noBorderButton, isHalf]}>
<Text style={[styles.text, buttonBig, hasShadow ? styles.shadow : ''], {fontWeight: "500"}}>{text}</Text>
<Text style={[styles.subtitle, hasShadow ? styles.shadow : '']}>{subtitle}</Text>
</View>
)
} else {
return (
<View style={[styles.button, buttonColor, planeButton, noBorderButton, isHalf]}>
<Text style={[styles.text, buttonBig, hasShadow ? styles.shadow : '']}>{text}</Text>
</View>
)
}
} }
} }

39
vds-app/App/components/RowItem.js

@ -1,6 +1,6 @@
import React from "react" import React from "react"
import { View, Text, TouchableOpacity, StyleSheet } from "react-native" import { View, Text, TouchableOpacity, StyleSheet } from "react-native"
import { colors } from "../components/Variables"
import { colors, texts } from "../components/Variables"
const styles = StyleSheet.create({ const styles = StyleSheet.create({
row: { row: {
@ -9,17 +9,44 @@ const styles = StyleSheet.create({
backgroundColor: colors.blue, backgroundColor: colors.blue,
marginBottom: 1 marginBottom: 1
}, },
container: {
paddingHorizontal: 20
},
button: {
backgroundColor: colors.white_alpha,
borderWidth: 4,
borderColor: 'transparent',
borderRadius: 10,
paddingHorizontal: 10,
paddingVertical: 13,
alignItems: "center",
justifyContent: "center",
width: "100%",
marginVertical: 5
},
text: { text: {
fontSize: 18,
fontSize: 20,
color: colors.white,
fontWeight: "500",
textShadowColor: 'rgba(0, 0, 0, 0.45)',
textShadowOffset: {width: -1, height: 1},
textShadowRadius: 2
},
subtitle: {
fontSize: 14,
color: colors.white, color: colors.white,
fontWeight: "400"
fontWeight: "400",
textShadowColor: 'rgba(0, 0, 0, 0.45)',
textShadowOffset: {width: -1, height: 1},
textShadowRadius: 2
} }
}) })
export const RowItem = ({ onPress = () => {}, name, color, textColor }) => (
<TouchableOpacity onPress={onPress} activeOpacity={0.8}>
<View style={[styles.row, { backgroundColor: color }]}>
export const RowItem = ({ onPress = () => {}, name, subtitle, textColor }) => (
<TouchableOpacity style={styles.container} onPress={onPress} activeOpacity={0.8}>
<View style={styles.button}>
<Text style={[styles.text, { color: textColor }]}>{name}</Text> <Text style={[styles.text, { color: textColor }]}>{name}</Text>
<Text style={[styles.subtitle, { color: textColor }]}>({subtitle} {texts.questions})</Text>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
) )

47
vds-app/App/components/TrueFalseQuestions.js

@ -0,0 +1,47 @@
import aerodynamicsQuestions from "../data/aerodynamics"
import firstAidQuestions from "../data/firstAid"
import flightSafetyQuestions from "../data/flightSafety"
import instrumentsQuestions from "../data/instruments"
import legislationQuestions from "../data/legislation"
import materialsQuestions from "../data/materials"
import meteorologyQuestions from "../data/meteorology"
import physiopathologyQuestions from "../data/physiopathology"
import pilotingTechniquesQuestions from "../data/pilotingTechniques"
import { examScheme } from "../components/Variables"
let tmpQuestions = []
const allQuestions = {
aerodynamics: aerodynamicsQuestions,
firstAid: firstAidQuestions,
flightSafety: flightSafetyQuestions,
instruments: instrumentsQuestions,
legislation: legislationQuestions,
materials: materialsQuestions,
meteorology: meteorologyQuestions,
physiopathology: physiopathologyQuestions,
pilotingTechniques: pilotingTechniquesQuestions
}
const generateQuestions = () => {
let fullQuestions = []
examScheme.forEach( (elem) => {
let currentSection = allQuestions[elem.section]
for(let i=0; i<currentSection.length; i++) {
fullQuestions.push(currentSection[i])
}
})
for(let i=0; i<10; i++) {
const currentIndex = Math.floor(Math.random() * fullQuestions.length)
tmpQuestions.push(fullQuestions[currentIndex])
fullQuestions = fullQuestions.filter( (item, index) => index != currentIndex)
}
}
generateQuestions()
export const trueFalseQuestions = tmpQuestions

15
vds-app/App/components/Variables.js

@ -1,13 +1,13 @@
export const colors = { export const colors = {
white: "#fff", white: "#fff",
white_alpha: "rgba(255, 255, 255, 0.3)",
white_alpha: "rgba(255, 255, 255, 0.2)",
white_alpha2: "rgba(255, 255, 255, 0.5)", white_alpha2: "rgba(255, 255, 255, 0.5)",
black: "#000", black: "#000",
black_alpha: "rgba(0, 0, 0, 0.1)", black_alpha: "rgba(0, 0, 0, 0.1)",
purple: "#8c0072", purple: "#8c0072",
purple_light: "#a30085", purple_light: "#a30085",
blue: "#1385d0",
dark_blue: "#1279be",
blue: "#0080d0",
dark_blue: "#0072be",
red: "#af321e", red: "#af321e",
red_alpha: "rgba(175, 50, 30, 0.9)", red_alpha: "rgba(175, 50, 30, 0.9)",
red_light: "#af5d44", red_light: "#af5d44",
@ -23,6 +23,7 @@ export const colors = {
export const texts = { export const texts = {
quizzes: "Seleziona un argomento", quizzes: "Seleziona un argomento",
section_quizzes: "Quiz per argomento", section_quizzes: "Quiz per argomento",
section_quizzes_subtitle: "Esercitati su argomenti specifici",
exam: "Simulazione esame", exam: "Simulazione esame",
exam_simulation: "30 domande in 30min", exam_simulation: "30 domande in 30min",
exam_passed: "Esame superato!", exam_passed: "Esame superato!",
@ -44,7 +45,7 @@ export const texts = {
piloting_techniques: "Tecniche di pilotaggio", piloting_techniques: "Tecniche di pilotaggio",
restart: "Ricomincia!", restart: "Ricomincia!",
recap: "Visualizza errori", recap: "Visualizza errori",
recapTitle: "Riepilogo domande sbagliate",
recapTitle: "Riepilogo risposte sbagliate",
infoTitle: "Informazioni App", infoTitle: "Informazioni App",
dictionaryTitle: "Terminologia", dictionaryTitle: "Terminologia",
dictionarySubtitle: "Dizionario ICAO e abbreviazioni", dictionarySubtitle: "Dizionario ICAO e abbreviazioni",
@ -69,7 +70,11 @@ export const texts = {
materials: "Materiali", materials: "Materiali",
flightSafety: "Sicurezza del volo", flightSafety: "Sicurezza del volo",
examScheme: "Schema domande d'esame", examScheme: "Schema domande d'esame",
resultsScheme: "Calcolo risultati"
resultsScheme: "Calcolo risultati",
true: "Vero",
false: "Falso",
trueFalse: "Test Vero/Falso",
trueFalseSubtitle: "10 domande casuali con risposte Vero/Falso"
} }
export const examScheme = [ export const examScheme = [

2
vds-app/App/data/flightSafety.js

@ -95,7 +95,7 @@ const questions = [
}, },
{ {
"id": "3", "id": "3",
"text": "può non essere pericoloso se l’esperienza è molta. DEL VOLO"
"text": "può non essere pericoloso se l’esperienza è molta."
} }
] ]
}, },

8
vds-app/App/data/physiopathology.js

@ -95,7 +95,7 @@ const questions = [
}, },
{ {
"id": "3", "id": "3",
"text": "permanenza ad alta quota dopo lungo periodo di ambientamento. DEL VOLO"
"text": "permanenza ad alta quota dopo lungo periodo di ambientamento."
} }
] ]
}, },
@ -186,16 +186,16 @@ const questions = [
"answers": [ "answers": [
{ {
"id": "1", "id": "1",
"text": "1 no.",
"text": "no.",
"correct": true "correct": true
}, },
{ {
"id": "2", "id": "2",
"text": "2 – si."
"text": "si."
}, },
{ {
"id": "3", "id": "3",
"text": "3 sì, se l’equilibrio è affinato da adeguato addestramento."
"text": "sì, se l’equilibrio è affinato da adeguato addestramento."
} }
] ]
} }

76
vds-app/App/index.js

@ -4,9 +4,12 @@ import Splash from "./screens/Splash"
import Banner from "./screens/Banner" import Banner from "./screens/Banner"
import QuizIndex from "./screens/QuizIndex" import QuizIndex from "./screens/QuizIndex"
import Quiz from "./screens/Quiz" import Quiz from "./screens/Quiz"
import TrueFalse from "./screens/TrueFalse"
import Exam from "./screens/Exam" import Exam from "./screens/Exam"
import Results from "./screens/Results" import Results from "./screens/Results"
import ResultsTrueFalse from "./screens/ResultsTrueFalse"
import Recap from "./screens/Recap" import Recap from "./screens/Recap"
import RecapTrueFalse from "./screens/RecapTrueFalse"
import Info from "./screens/Info" import Info from "./screens/Info"
import Dictionary from "./screens/Dictionary" import Dictionary from "./screens/Dictionary"
import { colors, texts} from "./components/Variables" import { colors, texts} from "./components/Variables"
@ -15,86 +18,79 @@ const MainStack = createStackNavigator({
Splash: { Splash: {
screen: Splash, screen: Splash,
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
header: null,
backgroundColor: colors.yellow,
headerStyle: {
backgroundColor: colors.yellow
}
header: null
})
},
RecapTrueFalse: {
screen: RecapTrueFalse,
navigationOptions: ({ navigation }) => ({
header: null
}) })
}, },
Recap: { Recap: {
screen: Recap, screen: Recap,
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
header: null,
backgroundColor: colors.yellow,
headerStyle: {
backgroundColor: colors.yellow
}
header: null
}) })
}, },
Results: { Results: {
screen: Results, screen: Results,
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
header: null,
backgroundColor: colors.yellow,
headerStyle: {
backgroundColor: colors.yellow
}
header: null
})
},
ResultsTrueFalse: {
screen: ResultsTrueFalse,
navigationOptions: ({ navigation }) => ({
header: null
}) })
}, },
Info: { Info: {
screen: Info, screen: Info,
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
header: null,
header: null
}) })
}, },
Dictionary: { Dictionary: {
screen: Dictionary, screen: Dictionary,
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
header: null,
header: null
}) })
}, },
Banner: { Banner: {
screen: Banner, screen: Banner,
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
header: null,
backgroundColor: colors.yellow,
headerStyle: {
backgroundColor: colors.yellow
}
header: null
}) })
}, },
QuizIndex: { QuizIndex: {
screen: QuizIndex, screen: QuizIndex,
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
headerTitle: texts.quizzes,
headerTintColor: colors.white,
backgroundColor: colors.dark_blue,
headerStyle: {
backgroundColor: colors.dark_blue
}
header: null
}) })
}, },
Quiz: { Quiz: {
screen: Quiz, screen: Quiz,
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
headerTitle: navigation.getParam("title"),
headerTintColor: colors.white,
headerStyle: {
backgroundColor: navigation.getParam("color"),
borderBottomColor: navigation.getParam("color")
}
header: null
})
},
TrueFalse: {
screen: TrueFalse,
navigationOptions: ({ navigation }) => ({
header: null
// headerTitle: navigation.getParam("title"),
// headerTintColor: colors.white,
// headerStyle: {
// backgroundColor: navigation.getParam("color"),
// borderBottomColor: navigation.getParam("color")
// }
}) })
}, },
Exam: { Exam: {
screen: Exam, screen: Exam,
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
headerTitle: navigation.getParam("title"),
headerTintColor: colors.white,
headerStyle: {
backgroundColor: navigation.getParam("color"),
borderBottomColor: navigation.getParam("color")
}
header: null
}) })
} }
}) })

63
vds-app/App/screens/Dictionary.js

@ -1,47 +1,24 @@
import React from "react" import React from "react"
import { View, ScrollView, StyleSheet, StatusBar, Text, SafeAreaView, Dimensions, Image, BackHandler, Linking} from "react-native"
import { View, ScrollView, StyleSheet, StatusBar, Text, SafeAreaView, Dimensions, ImageBackground, BackHandler, Linking} from "react-native"
import { AdMobBanner } from "expo-ads-admob" import { AdMobBanner } from "expo-ads-admob"
import { Button, ButtonContainer } from "../components/Button" import { Button, ButtonContainer } from "../components/Button"
import { colors, texts, credentials} from "../components/Variables" import { colors, texts, credentials} from "../components/Variables"
import { abbreviations, alphabeth, numbers} from "../data/dictionary" import { abbreviations, alphabeth, numbers} from "../data/dictionary"
const bgImage = require("../assets/bg.jpg")
const screen = Dimensions.get("window") const screen = Dimensions.get("window")
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
backgroundColor: colors.dark_blue,
flex: 1 flex: 1
}, },
safearea: { safearea: {
flex: 1, flex: 1,
marginTop: 30, marginTop: 30,
marginBottom: 30,
justifyContent: "space-between", justifyContent: "space-between",
paddingHorizontal: 20 paddingHorizontal: 20
}, },
bannerContainer: {
flex: 1,
alignItems: "center",
justifyContent: "center"
},
banner: {
width: 320,
height: 60,
marginVertical: 10
},
box: {
width: screen.width-40,
paddingHorizontal: 20,
backgroundColor: colors.white,
borderRadius: 10,
overflow: "hidden"
},
scrollView: {
margin: 0,
height: screen.height-350
},
buttonContainer: { buttonContainer: {
marginHorizontal: 0, marginHorizontal: 0,
@ -120,6 +97,39 @@ const styles = StyleSheet.create({
lineHeight: 30, lineHeight: 30,
fontSize: 26, fontSize: 26,
fontWeight: "600" fontWeight: "600"
},
box: {
width: screen.width-40,
paddingHorizontal: 20,
paddingVertical: 10,
backgroundColor: colors.white,
borderRadius: 10,
overflow: "hidden"
},
scrollView: {
margin: 10,
height: screen.height-400
},
bg: {
width: "100%",
height: "100%"
},
bannerContainer: {
flex: 1,
alignItems: "center",
justifyContent: "center",
height: 60
},
banner: {
flex: 1,
alignItems: "center",
justifyContent: "center",
width: 320,
height: 60
} }
}) })
@ -178,8 +188,8 @@ class Dictionary extends React.Component {
render() { render() {
return ( return (
<ImageBackground source={bgImage} style={styles.bg} resizeMode="cover">
<View style={styles.container} > <View style={styles.container} >
<SafeAreaView style={styles.safearea}> <SafeAreaView style={styles.safearea}>
<View style={styles.buttonContainer}> <View style={styles.buttonContainer}>
<ButtonContainer isBoxed={true}> <ButtonContainer isBoxed={true}>
@ -231,6 +241,7 @@ class Dictionary extends React.Component {
</View> </View>
</SafeAreaView> </SafeAreaView>
</View> </View>
</ImageBackground>
) )
} }
} }

9
vds-app/App/screens/Exam.js

@ -45,7 +45,12 @@ const styles = StyleSheet.create({
textAlign: "center", textAlign: "center",
fontWeight: "600", fontWeight: "600",
paddingVertical: 10, paddingVertical: 10,
marginTop: 10,
marginTop: 30,
backgroundColor: colors.white_alpha,
borderRadius: 25,
textShadowColor: 'rgba(0, 0, 0, 0.45)',
textShadowOffset: {width: -1, height: 1},
textShadowRadius: 2
}, },
safearea: { safearea: {
flex: 1, flex: 1,
@ -91,7 +96,7 @@ class Exam extends React.Component {
handleBackButton = () => { handleBackButton = () => {
const tmpQuestions = []
let tmpQuestions = []
examScheme.forEach( (elem) => { examScheme.forEach( (elem) => {
let currentSection = allQuestions[elem.section] let currentSection = allQuestions[elem.section]
for(let i=0; i<elem.questions; i++) { for(let i=0; i<elem.questions; i++) {

22
vds-app/App/screens/Info.js

@ -48,7 +48,7 @@ const styles = StyleSheet.create({
lineHeight: 20, lineHeight: 20,
textShadowColor: 'rgba(0, 0, 0, 0.75)', textShadowColor: 'rgba(0, 0, 0, 0.75)',
textShadowOffset: {width: -1, height: 1}, textShadowOffset: {width: -1, height: 1},
textShadowRadius: 10
textShadowRadius: 5
}, },
title: { title: {
paddingTop: 30, paddingTop: 30,
@ -60,32 +60,38 @@ const styles = StyleSheet.create({
lineHeight: 20, lineHeight: 20,
textShadowColor: 'rgba(0, 0, 0, 0.75)', textShadowColor: 'rgba(0, 0, 0, 0.75)',
textShadowOffset: {width: -1, height: 1}, textShadowOffset: {width: -1, height: 1},
textShadowRadius: 10
textShadowRadius: 5
}, },
textSmall: { textSmall: {
lineHeight: 23, lineHeight: 23,
marginTop: 15, marginTop: 15,
borderRadius: 10, borderRadius: 10,
backgroundColor: colors.white,
backgroundColor: colors.white_alpha,
borderWidth: 0, borderWidth: 0,
borderColor: colors.white_alpha, borderColor: colors.white_alpha,
fontSize: 16, fontSize: 16,
color: colors.black,
color: colors.white,
fontWeight: "400", fontWeight: "400",
textAlign: "center", textAlign: "center",
paddingHorizontal: 20, paddingHorizontal: 20,
paddingVertical: 20
paddingVertical: 20,
textShadowColor: 'rgba(0, 0, 0, 0.75)',
textShadowOffset: {width: -1, height: 1},
textShadowRadius: 5
}, },
textItems: { textItems: {
fontSize: 16, fontSize: 16,
fontWeight: "400", fontWeight: "400",
lineHeight: 23, lineHeight: 23,
color: colors.black,
color: colors.white,
textAlign: "center", textAlign: "center",
paddingBottom: 10, paddingBottom: 10,
marginBottom: 10, marginBottom: 10,
borderBottomColor: colors.black_alpha,
borderBottomWidth: 1
borderBottomColor: colors.white_alpha,
borderBottomWidth: 1,
textShadowColor: 'rgba(0, 0, 0, 0.55)',
textShadowOffset: {width: -1, height: 1},
textShadowRadius: 2
}, },
noBorder: { noBorder: {
borderBottomWidth: 0 borderBottomWidth: 0

74
vds-app/App/screens/Quiz.js

@ -1,11 +1,12 @@
import React from "react" import React from "react"
import { View, ScrollView, StyleSheet, StatusBar, Text, SafeAreaView, ImageBackground, BackHandler } from "react-native"
import { View, ScrollView, StyleSheet, StatusBar, Text, SafeAreaView, Dimensions, ImageBackground, BackHandler } from "react-native"
import { AdMobBanner } from "expo-ads-admob" import { AdMobBanner } from "expo-ads-admob"
import { Button, ButtonContainer } from "../components/Button" import { Button, ButtonContainer } from "../components/Button"
import { colors, credentials } from "../components/Variables" import { colors, credentials } from "../components/Variables"
const bgImage = require("../assets/bg.jpg") const bgImage = require("../assets/bg.jpg")
const screen = Dimensions.get("window")
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
@ -20,10 +21,19 @@ const styles = StyleSheet.create({
}, },
safearea: { safearea: {
flex: 1, flex: 1,
marginTop: 20,
paddingHorizontal: 20, paddingHorizontal: 20,
paddingTop: 20,
justifyContent: "space-between" justifyContent: "space-between"
}, },
box: {
width: screen.width,
paddingVertical: 10,
overflow: "hidden"
},
scrollView: {
//margin: 10,
height: screen.height-150
},
bg: { bg: {
width: "100%", width: "100%",
height: "100%" height: "100%"
@ -34,9 +44,10 @@ const styles = StyleSheet.create({
justifyContent: "center" justifyContent: "center"
}, },
banner: { banner: {
width: 320,
height: 100,
marginVertical: 20
flex: 1,
alignItems: "center",
justifyContent: "center",
width: 320
} }
}) })
@ -142,32 +153,34 @@ class Quiz extends React.Component {
return ( return (
<ImageBackground source={bgImage} style={styles.bg} resizeMode="cover"> <ImageBackground source={bgImage} style={styles.bg} resizeMode="cover">
<ScrollView style={ styles.container } >
<StatusBar barStyle="light-content" />
{!this.state.results ?
<SafeAreaView style={styles.safearea}>
<View>
<Text style={styles.text}>{question.question}</Text>
<ButtonContainer>
{question.answers.map( (answer, index) => (
<Button
key={answer.id}
text={answer.text}
colorize={{id: answer.id, clicked: this.state.clickedId, answered: this.state.answered, isCorrect: answer.correct}}
onPress={() => this.answer(answer.correct, answer.id, question)}
/>
))}
</ButtonContainer>
<View style={styles.box}>
<View style={styles.scrollView}>
<ScrollView style={ styles.container } >
{!this.state.results ?
<SafeAreaView style={styles.safearea}>
<View>
<Text style={styles.text}>{question.question}</Text>
<ButtonContainer>
{question.answers.map( (answer, index) => (
<Button
key={answer.id}
text={answer.text}
colorize={{id: answer.id, clicked: this.state.clickedId, answered: this.state.answered, isCorrect: answer.correct}}
onPress={() => this.answer(answer.correct, answer.id, question)}
/>
))}
</ButtonContainer>
</View>
<Text style={styles.text}>
{`${this.state.correctCount+this.state.wrongCount}/${this.state.totalCount}`}
</Text>
</SafeAreaView>
: <SafeAreaView></SafeAreaView>}
</ScrollView>
</View> </View>
<Text style={styles.text}>
{`${this.state.correctCount+this.state.wrongCount}/${this.state.totalCount}`}
</Text>
</SafeAreaView>
: <SafeAreaView></SafeAreaView>}
</View>
<View style={styles.bannerContainer}> <View style={styles.bannerContainer}>
<AdMobBanner <AdMobBanner
style={styles.banner} style={styles.banner}
@ -175,7 +188,6 @@ class Quiz extends React.Component {
adUnitID={credentials.adMobUnitIDFooter} adUnitID={credentials.adMobUnitIDFooter}
onDidFailToReceiveAdWithError={this.bannerError} /> onDidFailToReceiveAdWithError={this.bannerError} />
</View> </View>
</ScrollView>
</ImageBackground> </ImageBackground>
) )
} }

154
vds-app/App/screens/QuizIndex.js

@ -1,5 +1,5 @@
import React from "react" import React from "react"
import { ScrollView, StatusBar, BackHandler } from "react-native"
import { View, ScrollView, StatusBar, BackHandler, StyleSheet, Dimensions, ImageBackground } from "react-native"
import aerodynamicsQuestions from "../data/aerodynamics" import aerodynamicsQuestions from "../data/aerodynamics"
import firstAidQuestions from "../data/firstAid" import firstAidQuestions from "../data/firstAid"
@ -16,9 +16,20 @@ import { Button, ButtonContainer } from "../components/Button"
import { RowItem } from "../components/RowItem" import { RowItem } from "../components/RowItem"
import { colors, texts} from "../components/Variables" import { colors, texts} from "../components/Variables"
const bgImage = require("../assets/bg.jpg")
const screen = Dimensions.get("window")
const styles = StyleSheet.create({
bg: {
flex: 1,
width: "100%",
height: "100%"
},
})
/* /*
<RowItem name="TEST" color={colors.blue} textColor={colors.white} onPress={()=>
<RowItem name="TEST" textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", { this.props.navigation.navigate("Quiz", {
title: "TEST", title: "TEST",
questions: testQuestions, questions: testQuestions,
@ -43,75 +54,76 @@ class QuizIndex extends React.Component {
render() { render() {
return ( return (
<ScrollView style={[{ backgroundColor: colors.dark_blue }]}>
<StatusBar barStyle="dark-content" />
<RowItem name={texts.aerodynamics} color={colors.blue} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.aerodynamics,
questions: aerodynamicsQuestions,
color: colors.blue
})}/>
<RowItem name={texts.first_aid} color={colors.blue} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.first_aid,
questions: firstAidQuestions,
color: colors.blue
})}/>
<RowItem name={texts.flight_safety} color={colors.blue} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.flight_safety,
questions: flightSafetyQuestions,
color: colors.blue
})}/>
<RowItem name={texts.instruments} color={colors.blue} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.instruments,
questions: instrumentsQuestions,
color: colors.blue
})}/>
<RowItem name={texts.legislation} color={colors.blue} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.legislation,
questions: legislationQuestions,
color: colors.blue
})}/>
<RowItem name={texts.materials} color={colors.blue} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.materials,
questions: materialsQuestions,
color: colors.blue
})}/>
<RowItem name={texts.meteorology} color={colors.blue} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.meteorology,
questions: meteorologyQuestions,
color: colors.blue
})}/>
<RowItem name={texts.physiopathology} color={colors.blue} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.physiopathology,
questions: physiopathologyQuestions,
color: colors.blue
})}/>
<RowItem name={texts.piloting_techniques} color={colors.blue} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.piloting_techniques,
questions: pilotingTechniquesQuestions,
color: colors.blue
})}/>
</ScrollView>
<ImageBackground source={bgImage} style={styles.bg} resizeMode="cover">
<ScrollView >
<View style={{marginVertical: 60}}>
<RowItem name={texts.aerodynamics} subtitle={aerodynamicsQuestions.length} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.aerodynamics,
questions: aerodynamicsQuestions,
color: colors.blue
})}/>
<RowItem name={texts.first_aid} subtitle={firstAidQuestions.length} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.first_aid,
questions: firstAidQuestions,
color: colors.blue
})}/>
<RowItem name={texts.flight_safety} subtitle={flightSafetyQuestions.length} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.flight_safety,
questions: flightSafetyQuestions,
color: colors.blue
})}/>
<RowItem name={texts.instruments} subtitle={instrumentsQuestions.length} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.instruments,
questions: instrumentsQuestions,
color: colors.blue
})}/>
<RowItem name={texts.legislation} subtitle={legislationQuestions.length} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.legislation,
questions: legislationQuestions,
color: colors.blue
})}/>
<RowItem name={texts.materials} subtitle={materialsQuestions.length} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.materials,
questions: materialsQuestions,
color: colors.blue
})}/>
<RowItem name={texts.meteorology} subtitle={meteorologyQuestions.length} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.meteorology,
questions: meteorologyQuestions,
color: colors.blue
})}/>
<RowItem name={texts.physiopathology} subtitle={physiopathologyQuestions.length} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.physiopathology,
questions: physiopathologyQuestions,
color: colors.blue
})}/>
<RowItem name={texts.piloting_techniques} subtitle={pilotingTechniquesQuestions.length} textColor={colors.white} onPress={()=>
this.props.navigation.navigate("Quiz", {
title: texts.piloting_techniques,
questions: pilotingTechniquesQuestions,
color: colors.blue
})}/>
</View>
</ScrollView>
</ImageBackground>
) )
} }
} }

13
vds-app/App/screens/Recap.js

@ -59,21 +59,22 @@ const styles = StyleSheet.create({
borderWidth: 1, borderWidth: 1,
padding: 15, padding: 15,
borderRadius: 5, borderRadius: 5,
backgroundColor: colors.black_alpha
backgroundColor: colors.white_alpha
}, },
text: { text: {
color: colors.white, color: colors.white,
fontSize: 20, fontSize: 20,
textAlign: "center", textAlign: "center",
fontWeight: "600", fontWeight: "600",
paddingVertical: 10
paddingTop: 10
}, },
textBig: { textBig: {
color: colors.white, color: colors.white,
fontSize: 24,
fontSize: 22,
textAlign: "center", textAlign: "center",
fontWeight: "500",
paddingBottom: 10,
fontWeight: "400",
paddingBottom: 15,
textTransform: "uppercase",
textShadowColor: 'rgba(0, 0, 0, 0.75)', textShadowColor: 'rgba(0, 0, 0, 0.75)',
textShadowOffset: {width: -1, height: 1}, textShadowOffset: {width: -1, height: 1},
textShadowRadius: 10 textShadowRadius: 10
@ -156,6 +157,8 @@ class Recap extends React.Component {
<View style={styles.button}> <View style={styles.button}>
<Button <Button
color={colors.white_alpha2}
hasShadow={true}
text={texts.restart} text={texts.restart}
onPress={() => {this.handleBackButton()} onPress={() => {this.handleBackButton()}
} }

193
vds-app/App/screens/RecapTrueFalse.js

@ -0,0 +1,193 @@
import React from "react"
import { View, ScrollView, StyleSheet, StatusBar, Text, SafeAreaView, Dimensions, Image, ImageBackground, BackHandler} from "react-native"
import { AdMobBanner } from "expo-ads-admob"
import { Button, ButtonContainer } from "../components/Button"
import { colors, texts, examScheme, credentials } from "../components/Variables"
import aerodynamicsQuestions from "../data/aerodynamics"
import firstAidQuestions from "../data/firstAid"
import flightSafetyQuestions from "../data/flightSafety"
import instrumentsQuestions from "../data/instruments"
import legislationQuestions from "../data/legislation"
import materialsQuestions from "../data/materials"
import meteorologyQuestions from "../data/meteorology"
import physiopathologyQuestions from "../data/physiopathology"
import pilotingTechniquesQuestions from "../data/pilotingTechniques"
const screen = Dimensions.get("window")
const header = require("../assets/header.png")
const bgImage = require("../assets/bg.jpg")
const allQuestions = {
aerodynamics: aerodynamicsQuestions,
firstAid: firstAidQuestions,
flightSafety: flightSafetyQuestions,
instruments: instrumentsQuestions,
legislation: legislationQuestions,
materials: materialsQuestions,
meteorology: meteorologyQuestions,
physiopathology: physiopathologyQuestions,
pilotingTechniques: pilotingTechniquesQuestions
}
const styles = StyleSheet.create({
container: {
backgroundColor: colors.blue,
flex: 1
},
safearea: {
flex: 1,
marginTop: 0,
justifyContent: "space-between",
paddingHorizontal: 20,
paddingBottom: 40
},
headerContainer: {
marginTop: -40,
alignItems: "center",
justifyContent: "center",
width: "100%",
height: screen.width/1.5
},
header: {
width: "100%"
},
box: {
marginTop: 30,
borderColor: colors.black_alpha,
borderWidth: 1,
padding: 15,
borderRadius: 5,
backgroundColor: colors.white_alpha
},
text: {
color: colors.white,
fontSize: 20,
textAlign: "center",
fontWeight: "600",
paddingTop: 10
},
textBig: {
color: colors.white,
fontSize: 22,
textAlign: "center",
fontWeight: "400",
paddingBottom: 15,
textTransform: "uppercase",
textShadowColor: 'rgba(0, 0, 0, 0.75)',
textShadowOffset: {width: -1, height: 1},
textShadowRadius: 10
},
bg: {
width: "100%",
height: "100%"
},
bannerContainer: {
flex: 1,
alignItems: "center",
justifyContent: "center"
},
banner: {
width: 320,
height: 100,
marginVertical: 20
}
})
class RecapTrueFalse extends React.Component {
componentDidMount() {
BackHandler.addEventListener('hardwareBackPress', this.handleBackButton)
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton)
}
handleBackButton = () => {
let tmpQuestions = []
let fullQuestions = []
examScheme.forEach( (elem) => {
let currentSection = allQuestions[elem.section]
for(let i=0; i<currentSection.length; i++) {
fullQuestions.push(currentSection[i])
}
})
for(let i=0; i<10; i++) {
const currentIndex = Math.floor(Math.random() * fullQuestions.length)
tmpQuestions.push(fullQuestions[currentIndex])
fullQuestions = fullQuestions.filter( (item, index) => index != currentIndex)
}
this.props.navigation.navigate("Splash", {
trueFalseQuestions: tmpQuestions
})
return true
}
render() {
const questions = this.props.navigation.getParam("wrongAnswers", [])
return (
<View style={styles.container} >
<View style={styles.headerContainer} >
<Image source={header} style={styles.header} resizeMode="contain" />
</View>
<Text style={styles.textBig}>{texts.recapTitle}</Text>
<ScrollView>
<SafeAreaView style={styles.safearea}>
{questions.map( (question, index) => (
<View style={styles.box} key={question.id}>
<Text style={styles.text}>{question.text}</Text>
<ButtonContainer>
{question.answers.map( (answer, index) => {
if(question.clicked == answer.id) {
return (
<Button
noBorder={true}
key={answer.id}
text={answer.text}
colorize={{id: answer.id, clicked: question.clicked, answered: true, isCorrect: answer.correct}}
/>
)}
}
)}
</ButtonContainer>
</View>
))}
<View style={styles.button}>
<Button
color={colors.white_alpha2}
hasShadow={true}
text={texts.restart}
onPress={() => {this.handleBackButton()}
}
/>
</View>
</SafeAreaView>
<View style={styles.bannerContainer}>
<AdMobBanner
style={styles.banner}
bannerSize="largeBanner"
adUnitID={credentials.adMobUnitIDFooter}
onDidFailToReceiveAdWithError={this.bannerError} />
</View>
</ScrollView>
</View>
)
}
}
export default RecapTrueFalse

4
vds-app/App/screens/Results.js

@ -204,7 +204,7 @@ class Results extends React.Component {
}) })
}}/> }}/>
<Button <Button
isBig={true}
isBig={false}
color={colors.white_alpha} color={colors.white_alpha}
text={texts.restart} text={texts.restart}
onPress={() => {this.handleBackButton()} onPress={() => {this.handleBackButton()}
@ -214,7 +214,7 @@ class Results extends React.Component {
</View> : </View> :
<View style={styles.button}> <View style={styles.button}>
<Button <Button
isBig={true}
isBig={false}
color={colors.white_alpha} color={colors.white_alpha}
text={texts.restart} text={texts.restart}
onPress={() => {this.handleBackButton()} onPress={() => {this.handleBackButton()}

230
vds-app/App/screens/ResultsTrueFalse.js

@ -0,0 +1,230 @@
import React from "react"
import { View, ScrollView, StyleSheet, StatusBar, Text, SafeAreaView, Dimensions, Image, BackHandler} from "react-native"
import { Button, ButtonContainer } from "../components/Button"
import { colors, texts, examScheme } from "../components/Variables"
import aerodynamicsQuestions from "../data/aerodynamics"
import firstAidQuestions from "../data/firstAid"
import flightSafetyQuestions from "../data/flightSafety"
import instrumentsQuestions from "../data/instruments"
import legislationQuestions from "../data/legislation"
import materialsQuestions from "../data/materials"
import meteorologyQuestions from "../data/meteorology"
import physiopathologyQuestions from "../data/physiopathology"
import pilotingTechniquesQuestions from "../data/pilotingTechniques"
const screen = Dimensions.get("window")
const header = require("../assets/header.png")
const maxTime = 0 // 10
let interval = null
const allQuestions = {
aerodynamics: aerodynamicsQuestions,
firstAid: firstAidQuestions,
flightSafety: flightSafetyQuestions,
instruments: instrumentsQuestions,
legislation: legislationQuestions,
materials: materialsQuestions,
meteorology: meteorologyQuestions,
physiopathology: physiopathologyQuestions,
pilotingTechniques: pilotingTechniquesQuestions
}
const styles = StyleSheet.create({
container: {
backgroundColor: colors.dark_blue,
flex: 1
},
safearea: {
flex: 1,
marginTop: 0,
justifyContent: "space-between",
paddingHorizontal: 20,
paddingBottom: 40
},
headerContainer: {
marginTop: -40,
alignItems: "center",
justifyContent: "center",
width: "100%",
height: screen.width/1.5
},
header: {
width: "100%"
},
box: {
marginTop: 20,
marginBottom: 20,
marginHorizontal: 20,
width: screen.width-80,
borderRadius: 20,
borderBottomEndRadius: 80,
borderTopStartRadius: 100,
backgroundColor: colors.white_alpha,
borderColor: colors.white,
borderWidth: 2,
paddingVertical: 30
},
boxCorrect: {
backgroundColor: colors.green_light,
},
boxWrong: {
backgroundColor: colors.red,
},
boxUnsafe: {
backgroundColor: colors.orange,
},
button: {
width: screen.width-80,
marginHorizontal: 20
},
text: {
color: colors.white,
fontSize: 22,
textAlign: "center",
fontWeight: "400",
lineHeight: 40,
textShadowColor: 'rgba(0, 0, 0, 0.75)',
textShadowOffset: {width: -1, height: 1},
textShadowRadius: 10
},
textSmall: {
color: colors.white,
marginTop: 20,
fontSize: 26,
textAlign: "center",
fontWeight: "500",
lineHeight: 30,
textShadowColor: 'rgba(0, 0, 0, 0.75)',
textShadowOffset: {width: -1, height: 1},
textShadowRadius: 10
},
textLabel: {
paddingHorizontal: 20,
paddingVertical: 20
},
correct: {
color: colors.green
},
wrong: {
color: colors.red
},
unsafe: {
color: colors.yellow
}
})
class Results extends React.Component {
state = {
bannerExpanded: true,
timer: maxTime
}
componentDidMount() {
BackHandler.addEventListener('hardwareBackPress', this.handleBackButton)
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton)
}
handleBackButton = () => {
let tmpQuestions = []
let fullQuestions = []
examScheme.forEach( (elem) => {
let currentSection = allQuestions[elem.section]
for(let i=0; i<currentSection.length; i++) {
fullQuestions.push(currentSection[i])
}
})
for(let i=0; i<10; i++) {
const currentIndex = Math.floor(Math.random() * fullQuestions.length)
tmpQuestions.push(fullQuestions[currentIndex])
fullQuestions = fullQuestions.filter( (item, index) => index != currentIndex)
}
this.props.navigation.navigate("Splash", {
trueFalseQuestions: tmpQuestions
})
return true
}
render() {
const currentResults = this.props.navigation.getParam("results")
const wrongAnswers = currentResults.wrongAnswers || null
const percentage = currentResults.total ? (100/currentResults.total) * currentResults.correct : 0
let resultStyle = ''
let boxStyle = currentResults.points >= 80 ? currentResults.points >= 85 ? styles.boxCorrect : styles.boxUnsafe : styles.boxWrong
if(!currentResults.isExam) {
resultStyle = ''
boxStyle = percentage >= 80 ? percentage >= 85 ? styles.boxCorrect : styles.boxUnsafe : styles.boxWrong
}
//console.log(currentResults)
return (
<View style={styles.container} >
<View style={styles.headerContainer} >
<Image source={header} style={styles.header} resizeMode="contain" />
</View>
<ScrollView>
<SafeAreaView style={styles.safearea}>
<View style={[styles.box, boxStyle]}>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.corrects}: ${currentResults.correct}`}</Text>
</Text>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.wrongs}: ${currentResults.wrong}`}</Text>
</Text>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.percentage}: ${Math.round(percentage)}%`}</Text>
</Text>
</View>
{wrongAnswers.length ?
<View style={styles.button}>
<Button
color={colors.red_light}
text={texts.recap}
onPress={ ()=> {
this.props.navigation.navigate("RecapTrueFalse", {
wrongAnswers: wrongAnswers
})
}}/>
<Button
isBig={false}
color={colors.white_alpha}
text={texts.restart}
onPress={() => {this.handleBackButton()}
}
/>
</View> :
<View style={styles.button}>
<Button
isBig={false}
color={colors.white_alpha}
text={texts.restart}
onPress={() => {this.handleBackButton()}
}
/>
</View>
}
</SafeAreaView>
</ScrollView>
</View>
)
}
}
export default Results

36
vds-app/App/screens/Splash.js

@ -5,6 +5,7 @@ import { AdMobBanner } from "expo-ads-admob"
import { Button, ButtonContainer } from "../components/Button" import { Button, ButtonContainer } from "../components/Button"
import { colors, texts, credentials } from "../components/Variables" import { colors, texts, credentials } from "../components/Variables"
import { examQuestions } from "../components/ExamQuestions" import { examQuestions } from "../components/ExamQuestions"
import { trueFalseQuestions } from "../components/TrueFalseQuestions"
const screen = Dimensions.get("window") const screen = Dimensions.get("window")
const header = require("../assets/header.png") const header = require("../assets/header.png")
@ -69,7 +70,7 @@ const styles = StyleSheet.create({
alignItems: "center", alignItems: "center",
justifyContent: "center", justifyContent: "center",
width: "100%", width: "100%",
height: 220
height: 200
}, },
header: { header: {
width: "100%" width: "100%"
@ -142,13 +143,15 @@ class Splash extends React.Component {
<ButtonContainer isBoxed={true}> <ButtonContainer isBoxed={true}>
<Button <Button
text={texts.section_quizzes} text={texts.section_quizzes}
subtitle={`(${texts.section_quizzes_subtitle})`}
isBig={false} isBig={false}
noPadding={true} noPadding={true}
color={colors.green_light}
hasShadow={true}
color={colors.white_alpha}
onPress={() => onPress={() =>
this.props.navigation.navigate("QuizIndex", { this.props.navigation.navigate("QuizIndex", {
title: texts.section_quizzes, title: texts.section_quizzes,
color: colors.blue
color: colors.white_alpha
})} })}
/> />
<Button <Button
@ -156,12 +159,28 @@ class Splash extends React.Component {
subtitle={`(${texts.exam_simulation})`} subtitle={`(${texts.exam_simulation})`}
isBig={false} isBig={false}
noPadding={true} noPadding={true}
color={colors.purple_light}
hasShadow={true}
color={colors.white_alpha}
onPress={() => onPress={() =>
this.props.navigation.navigate("Exam", { this.props.navigation.navigate("Exam", {
title: texts.exam, title: texts.exam,
questions: this.props.navigation.getParam("examQuestions") || examQuestions, questions: this.props.navigation.getParam("examQuestions") || examQuestions,
color: colors.blue
color: colors.white_alpha
})}
/>
<Button
text={texts.trueFalse}
subtitle={`(${texts.trueFalseSubtitle})`}
isBig={false}
noPadding={true}
hasShadow={true}
color={colors.white_alpha}
onPress={() =>
this.props.navigation.navigate("TrueFalse", {
title: texts.trueFalse,
questions: this.props.navigation.getParam("trueFalseQuestions") || trueFalseQuestions,
color: colors.white_alpha
})} })}
/> />
<Button <Button
@ -169,13 +188,15 @@ class Splash extends React.Component {
subtitle={`(${texts.dictionarySubtitle})`} subtitle={`(${texts.dictionarySubtitle})`}
isBig={false} isBig={false}
noPadding={true} noPadding={true}
color={colors.orange}
hasShadow={true}
color={colors.white_alpha}
onPress={() => this.props.navigation.navigate("Dictionary", {})} onPress={() => this.props.navigation.navigate("Dictionary", {})}
/> />
<Button <Button
text={texts.infoTitle} text={texts.infoTitle}
isBig={false} isBig={false}
noPadding={true} noPadding={true}
hasShadow={true}
color={colors.white_alpha} color={colors.white_alpha}
onPress={() => this.props.navigation.navigate("Info", {})} onPress={() => this.props.navigation.navigate("Info", {})}
/> />
@ -183,8 +204,9 @@ class Splash extends React.Component {
text={texts.exit} text={texts.exit}
isBig={false} isBig={false}
noPadding={true} noPadding={true}
hasShadow={true}
noBorder={true} noBorder={true}
color={colors.black_alpha}
color={colors.white_alpha2}
onPress={() => this.handleBackButton()} onPress={() => this.handleBackButton()}
/> />

260
vds-app/App/screens/TrueFalse.js

@ -0,0 +1,260 @@
import React from "react"
import { View, ScrollView, StyleSheet, StatusBar, Text, SafeAreaView, Dimensions, ImageBackground, BackHandler } from "react-native"
import { AdMobBanner } from "expo-ads-admob"
import { Button, ButtonContainer } from "../components/Button"
import { texts, colors, examScheme, credentials } from "../components/Variables"
import aerodynamicsQuestions from "../data/aerodynamics"
import firstAidQuestions from "../data/firstAid"
import flightSafetyQuestions from "../data/flightSafety"
import instrumentsQuestions from "../data/instruments"
import legislationQuestions from "../data/legislation"
import materialsQuestions from "../data/materials"
import meteorologyQuestions from "../data/meteorology"
import physiopathologyQuestions from "../data/physiopathology"
import pilotingTechniquesQuestions from "../data/pilotingTechniques"
const allQuestions = {
aerodynamics: aerodynamicsQuestions,
firstAid: firstAidQuestions,
flightSafety: flightSafetyQuestions,
instruments: instrumentsQuestions,
legislation: legislationQuestions,
materials: materialsQuestions,
meteorology: meteorologyQuestions,
physiopathology: physiopathologyQuestions,
pilotingTechniques: pilotingTechniquesQuestions
}
const bgImage = require("../assets/bg.jpg")
const screen = Dimensions.get("window")
const styles = StyleSheet.create({
container: {
flex: 1
},
text: {
color: colors.white,
fontSize: 20,
textAlign: "center",
fontWeight: "600",
paddingVertical: 20
},
textAnswer: {
color: colors.black,
backgroundColor: colors.white,
fontSize: 18,
textAlign: "center",
fontWeight: "400",
marginTop: 20,
paddingVertical: 20,
paddingHorizontal: 20,
borderRadius: 10
},
safearea: {
flex: 1,
paddingHorizontal: 20,
paddingTop: 40,
justifyContent: "space-between"
},
box: {
width: screen.width,
paddingVertical: 10,
overflow: "hidden"
},
scrollView: {
//margin: 10,
height: screen.height-150
},
bg: {
width: "100%",
height: "100%"
},
bannerContainer: {
flex: 1,
alignItems: "center",
justifyContent: "center"
},
banner: {
flex: 1,
alignItems: "center",
justifyContent: "center",
width: 320
}
})
class Quiz extends React.Component {
state = {
correctCount: 0,
wrongCount: 0,
wrongAnswers: [],
totalCount: this.props.navigation.getParam("questions", []).length,
availableIds: this.props.navigation.getParam("questions", []).map(a => a.id),
activeQuestionId: this.props.navigation.getParam("questions", [])[
Math.floor(Math.random() * this.props.navigation.getParam("questions", []).length)
].id,
activeAnswerId: Math.floor(Math.random() * 3),
clickedAnswer: false,
answered: false,
results: false
}
bannerError = (e) => {
console.log("Banner error (footer): ", e)
}
componentDidMount() {
BackHandler.addEventListener('hardwareBackPress', this.handleBackButton)
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton)
}
handleBackButton = () => {
let tmpQuestions = []
let fullQuestions = []
examScheme.forEach( (elem) => {
let currentSection = allQuestions[elem.section]
for(let i=0; i<currentSection.length; i++) {
fullQuestions.push(currentSection[i])
}
})
for(let i=0; i<10; i++) {
const currentIndex = Math.floor(Math.random() * fullQuestions.length)
tmpQuestions.push(fullQuestions[currentIndex])
fullQuestions = fullQuestions.filter( (item, index) => index != currentIndex)
}
this.props.navigation.navigate("Splash", {
trueFalseQuestions: tmpQuestions
})
return true
}
answer = (answer, correct, id, question) => {
this.setState(
state => {
const nextState = { answered: true, clickedId: id, clickedAnswer: answer }
if ((correct && answer) || (!correct && !answer)) {
//console.log('ok')
nextState.correctCount = state.correctCount + 1
} else {
//console.log('ko')
nextState.wrongCount = state.wrongCount + 1
nextState.wrongAnswers = state.wrongAnswers
nextState.wrongAnswers.push(
{ text: question.question,
id: question.id,
clicked: question.answers[state.activeAnswerId].id,
answers: question.answers
}
)
}
return nextState
},
() => {
setTimeout(() => this.nextQuestion(), 2000)
}
)
}
nextQuestion = () => {
const updatedIndexes = this.state.availableIds.filter( item => item != this.state.activeQuestionId)
const nextId = updatedIndexes[Math.floor(Math.random() * updatedIndexes.length)]
if (!updatedIndexes.length) {
//console.log(this.state.wrongAnswers)
this.props.navigation.navigate("ResultsTrueFalse", {
results: {
isExam: false,
total: this.state.totalCount,
correct: this.state.correctCount,
wrong: this.state.wrongCount,
wrongAnswers: this.state.wrongAnswers
}
})
} else {
this.setState( (state) => {
return {
availableIds: updatedIndexes,
activeQuestionId: nextId,
activeAnswerId: Math.floor(Math.random() * 3),
answered: false
}
})
}
}
render() {
const questions = this.props.navigation.getParam("questions", [])
const question = questions.filter(item => item.id == this.state.activeQuestionId)[0] || questions[0]
const randomAnswer = question.answers[this.state.activeAnswerId]
//console.log({id: randomAnswer.id, clicked: this.state.clickedId, answered: this.state.answered, isCorrect: randomAnswer.correct || false})
return (
<ImageBackground source={bgImage} style={styles.bg} resizeMode="cover">
<View style={styles.box}>
<View style={styles.scrollView}>
<ScrollView style={ styles.container } >
<StatusBar barStyle="light-content" />
{!this.state.results ?
<SafeAreaView style={styles.safearea}>
<View>
<Text style={styles.text}>{question.question}</Text>
<Text style={styles.textAnswer}>{randomAnswer.text}</Text>
<ButtonContainer>
<Button
halfSize={true}
text={texts.true}
colorize={{id: randomAnswer.id, clicked: this.state.clickedAnswer ? randomAnswer.id : false, answered: this.state.answered, isCorrect: randomAnswer.correct || false}}
onPress={() => this.answer(true, randomAnswer.correct || false, randomAnswer.id, question)}
/>
<Button
halfSize={true}
text={texts.false}
colorize={{id: randomAnswer.id, clicked: !this.state.clickedAnswer ? randomAnswer.id : false, answered: this.state.answered, isCorrect: !randomAnswer.correct}}
onPress={() => this.answer(false, randomAnswer.correct || false, randomAnswer.id, question)}
/>
</ButtonContainer>
</View>
<Text style={styles.text}>
{`${this.state.correctCount+this.state.wrongCount}/${this.state.totalCount}`}
</Text>
</SafeAreaView>
: <SafeAreaView></SafeAreaView>}
</ScrollView>
</View>
</View>
<View style={styles.bannerContainer}>
<AdMobBanner
style={styles.banner}
bannerSize="largeBanner"
adUnitID={credentials.adMobUnitIDFooter}
onDidFailToReceiveAdWithError={this.bannerError} />
</View>
</ImageBackground>
)
}
}
export default Quiz
Loading…
Cancel
Save