-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSettingsPanel.tsx
249 lines (152 loc) · 7.66 KB
/
SettingsPanel.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
import React, { Component, createRef } from 'react';
import { Animated, StyleSheet, Text, View, ScrollView, Platform,StatusBar, TextInput, FlatList, Image, Modal, Switch,AsyncStorage, Alert, AlertButton, ProgressBarAndroid, ColorPropType, VirtualizedList, Picker, Dimensions, ViewStyle, StyleProp, Clipboard, TextStyle } from 'react-native';
//
import DiskInfo from "./DiskInfo"
import TaskCard from "./TaskCard"
import Swipeable, { Swip } from './Swipeable';
import { ButtonPretty } from './ButtonPretty';
import ProgressBar from './ProgressBar';
import { Colors } from 'react-native/Libraries/NewAppScreen';
import Svg from 'react-native-svg';
import SvgMi, { st } from './SvgMi';
import { OptionsPanel } from './InputPanel';
import { Palette } from './theme';
import MiMenuItem from './MiMenuItem';
import MiMenuGroupHeader from './MiMenuGroupHeader';
import { IPostInfo , AppSettings} from './rev02types';
export const HalfSection : StyleProp<ViewStyle> ={
//height:80,
paddingLeft:6,
paddingRight:6,
paddingTop:6,
flex:1,
//alignSelf:"stretch",
flexDirection:"column",
alignContent:"flex-start",
//backgroundColor:"#3c3c3c",
maxWidth:"50%",
alignItems:"flex-start",
justifyContent:"flex-start"
}
export const twoHalfsWraper : StyleProp<ViewStyle> ={
marginTop:0,
paddingVertical:4,
alignSelf:"flex-start", flexDirection:"row",
alignItems:"flex-start",
justifyContent:"flex-start",
//backgroundColor:"#322",
}
const style_InputPanel : ViewStyle ={
zIndex:20,
// maxHeight: 200, // so important cuz the whole MainPannel thing should be free to shrink as the InputPenel shrinks, so this sibling shouldn't be hiding it, and leting the content overflows here is no problem
flexDirection: "column",
justifyContent: "flex-start",
//alignSelf: "stretch",
alignItems: "center",
backgroundColor: "#1c1c1c",
marginBottom:20,
paddingBottom:10
//borderWidth: 1,
//borderStyle: "dashed",//
//borderColor: "darkslategray"
}
const text_style : TextStyle= {
fontSize:11, backgroundColor:"#222c",
width:140,paddingHorizontal:4,color:"#999",
height:22,
}
type SettingsPanelProps={
onSettingsChanged:(settings:AppSettings)=>void
currentAppSettings:AppSettings
style?:any //used for transfering animated values such as opac from parent as the user scrols
}
type SettingsPanelState={
}
export default class SettingsPanel extends Component<SettingsPanelProps,SettingsPanelState>{
constructor(props){
super(props)
}
render(){
return(
<Animated.View style={[{...style_InputPanel,backgroundColor:"transparent", width:Dimensions.get("window").width, },this.props.style]}>
<View style={{minHeight:400,
//backgroundColor:"firebrick",
zIndex:45,
overflow:"visible",
// height:400,
flexDirection:"column",
alignSelf:'flex-start',
}}>
<ScrollView style={{ flexDirection:"column", paddingVertical:2,backgroundColor:null,minWidth:"100%"} }
contentContainerStyle={{alignItems:"center",}}
>
<MiMenuGroupHeader tilte={"General"} />
<MiMenuItem tilte={"Use mobile mode (low quality)"} values={["Yes","No"]}
selected={(this.props.currentAppSettings as AppSettings).Legacy.UseLegacyMode?"Yes":"No"} iconXmldata={st.phoneAndroid}
isDisabled={false}
onSelectionChanged={((val)=>
this.props.onSettingsChanged({Legacy:{UseLegacyMode:val=="Yes"?true:false}}as AppSettings)).bind(this)}
selectedIndex={1}
isParent={false}
/>
<MiMenuItem tilte={"Use Auto-fill"} selected={(this.props.currentAppSettings as AppSettings).General.EnableAutoFill?"Yes":"No"} values={["Yes","No"]} iconXmldata={st.autoFix}
isDisabled={(this.props.currentAppSettings as AppSettings).Legacy.UseLegacyMode==true}
onSelectionChanged={((val)=>
this.props.onSettingsChanged({General:{EnableAutoFill:val=="Yes"?true:false}}as AppSettings)).bind(this)}
/>
<MiMenuGroupHeader tilte={"Auto-fill settings"} />
<MiMenuItem tilte={"Video quality"} values={["Highest","720p","420p","Lowest"]} iconXmldata={true? st.hd:st.moviesLocal}
selected={(this.props.currentAppSettings as AppSettings).AutoFillSettings.PreferedVideoQuality}
onSelectionChanged={((val)=>this.props.onSettingsChanged({AutoFillSettings:{PreferedVideoQuality:val}}as AppSettings)).bind(this)}
isDisabled={((this.props.currentAppSettings as AppSettings).General.EnableAutoFill==false)
||((this.props.currentAppSettings as AppSettings).Legacy.UseLegacyMode==true)}
/>
<MiMenuItem tilte={"Thumbnail"} values={["Yes","No"]} iconXmldata={st.image}
selected={(this.props.currentAppSettings as AppSettings).AutoFillSettings.EnableThumbnail?"Yes":"No"}
isDisabled={((this.props.currentAppSettings as AppSettings).General.EnableAutoFill==false)
||((this.props.currentAppSettings as AppSettings).Legacy.UseLegacyMode==true)}
onSelectionChanged={null} />
<MiMenuItem tilte={"File name source"} values={["og-title","description","title" ]} iconXmldata={st.titleFelds}
selected={(this.props.currentAppSettings as AppSettings).AutoFillSettings.PreferedNameSource}
isDisabled={((this.props.currentAppSettings as AppSettings).General.EnableAutoFill==false)
||((this.props.currentAppSettings as AppSettings).Legacy.UseLegacyMode==true)}
onSelectionChanged={((val)=>
this.props.onSettingsChanged({AutoFillSettings:{PreferedNameSource:val}}as AppSettings)).bind(this)}
/>
<MiMenuItem tilte={"Output location"} values={["Downloads","YVDLFolder"]} iconXmldata={st.folder}
selected={(this.props.currentAppSettings as AppSettings).AutoFillSettings.OutputLocation}
isDisabled={false}
onSelectionChanged={((val)=>
this.props.onSettingsChanged({AutoFillSettings:{OutputLocation :val=="Downloads"?"Downloads":"YVDLFolder"}}as AppSettings)).bind(this)}
/>
<MiMenuGroupHeader tilte={"Advanced"} />
<MiMenuItem tilte={"Download streams first"} values={["Yes","No"]} isParent={false} iconXmldata={st.saveAlt}
isDisabled={(this.props.currentAppSettings as AppSettings).Legacy.UseLegacyMode==true}
onSelectionChanged={null}
/>
<MiMenuItem tilte={"Video codec"} values={["Copy","h264"]} isParent={false} iconXmldata={st.tune}
isDisabled={(this.props.currentAppSettings as AppSettings).Legacy.UseLegacyMode==true}
onSelectionChanged={null}
/>
</ScrollView>
{ false&& <View style={{alignSelf:"flex-start",marginLeft:20,flexDirection:"row",alignContent:"center",alignItems:"center"}}>
<Text style={{color:"#aaa", marginRight:4, fontSize:12}}>Audio format: </Text>
</View>}
{false&&<View style={[twoHalfsWraper, { marginTop: 24 }]}>
<View style={HalfSection}>
<ButtonPretty Wraper_rest_color={Palette.appBackground}
iconFirst
spanStyle={{ fontFamily: "sans-serif-light", color: "white" }}
touchableHighlightStyle={{ alignSelf: "flex-start", marginLeft: 8, marginBottom: 11 }}
style={{ elevation: 0, flexDirection: "row-reverse" }} iconChild
iconMiProps={{ xmldata: st.mi_cleaner, color: "steelblue" }} caption="Cleaner">
</ButtonPretty>
</View>
<View style={HalfSection}>
</View>
</View>}
</View>
</Animated.View>
)
}
}