Commit 49bae6b6 authored by Lihinikaduwa D.N.R.  's avatar Lihinikaduwa D.N.R.

changed Read Category

parent 89274bdb
File deleted
import re import re
import MySQLdb # import MySQLdb
import mysql import mysql
from flask import Flask, redirect, url_for, render_template, request, jsonify, make_response from flask import Flask, redirect, url_for, render_template, request, jsonify, make_response
import random import random
...@@ -22,31 +22,31 @@ app = Flask(__name__) ...@@ -22,31 +22,31 @@ app = Flask(__name__)
def home(): def home():
return render_template('home.html') return render_template('home.html')
@app.route('/register', methods =['POST']) # @app.route('/register', methods =['POST'])
def register(): # def register():
msg = '' # msg = ''
if request.method == 'POST' and 'username' in request.form and 'password' in request.form and 'email' in request.form: # if request.method == 'POST' and 'username' in request.form and 'password' in request.form and 'email' in request.form:
username = request.form['username'] # username = request.form['username']
password = request.form['password'] # password = request.form['password']
email = request.form['email'] # email = request.form['email']
cursor = mysql.connection.cursor(MySQLdb.cursors.DictCursor) # cursor = mysql.connection.cursor(MySQLdb.cursors.DictCursor)
cursor.execute('SELECT * FROM user WHERE name = % s', (username,)) # cursor.execute('SELECT * FROM user WHERE name = % s', (username,))
account = cursor.fetchone() # account = cursor.fetchone()
if account: # if account:
msg = 'Account already exists !' # msg = 'Account already exists !'
elif not re.match(r'[^@]+@[^@]+\.[^@]+', email): # elif not re.match(r'[^@]+@[^@]+\.[^@]+', email):
msg = 'Invalid email address !' # msg = 'Invalid email address !'
elif not re.match(r'[A-Za-z0-9]+', username): # elif not re.match(r'[A-Za-z0-9]+', username):
msg = 'Username must contain only characters and numbers !' # msg = 'Username must contain only characters and numbers !'
elif not username or not password or not email: # elif not username or not password or not email:
msg = 'Please fill out the form !' # msg = 'Please fill out the form !'
else: # else:
cursor.execute('INSERT INTO accounts VALUES (NULL, % s, % s, % s)', (username, password, email,)) # cursor.execute('INSERT INTO accounts VALUES (NULL, % s, % s, % s)', (username, password, email,))
mysql.connection.commit() # mysql.connection.commit()
msg = 'You have successfully registered !' # msg = 'You have successfully registered !'
elif request.method == 'POST': # elif request.method == 'POST':
msg = 'Please fill out the form !' # msg = 'Please fill out the form !'
return msg # return msg
# Color Function Route (IT18218640) # Color Function Route (IT18218640)
...@@ -165,6 +165,6 @@ def login(): ...@@ -165,6 +165,6 @@ def login():
return make_response(body) return make_response(body)
if __name__ == "__main__": if __name__ == "__main__":
app.run(host='192.168.8.102') app.run(host='192.168.1.101')
# app.run(host='192.168.8.100,port='5000', debug=True) # app.run(host='192.168.8.102')
# app.run(debug=True) # app.run(debug=True)
\ No newline at end of file
...@@ -12,7 +12,7 @@ def create_con(): ...@@ -12,7 +12,7 @@ def create_con():
database="helply", database="helply",
host="127.0.0.1", host="127.0.0.1",
user="root", user="root",
password="rp19970520" password="12345678"
) )
return db return db
......
const ImagePaths = {
roundOne: require('../image/round1.jpeg'),
roundTwo: require('../image/round2.png'),
summery: require('../image/ReadHeaderImg4.webp'),
robot1: require('../image/robot1.png'),
robot2: require('../image/activity-2-rob.png'),
};
export default ImagePaths;
...@@ -33,7 +33,7 @@ export default function ColorActivity(props) { ...@@ -33,7 +33,7 @@ export default function ColorActivity(props) {
<View style={[{flexDirection: 'row'}]}> <View style={[{flexDirection: 'row'}]}>
<View style={styles.cardImage}> <View style={styles.cardImage}>
<Image <Image
source={require('../assets/read/backboard3.jpeg')} source={require('../assets/read/image/backboard3.jpeg')}
style={{width: 100, height: 100, borderRadius: 20}}></Image> style={{width: 100, height: 100, borderRadius: 20}}></Image>
</View> </View>
......
import React, {useEffect} from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
ImageBackground,
TouchableNativeFeedback,
Platform,
} from 'react-native';
const ReadCategory = props => {
const {title, image, id, color, onSelectGame, path} = props;
return (
<View style={styles.gameItem}>
<TouchableOpacity onPress={onSelectGame}>
<View>
{/* <View style={{...styles.gameItemRow, ...styles.gameItemHeader}}> */}
<ImageBackground style={styles.bgImage} source={image}>
<View style={styles.titleContainer}>
<Text style={styles.title} numberOfLines={1}>
{title}
</Text>
</View>
</ImageBackground>
{/* </View> */}
</View>
</TouchableOpacity>
</View>
);
};
const styles = StyleSheet.create({
gameItem: {
height: 300,
width: '100%',
backgroundColor: '#ccc',
marginVertical: 10,
borderRadius: 10,
overflow: 'hidden',
},
gameItemHeader: {
height: '90%',
},
gameItemRow: {
flexDirection: 'row',
backgroundColor: 'green',
},
gameItemDetails: {
height: '10%',
paddingHorizontal: 10,
justifyContent: 'space-between',
alignItems: 'center',
},
bgImage: {
height: '100%',
width: '100%',
justifyContent: 'flex-end',
},
title: {
color: 'white',
fontFamily: 'open-sans-bold',
fontSize: 20,
textAlign: 'center',
},
titleContainer: {
padding: 10,
backgroundColor: 'rgba(0,0,0,0.7)',
},
});
export default ReadCategory;
import React from 'react'; import React from 'react';
import {NavigationContainer} from '@react-navigation/native'; import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack'; import {createNativeStackNavigator} from '@react-navigation/native-stack';
import Colors from '../constants/Colors' import Colors from '../constants/Colors';
import Home from '../screen/home'; import Home from '../screen/home';
import Start from '../screen/Start'; import Start from '../screen/Start';
...@@ -11,13 +11,12 @@ import Splash from '../screen/splash/Splash'; ...@@ -11,13 +11,12 @@ import Splash from '../screen/splash/Splash';
import Color from '../screen/Color'; import Color from '../screen/Color';
import Blue from '../screen/activity/Blue'; import Blue from '../screen/activity/Blue';
import Read from '../screen/Read'; import Read from '../screen/Read';
import ReadActivity from '../screen/activity/readActivity'; import ReadActivity from '../screen/reading/ReadActivity';
import ReadActivity2 from '../screen/activity/readActivity2' import ColorResult from '../screen/result/ColorResult';
import ColorResult from '../screen/result/ColorResult';; import PrimaryType from '../screen/activity/PrimaryType';
import PrimaryType from '../screen/activity/PrimaryType' import SecondaryType from '../screen/activity/SecondaryType';
import SecondaryType from '../screen/activity/SecondaryType'
import GameList from '../screen/memory/GameList'; import GameList from '../screen/memory/GameList';
import StartGameScreen from '../screen/memory/StartGameScreen' import StartGameScreen from '../screen/memory/StartGameScreen';
import GameScreenOne from '../screen/memory/elementry/GameScreenOne'; import GameScreenOne from '../screen/memory/elementry/GameScreenOne';
import GameScreenOneAll from '../screen/memory/elementry/GameScreenOneAll'; import GameScreenOneAll from '../screen/memory/elementry/GameScreenOneAll';
import GameScreenTwo from '../screen/memory/elementry/GameScreenTwo'; import GameScreenTwo from '../screen/memory/elementry/GameScreenTwo';
...@@ -25,11 +24,11 @@ import GameScreenTwoAll from '../screen/memory/elementry/GameScreenTwoAll'; ...@@ -25,11 +24,11 @@ import GameScreenTwoAll from '../screen/memory/elementry/GameScreenTwoAll';
import GameScreenThree from '../screen/memory/elementry/GameScreenThree'; import GameScreenThree from '../screen/memory/elementry/GameScreenThree';
import GameScreenThreeAll from '../screen/memory/elementry/GameScreenThreeAll'; import GameScreenThreeAll from '../screen/memory/elementry/GameScreenThreeAll';
import GameScreenFour from '../screen/memory/elementry/GameScreenFour'; import GameScreenFour from '../screen/memory/elementry/GameScreenFour';
import GameScreenFourAll from '../screen/memory/elementry/GameScreenFourAll' import GameScreenFourAll from '../screen/memory/elementry/GameScreenFourAll';
import GameScreenFive from '../screen/memory/elementry/GameScreenFive'; import GameScreenFive from '../screen/memory/elementry/GameScreenFive';
import GameScreenFiveAll from '../screen/memory/elementry/GameScreenFiveAll' import GameScreenFiveAll from '../screen/memory/elementry/GameScreenFiveAll';
import GameScreenSix from '../screen/memory/elementry/GameScreenSix'; import GameScreenSix from '../screen/memory/elementry/GameScreenSix';
import GameScreenSixAll from '../screen/memory/elementry/GameScreenSixAll' import GameScreenSixAll from '../screen/memory/elementry/GameScreenSixAll';
import GameOverScreen from '../screen/memory/GameOverScreen'; import GameOverScreen from '../screen/memory/GameOverScreen';
const Stack = createNativeStackNavigator(); const Stack = createNativeStackNavigator();
...@@ -74,7 +73,11 @@ const AppRouter = () => { ...@@ -74,7 +73,11 @@ const AppRouter = () => {
component={Blue} component={Blue}
/> />
<Stack.Screen <Stack.Screen
options={{headerShown: false}} options={{
title: 'Read Activity',
headerTintColor: 'white',
headerStyle: {backgroundColor: Colors.secondary},
}}
name="Read" name="Read"
component={Read} component={Read}
/> />
...@@ -83,11 +86,6 @@ const AppRouter = () => { ...@@ -83,11 +86,6 @@ const AppRouter = () => {
name="ReadActivity" name="ReadActivity"
component={ReadActivity} component={ReadActivity}
/> />
<Stack.Screen
options={{headerShown: false}}
name="ReadActivity2"
component={ReadActivity2}
/>
<Stack.Screen <Stack.Screen
options={{headerShown: false}} options={{headerShown: false}}
name="ColorResult" name="ColorResult"
...@@ -99,7 +97,7 @@ const AppRouter = () => { ...@@ -99,7 +97,7 @@ const AppRouter = () => {
options={{ options={{
title: 'Memory Games', title: 'Memory Games',
headerTintColor: 'white', headerTintColor: 'white',
headerStyle: { backgroundColor: Colors.primary }, headerStyle: {backgroundColor: Colors.primary},
}} }}
/> />
<Stack.Screen <Stack.Screen
...@@ -109,7 +107,7 @@ const AppRouter = () => { ...@@ -109,7 +107,7 @@ const AppRouter = () => {
headerShown: true, headerShown: true,
title: 'Game Start', title: 'Game Start',
headerTintColor: 'white', headerTintColor: 'white',
headerStyle: { backgroundColor: Colors.primary }, headerStyle: {backgroundColor: Colors.primary},
}} }}
/> />
<Stack.Screen <Stack.Screen
...@@ -175,12 +173,12 @@ const AppRouter = () => { ...@@ -175,12 +173,12 @@ const AppRouter = () => {
<Stack.Screen <Stack.Screen
name="GameOverScreen" name="GameOverScreen"
component={GameOverScreen} component={GameOverScreen}
options={{ options={{
headerShown: true , headerShown: true,
title: 'Game Over', title: 'Game Over',
headerTintColor: 'white', headerTintColor: 'white',
headerStyle: { backgroundColor: Colors.primary }, headerStyle: {backgroundColor: Colors.primary},
}} }}
/> />
<Stack.Screen <Stack.Screen
options={{headerShown: false}} options={{headerShown: false}}
......
...@@ -15,9 +15,12 @@ import { ...@@ -15,9 +15,12 @@ import {
Animated, Animated,
Easing, Easing,
NativeModules, NativeModules,
TouchableOpacity,
} from 'react-native'; } from 'react-native';
import ImageButton from '../component/ImageButton'; import ImageButton from '../component/ImageButton';
import ButtonView from '../component/buttonView'; import ButtonView from '../component/buttonView';
import ReadCategory from '../component/reading/ReadCategory';
import ImagePaths from '../assets/read/data/ReadData';
const webUrel = 'http://127.0.0.1:5000/reading'; const webUrel = 'http://127.0.0.1:5000/reading';
...@@ -52,35 +55,55 @@ export default function Read() { ...@@ -52,35 +55,55 @@ export default function Read() {
return ( return (
<SafeAreaView> <SafeAreaView>
<ScrollView> <ScrollView>
<View> {/* <View style={styles.screenHeader}>
<View> <ImageBackground
<ImageBackground source={require('../assets/read/image/ReadHeaderImg3.jpeg')}
source={require('../assets/read/background3.jpeg')} style={styles.image}>
style={styles.image}> <Text style={styles.title}>Read Activity</Text>
<Text style={styles.title}>Read Activity</Text> </ImageBackground>
</ImageBackground> </View> */}
</View> <TouchableOpacity style={styles.screen}>
</View> <ReadCategory
id={1}
{/* {activity.map((data, index) => { title={'First Round'}
return <ButtonView title={data.round} color="#00008B" />; image={ImagePaths.roundOne}
})} */} onSelectGame={() => {
navigation.navigate('ReadActivity');
<ButtonView }}
title="First Round" />
color="#00008B" <ReadCategory
path="ReadActivity"></ButtonView> id={1}
<ButtonView title={'Second Round'}
title="Second Round" image={ImagePaths.roundTwo}
color="#00008B" onSelectGame={() => {
path="ReadActivity2"></ButtonView> navigation.navigate('ReadActivity');
{/* <ButtonView title="Third Round" color="#00008B"></ButtonView> */} }}
/>
<ReadCategory
id={1}
title={'Result & Summery'}
image={ImagePaths.summery}
onSelectGame={() => {
navigation.navigate('ReadActivity');
}}
/>
</TouchableOpacity>
</ScrollView> </ScrollView>
</SafeAreaView> </SafeAreaView>
); );
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
screenHeader: {
height:200
},
screen: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
padding: 20,
backgroundColor: '#ffff',
},
imageContainer: { imageContainer: {
flexDirection: 'row', flexDirection: 'row',
marginTop: 70, marginTop: 70,
......
import {useNavigation} from '@react-navigation/native';
import Orientation from 'react-native-orientation-locker';
import React, {useEffect, useState} from 'react';
import {
Text,
TouchableOpacity,
StyleSheet,
View,
Dimensions,
SafeAreaView,
ImageBackground,
Button,
Image,
} from 'react-native';
export default function ReadActivity() {
const navigation = useNavigation();
React.useEffect(() => {
const unsubscribe = navigation.addListener('focus', () => {
// The screen is focused
// Call any action
Orientation.unlockAllOrientations();
Orientation.lockToLandscape();
});
return unsubscribe;
}, [navigation]);
return (
<SafeAreaView>
<View style={{flexDirection: 'column'}}>
<ImageBackground
style={styles.image}
source={require('../../assets/read/background2.jpeg')}>
<View>
<View style={styles.textBody}>
<Text style={styles.text}>Pronounce this Word!</Text>
</View>
<Image
style={styles.robo}
source={require('../../assets/read/activity-2-rob.png')}></Image>
</View>
<View>
<Image
style={styles.blackboard}
source={require('../../assets/read/reading.png')}></Image>
</View>
<View style={{flexDirection: 'row', marginLeft: 580, marginTop: -30}}>
<Button style={styles.button} title="Start" />
</View>
</ImageBackground>
</View>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
body: {
flex: 1,
},
image: {
width: '100%',
height: '100%',
},
box: {
width: 180,
height: 180,
// borderColor: "#000000",
backgroundColor: 'blue',
marginTop: -370,
marginLeft: 455,
borderRadius: 100,
},
aa: {
marginTop: -120,
},
blackboard: {
marginTop: -320,
marginLeft: 240,
width: '50%',
height: 300,
},
robo: {
marginTop: -70,
marginLeft: -5,
width: 150,
height: 200,
},
textBody: {
marginTop: 150,
marginLeft: 95,
backgroundColor: '#00008B',
width: 150,
borderRadius: 50,
padding: 5,
},
text: {
fontSize: 25,
justifyContent: 'center',
alignItems: 'center',
color: 'white',
textAlign: 'center',
fontWeight: 'bold',
},
button: {
padding: 10,
marginRight: 50,
color: '#000000',
},
});
This diff is collapsed.
import axios from 'axios'; import axios from 'axios';
export default axios.create({ baseURL: 'http://192.168.8.102:5000/',timeout: 15000, }); // export default axios.create({ baseURL: 'http://192.168.8.102:5000/', timeout: 15000, });
\ No newline at end of file export default axios.create({
baseURL: 'http://192.168.1.101:5000/',
timeout: 15000,
});
...@@ -31,7 +31,7 @@ export default function Home({ navigation }){ ...@@ -31,7 +31,7 @@ export default function Home({ navigation }){
<View style={styles.imageView}> <View style={styles.imageView}>
<Image <Image
style={styles.image} style={styles.image}
source={require('../assets/read/background4.jpg')} source={require('../assets/read/image/background4.jpg')}
resizeMode="contain"></Image> resizeMode="contain"></Image>
<ImageButton path="Read" title="Read Activity" /> <ImageButton path="Read" title="Read Activity" />
</View> </View>
......
...@@ -13,7 +13,7 @@ import { ...@@ -13,7 +13,7 @@ import {
Image, Image,
} from 'react-native'; } from 'react-native';
export default function ReadActivity2() { export default function ReadActivity() {
const navigation = useNavigation(); const navigation = useNavigation();
// React.useEffect(() => { // React.useEffect(() => {
...@@ -32,12 +32,12 @@ export default function ReadActivity2() { ...@@ -32,12 +32,12 @@ export default function ReadActivity2() {
<View style={{flexDirection: 'column'}}> <View style={{flexDirection: 'column'}}>
<ImageBackground <ImageBackground
style={styles.image} style={styles.image}
source={require('../../assets/read/activity-2-backg.jpeg')}> source={require('../../assets/read/image/activity-2-backg.jpeg')}>
<View style={styles.imageContainer}> <View style={styles.imageContainer}>
<View style={styles.imageView}> <View style={styles.imageView}>
<View style={styles.robo}> <View style={styles.robo}>
<Image <Image
source={require('../../assets/read/activity-2-rob.png')}></Image> source={require('../../assets/read/image/activity-2-rob.png')}></Image>
</View> </View>
</View> </View>
<View style={styles.textBody}> <View style={styles.textBody}>
...@@ -55,12 +55,11 @@ export default function ReadActivity2() { ...@@ -55,12 +55,11 @@ export default function ReadActivity2() {
<View> <View>
<Image <Image
style={styles.blackboard} style={styles.blackboard}
source={require('../../assets/read/backboard3.png')}></Image> source={require('../../assets/read/image/backboard3.png')}></Image>
</View> </View>
<View style={{flexDirection: 'row', marginTop: 120}}>
{/* <View style={{flexDirection: 'row', marginTop: 120}}>
<Button style={styles.button} title="Start" /> <Button style={styles.button} title="Start" />
</View> */} </View>
</ImageBackground> </ImageBackground>
</View> </View>
</SafeAreaView> </SafeAreaView>
...@@ -121,10 +120,12 @@ const styles = StyleSheet.create({ ...@@ -121,10 +120,12 @@ const styles = StyleSheet.create({
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
color: '#00008B', color: '#00008B',
borderRadius:10,
backgroundColor: 'rgba(0,0,0,0.2)',
textAlign: 'center', textAlign: 'center',
fontWeight: 'bold', fontWeight: 'bold',
}, },
button: { button: {
padding: 10, padding: 10,
marginLeft: 5, marginLeft: 5,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment