Proyectos de Subversion Iphone Microlearning - Inconcert

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 17
Línea 20... Línea 20...
20
 
20
 
21
    var body: some View {
21
    var body: some View {
22
        VStack(spacing: 0) {
22
        VStack(spacing: 0) {
23
                HStack {
23
                HStack {
24
                    Text(Config.LANG_POST_COMMENT_COMMENT_LABEL)
24
                    Text(Config.LANG_POST_COMMENT_COMMENT_LABEL)
25
                        .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_SIGNIN_TEXTFIELD_LABEL))
25
                        .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_TEXTFIELD_LABEL))
-
 
26
                        Spacer()
26
                        Spacer()
27
                }
27
                }.padding(.leading, 16)
28
                .padding(.leading, 16)
28
                
29
    
29
                HStack {
30
                HStack {
30
                    
31
                
31
                    MultilineTextView(text: $comment)
32
                    MultilineTextView(text: $comment)
32
                        .frame(
33
                        .frame(
33
                            minWidth: UIScreen.main.bounds.width,
34
                            minWidth: UIScreen.main.bounds.width - 32,
34
                            maxWidth: UIScreen.main.bounds.width,
35
                            maxWidth: UIScreen.main.bounds.width - 32,
-
 
36
                            minHeight: 100,
35
                            minHeight: 100,
37
                            maxHeight: 100)
36
                            maxHeight: 100)        .overlay(RoundedRectangle(cornerRadius: 5).stroke(
38
                            .overlay(RoundedRectangle(cornerRadius: 5).stroke(
37
                            Color ("color_textfield_border" )
39
                            Color ("color_textfield_border" )
Línea -... Línea 40...
-
 
40
                        ))
38
                        ))
41
                    
39
                    
42
                }
40
                } .padding(.leading, 16)
43
                .padding(.leading, 16)
-
 
44
                .padding(.trailing, 16)
Línea -... Línea 45...
-
 
45
                .padding(.top, comment.isEmpty ? 10 : 2)
41
                .padding(.trailing, 16)
46
            
42
                .padding(.top, comment.isEmpty ? 10 : 2)
47
                
43
                
48
 
Línea 44... Línea 49...
44
            if   !capsuleModel.linkComments.trimingLeadingSpaces().isEmpty && comment.trimingLeadingSpaces().isEmpty {
49
            if   !capsuleModel.linkComments.trimingLeadingSpaces().isEmpty && comment.trimingLeadingSpaces().isEmpty {
45
                    HStack {
50
                    HStack {
46
                        Spacer()
51
                        Spacer()
Línea 47... Línea 52...
47
                     
52
                     
48
                        Text(Config.LANG_POST_COMMENT_ERROR_COMMENT_FIELD)
53
                        Text(Config.LANG_POST_COMMENT_ERROR_COMMENT_FIELD)
49
                        .foregroundColor(.red)
54
                        .foregroundColor(.red)
50
                            .font(Font.custom(Config.FONT_NAME_REGULAR, size: 11))
55
                        .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_TEXTFIELD_ERROR))
-
 
56
                     
-
 
57
                    }
Línea 51... Línea 58...
51
                     
58
                    .padding(.top, 5)
52
                    }
59
                    .padding(.trailing, 16)
53
                    .padding(.top, 5)
60
                }
54
                    .padding(.trailing, 16)
61
            
-
 
62
         
55
                }
63
                
56
                
64
                HStack {
-
 
65
                    Text(Config.LANG_POST_COMMENT_RATING_LABEL)
Línea -... Línea 66...
-
 
66
                        .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_TEXTFIELD_LABEL))
57
                HStack {
67
                        Spacer()
58
                    Text(Config.LANG_POST_COMMENT_RATING_LABEL)
68
                }
Línea -... Línea 69...
-
 
69
                .padding(.leading, 16)
59
                        .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_SIGNIN_TEXTFIELD_LABEL))
70
                .padding(.top, 10)
60
                        Spacer()
71
        
-
 
72
                
Línea 61... Línea -...
61
                }.padding(.leading, 16)
-
 
-
 
73
          
Línea -... Línea 74...
-
 
