Browse Source

Added self menu,added screen animations, improved themes

keplyx 4 years ago
parent
commit
7d7b17765d

+ 2
- 2
App.js View File

51
         this.setState({
51
         this.setState({
52
             isLoading: false,
52
             isLoading: false,
53
             currentTheme: ThemeManager.getCurrentTheme(),
53
             currentTheme: ThemeManager.getCurrentTheme(),
54
-            // showIntro: AsyncStorageManager.getInstance().preferences.showIntro.current === '1'
55
-            showIntro: true
54
+            showIntro: AsyncStorageManager.getInstance().preferences.showIntro.current === '1'
55
+            // showIntro: true
56
         });
56
         });
57
     }
57
     }
58
 
58
 

+ 6
- 11
components/Sidebar.js View File

12
 
12
 
13
 const WIKETUD_LINK = "https://www.etud.insa-toulouse.fr/wiketud";
13
 const WIKETUD_LINK = "https://www.etud.insa-toulouse.fr/wiketud";
14
 const Amicale_LINK = "https://www.etud.insa-toulouse.fr/~amicale";
14
 const Amicale_LINK = "https://www.etud.insa-toulouse.fr/~amicale";
15
+const RU_LINK = "http://m.insa-toulouse.fr/ru.html";
15
 
16
 
16
 type Props = {
17
 type Props = {
17
     navigation: Object,
18
     navigation: Object,
54
                 icon: "wikipedia",
55
                 icon: "wikipedia",
55
                 link: WIKETUD_LINK
56
                 link: WIKETUD_LINK
56
             },
57
             },
57
-            // {
58
-            //     name: i18n.t('screens.settings'),
59
-            //     route: "Settings",
60
-            //     icon: "settings",
61
-            // },
62
-            // {
63
-            //     name: i18n.t('screens.about'),
64
-            //     route: "About",
65
-            //     icon: "information",
66
-            // },
58
+            {
59
+                name: i18n.t('screens.menuSelf'),
60
+                route: "SelfMenuScreen",
61
+                icon: "silverware-fork-knife",
62
+            },
67
         ];
63
         ];
68
     }
64
     }
69
 
65
 
73
      */
69
      */
74
     navigateToScreen(route: string) {
70
     navigateToScreen(route: string) {
75
         this.props.navigation.navigate(route);
71
         this.props.navigation.navigate(route);
76
-        this.props.navigation.closeDrawer();
77
     };
72
     };
78
 
73
 
