From 72778c3c4563179fdb51359481ab4f1d43777889 Mon Sep 17 00:00:00 2001 From: Dslak Date: Thu, 7 Nov 2019 11:00:23 +0100 Subject: [PATCH] fix navigation, info styles --- vds-app/App/components/Button.js | 6 +- vds-app/App/components/Variables.js | 28 ++++- vds-app/App/screens/Info.js | 83 ++++++++++++-- vds-app/App/screens/Quiz.js | 15 ++- vds-app/App/screens/QuizIndex.js | 165 ++++++++++++++++------------ vds-app/App/screens/Splash.js | 37 ++++++- vds-app/app.json | 4 +- 7 files changed, 245 insertions(+), 93 deletions(-) diff --git a/vds-app/App/components/Button.js b/vds-app/App/components/Button.js index 7b83905..6422a01 100644 --- a/vds-app/App/components/Button.js +++ b/vds-app/App/components/Button.js @@ -33,7 +33,7 @@ const styles = StyleSheet.create({ } }) -export const Button = ({ text, subtitle = null, isBig = false, colorize = false, onPress = () => {} }) => { +export const Button = ({ text, subtitle = null, isBig = false, colorize = false, color = false, onPress = () => {} }) => { const buttonBig = isBig ? {fontSize: 25} : {} const isClicked = colorize.clicked == colorize.id @@ -50,6 +50,10 @@ export const Button = ({ text, subtitle = null, isBig = false, colorize = false, } } + if(color) { + buttonColor = {backgroundColor: color, borderColor: 'transparent'} + } + if(subtitle) { return ( diff --git a/vds-app/App/components/Variables.js b/vds-app/App/components/Variables.js index 23cfd75..0e89703 100644 --- a/vds-app/App/components/Variables.js +++ b/vds-app/App/components/Variables.js @@ -30,6 +30,7 @@ export const texts = { wrongs: "Sbagliate", percentage: "Percentuale", points: "Punti", + questions: "Domande", aerodynamics: "Aerodinamica", first_aid: "Primo soccorso", flight_safety: "Sicurezza in volo", @@ -45,13 +46,25 @@ export const texts = { infoTitle: "Informazioni", version: "Versione", author: "Autore", + exit: "Esci", + exitQuestion: "Vuoi uscire dall'app?", description: "VDS Quiz รจ una applicazione che utilizza le 500 domande ufficiali dell'AeCI (Aero Club d'Italia), nella simulazione le domande vengono estrapolate seguendo lo schema ufficiale d'esame:", - source: "Domande ufficiali", + source: "PDF Domande ufficiali", pdfLinkText: "Fonte: AeCI (Aero Club d'Italia) \"500 Quiz\"", pdfLink: "http://www.aeci.it/upload/files/quiz_VDS-VL_2017.pdf", - schema: "Normativa e legislazione: 4 domande / 3pt \n\r Aerodinamica: 8 domande / 3pt \n\r Pronto soccorso: 1 domande / 2pt \n\r Fisiopatologia del volo: 1 domande / 2pt \n\r Meteorologia e aerologia: 6 domande / 4pt \n\r Strumenti: 1 domande / 2pt \n\r Tecnica di pilotaggio: 5 domande / 4pt \n\r Materiali: 1 domande / 2pt \n\r Sicurezza del volo: 3 domande / 4pt \n\r TOTALE: 30 domande / 100pt", - resultsSchema: "da 100pt a 86pt idoneo\n\r da 85pt a 80pt idoneo con superamento di una verifica orale, riguardante i quesiti errati\n\r inferiore a 80pt non idoneo" + legislation: "Normativa e legislazione", + aerodynamics: "Aerodinamica", + firstAid: "Pronto soccorso", + physiopathology: "Fisiopatologia del volo", + meteorology: "Meteorologia e aerologia", + instruments: "Strumenti", + pilotingTechniques: "Tecnica di pilotaggio", + materials: "Materiali", + flightSafety: "Sicurezza del volo", + examScheme: "Schema domande d'esame", + resultsScheme: "Calcolo risultati" } + export const examScheme = [ {section: "aerodynamics", questions: 8, points: 3}, {section: "firstAid", questions: 1, points: 2}, @@ -70,8 +83,15 @@ export const examScheme = [ {section: "flightSafety", questions: 1, points: 4}, {section: "instruments", questions: 1, points: 2} ] - */ + +export const resultsScheme = [ + {points: "da 86 a 100 punti", result: "idoneo"}, + {points: "da 80 a 85 punti", result: "doneo con superamento di una verifica orale, riguardante i quesiti errati"}, + {points: "inferiore a 80 punti", result: "non idoneo"}, +] + + export const credentials = { adMobUnitIDTest: "ca-app-pub-3940256099942544/6300978111", adMobUnitID: "ca-app-pub-4145771316565790/1848957462" //"ca-app-pub-3940256099942544/6300978111" // "ca-app-pub-4145771316565790/1848957462", diff --git a/vds-app/App/screens/Info.js b/vds-app/App/screens/Info.js index bccdc82..c6acebb 100644 --- a/vds-app/App/screens/Info.js +++ b/vds-app/App/screens/Info.js @@ -2,7 +2,7 @@ import React from "react" import { View, ScrollView, StyleSheet, StatusBar, Text, SafeAreaView, Dimensions, Image, BackHandler, Linking} from "react-native" import { Button, ButtonContainer } from "../components/Button" -import { colors, texts } from "../components/Variables" +import { colors, texts, examScheme, resultsScheme} from "../components/Variables" const screen = Dimensions.get("window") const header = require("../assets/header.png") @@ -18,7 +18,7 @@ const styles = StyleSheet.create({ flex: 1, marginTop: 0, justifyContent: "space-between", - paddingHorizontal: 20 + paddingHorizontal: 10 }, headerContainer: { marginTop: -40, @@ -37,8 +37,8 @@ const styles = StyleSheet.create({ width: screen.width-80 }, box: { - width: screen.width-40, - paddingHorizontal: 20 + width: screen.width-20, + paddingHorizontal: 10 }, text: { color: colors.white, @@ -50,12 +50,24 @@ const styles = StyleSheet.create({ textShadowOffset: {width: -1, height: 1}, textShadowRadius: 10 }, + title: { + paddingTop: 30, + color: colors.white, + fontSize: 18, + textTransform: "uppercase", + textAlign: "center", + fontWeight: "400", + lineHeight: 20, + textShadowColor: 'rgba(0, 0, 0, 0.75)', + textShadowOffset: {width: -1, height: 1}, + textShadowRadius: 10 + }, textSmall: { lineHeight: 23, marginTop: 15, borderRadius: 5, backgroundColor: colors.black_alpha, - borderWidth: 1, + borderWidth: 0, borderColor: colors.white_alpha, fontSize: 16, color: colors.white, @@ -64,6 +76,23 @@ const styles = StyleSheet.create({ paddingHorizontal: 20, paddingVertical: 20 }, + textItems: { + fontSize: 16, + fontWeight: "400", + lineHeight: 23, + color: colors.white, + textAlign: "center", + paddingBottom: 10, + marginBottom: 10, + borderBottomColor: colors.black_alpha, + borderBottomWidth: 1 + }, + noBorder: { + borderBottomWidth: 0 + }, + item: { + width: "100%" + }, noPadding: { paddingVertical: 0, }, @@ -78,6 +107,8 @@ const styles = StyleSheet.create({ } }) +const B = (props) => {props.children} + class Info extends React.Component { state = {} @@ -87,6 +118,18 @@ class Info extends React.Component { Linking.openURL(url).catch((err) => console.error('An error occurred', err)) } + componentDidMount() { + BackHandler.addEventListener('hardwareBackPress', this.handleBackButton) + } + + componentWillUnmount() { + BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton) + } + + handleBackButton = () => { + this.props.navigation.navigate("Splash") + return true + } render() { @@ -112,13 +155,35 @@ class Info extends React.Component { {texts.description} - - {texts.schema} + + + {texts.examScheme}: - - {texts.resultsSchema} + + + {examScheme.map( (arg, index) => ( + + {texts[arg.section]}: {'\n\r'}{arg.questions} {texts.questions} / {arg.points} {texts.points} + + ))} + + + TOTALE: {'\n\r'}30 {texts.questions} / 100 {texts.points} + + + + + {texts.resultsScheme}: + + {resultsScheme.map( (arg, index) => ( + + {arg.points}: {'\n\r'}{arg.result} + + ))} + +