74
                HStack {
62
                .padding(.top, 10)
75
                    Slider(value: self.$rating, in: 1...5, step: 1)
63
                
76
                    
64
                HStack {
77
             
-
 
78
                    FiveStarView(rating: Decimal(rating), color: Color("color_capsule_list_item_star_foreground"), backgroundColor: Color("color_capsule_list_item_star_background"))
Línea 65... Línea 79...
65
                    Slider(value: self.$rating, in: 1...5, step: 1)
79
                        .frame(width: /*@START_MENU_TOKEN@*/100/*@END_MENU_TOKEN@*/, height: 16, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
66
                    
-
 
-
 
80
                        .padding(.leading, 8)
67
             
81
                        .padding(.trailing, 8)
68
                    FiveStarView(rating: Decimal(rating), color: Color("color_capsule_list_item_star_foreground"), backgroundColor: Color("color_capsule_list_item_star_background"))               .frame(width: /*@START_MENU_TOKEN@*/100/*@END_MENU_TOKEN@*/, height: 16, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
82
                    
69
                        .padding(.leading, 8)
83
                   
70
                    
84
                    
Línea 87... Línea 101...
87
                            .border(Color( "color_button_dark_border"), width: Config.BUTTON_BORDER_SIZE)
101
                            .border(Color( "color_button_dark_border"), width: Config.BUTTON_BORDER_SIZE)
88
                            .cornerRadius(Config.BUTTON_BORDER_RADIUS)
102
                            .cornerRadius(Config.BUTTON_BORDER_RADIUS)
Línea 89... Línea 103...
89
                        
103
                        
Línea -... Línea 104...
-
 
104
                    })
90
                    })
105
  
91
  
106
                }
92
                }                  .padding(.top, 16)
107
                .padding(.top, 16)
-
 
108
                /*.padding(.leading, 16)
Línea 93... Línea 109...
93
                .padding(.leading, 16)
109
                .padding(.trailing, 16)*/
94
                .padding(.trailing, 16)
110
            
Línea 95... Línea 111...
95
                
111
                
Línea 119... Línea 135...
119
    }
135
    }
120
}
136
}
Línea 121... Línea -...
121
 
-
 
122
 
137
 
123
 
138
 
Línea 124... Línea 139...
124
 
139
 
125
struct MultilineTextView: UIViewRepresentable {
140
struct MultilineTextView: UIViewRepresentable {
Línea 132... Línea 147...
132
            UIColor(Color("color_textfield_background"))
147
            UIColor(Color("color_textfield_background"))
Línea 133... Línea 148...
133
        
148
        
134
        view.textColor = UIColor(Color("color_textfield_foreground"))
149
        view.textColor = UIColor(Color("color_textfield_foreground"))
135
        view.autocapitalizationType = .none
150
        view.autocapitalizationType = .none
-
 
151
        view.autocorrectionType = .no
-
 
152
        view.keyboardType = .alphabet
-
 
153
        view.keyboardAppearance = .default
136
        view.autocorrectionType = .no
154
        view.returnKeyType = .done
Línea 137... Línea 155...
137
        view.font = UIFont(name: Config.FONT_NAME_REGULAR, size: 12)
155
        view.font = UIFont(name: Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_TEXTFIELD)
138
 
156
 
139
 
157
 
-
 
158
        view.isScrollEnabled = true
Línea 140... Línea 159...
140
        view.isScrollEnabled = true
159
        view.isEditable = true
141
        view.isEditable = true
160
        view.isUserInteractionEnabled = true
Línea 142... Línea 161...
142
        view.isUserInteractionEnabled = true
161
        view
Línea 158... Línea 177...
158
        init(_ uiTextView: MultilineTextView) {
177
        init(_ uiTextView: MultilineTextView) {
159
            self.parent = uiTextView
178
            self.parent = uiTextView
160
        }
179
        }
Línea 161... Línea 180...
161
 
180
 
-
 
181
        func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
-
 
182
           
-
 
183
            if("\n" == text) {
-
 
184
                textView.resignFirstResponder()
-
 
185
                return false
-
 
186
            }
162
        func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
187
            
163
            return true
188
            return true
Línea 164... Línea 189...
164
        }
189
        }
165
 
190
 
166
        func textViewDidChange(_ textView: UITextView) {
191
        func textViewDidChange(_ textView: UITextView) {
-
 
192
            self.parent.text = textView.text
167
            self.parent.text = textView.text
193
        }
168
        }
194