-
Notifications
You must be signed in to change notification settings - Fork 1
/
signinscreen.kv
168 lines (164 loc) · 7.54 KB
/
signinscreen.kv
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
<SignInScreen>:
GridLayout:
cols: 2
GridLayout:
cols: 1
canvas.before:
Color:
rgb:(255,255,255)
Rectangle:
size: self.size
pos: self.pos
Image:
source: "logo.png"
FloatLayout:
text: ""
hint_text: ""
password: False
bg_color: (0,0,0,1) #app.login_primary_color
highlight_color1: (1,0,0,1) #app.login_secondary_color
highlight_color2: (0,0,1,1) #app.login_tertiary_color
canvas.before:
Color:
rgba: 0, 0.584, 1,1
Rectangle:
pos: self.pos
size: self.size
ThemedButton:
size_hint: .4, .05
pos_hint: {"center_x": .5, "top": .35}
text: "[u]Create new account[/u]"
bg_color: (1,1,1,0)
color: root.parent.parent.secondary_color if root.parent else (0,0,0,1)
on_release:
root.parent.current = "create_account_screen"
root.parent.parent.ids.create_account_screen.ids.email.text = email.text
root.parent.parent.ids.create_account_screen.ids.password.text = password.text
TextInput:
id: email
size_hint: .7 ,.08
pos_hint: {"top": .7, "right": 0.95}
multiline: False
focus: True
bg_color: (1,1,1,1)
highlight_color1: root.parent.parent.secondary_color if root.parent else (0,0,0,1)
highlight_color2: root.parent.parent.tertiary_color if root.parent else (0,0,0,1)
bottom_color: self.highlight_color1
on_text_validate:
password.focus = True
write_tab: False
padding: 7, self.height / 2.0 - (self.line_height / 2.0) * len(self._lines)
canvas.before:
Color:
rgba: self.bottom_color if self.bottom_color else (0,0,0,1)
Rectangle:
size: (self.size[0], self.size[1]/15.)
pos: self.pos
on_focus:
self.bottom_color = self.highlight_color2 if self.focused else self.highlight_color1
Animation(animated_center_y=(0.68 if (self.focused) else 0.65)).start(the_label)
Label:
id: the_label
color: (1,0,0,1)
text: "email"
valign: "middle"
size_hint: None, None
size: self.texture_size
animated_center_y: .65
animated_x: .93
pos_hint: {"center_y": self.animated_center_y, "right": self.animated_x}
TextInput:
id: password
size_hint: .7 ,.08
pos_hint: {"center_x": .6, "top": .575}
password: True
multiline: False
write_tab: False
bg_color: (1,1,1,1)
padding: 7, self.height / 2.0 - (self.line_height / 2.0) * len(self._lines)
highlight_color1: root.parent.parent.secondary_color if root.parent else (0,0,0,1)
highlight_color2: root.parent.parent.tertiary_color if root.parent else (0,0,0,1)
on_text_validate:
root.parent.parent.sign_in(email.text, password.text)
Animation(opacity=0, duration=0.5).start(message)
sign_in_button.opacity = 0
sign_in_button.disabled = True
root.parent.parent.display_loading_screen()
canvas.before:
Color:
rgba: self.bottom_color if self.bottom_color else (0,0,0,1)
Rectangle:
size: (self.size[0], self.size[1]/15.)
pos: self.pos
on_focus:
self.bottom_color = self.highlight_color2 if self.focused else self.highlight_color1
Animation(animated_center_y=(0.55 if (self.focused) else 0.52)).start(the_label1)
Label:
id: the_label1
color: (1,0,0,1)
text: "password"
size_hint: None, None
size: self.texture_size
animated_center_y: .52
animated_x: .93
pos_hint: {"center_y": self.animated_center_y, "right": self.animated_x}
ThemedButton:
text: "[u]Google Sign[/u]"
size_hint: .4 ,.05
pos_hint: {"center_x": .5, "top": .28}
bg_color: (0.976, 0.165, 0.976,1)
color: 1,1,1,1
on_release:
# Need to refer to the FirebaseLoginScreen
root.parent.parent.google_sign_in()
Animation(opacity=0, duration=0.5).start(message)
sign_in_button.opacity = 0
sign_in_button.disabled = True
# root.parent.parent.display_loading_screen()
ThemedButton:
id: signin
markup: True
text: "[u]Sign In[/u]"
size_hint: .4 ,.05
pos_hint: {"center_x": .5, "top": .42}
bg_color: (0.114, 0.443, 1,1)
color: 1,1,1,1
on_release:
# Need to refer to the FirebaseLoginScreen
root.parent.parent.sign_in(email.text, password.text)
Animation(opacity=0, duration=0.5).start(message)
sign_in_button.opacity = 0
sign_in_button.disabled = True
root.parent.parent.display_loading_screen()
ThemedMessage:
id: message
size_hint: .9 ,.1
pos_hint: {"center_x": .5, "center_y": .1}
opacity: 0
bg_color: (root.parent.parent.primary_color[:3] + [.7] if (type(root.parent.parent.primary_color) != tuple) else root.parent.parent.primary_color[:3] + tuple([.7])) if root.parent else (0,0,0,1)
color: root.parent.parent.secondary_color if root.parent else (0,0,0,1)
on_text:
Animation(opacity=1, duration=0.5).start(self)
ThemedButton:
id: sign_in_button
text: "[u]Sign up[/u]"
size_hint: .2 ,.05
pos_hint: {"right": .85, "center_y": .1}
opacity: 0
disabled: True
bg_color: (0,0,0,0)# root.parent.parent.primary_color if root.parent else (0,0,0,1)
color: root.parent.parent.secondary_color if root.parent else (0,0,0,1)
on_release:
root.parent.current = "create_account_screen"
root.parent.parent.ids.create_account_screen.ids.email.text = email.text
root.parent.parent.ids.create_account_screen.ids.password.text = password.text
Label:
text: "Email:"
font_size: 18
background_color: 1,1,1,1
pos_hint: {"center_x": .15, "top":1.15}
Label:
text: "Password:"
font_size: 18
background_color: 1,1,1,1
pos_hint: {"center_x": .148, "top":1.03}