Merge commit 'c76d2996aa994714427fc1cf0b7578fa9b935b16' into develop
12
MenuPage.js
@ -7,7 +7,7 @@ import { AS } from "./storageControl";
|
||||
import TrainBase from "./trainbaseview";
|
||||
import HowTo from "./howto";
|
||||
import Menu from "./menu";
|
||||
import Setting from "./components/settings.js";
|
||||
import Setting from "./components/Settings/settings";
|
||||
import { useFavoriteStation } from "./stateBox/useFavoriteStation";
|
||||
import { optionData } from "./lib/stackOption.js";
|
||||
import CurrentTrainListView from "./components/CurrentTrainListView.js";
|
||||
@ -46,7 +46,15 @@ export function MenuPage() {
|
||||
}}
|
||||
children={() => <Menu getCurrentTrain={getCurrentTrain} />}
|
||||
/>
|
||||
<Stack.Screen name="setting" options={optionData} component={Setting} />
|
||||
<Stack.Screen
|
||||
name="setting"
|
||||
options={{
|
||||
...optionData,
|
||||
gestureEnabled: false,
|
||||
cardOverlayEnabled: true,
|
||||
}}
|
||||
component={Setting}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="trainbase"
|
||||
options={{ ...optionData, gestureResponseDistance: { vertical: 300 } }}
|
||||
|
BIN
assets/configuration/icon_default.jpg
Normal file
After Width: | Height: | Size: 8.3 KiB |
BIN
assets/configuration/icon_original.jpg
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/configuration/menu_default.jpg
Normal file
After Width: | Height: | Size: 106 KiB |
BIN
assets/configuration/menu_original.jpg
Normal file
After Width: | Height: | Size: 197 KiB |
BIN
assets/configuration/station_default.jpg
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
assets/configuration/station_original.jpg
Normal file
After Width: | Height: | Size: 90 KiB |
BIN
assets/configuration/train_default.jpg
Normal file
After Width: | Height: | Size: 83 KiB |
BIN
assets/configuration/train_original.jpg
Normal file
After Width: | Height: | Size: 88 KiB |
@ -115,13 +115,13 @@ export const StationDeteilView = (props) => {
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
{currentStation &&
|
||||
{/* {currentStation &&
|
||||
currentStation.map((d) => (
|
||||
<NexPreStationLine
|
||||
currentStation={d}
|
||||
originalStationList={originalStationList}
|
||||
/>
|
||||
))}
|
||||
))} */}
|
||||
{currentStation &&
|
||||
currentStation[0].JrHpUrl &&
|
||||
currentStation[0].StationNumber != "M12" && (
|
||||
|
143
components/Settings/LayoutSettings.js
Normal file
@ -0,0 +1,143 @@
|
||||
import React from "react";
|
||||
import { View, Text, TouchableOpacity, ScrollView } from "react-native";
|
||||
import { SwitchArea } from "../atom/SwitchArea";
|
||||
import { CheckBox } from "react-native-elements";
|
||||
|
||||
export const LayoutSettings = ({
|
||||
navigate,
|
||||
iconSetting,
|
||||
setIconSetting,
|
||||
mapSwitch,
|
||||
setMapSwitch,
|
||||
stationMenu,
|
||||
setStationMenu,
|
||||
usePDFView,
|
||||
setUsePDFView,
|
||||
trainMenu,
|
||||
setTrainMenu,
|
||||
trainPosition,
|
||||
setTrainPosition,
|
||||
}) => {
|
||||
return (
|
||||
<View style={{ height: "100%", backgroundColor: "#0099CC" }}>
|
||||
<View style={{ backgroundColor: "#0099CC", flexDirection: "row" }}>
|
||||
<View style={{ flex: 1 }}>
|
||||
<TouchableOpacity
|
||||
onPress={() => navigate("settingTopPage")}
|
||||
style={{
|
||||
flexDirection: "column",
|
||||
flex: 1,
|
||||
}}
|
||||
>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 20,
|
||||
fontWeight: "bold",
|
||||
textAlign: "left",
|
||||
textAlignVertical: "center",
|
||||
color: "white",
|
||||
padding: 10,
|
||||
}}
|
||||
>
|
||||
< 設定
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 20,
|
||||
fontWeight: "bold",
|
||||
textAlign: "center",
|
||||
color: "white",
|
||||
padding: 10,
|
||||
}}
|
||||
>
|
||||
設定画面
|
||||
</Text>
|
||||
<View style={{ flex: 1 }}></View>
|
||||
</View>
|
||||
<ScrollView style={{ flex: 1, backgroundColor: "white" }}>
|
||||
<View style={{ flex: 1 }}>
|
||||
<SwitchArea
|
||||
str="列車アイコン表示"
|
||||
bool={iconSetting}
|
||||
setBool={setIconSetting}
|
||||
falseImage={require("../../assets/configuration/icon_default.jpg")}
|
||||
trueImage={require("../../assets/configuration/icon_original.jpg")}
|
||||
falseText={"本家\n(文字アイコン)"}
|
||||
trueText={"オリジナル\n(車種アイコン)"}
|
||||
/>
|
||||
<SwitchArea
|
||||
str="トップメニュー表示"
|
||||
bool={mapSwitch}
|
||||
setBool={setMapSwitch}
|
||||
falseImage={require("../../assets/configuration/menu_default.jpg")}
|
||||
trueImage={require("../../assets/configuration/menu_original.jpg")}
|
||||
falseText={"本家\n(文字&路線リスト)"}
|
||||
trueText={"オリジナル\n(マップ&お気に入り)"}
|
||||
/>
|
||||
<SwitchArea
|
||||
str="駅メニュー表示"
|
||||
bool={stationMenu}
|
||||
setBool={setStationMenu}
|
||||
falseText={"本家\n(文字)"}
|
||||
trueText={"オリジナル\n(駅名標)"}
|
||||
falseImage={require("../../assets/configuration/station_default.jpg")}
|
||||
trueImage={require("../../assets/configuration/station_original.jpg")}
|
||||
/>
|
||||
{stationMenu == "true" && (
|
||||
<SimpleSwitch
|
||||
bool={usePDFView}
|
||||
setBool={setUsePDFView}
|
||||
color="red"
|
||||
str="時刻表PDFをアプリの外で表示する"
|
||||
/>
|
||||
)}
|
||||
<SwitchArea
|
||||
str="列車メニュー"
|
||||
bool={trainMenu}
|
||||
setBool={setTrainMenu}
|
||||
falseText={"本家"}
|
||||
trueText={"オリジナル"}
|
||||
falseImage={require("../../assets/configuration/train_default.jpg")}
|
||||
trueImage={require("../../assets/configuration/train_original.jpg")}
|
||||
/>
|
||||
{trainMenu == "true" && (
|
||||
<SimpleSwitch
|
||||
bool={trainPosition}
|
||||
setBool={setTrainPosition}
|
||||
color="red"
|
||||
str="列車の現在位置をアイコン表示"
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
</ScrollView>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
const SimpleSwitch = ({ bool, setBool, str }) => (
|
||||
<View style={{ flexDirection: "row" }}>
|
||||
<CheckBox
|
||||
checked={bool == "true" ? true : false}
|
||||
checkedColor="red"
|
||||
onPress={() => setBool(bool == "true" ? "false" : "true")}
|
||||
/>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 22,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
}}
|
||||
>
|
||||
{str}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
246
components/Settings/SettingTopPage.js
Normal file
@ -0,0 +1,246 @@
|
||||
import React from "react";
|
||||
import {
|
||||
View,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
ScrollView,
|
||||
Linking,
|
||||
Image,
|
||||
} from "react-native";
|
||||
import * as Updates from "expo-updates";
|
||||
import { SwitchArea } from "../atom/SwitchArea";
|
||||
import { useWindowDimensions } from "react-native";
|
||||
import { ListItem } from "native-base";
|
||||
|
||||
export const SettingTopPage = ({
|
||||
navigate,
|
||||
iconSetting,
|
||||
setIconSetting,
|
||||
mapSwitch,
|
||||
setMapSwitch,
|
||||
stationMenu,
|
||||
setStationMenu,
|
||||
usePDFView,
|
||||
setUsePDFView,
|
||||
trainMenu,
|
||||
setTrainMenu,
|
||||
trainPosition,
|
||||
setTrainPosition,
|
||||
testNFC,
|
||||
updateAndReload,
|
||||
}) => {
|
||||
const { width } = useWindowDimensions();
|
||||
return (
|
||||
<View style={{ height: "100%", backgroundColor: "#0099CC" }}>
|
||||
<View style={{ backgroundColor: "#0099CC", flexDirection: "row" }}>
|
||||
<View style={{ flex: 1 }}>
|
||||
<TouchableOpacity
|
||||
onPress={() => navigate("menu")}
|
||||
style={{
|
||||
flexDirection: "column",
|
||||
flex: 1,
|
||||
}}
|
||||
>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 20,
|
||||
fontWeight: "bold",
|
||||
textAlign: "left",
|
||||
textAlignVertical: "center",
|
||||
color: "white",
|
||||
padding: 10,
|
||||
}}
|
||||
>
|
||||
閉じる
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 20,
|
||||
fontWeight: "bold",
|
||||
textAlign: "center",
|
||||
color: "white",
|
||||
padding: 10,
|
||||
}}
|
||||
>
|
||||
アプリの設定画面
|
||||
</Text>
|
||||
<View style={{ flex: 1 }}></View>
|
||||
</View>
|
||||
<ScrollView style={{ flex: 1, backgroundColor: "#f8f8fc" }}>
|
||||
<View style={{ height: 300, padding: 10 }}>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Image
|
||||
source={require("../../assets/Header.png")}
|
||||
style={{
|
||||
aspectRatio: 8.08,
|
||||
height: undefined,
|
||||
width: width - 20,
|
||||
borderRadius: 5,
|
||||
}}
|
||||
/>
|
||||
<View style={{ flexDirection: "row", paddingTop: 10 }}>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text>内部バージョン: 5.0.3.1</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
</View>
|
||||
<View style={{ flexDirection: "row", paddingBottom: 10 }}>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text>ReleaseChannel: {Updates.channel}</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
</View>
|
||||
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 14,
|
||||
fontStyle: "italic",
|
||||
}}
|
||||
>
|
||||
このアプリは、四国旅客鉄道株式会社の提供する列車走行位置表示システムを利用し、HARUKIN/Xprocessにより一部の機能を拡張したものです。
|
||||
</Text>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 14,
|
||||
fontStyle: "italic",
|
||||
}}
|
||||
>
|
||||
このアプリに関するお問い合わせは、HARUKIN/Xprocessにお願いします。くれぐれも四国旅客鉄道株式会社にはお問い合わせしないようにお願いします。
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View style={{ flex: 1, borderTopWidth: 1, borderColor: "gray" }}>
|
||||
<ListItem style={{ flexDirection: "row" }} onPress={() => {}}>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 20,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
お気に入り登録の管理(工事中)
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 20,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
{">"}
|
||||
</Text>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
style={{ flexDirection: "row" }}
|
||||
onPress={() => navigate("LayoutSettings")}
|
||||
>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 20,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
レイアウト設定
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 20,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
{">"}
|
||||
</Text>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
style={{ flexDirection: "row" }}
|
||||
onPress={() =>
|
||||
Linking.openURL(
|
||||
"https://nexcloud.haruk.in/sites/press-harukin/JRShikokuApps/policy"
|
||||
)
|
||||
}
|
||||
>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 20,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
プライバシーポリシー
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
</ListItem>
|
||||
<ListItem
|
||||
style={{ flexDirection: "row" }}
|
||||
onPress={() =>
|
||||
Linking.openURL("https://nexcloud.haruk.in/s/2WFEN5oLPGtrRqT")
|
||||
}
|
||||
>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 20,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
開発情報
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
</ListItem>
|
||||
<ListItem style={{ flexDirection: "row" }} onPress={() => testNFC()}>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 20,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
testNFC
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
</ListItem>
|
||||
</View>
|
||||
</ScrollView>
|
||||
<TouchableOpacity
|
||||
style={{
|
||||
padding: 10,
|
||||
flexDirection: "row",
|
||||
borderColor: "white",
|
||||
borderWidth: 1,
|
||||
margin: 10,
|
||||
borderRadius: 5,
|
||||
alignItems: "center",
|
||||
}}
|
||||
onPress={updateAndReload}
|
||||
>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}>
|
||||
設定を保存して再読み込み
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
);
|
||||
};
|
123
components/Settings/settings.js
Normal file
@ -0,0 +1,123 @@
|
||||
import React, { useState, useEffect, useLayoutEffect } from "react";
|
||||
import {
|
||||
View,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
Linking,
|
||||
ScrollView,
|
||||
Image,
|
||||
useWindowDimensions,
|
||||
ToastAndroid,
|
||||
} from "react-native";
|
||||
import { createStackNavigator } from "@react-navigation/stack";
|
||||
import { TransitionPresets } from "@react-navigation/stack";
|
||||
import * as ExpoFelicaReader from "../../modules/expo-felica-reader/src";
|
||||
import * as Updates from "expo-updates";
|
||||
import StatusbarDetect from "../../StatusbarDetect";
|
||||
import { AS } from "../../storageControl";
|
||||
var Status = StatusbarDetect();
|
||||
import { Switch } from "react-native-elements";
|
||||
import AutoHeightImage from "react-native-auto-height-image";
|
||||
import { SettingTopPage } from "./SettingTopPage";
|
||||
import { LayoutSettings } from "./LayoutSettings";
|
||||
|
||||
const Stack = createStackNavigator();
|
||||
export default function Setting(props) {
|
||||
const {
|
||||
navigation: { navigate },
|
||||
} = props;
|
||||
const [iconSetting, setIconSetting] = useState(false);
|
||||
const [mapSwitch, setMapSwitch] = useState(false);
|
||||
const [stationMenu, setStationMenu] = useState(false);
|
||||
const [usePDFView, setUsePDFView] = useState(false);
|
||||
const [trainMenu, setTrainMenu] = useState(false);
|
||||
const [trainPosition, setTrainPosition] = useState(false);
|
||||
useLayoutEffect(() => {
|
||||
AS.getItem("iconSwitch").then(setIconSetting);
|
||||
AS.getItem("mapSwitch").then(setMapSwitch);
|
||||
AS.getItem("stationSwitch").then(setStationMenu);
|
||||
AS.getItem("usePDFView").then(setUsePDFView);
|
||||
AS.getItem("trainSwitch").then(setTrainMenu);
|
||||
AS.getItem("trainPositionSwitch").then(setTrainPosition);
|
||||
}, []);
|
||||
const testNFC = async () => {
|
||||
const result = await ExpoFelicaReader.scan();
|
||||
alert(result);
|
||||
};
|
||||
const updateAndReload = () => {
|
||||
Promise.all([
|
||||
AS.setItem("iconSwitch", iconSetting.toString()),
|
||||
AS.setItem("mapSwitch", mapSwitch.toString()),
|
||||
AS.setItem("stationSwitch", stationMenu.toString()),
|
||||
AS.setItem("usePDFView", usePDFView.toString()),
|
||||
AS.setItem("trainSwitch", trainMenu.toString()),
|
||||
AS.setItem("trainPositionSwitch", trainPosition.toString()),
|
||||
]).then(() => Updates.reloadAsync());
|
||||
};
|
||||
return (
|
||||
<Stack.Navigator>
|
||||
<Stack.Screen
|
||||
name="settingTopPage"
|
||||
options={{
|
||||
gestureEnabled: false,
|
||||
...TransitionPresets.SlideFromRightIOS,
|
||||
cardOverlayEnabled: true,
|
||||
headerTransparent: true,
|
||||
headerShown: false,
|
||||
}}
|
||||
>
|
||||
{(props) => (
|
||||
<SettingTopPage
|
||||
{...props}
|
||||
navigate={navigate}
|
||||
iconSetting={iconSetting}
|
||||
setIconSetting={setIconSetting}
|
||||
mapSwitch={mapSwitch}
|
||||
setMapSwitch={setMapSwitch}
|
||||
stationMenu={stationMenu}
|
||||
setStationMenu={setStationMenu}
|
||||
usePDFView={usePDFView}
|
||||
setUsePDFView={setUsePDFView}
|
||||
trainMenu={trainMenu}
|
||||
setTrainMenu={setTrainMenu}
|
||||
trainPosition={trainPosition}
|
||||
setTrainPosition={setTrainPosition}
|
||||
testNFC={testNFC}
|
||||
updateAndReload={updateAndReload}
|
||||
/>
|
||||
)}
|
||||
</Stack.Screen>
|
||||
<Stack.Screen
|
||||
name="LayoutSettings"
|
||||
options={{
|
||||
gestureEnabled: true,
|
||||
...TransitionPresets.SlideFromRightIOS,
|
||||
cardOverlayEnabled: true,
|
||||
headerTransparent: true,
|
||||
headerShown: false,
|
||||
}}
|
||||
>
|
||||
{(props) => (
|
||||
<LayoutSettings
|
||||
{...props}
|
||||
navigate={navigate}
|
||||
iconSetting={iconSetting}
|
||||
setIconSetting={setIconSetting}
|
||||
mapSwitch={mapSwitch}
|
||||
setMapSwitch={setMapSwitch}
|
||||
stationMenu={stationMenu}
|
||||
setStationMenu={setStationMenu}
|
||||
usePDFView={usePDFView}
|
||||
setUsePDFView={setUsePDFView}
|
||||
trainMenu={trainMenu}
|
||||
setTrainMenu={setTrainMenu}
|
||||
trainPosition={trainPosition}
|
||||
setTrainPosition={setTrainPosition}
|
||||
testNFC={testNFC}
|
||||
updateAndReload={updateAndReload}
|
||||
/>
|
||||
)}
|
||||
</Stack.Screen>
|
||||
</Stack.Navigator>
|
||||
);
|
||||
}
|
54
components/atom/SimpleSwitch.js
Normal file
@ -0,0 +1,54 @@
|
||||
import {
|
||||
useWindowDimensions,
|
||||
View,
|
||||
TouchableOpacity,
|
||||
Text,
|
||||
Image,
|
||||
} from "react-native";
|
||||
export const SimpleSwitch = ({
|
||||
bool,
|
||||
setBool,
|
||||
color,
|
||||
value,
|
||||
image = require("../../assets/icons.png"),
|
||||
subText = "",
|
||||
}) => {
|
||||
const { width } = useWindowDimensions();
|
||||
return (
|
||||
<View style={{ flex: 1 }}>
|
||||
<TouchableOpacity
|
||||
style={{
|
||||
backgroundColor: bool == value.toString() ? color : null,
|
||||
padding: 5,
|
||||
borderRadius: 5,
|
||||
margin: 10,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
flexDirection: "row",
|
||||
flex: 1,
|
||||
}}
|
||||
onPress={() => setBool(value.toString())}
|
||||
>
|
||||
<Image
|
||||
source={image}
|
||||
style={{
|
||||
aspectRatio: 1,
|
||||
height: undefined,
|
||||
width: "100%",
|
||||
borderRadius: 5,
|
||||
}}
|
||||
resizeMethod="scale"
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 14,
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
{subText}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
};
|
45
components/atom/SwitchArea.js
Normal file
@ -0,0 +1,45 @@
|
||||
import { View, Text, Image, TouchableOpacity } from "react-native";
|
||||
import { SimpleSwitch } from "./SimpleSwitch";
|
||||
export const SwitchArea = ({
|
||||
str,
|
||||
bool,
|
||||
setBool,
|
||||
falseImage,
|
||||
trueImage,
|
||||
falseText,
|
||||
trueText,
|
||||
}) => {
|
||||
return (
|
||||
<View style={{ flexDirection: "column", padding: 10 }}>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 25,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
{str}
|
||||
</Text>
|
||||
<View style={{ flexDirection: "row", padding: 10 }}>
|
||||
<SimpleSwitch
|
||||
bool={bool}
|
||||
setBool={setBool}
|
||||
color="red"
|
||||
value={false}
|
||||
image={falseImage}
|
||||
subText={falseText}
|
||||
/>
|
||||
<SimpleSwitch
|
||||
bool={bool}
|
||||
setBool={setBool}
|
||||
color="red"
|
||||
value={true}
|
||||
image={trueImage}
|
||||
subText={trueText}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
};
|
@ -1,245 +0,0 @@
|
||||
import React, { useState, useEffect, useLayoutEffect } from "react";
|
||||
import { View, Text, TouchableOpacity, Linking } from "react-native";
|
||||
import * as ExpoFelicaReader from "../modules/expo-felica-reader/src";
|
||||
import * as Updates from "expo-updates";
|
||||
import StatusbarDetect from "../StatusbarDetect";
|
||||
import { AS } from "../storageControl";
|
||||
var Status = StatusbarDetect();
|
||||
import { Switch } from "react-native-elements";
|
||||
|
||||
export default function Setting() {
|
||||
const [iconSetting, setIconSetting] = useState(false);
|
||||
const [mapSwitch, setMapSwitch] = useState(false);
|
||||
const [stationMenu, setStationMenu] = useState(false);
|
||||
const [usePDFView, setUsePDFView] = useState(false);
|
||||
const [trainMenu, setTrainMenu] = useState(false);
|
||||
const [trainPosition, setTrainPosition] = useState(false);
|
||||
useLayoutEffect(() => {
|
||||
AS.getItem("iconSwitch").then(setIconSetting);
|
||||
AS.getItem("mapSwitch").then(setMapSwitch);
|
||||
AS.getItem("stationSwitch").then(setStationMenu);
|
||||
AS.getItem("usePDFView").then(setUsePDFView);
|
||||
AS.getItem("trainSwitch").then(setTrainMenu);
|
||||
AS.getItem("trainPositionSwitch").then(setTrainPosition);
|
||||
}, []);
|
||||
const testNFC = async () => {
|
||||
const resulit = await ExpoFelicaReader.scan();
|
||||
alert(resulit);
|
||||
};
|
||||
const updateAndReload = () => {
|
||||
Promise.all([
|
||||
AS.setItem("iconSwitch", iconSetting.toString()),
|
||||
AS.setItem("mapSwitch", mapSwitch.toString()),
|
||||
AS.setItem("stationSwitch", stationMenu.toString()),
|
||||
AS.setItem("usePDFView", usePDFView.toString()),
|
||||
AS.setItem("trainSwitch", trainMenu.toString()),
|
||||
AS.setItem("trainPositionSwitch", trainPosition.toString()),
|
||||
]).then(() => {
|
||||
Updates.reloadAsync();
|
||||
});
|
||||
};
|
||||
return (
|
||||
<View style={{ height: "100%", backgroundColor: "#0099CC" }}>
|
||||
<View style={{ flex: 1, backgroundColor: "white" }}>
|
||||
<View style={{ backgroundColor: "#0099CC" }}>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 30,
|
||||
fontWeight: "bold",
|
||||
textAlign: "center",
|
||||
color: "white",
|
||||
padding: 10,
|
||||
}}
|
||||
>
|
||||
設定画面
|
||||
</Text>
|
||||
</View>
|
||||
<View style={{ flex: 1 }}>
|
||||
<View style={{ flexDirection: "row", padding: 10 }}>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 25,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
列車アイコンを表示する
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
<SimpleSwitch
|
||||
bool={iconSetting}
|
||||
setBool={setIconSetting}
|
||||
color="red"
|
||||
/>
|
||||
</View>
|
||||
<View style={{ flexDirection: "row", padding: 10 }}>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 25,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
マップを表示する(beta)
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
<SimpleSwitch bool={mapSwitch} setBool={setMapSwitch} color="red" />
|
||||
</View>
|
||||
<View style={{ flexDirection: "row", padding: 10 }}>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 25,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
駅メニューを表示
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
<SimpleSwitch
|
||||
bool={stationMenu}
|
||||
setBool={setStationMenu}
|
||||
color="red"
|
||||
/>
|
||||
</View>
|
||||
<View style={{ flexDirection: "row", padding: 10 }}>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 25,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
時刻表PDFをアプリ外で表示
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
<SimpleSwitch
|
||||
bool={usePDFView}
|
||||
setBool={setUsePDFView}
|
||||
color="red"
|
||||
/>
|
||||
</View>
|
||||
<View style={{ flexDirection: "row", padding: 10 }}>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 25,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
列車メニュー
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
<SimpleSwitch bool={trainMenu} setBool={setTrainMenu} color="red" />
|
||||
</View>
|
||||
<View style={{ flexDirection: "row", padding: 10 }}>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 25,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
→列車現在位置表示(alpha)
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
<SimpleSwitch
|
||||
bool={trainPosition}
|
||||
setBool={setTrainPosition}
|
||||
color="red"
|
||||
/>
|
||||
</View>
|
||||
<View style={{ flexDirection: "row", padding: 10 }}>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 25,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
内部バージョン: 5.0.3.1
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
</View>
|
||||
<TouchableOpacity
|
||||
style={{ flexDirection: "row", padding: 10 }}
|
||||
onPress={testNFC}
|
||||
>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 25,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
releaseChannel: {Updates.channel}
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity
|
||||
style={{ flexDirection: "row", padding: 10 }}
|
||||
onPress={() =>
|
||||
Linking.openURL(
|
||||
"https://nexcloud.haruk.in/sites/press-harukin/JRShikokuApps/policy"
|
||||
)
|
||||
}
|
||||
>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 25,
|
||||
alignItems: "center",
|
||||
alignContent: "center",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
プライバシーポリシー
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
<TouchableOpacity
|
||||
style={{
|
||||
padding: 10,
|
||||
flexDirection: "row",
|
||||
borderColor: "white",
|
||||
borderWidth: 1,
|
||||
margin: 10,
|
||||
borderRadius: 5,
|
||||
alignItems: "center",
|
||||
}}
|
||||
onPress={updateAndReload}
|
||||
>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}>
|
||||
設定を保存して再読み込み
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
const SimpleSwitch = ({ bool, setBool, color }) => (
|
||||
<Switch
|
||||
value={bool == "true" ? true : false}
|
||||
color={bool == "true" ? color : null}
|
||||
onValueChange={(value) => setBool(value.toString())}
|
||||
/>
|
||||
);
|