79
     render() {
74
     render() {

+ 4
- 4
native-base-theme/variables/platformDark.js View File

115
     brandLight: "#f4f4f4",
115
     brandLight: "#f4f4f4",
116
 
116
 
117
     //Container
117
     //Container
118
-    containerBgColor: "#333333",
118
+    containerBgColor: "#222222",
119
 
119
 
120
     //Date Picker
120
     //Date Picker
121
     datePickerTextColor: "#fff",
121
     datePickerTextColor: "#fff",
150
 
150
 
151
     // Header
151
     // Header
152
     toolbarBtnColor: platform === "ios" ? "#be1522" : "#fff",
152
     toolbarBtnColor: platform === "ios" ? "#be1522" : "#fff",
153
-    toolbarDefaultBg: platform === "ios" ? "#F8F8F8" : "#be1522",
153
+    toolbarDefaultBg: platform === "ios" ? "#333333" : "#be1522",
154
     toolbarHeight: platform === "ios" ? 64 : 56,
154
     toolbarHeight: platform === "ios" ? 64 : 56,
155
     toolbarSearchIconSize: platform === "ios" ? 20 : 23,
155
     toolbarSearchIconSize: platform === "ios" ? 20 : 23,
156
     toolbarInputColor: platform === "ios" ? "#CECDD2" : "#fff",
156
     toolbarInputColor: platform === "ios" ? "#CECDD2" : "#fff",
241
     tabFontSize: 15,
241
     tabFontSize: 15,
242
 
242
 
243
     // Text
243
     // Text
244
-    textColor: "#d6d6d6",
244
+    textColor: "#ebebeb",
245
     inverseTextColor: "#000",
245
     inverseTextColor: "#000",
246
     noteFontSize: 14,
246
     noteFontSize: 14,
247
     get defaultTextColor() {
247
     get defaultTextColor() {
253
     titleFontSize: platform === "ios" ? 17 : 19,
253
     titleFontSize: platform === "ios" ? 17 : 19,
254
     subTitleFontSize: platform === "ios" ? 11 : 14,
254
     subTitleFontSize: platform === "ios" ? 11 : 14,
255
     subtitleColor: platform === "ios" ? "#8e8e93" : "#FFF",
255
     subtitleColor: platform === "ios" ? "#8e8e93" : "#FFF",
256
-    titleFontColor: platform === "ios" ? "#000" : "#FFF",
256
+    titleFontColor: platform === "ios" ? "#FFF" : "#FFF",
257
 
257
 
258
 
258
 
259
     // CUSTOM
259
     // CUSTOM

+ 5
- 1
navigation/AppNavigator.js View File

6
 import AboutScreen from '../screens/About/AboutScreen';
6
 import AboutScreen from '../screens/About/AboutScreen';
7
 import ProximoListScreen from '../screens/Proximo/ProximoListScreen';
7
 import ProximoListScreen from '../screens/Proximo/ProximoListScreen';
8
 import AboutDependenciesScreen from '../screens/About/AboutDependenciesScreen';
8
 import AboutDependenciesScreen from '../screens/About/AboutDependenciesScreen';
9
+import SelfMenuScreen from '../screens/SelfMenuScreen';
10
+import {fromRight} from "react-navigation-transitions";
9
 
11
 
10
 /**
12
 /**
11
  * Create a stack navigator using the drawer to handle navigation between screens
13
  * Create a stack navigator using the drawer to handle navigation between screens
18
             SettingsScreen: {screen: SettingsScreen},
20
             SettingsScreen: {screen: SettingsScreen},
19
             AboutScreen: {screen: AboutScreen},
21
             AboutScreen: {screen: AboutScreen},
20
             AboutDependenciesScreen: {screen: AboutDependenciesScreen},
22
             AboutDependenciesScreen: {screen: AboutDependenciesScreen},
23
+            SelfMenuScreen: {screen: SelfMenuScreen},
21
         },
24
         },
22
         {
25
         {
23
             initialRouteName: "Main",
26
             initialRouteName: "Main",
24
             mode: 'card',
27
             mode: 'card',
25
-            headerMode: "none"
28
+            headerMode: "none",
29
+            transitionConfig: () => fromRight(),
26
         })
30
         })
27
 );
31
 );

+ 5
- 0
package-lock.json View File

6372
         "react-native-tab-view": "^1.4.1"
6372
         "react-native-tab-view": "^1.4.1"
6373
       }
6373
       }
6374
     },
6374
     },
6375
+    "react-navigation-transitions": {
6376
+      "version": "1.0.12",
6377
+      "resolved": "https://registry.npmjs.org/react-navigation-transitions/-/react-navigation-transitions-1.0.12.tgz",
6378
+      "integrity": "sha512-Hp0wX9KoXwsFch6Fgiz9HpGjQZDhnyucLbCai0LcaOC3VpmgYmvkbeAg/mQ5Z5exuY6PPrh/+FXU00yMPDHkcw=="
6379
+    },
6375
     "react-proxy": {
6380
     "react-proxy": {
6376
       "version": "1.1.8",
6381
       "version": "1.1.8",
6377
       "resolved": "https://registry.npmjs.org/react-proxy/-/react-proxy-1.1.8.tgz",
6382
       "resolved": "https://registry.npmjs.org/react-proxy/-/react-proxy-1.1.8.tgz",

+ 2
- 1
package.json View File

29
     "react-native-status-bar-height": "^2.3.1",
29
     "react-native-status-bar-height": "^2.3.1",
30
     "react-native-webview": "^5.8.1",
30
     "react-native-webview": "^5.8.1",
31
     "react-navigation": "^3.11.0",
31
     "react-navigation": "^3.11.0",
32
-    "react-navigation-material-bottom-tabs": "^1.0.0"
32
+    "react-navigation-material-bottom-tabs": "^1.0.0",
33
+    "react-navigation-transitions": "^1.0.12"
33
   },
34
   },
34
   "devDependencies": {
35
   "devDependencies": {
35
     "babel-preset-expo": "^5.1.1",
36
     "babel-preset-expo": "^5.1.1",

+ 1
- 1
screens/HomeScreen.js View File

76
             }}>
76
             }}>
77
                 <CardItem>
77
                 <CardItem>
78
                     <Left>
78
                     <Left>
79
-                        <Thumbnail source={ICON_AMICALE}/>
79
+                        <Thumbnail source={ICON_AMICALE} square/>
80
                         <Body>
80
                         <Body>
81
                             <Text>{NAME_AMICALE}</Text>
81
                             <Text>{NAME_AMICALE}</Text>
82
                             <Text note>{HomeScreen.getFormattedDate(item.created_time)}</Text>
82
                             <Text note>{HomeScreen.getFormattedDate(item.created_time)}</Text>

+ 5
- 12
screens/PlanexScreen.js View File

13
     navigation: Object,
13
     navigation: Object,
14
 }
14
 }
15
 
15
 
16
-type State = {
17
-    isFinishedLoading: boolean
18
-}
19
 
16
 
20
-// const PLANEX_URL = 'http://planex.insa-toulouse.fr/';
21
-// TODO use real url in prod
22
-const PLANEX_URL = 'https://srv-falcon.etud.insa-toulouse.fr/~vergnet/planex/planex.insa-toulouse.fr.html';
17
+const PLANEX_URL = 'http://planex.insa-toulouse.fr/';
23
 
18
 
24
 /**
19
 /**
25
  * Class defining the app's planex screen.
20
  * Class defining the app's planex screen.
26
  * This screen uses a webview to render the planex page
21
  * This screen uses a webview to render the planex page
27
  */
22
  */
28
-export default class PlanningScreen extends React.Component<Props, State> {
29
-
30
-    state = {
31
-        isFinishedLoading: false,
32
-    };
23
+export default class PlanningScreen extends React.Component<Props> {
33
 
24
 
34
     webview: WebView;
25
     webview: WebView;
35
 
26
 
46
     };
37
     };
47
 
38
 
48
     refreshWebview() {
39
     refreshWebview() {
49
-        this.setState({isFinishedLoading: false});
50
         this.webview.reload();
40
         this.webview.reload();
51
     }
41
     }
52
 
42
 
65
                     renderLoading={() =>
55
                     renderLoading={() =>
66
                         <View style={{
56
                         <View style={{
67
                             backgroundColor: ThemeManager.getCurrentThemeVariables().containerBgColor,
57
                             backgroundColor: ThemeManager.getCurrentThemeVariables().containerBgColor,
58
+                            position: 'absolute',
59
+                            top: 0,
60
+                            right: 0,
68
                             width: '100%',
61
                             width: '100%',
69
                             height: '100%',
62
                             height: '100%',
70
                             flex: 1,
63
                             flex: 1,

+ 8
- 7
screens/ProxiwashScreen.js View File

268
     createDataset(fetchedData: Object) {
268
     createDataset(fetchedData: Object) {
269
         return [
269
         return [
270
             {
270
             {
271
-                title: i18n.t('proxiwashScreen.dryers'),
272
-                icon: 'tumble-dryer',
273
-                data: fetchedData.dryers === undefined ? [] : fetchedData.dryers,
274
-                extraData: super.state,
275
-                keyExtractor: this.getDryersKeyExtractor
276
-            },
277
-            {
278
                 title: i18n.t('proxiwashScreen.washers'),
271
                 title: i18n.t('proxiwashScreen.washers'),
279
                 icon: 'washing-machine',
272
                 icon: 'washing-machine',
280
                 data: fetchedData.washers === undefined ? [] : fetchedData.washers,
273
                 data: fetchedData.washers === undefined ? [] : fetchedData.washers,
281
                 extraData: super.state,
274
                 extraData: super.state,
282
                 keyExtractor: this.getWashersKeyExtractor
275
                 keyExtractor: this.getWashersKeyExtractor
283
             },
276
             },
277
+            {
278
+                title: i18n.t('proxiwashScreen.dryers'),
279
+                icon: 'tumble-dryer',
280
+                data: fetchedData.dryers === undefined ? [] : fetchedData.dryers,
281
+                extraData: super.state,
282
+                keyExtractor: this.getDryersKeyExtractor
283
+            },
284
+
284
         ];
285
         ];
285
     }
286
     }
286
 
287
 

+ 78
- 0
screens/SelfMenuScreen.js View File

1
+// @flow
2
+
3
+import * as React from 'react';
4
+import {Platform, View} from 'react-native';
5
+import {Container, Spinner} from 'native-base';
6
+import WebView from "react-native-webview";
7
+import Touchable from "react-native-platform-touchable";
8
+import CustomMaterialIcon from "../components/CustomMaterialIcon";
9
+import ThemeManager from "../utils/ThemeManager";
10
+import CustomHeader from "../components/CustomHeader";
11
+import i18n from "i18n-js";
12
+
13
+type Props = {
14
+    navigation: Object,
15
+}
16
+
17
+
18
+const RU_URL = 'http://m.insa-toulouse.fr/ru.html';
19
+
20
+/**
21
+ * Class defining the app's planex screen.
22
+ * This screen uses a webview to render the planex page
23
+ */
24
+export default class SelfMenuScreen extends React.Component<Props> {
25
+
26
+    webview: WebView;
27
+
28
+    getRefreshButton() {
29
+        return (
30
+            <Touchable
31
+                style={{padding: 6}}
32
+                onPress={() => this.refreshWebview()}>
33
+                <CustomMaterialIcon
34
+                    color={Platform.OS === 'ios' ? ThemeManager.getCurrentThemeVariables().brandPrimary : "#fff"}
35
+                    icon="refresh"/>
36
+            </Touchable>
37
+        );
38
+    };
39
+
40
+    refreshWebview() {
41
+        this.webview.reload();
42
+    }
43
+
44
+    render() {
45
+        const nav = this.props.navigation;
46
+        return (
47
+            <Container>
48
+                <CustomHeader navigation={nav} title={i18n.t('screens.menuSelf')} hasBackButton={true}
49
+                              rightButton={this.getRefreshButton()}/>
50
+                <WebView
51
+                    ref={ref => (this.webview = ref)}
52
+                    source={{uri: RU_URL}}
53
+                    style={{
54
+                        width: '100%',
55
+                        height: '100%',
56
+                    }}
57
+                    startInLoadingState={true}
58
+                    renderLoading={() =>
59
+                        <View style={{
60
+                            backgroundColor: ThemeManager.getCurrentThemeVariables().containerBgColor,
61
+                            position: 'absolute',
62
+                            top: 0,
63
+                            right: 0,
64
+                            width: '100%',
65
+                            height: '100%',
66
+                            flex: 1,
67
+                            alignItems: 'center',
68
+                            justifyContent: 'center'
69
+                        }}>
70
+                            <Spinner/>
71
+                        </View>
72
+                    }
73
+                />
74
+            </Container>
75
+        );
76
+    }
77
+}
78
+

+ 1
- 0
translations/en.json View File

4
     "planning": "Planning",
4
     "planning": "Planning",
5
     "proxiwash": "Proxiwash",
5
     "proxiwash": "Proxiwash",
6
     "proximo": "Proximo",
6
     "proximo": "Proximo",
7
+    "menuSelf": "UR Menu",
7
     "settings": "Settings",
8
     "settings": "Settings",
8
     "about": "About"
9
     "about": "About"
9
   },
10
   },

+ 1
- 0
translations/fr.json View File

4
     "planning": "Planning",
4
     "planning": "Planning",
5
     "proxiwash": "Proxiwash",
5
     "proxiwash": "Proxiwash",
6
     "proximo": "Proximo",
6
     "proximo": "Proximo",
7
+    "menuSelf": "Menu Ru",
7
     "settings": "Paramètres",
8
     "settings": "Paramètres",
8
     "about": "À Propos"
9
     "about": "À Propos"
9
   },
10
   },

Loading…
Cancel
Save