Browse Source

Added self menu,added screen animations, improved themes

keplyx 4 years ago
parent
commit
7d7b17765d

+ 2
- 2
App.js View File

@@ -51,8 +51,8 @@ export default class App extends React.Component<Props, State> {
51 51
         this.setState({
52 52
             isLoading: false,
53 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,6 +12,7 @@ const drawerCover = require("../assets/drawer-cover.png");
12 12
 
13 13
 const WIKETUD_LINK = "https://www.etud.insa-toulouse.fr/wiketud";
14 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 17
 type Props = {
17 18
     navigation: Object,
@@ -54,16 +55,11 @@ export default class SideBar extends React.Component<Props, State> {
54 55
                 icon: "wikipedia",
55 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,7 +69,6 @@ export default class SideBar extends React.Component<Props, State> {
73 69
      */
74 70
     navigateToScreen(route: string) {
75 71
         this.props.navigation.navigate(route);
76
-        this.props.navigation.closeDrawer();
77 72
     };
78 73
 
79 74
     render() {

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

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

+ 5
- 1
navigation/AppNavigator.js View File

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

+ 5
- 0
package-lock.json View File

@@ -6372,6 +6372,11 @@
6372 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 6380
     "react-proxy": {
6376 6381
       "version": "1.1.8",
6377 6382
       "resolved": "https://registry.npmjs.org/react-proxy/-/react-proxy-1.1.8.tgz",

+ 2
- 1
package.json View File

@@ -29,7 +29,8 @@
29 29
     "react-native-status-bar-height": "^2.3.1",
30 30
     "react-native-webview": "^5.8.1",
31 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 35
   "devDependencies": {
35 36
     "babel-preset-expo": "^5.1.1",

+ 1
- 1
screens/HomeScreen.js View File

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

+ 5
- 12
screens/PlanexScreen.js View File

@@ -13,23 +13,14 @@ type Props = {
13 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 20
  * Class defining the app's planex screen.
26 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 25
     webview: WebView;
35 26
 
@@ -46,7 +37,6 @@ export default class PlanningScreen extends React.Component<Props, State> {
46 37
     };
47 38
 
48 39
     refreshWebview() {
49
-        this.setState({isFinishedLoading: false});
50 40
         this.webview.reload();
51 41
     }
52 42
 
@@ -65,6 +55,9 @@ export default class PlanningScreen extends React.Component<Props, State> {
65 55
                     renderLoading={() =>
66 56
                         <View style={{
67 57
                             backgroundColor: ThemeManager.getCurrentThemeVariables().containerBgColor,
58
+                            position: 'absolute',
59
+                            top: 0,
60
+                            right: 0,
68 61
                             width: '100%',
69 62
                             height: '100%',
70 63
                             flex: 1,

+ 8
- 7
screens/ProxiwashScreen.js View File

@@ -268,19 +268,20 @@ export default class ProxiwashScreen extends FetchedDataSectionList {
268 268
     createDataset(fetchedData: Object) {
269 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 271
                 title: i18n.t('proxiwashScreen.washers'),
279 272
                 icon: 'washing-machine',
280 273
                 data: fetchedData.washers === undefined ? [] : fetchedData.washers,
281 274
                 extraData: super.state,
282 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

@@ -0,0 +1,78 @@
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,6 +4,7 @@
4 4
     "planning": "Planning",
5 5
     "proxiwash": "Proxiwash",
6 6
     "proximo": "Proximo",
7
+    "menuSelf": "UR Menu",
7 8
     "settings": "Settings",
8 9
     "about": "About"
9 10
   },

+ 1
- 0
translations/fr.json View File

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

Loading…
Cancel
Save