Commit df4a49f76c938e9fed8e03343da230b0855f71c5
1 parent
c1c9b23894
Exists in
master
15092020 1607
Showing
73 changed files
with
3098 additions
and
2618 deletions
Show diff stats
.idea/codeStyles/Project.xml
1 | <component name="ProjectCodeStyleConfiguration"> | 1 | <component name="ProjectCodeStyleConfiguration"> |
2 | <code_scheme name="Project" version="173"> | 2 | <code_scheme name="Project" version="173"> |
3 | <DBN-PSQL> | ||
4 | <case-options enabled="true"> | ||
5 | <option name="KEYWORD_CASE" value="lower" /> | ||
6 | <option name="FUNCTION_CASE" value="lower" /> | ||
7 | <option name="PARAMETER_CASE" value="lower" /> | ||
8 | <option name="DATATYPE_CASE" value="lower" /> | ||
9 | <option name="OBJECT_CASE" value="preserve" /> | ||
10 | </case-options> | ||
11 | <formatting-settings enabled="false" /> | ||
12 | </DBN-PSQL> | ||
13 | <DBN-SQL> | ||
14 | <case-options enabled="true"> | ||
15 | <option name="KEYWORD_CASE" value="lower" /> | ||
16 | <option name="FUNCTION_CASE" value="lower" /> | ||
17 | <option name="PARAMETER_CASE" value="lower" /> | ||
18 | <option name="DATATYPE_CASE" value="lower" /> | ||
19 | <option name="OBJECT_CASE" value="preserve" /> | ||
20 | </case-options> | ||
21 | <formatting-settings enabled="false"> | ||
22 | <option name="STATEMENT_SPACING" value="one_line" /> | ||
23 | <option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" /> | ||
24 | <option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" /> | ||
25 | </formatting-settings> | ||
26 | </DBN-SQL> | ||
3 | <JetCodeStyleSettings> | 27 | <JetCodeStyleSettings> |
4 | <option name="PACKAGES_TO_USE_STAR_IMPORTS"> | 28 | <option name="PACKAGES_TO_USE_STAR_IMPORTS"> |
5 | <value> | 29 | <value> |
6 | <package name="java.util" alias="false" withSubpackages="false" /> | 30 | <package name="java.util" alias="false" withSubpackages="false" /> |
7 | <package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" /> | 31 | <package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" /> |
8 | <package name="io.ktor" alias="false" withSubpackages="true" /> | 32 | <package name="io.ktor" alias="false" withSubpackages="true" /> |
9 | </value> | 33 | </value> |
10 | </option> | 34 | </option> |
11 | <option name="PACKAGES_IMPORT_LAYOUT"> | 35 | <option name="PACKAGES_IMPORT_LAYOUT"> |
12 | <value> | 36 | <value> |
13 | <package name="" alias="false" withSubpackages="true" /> | 37 | <package name="" alias="false" withSubpackages="true" /> |
14 | <package name="java" alias="false" withSubpackages="true" /> | 38 | <package name="java" alias="false" withSubpackages="true" /> |
15 | <package name="javax" alias="false" withSubpackages="true" /> | 39 | <package name="javax" alias="false" withSubpackages="true" /> |
16 | <package name="kotlin" alias="false" withSubpackages="true" /> | 40 | <package name="kotlin" alias="false" withSubpackages="true" /> |
17 | <package name="" alias="true" withSubpackages="true" /> | 41 | <package name="" alias="true" withSubpackages="true" /> |
18 | </value> | 42 | </value> |
19 | </option> | 43 | </option> |
20 | <option name="IF_RPAREN_ON_NEW_LINE" value="false" /> | 44 | <option name="IF_RPAREN_ON_NEW_LINE" value="false" /> |
21 | <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> | 45 | <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> |
22 | </JetCodeStyleSettings> | 46 | </JetCodeStyleSettings> |
23 | <codeStyleSettings language="XML"> | 47 | <codeStyleSettings language="XML"> |
24 | <indentOptions> | 48 | <indentOptions> |
25 | <option name="CONTINUATION_INDENT_SIZE" value="4" /> | 49 | <option name="CONTINUATION_INDENT_SIZE" value="4" /> |
26 | </indentOptions> | 50 | </indentOptions> |
27 | <arrangement> | 51 | <arrangement> |
28 | <rules> | 52 | <rules> |
29 | <section> | 53 | <section> |
30 | <rule> | 54 | <rule> |
31 | <match> | 55 | <match> |
32 | <AND> | 56 | <AND> |
33 | <NAME>xmlns:android</NAME> | 57 | <NAME>xmlns:android</NAME> |
34 | <XML_ATTRIBUTE /> | 58 | <XML_ATTRIBUTE /> |
35 | <XML_NAMESPACE>^$</XML_NAMESPACE> | 59 | <XML_NAMESPACE>^$</XML_NAMESPACE> |
36 | </AND> | 60 | </AND> |
37 | </match> | 61 | </match> |
38 | </rule> | 62 | </rule> |
39 | </section> | 63 | </section> |
40 | <section> | 64 | <section> |
41 | <rule> | 65 | <rule> |
42 | <match> | 66 | <match> |
43 | <AND> | 67 | <AND> |
44 | <NAME>xmlns:.*</NAME> | 68 | <NAME>xmlns:.*</NAME> |
45 | <XML_ATTRIBUTE /> | 69 | <XML_ATTRIBUTE /> |
46 | <XML_NAMESPACE>^$</XML_NAMESPACE> | 70 | <XML_NAMESPACE>^$</XML_NAMESPACE> |
47 | </AND> | 71 | </AND> |
48 | </match> | 72 | </match> |
49 | <order>BY_NAME</order> | 73 | <order>BY_NAME</order> |
50 | </rule> | 74 | </rule> |
51 | </section> | 75 | </section> |
52 | <section> | 76 | <section> |
53 | <rule> | 77 | <rule> |
54 | <match> | 78 | <match> |
55 | <AND> | 79 | <AND> |
56 | <NAME>.*:id</NAME> | 80 | <NAME>.*:id</NAME> |
57 | <XML_ATTRIBUTE /> | 81 | <XML_ATTRIBUTE /> |
58 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | 82 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> |
59 | </AND> | 83 | </AND> |
60 | </match> | 84 | </match> |
61 | </rule> | 85 | </rule> |
62 | </section> | 86 | </section> |
63 | <section> | 87 | <section> |
64 | <rule> | 88 | <rule> |
65 | <match> | 89 | <match> |
66 | <AND> | 90 | <AND> |
67 | <NAME>.*:name</NAME> | 91 | <NAME>.*:name</NAME> |
68 | <XML_ATTRIBUTE /> | 92 | <XML_ATTRIBUTE /> |
69 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | 93 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> |
70 | </AND> | 94 | </AND> |
71 | </match> | 95 | </match> |
72 | </rule> | 96 | </rule> |
73 | </section> | 97 | </section> |
74 | <section> | 98 | <section> |
75 | <rule> | 99 | <rule> |
76 | <match> | 100 | <match> |
77 | <AND> | 101 | <AND> |
78 | <NAME>name</NAME> | 102 | <NAME>name</NAME> |
79 | <XML_ATTRIBUTE /> | 103 | <XML_ATTRIBUTE /> |
80 | <XML_NAMESPACE>^$</XML_NAMESPACE> | 104 | <XML_NAMESPACE>^$</XML_NAMESPACE> |
81 | </AND> | 105 | </AND> |
82 | </match> | 106 | </match> |
83 | </rule> | 107 | </rule> |
84 | </section> | 108 | </section> |
85 | <section> | 109 | <section> |
86 | <rule> | 110 | <rule> |
87 | <match> | 111 | <match> |
88 | <AND> | 112 | <AND> |
89 | <NAME>style</NAME> | 113 | <NAME>style</NAME> |
90 | <XML_ATTRIBUTE /> | 114 | <XML_ATTRIBUTE /> |
91 | <XML_NAMESPACE>^$</XML_NAMESPACE> | 115 | <XML_NAMESPACE>^$</XML_NAMESPACE> |
92 | </AND> | 116 | </AND> |
93 | </match> | 117 | </match> |
94 | </rule> | 118 | </rule> |
95 | </section> | 119 | </section> |
96 | <section> | 120 | <section> |
97 | <rule> | 121 | <rule> |
98 | <match> | 122 | <match> |
99 | <AND> | 123 | <AND> |
100 | <NAME>.*</NAME> | 124 | <NAME>.*</NAME> |
101 | <XML_ATTRIBUTE /> | 125 | <XML_ATTRIBUTE /> |
102 | <XML_NAMESPACE>^$</XML_NAMESPACE> | 126 | <XML_NAMESPACE>^$</XML_NAMESPACE> |
103 | </AND> | 127 | </AND> |
104 | </match> | 128 | </match> |
105 | <order>BY_NAME</order> | 129 | <order>BY_NAME</order> |
106 | </rule> | 130 | </rule> |
107 | </section> | 131 | </section> |
108 | <section> | 132 | <section> |
109 | <rule> | 133 | <rule> |
110 | <match> | 134 | <match> |
111 | <AND> | 135 | <AND> |
112 | <NAME>.*</NAME> | 136 | <NAME>.*</NAME> |
113 | <XML_ATTRIBUTE /> | 137 | <XML_ATTRIBUTE /> |
114 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | 138 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> |
115 | </AND> | 139 | </AND> |
116 | </match> | 140 | </match> |
117 | <order>ANDROID_ATTRIBUTE_ORDER</order> | 141 | <order>ANDROID_ATTRIBUTE_ORDER</order> |
118 | </rule> | 142 | </rule> |
119 | </section> | 143 | </section> |
120 | <section> | 144 | <section> |
121 | <rule> | 145 | <rule> |
122 | <match> | 146 | <match> |
123 | <AND> | 147 | <AND> |
124 | <NAME>.*</NAME> | 148 | <NAME>.*</NAME> |
125 | <XML_ATTRIBUTE /> | 149 | <XML_ATTRIBUTE /> |
126 | <XML_NAMESPACE>.*</XML_NAMESPACE> | 150 | <XML_NAMESPACE>.*</XML_NAMESPACE> |
127 | </AND> | 151 | </AND> |
128 | </match> | 152 | </match> |
129 | <order>BY_NAME</order> | 153 | <order>BY_NAME</order> |
130 | </rule> | 154 | </rule> |
131 | </section> | 155 | </section> |
132 | </rules> | 156 | </rules> |
133 | </arrangement> | 157 | </arrangement> |
134 | </codeStyleSettings> | 158 | </codeStyleSettings> |
135 | <codeStyleSettings language="kotlin"> | 159 | <codeStyleSettings language="kotlin"> |
136 | <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> | 160 | <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> |
137 | <option name="RIGHT_MARGIN" value="200" /> | 161 | <option name="RIGHT_MARGIN" value="200" /> |
138 | <option name="KEEP_LINE_BREAKS" value="false" /> | 162 | <option name="KEEP_LINE_BREAKS" value="false" /> |
139 | <option name="ALIGN_MULTILINE_PARAMETERS" value="false" /> | 163 | <option name="ALIGN_MULTILINE_PARAMETERS" value="false" /> |
140 | <option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="false" /> | 164 | <option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="false" /> |
141 | <option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="false" /> | 165 | <option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="false" /> |
142 | <option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="false" /> | 166 | <option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="false" /> |
143 | <option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="false" /> | 167 | <option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="false" /> |
144 | <option name="WRAP_ON_TYPING" value="1" /> | 168 | <option name="WRAP_ON_TYPING" value="1" /> |
145 | </codeStyleSettings> | 169 | </codeStyleSettings> |
146 | </code_scheme> | 170 | </code_scheme> |
147 | </component> | 171 | </component> |
.idea/dbnavigator.xml
File was created | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <project version="4"> | ||
3 | <component name="DBNavigator.Project.DataEditorManager"> | ||
4 | <record-view-column-sorting-type value="BY_INDEX" /> | ||
5 | <value-preview-text-wrapping value="false" /> | ||
6 | <value-preview-pinned value="false" /> | ||
7 | </component> | ||
8 | <component name="DBNavigator.Project.DataExportManager"> | ||
9 | <export-instructions> | ||
10 | <create-header value="true" /> | ||
11 | <quote-values-containing-separator value="true" /> | ||
12 | <quote-all-values value="false" /> | ||
13 | <value-separator value="" /> | ||
14 | <file-name value="" /> | ||
15 | <file-location value="" /> | ||
16 | <scope value="GLOBAL" /> | ||
17 | <destination value="FILE" /> | ||
18 | <format value="EXCEL" /> | ||
19 | <charset value="windows-1252" /> | ||
20 | </export-instructions> | ||
21 | </component> | ||
22 | <component name="DBNavigator.Project.DatabaseBrowserManager"> | ||
23 | <autoscroll-to-editor value="false" /> | ||
24 | <autoscroll-from-editor value="true" /> | ||
25 | <show-object-properties value="true" /> | ||
26 | <loaded-nodes /> | ||
27 | </component> | ||
28 | <component name="DBNavigator.Project.DatabaseConsoleManager"> | ||
29 | <connection id="3918bd62-034e-4b46-81a6-a20fcdcc253d"> | ||
30 | <console name="Connection" type="STANDARD" schema="" session="Main"><![CDATA[select * from ServeInv]]></console> | ||
31 | </connection> | ||
32 | </component> | ||
33 | <component name="DBNavigator.Project.DatabaseFileManager"> | ||
34 | <open-files /> | ||
35 | </component> | ||
36 | <component name="DBNavigator.Project.DatabaseSessionManager"> | ||
37 | <connection id="3918bd62-034e-4b46-81a6-a20fcdcc253d" /> | ||
38 | </component> | ||
39 | <component name="DBNavigator.Project.EditorStateManager"> | ||
40 | <last-used-providers /> | ||
41 | </component> | ||
42 | <component name="DBNavigator.Project.MethodExecutionManager"> | ||
43 | <method-browser /> | ||
44 | <execution-history> | ||
45 | <group-entries value="true" /> | ||
46 | <execution-inputs /> | ||
47 | </execution-history> | ||
48 | <argument-values-cache /> | ||
49 | </component> | ||
50 | <component name="DBNavigator.Project.ObjectDependencyManager"> | ||
51 | <last-used-dependency-type value="INCOMING" /> | ||
52 | </component> | ||
53 | <component name="DBNavigator.Project.ObjectQuickFilterManager"> | ||
54 | <last-used-operator value="EQUAL" /> | ||
55 | <filters /> | ||
56 | </component> | ||
57 | <component name="DBNavigator.Project.ScriptExecutionManager" clear-outputs="true"> | ||
58 | <recently-used-interfaces /> | ||
59 | </component> | ||
60 | <component name="DBNavigator.Project.Settings"> | ||
61 | <connections> | ||
62 | <connection id="3918bd62-034e-4b46-81a6-a20fcdcc253d" active="true"> | ||
63 | <database> | ||
64 | <name value="Connection" /> | ||
65 | <description value="" /> | ||
66 | <database-type value="SQLITE" /> | ||
67 | <config-type value="BASIC" /> | ||
68 | <database-version value="3.21" /> | ||
69 | <driver-source value="BUILTIN" /> | ||
70 | <driver-library value="" /> | ||
71 | <driver value="" /> | ||
72 | <url-type value="FILE" /> | ||
73 | <host value="localhost" /> | ||
74 | <port value="1234" /> | ||
75 | <database value="database" /> | ||
76 | <files> | ||
77 | <file path="C:\Users\mauricio sanchez\Desktop\DebInv-shm" schema="main" /> | ||
78 | </files> | ||
79 | <type value="NONE" /> | ||
80 | <user value="" /> | ||
81 | <deprecated-pwd value="" /> | ||
82 | </database> | ||
83 | <properties> | ||
84 | <auto-commit value="false" /> | ||
85 | </properties> | ||
86 | <ssh-settings> | ||
87 | <active value="false" /> | ||
88 | <proxy-host value="" /> | ||
89 | <proxy-port value="22" /> | ||
90 | <proxy-user value="" /> | ||
91 | <deprecated-proxy-pwd value="" /> | ||
92 | <auth-type value="PASSWORD" /> | ||
93 | <key-file value="" /> | ||
94 | <key-passphrase value="" /> | ||
95 | </ssh-settings> | ||
96 | <ssl-settings> | ||
97 | <active value="false" /> | ||
98 | <certificate-authority-file value="" /> | ||
99 | <client-certificate-file value="" /> | ||
100 | <client-key-file value="" /> | ||
101 | </ssl-settings> | ||
102 | <details> | ||
103 | <charset value="UTF-8" /> | ||
104 | <session-management value="true" /> | ||
105 | <ddl-file-binding value="true" /> | ||
106 | <database-logging value="false" /> | ||
107 | <connect-automatically value="true" /> | ||
108 | <restore-workspace value="true" /> | ||
109 | <restore-workspace-deep value="true" /> | ||
110 | <environment-type value="default" /> | ||
111 | <idle-time-to-disconnect value="30" /> | ||
112 | <idle-time-to-disconnect-pool value="5" /> | ||
113 | <credential-expiry-time value="10" /> | ||
114 | <max-connection-pool-size value="7" /> | ||
115 | <alternative-statement-delimiter value="" /> | ||
116 | </details> | ||
117 | <object-filters hide-empty-schemas="false" hide-pseudo-columns="false"> | ||
118 | <object-type-filter use-master-settings="true"> | ||
119 | <object-type name="SCHEMA" enabled="true" /> | ||
120 | <object-type name="USER" enabled="true" /> | ||
121 | <object-type name="ROLE" enabled="true" /> | ||
122 | <object-type name="PRIVILEGE" enabled="true" /> | ||
123 | <object-type name="CHARSET" enabled="true" /> | ||
124 | <object-type name="TABLE" enabled="true" /> | ||
125 | <object-type name="VIEW" enabled="true" /> | ||
126 | <object-type name="MATERIALIZED_VIEW" enabled="true" /> | ||
127 | <object-type name="NESTED_TABLE" enabled="true" /> | ||
128 | <object-type name="COLUMN" enabled="true" /> | ||
129 | <object-type name="INDEX" enabled="true" /> | ||
130 | <object-type name="CONSTRAINT" enabled="true" /> | ||
131 | <object-type name="DATASET_TRIGGER" enabled="true" /> | ||
132 | <object-type name="DATABASE_TRIGGER" enabled="true" /> | ||
133 | <object-type name="SYNONYM" enabled="true" /> | ||
134 | <object-type name="SEQUENCE" enabled="true" /> | ||
135 | <object-type name="PROCEDURE" enabled="true" /> | ||
136 | <object-type name="FUNCTION" enabled="true" /> | ||
137 | <object-type name="PACKAGE" enabled="true" /> | ||
138 | <object-type name="TYPE" enabled="true" /> | ||
139 | <object-type name="TYPE_ATTRIBUTE" enabled="true" /> | ||
140 | <object-type name="ARGUMENT" enabled="true" /> | ||
141 | <object-type name="DIMENSION" enabled="true" /> | ||
142 | <object-type name="CLUSTER" enabled="true" /> | ||
143 | <object-type name="DBLINK" enabled="true" /> | ||
144 | </object-type-filter> | ||
145 | <object-name-filters /> | ||
146 | </object-filters> | ||
147 | </connection> | ||
148 | </connections> | ||
149 | <browser-settings> | ||
150 | <general> | ||
151 | <display-mode value="TABBED" /> | ||
152 | <navigation-history-size value="100" /> | ||
153 | <show-object-details value="false" /> | ||
154 | </general> | ||
155 | <filters> | ||
156 | <object-type-filter> | ||
157 | <object-type name="SCHEMA" enabled="true" /> | ||
158 | <object-type name="USER" enabled="true" /> | ||
159 | <object-type name="ROLE" enabled="true" /> | ||
160 | <object-type name="PRIVILEGE" enabled="true" /> | ||
161 | <object-type name="CHARSET" enabled="true" /> | ||
162 | <object-type name="TABLE" enabled="true" /> | ||
163 | <object-type name="VIEW" enabled="true" /> | ||
164 | <object-type name="MATERIALIZED_VIEW" enabled="true" /> | ||
165 | <object-type name="NESTED_TABLE" enabled="true" /> | ||
166 | <object-type name="COLUMN" enabled="true" /> | ||
167 | <object-type name="INDEX" enabled="true" /> | ||
168 | <object-type name="CONSTRAINT" enabled="true" /> | ||
169 | <object-type name="DATASET_TRIGGER" enabled="true" /> | ||
170 | <object-type name="DATABASE_TRIGGER" enabled="true" /> | ||
171 | <object-type name="SYNONYM" enabled="true" /> | ||
172 | <object-type name="SEQUENCE" enabled="true" /> | ||
173 | <object-type name="PROCEDURE" enabled="true" /> | ||
174 | <object-type name="FUNCTION" enabled="true" /> | ||
175 | <object-type name="PACKAGE" enabled="true" /> | ||
176 | <object-type name="TYPE" enabled="true" /> | ||
177 | <object-type name="TYPE_ATTRIBUTE" enabled="true" /> | ||
178 | <object-type name="ARGUMENT" enabled="true" /> | ||
179 | <object-type name="DIMENSION" enabled="true" /> | ||
180 | <object-type name="CLUSTER" enabled="true" /> | ||
181 | <object-type name="DBLINK" enabled="true" /> | ||
182 | </object-type-filter> | ||
183 | </filters> | ||
184 | <sorting> | ||
185 | <object-type name="COLUMN" sorting-type="NAME" /> | ||
186 | <object-type name="FUNCTION" sorting-type="NAME" /> | ||
187 | <object-type name="PROCEDURE" sorting-type="NAME" /> | ||
188 | <object-type name="ARGUMENT" sorting-type="POSITION" /> | ||
189 | </sorting> | ||
190 | <default-editors> | ||
191 | <object-type name="VIEW" editor-type="SELECTION" /> | ||
192 | <object-type name="PACKAGE" editor-type="SELECTION" /> | ||
193 | <object-type name="TYPE" editor-type="SELECTION" /> | ||
194 | </default-editors> | ||
195 | </browser-settings> | ||
196 | <navigation-settings> | ||
197 | <lookup-filters> | ||
198 | <lookup-objects> | ||
199 | <object-type name="SCHEMA" enabled="true" /> | ||
200 | <object-type name="USER" enabled="false" /> | ||
201 | <object-type name="ROLE" enabled="false" /> | ||
202 | <object-type name="PRIVILEGE" enabled="false" /> | ||
203 | <object-type name="CHARSET" enabled="false" /> | ||
204 | <object-type name="TABLE" enabled="true" /> | ||
205 | <object-type name="VIEW" enabled="true" /> | ||
206 | <object-type name="MATERIALIZED VIEW" enabled="true" /> | ||
207 | <object-type name="NESTED TABLE" enabled="false" /> | ||
208 | <object-type name="COLUMN" enabled="false" /> | ||
209 | <object-type name="INDEX" enabled="true" /> | ||
210 | <object-type name="CONSTRAINT" enabled="true" /> | ||
211 | <object-type name="DATASET TRIGGER" enabled="true" /> | ||
212 | <object-type name="DATABASE TRIGGER" enabled="true" /> | ||
213 | <object-type name="SYNONYM" enabled="false" /> | ||
214 | <object-type name="SEQUENCE" enabled="true" /> | ||
215 | <object-type name="PROCEDURE" enabled="true" /> | ||
216 | <object-type name="FUNCTION" enabled="true" /> | ||
217 | <object-type name="PACKAGE" enabled="true" /> | ||
218 | <object-type name="TYPE" enabled="true" /> | ||
219 | <object-type name="TYPE ATTRIBUTE" enabled="false" /> | ||
220 | <object-type name="ARGUMENT" enabled="false" /> | ||
221 | <object-type name="DIMENSION" enabled="false" /> | ||
222 | <object-type name="CLUSTER" enabled="false" /> | ||
223 | <object-type name="DBLINK" enabled="true" /> | ||
224 | </lookup-objects> | ||
225 | <force-database-load value="false" /> | ||
226 | <prompt-connection-selection value="true" /> | ||
227 | <prompt-schema-selection value="true" /> | ||
228 | </lookup-filters> | ||
229 | </navigation-settings> | ||
230 | <dataset-grid-settings> | ||
231 | <general> | ||
232 | <enable-zooming value="true" /> | ||
233 | <enable-column-tooltip value="true" /> | ||
234 | </general> | ||
235 | <sorting> | ||
236 | <nulls-first value="true" /> | ||
237 | <max-sorting-columns value="4" /> | ||
238 | </sorting> | ||
239 | <tracking-columns> | ||
240 | <columnNames value="" /> | ||
241 | <visible value="true" /> | ||
242 | <editable value="false" /> | ||
243 | </tracking-columns> | ||
244 | </dataset-grid-settings> | ||
245 | <dataset-editor-settings> | ||
246 | <text-editor-popup> | ||
247 | <active value="false" /> | ||
248 | <active-if-empty value="false" /> | ||
249 | <data-length-threshold value="100" /> | ||
250 | <popup-delay value="1000" /> | ||
251 | </text-editor-popup> | ||
252 | <values-actions-popup> | ||
253 | <show-popup-button value="true" /> | ||
254 | <element-count-threshold value="1000" /> | ||
255 | <data-length-threshold value="250" /> | ||
256 | </values-actions-popup> | ||
257 | <general> | ||
258 | <fetch-block-size value="100" /> | ||
259 | <fetch-timeout value="30" /> | ||
260 | <trim-whitespaces value="true" /> | ||
261 | <convert-empty-strings-to-null value="true" /> | ||
262 | <select-content-on-cell-edit value="true" /> | ||
263 | <large-value-preview-active value="true" /> | ||
264 | </general> | ||
265 | <filters> | ||
266 | <prompt-filter-dialog value="true" /> | ||
267 | <default-filter-type value="BASIC" /> | ||
268 | </filters> | ||
269 | <qualified-text-editor text-length-threshold="300"> | ||
270 | <content-types> | ||
271 | <content-type name="Text" enabled="true" /> | ||
272 | <content-type name="Properties" enabled="true" /> | ||
273 | <content-type name="XML" enabled="true" /> | ||
274 | <content-type name="DTD" enabled="true" /> | ||
275 | <content-type name="HTML" enabled="true" /> | ||
276 | <content-type name="XHTML" enabled="true" /> | ||
277 | <content-type name="Java" enabled="true" /> | ||
278 | <content-type name="SQL" enabled="true" /> | ||
279 | <content-type name="PL/SQL" enabled="true" /> | ||
280 | <content-type name="JSON" enabled="true" /> | ||
281 | <content-type name="JSON5" enabled="true" /> | ||
282 | <content-type name="Groovy" enabled="true" /> | ||
283 | <content-type name="AIDL" enabled="true" /> | ||
284 | <content-type name="YAML" enabled="true" /> | ||
285 | <content-type name="Manifest" enabled="true" /> | ||
286 | </content-types> | ||
287 | </qualified-text-editor> | ||
288 | <record-navigation> | ||
289 | <navigation-target value="VIEWER" /> | ||
290 | </record-navigation> | ||
291 | </dataset-editor-settings> | ||
292 | <code-editor-settings> | ||
293 | <general> | ||
294 | <show-object-navigation-gutter value="false" /> | ||
295 | <show-spec-declaration-navigation-gutter value="true" /> | ||
296 | <enable-spellchecking value="true" /> | ||
297 | <enable-reference-spellchecking value="false" /> | ||
298 | </general> | ||
299 | <confirmations> | ||
300 | <save-changes value="false" /> | ||
301 | <revert-changes value="true" /> | ||
302 | </confirmations> | ||
303 | </code-editor-settings> | ||
304 | <code-completion-settings> | ||
305 | <filters> | ||
306 | <basic-filter> | ||
307 | <filter-element type="RESERVED_WORD" id="keyword" selected="true" /> | ||
308 | <filter-element type="RESERVED_WORD" id="function" selected="true" /> | ||
309 | <filter-element type="RESERVED_WORD" id="parameter" selected="true" /> | ||
310 | <filter-element type="RESERVED_WORD" id="datatype" selected="true" /> | ||
311 | <filter-element type="RESERVED_WORD" id="exception" selected="true" /> | ||
312 | <filter-element type="OBJECT" id="schema" selected="true" /> | ||
313 | <filter-element type="OBJECT" id="role" selected="true" /> | ||
314 | <filter-element type="OBJECT" id="user" selected="true" /> | ||
315 | <filter-element type="OBJECT" id="privilege" selected="true" /> | ||
316 | <user-schema> | ||
317 | <filter-element type="OBJECT" id="table" selected="true" /> | ||
318 | <filter-element type="OBJECT" id="view" selected="true" /> | ||
319 | <filter-element type="OBJECT" id="materialized view" selected="true" /> | ||
320 | <filter-element type="OBJECT" id="index" selected="true" /> | ||
321 | <filter-element type="OBJECT" id="constraint" selected="true" /> | ||
322 | <filter-element type="OBJECT" id="trigger" selected="true" /> | ||
323 | <filter-element type="OBJECT" id="synonym" selected="false" /> | ||
324 | <filter-element type="OBJECT" id="sequence" selected="true" /> | ||
325 | <filter-element type="OBJECT" id="procedure" selected="true" /> | ||
326 | <filter-element type="OBJECT" id="function" selected="true" /> | ||
327 | <filter-element type="OBJECT" id="package" selected="true" /> | ||
328 | <filter-element type="OBJECT" id="type" selected="true" /> | ||
329 | <filter-element type="OBJECT" id="dimension" selected="true" /> | ||
330 | <filter-element type="OBJECT" id="cluster" selected="true" /> | ||
331 | <filter-element type="OBJECT" id="dblink" selected="true" /> | ||
332 | </user-schema> | ||
333 | <public-schema> | ||
334 | <filter-element type="OBJECT" id="table" selected="false" /> | ||
335 | <filter-element type="OBJECT" id="view" selected="false" /> | ||
336 | <filter-element type="OBJECT" id="materialized view" selected="false" /> | ||
337 | <filter-element type="OBJECT" id="index" selected="false" /> | ||
338 | <filter-element type="OBJECT" id="constraint" selected="false" /> | ||
339 | <filter-element type="OBJECT" id="trigger" selected="false" /> | ||
340 | <filter-element type="OBJECT" id="synonym" selected="false" /> | ||
341 | <filter-element type="OBJECT" id="sequence" selected="false" /> | ||
342 | <filter-element type="OBJECT" id="procedure" selected="false" /> | ||
343 | <filter-element type="OBJECT" id="function" selected="false" /> | ||
344 | <filter-element type="OBJECT" id="package" selected="false" /> | ||
345 | <filter-element type="OBJECT" id="type" selected="false" /> | ||
346 | <filter-element type="OBJECT" id="dimension" selected="false" /> | ||
347 | <filter-element type="OBJECT" id="cluster" selected="false" /> | ||
348 | <filter-element type="OBJECT" id="dblink" selected="false" /> | ||
349 | </public-schema> | ||
350 | <any-schema> | ||
351 | <filter-element type="OBJECT" id="table" selected="true" /> | ||
352 | <filter-element type="OBJECT" id="view" selected="true" /> | ||
353 | <filter-element type="OBJECT" id="materialized view" selected="true" /> | ||
354 | <filter-element type="OBJECT" id="index" selected="true" /> | ||
355 | <filter-element type="OBJECT" id="constraint" selected="true" /> | ||
356 | <filter-element type="OBJECT" id="trigger" selected="true" /> | ||
357 | <filter-element type="OBJECT" id="synonym" selected="true" /> | ||
358 | <filter-element type="OBJECT" id="sequence" selected="true" /> | ||
359 | <filter-element type="OBJECT" id="procedure" selected="true" /> | ||
360 | <filter-element type="OBJECT" id="function" selected="true" /> | ||
361 | <filter-element type="OBJECT" id="package" selected="true" /> | ||
362 | <filter-element type="OBJECT" id="type" selected="true" /> | ||
363 | <filter-element type="OBJECT" id="dimension" selected="true" /> | ||
364 | <filter-element type="OBJECT" id="cluster" selected="true" /> | ||
365 | <filter-element type="OBJECT" id="dblink" selected="true" /> | ||
366 | </any-schema> | ||
367 | </basic-filter> | ||
368 | <extended-filter> | ||
369 | <filter-element type="RESERVED_WORD" id="keyword" selected="true" /> | ||
370 | <filter-element type="RESERVED_WORD" id="function" selected="true" /> | ||
371 | <filter-element type="RESERVED_WORD" id="parameter" selected="true" /> | ||
372 | <filter-element type="RESERVED_WORD" id="datatype" selected="true" /> | ||
373 | <filter-element type="RESERVED_WORD" id="exception" selected="true" /> | ||
374 | <filter-element type="OBJECT" id="schema" selected="true" /> | ||
375 | <filter-element type="OBJECT" id="user" selected="true" /> | ||
376 | <filter-element type="OBJECT" id="role" selected="true" /> | ||
377 | <filter-element type="OBJECT" id="privilege" selected="true" /> | ||
378 | <user-schema> | ||
379 | <filter-element type="OBJECT" id="table" selected="true" /> | ||
380 | <filter-element type="OBJECT" id="view" selected="true" /> | ||
381 | <filter-element type="OBJECT" id="materialized view" selected="true" /> | ||
382 | <filter-element type="OBJECT" id="index" selected="true" /> | ||
383 | <filter-element type="OBJECT" id="constraint" selected="true" /> | ||
384 | <filter-element type="OBJECT" id="trigger" selected="true" /> | ||
385 | <filter-element type="OBJECT" id="synonym" selected="true" /> | ||
386 | <filter-element type="OBJECT" id="sequence" selected="true" /> | ||
387 | <filter-element type="OBJECT" id="procedure" selected="true" /> | ||
388 | <filter-element type="OBJECT" id="function" selected="true" /> | ||
389 | <filter-element type="OBJECT" id="package" selected="true" /> | ||
390 | <filter-element type="OBJECT" id="type" selected="true" /> | ||
391 | <filter-element type="OBJECT" id="dimension" selected="true" /> | ||
392 | <filter-element type="OBJECT" id="cluster" selected="true" /> | ||
393 | <filter-element type="OBJECT" id="dblink" selected="true" /> | ||
394 | </user-schema> | ||
395 | <public-schema> | ||
396 | <filter-element type="OBJECT" id="table" selected="true" /> | ||
397 | <filter-element type="OBJECT" id="view" selected="true" /> | ||
398 | <filter-element type="OBJECT" id="materialized view" selected="true" /> | ||
399 | <filter-element type="OBJECT" id="index" selected="true" /> | ||
400 | <filter-element type="OBJECT" id="constraint" selected="true" /> | ||
401 | <filter-element type="OBJECT" id="trigger" selected="true" /> | ||
402 | <filter-element type="OBJECT" id="synonym" selected="true" /> | ||
403 | <filter-element type="OBJECT" id="sequence" selected="true" /> | ||
404 | <filter-element type="OBJECT" id="procedure" selected="true" /> | ||
405 | <filter-element type="OBJECT" id="function" selected="true" /> | ||
406 | <filter-element type="OBJECT" id="package" selected="true" /> | ||
407 | <filter-element type="OBJECT" id="type" selected="true" /> | ||
408 | <filter-element type="OBJECT" id="dimension" selected="true" /> | ||
409 | <filter-element type="OBJECT" id="cluster" selected="true" /> | ||
410 | <filter-element type="OBJECT" id="dblink" selected="true" /> | ||
411 | </public-schema> | ||
412 | <any-schema> | ||
413 | <filter-element type="OBJECT" id="table" selected="true" /> | ||
414 | <filter-element type="OBJECT" id="view" selected="true" /> | ||
415 | <filter-element type="OBJECT" id="materialized view" selected="true" /> | ||
416 | <filter-element type="OBJECT" id="index" selected="true" /> | ||
417 | <filter-element type="OBJECT" id="constraint" selected="true" /> | ||
418 | <filter-element type="OBJECT" id="trigger" selected="true" /> | ||
419 | <filter-element type="OBJECT" id="synonym" selected="true" /> | ||
420 | <filter-element type="OBJECT" id="sequence" selected="true" /> | ||
421 | <filter-element type="OBJECT" id="procedure" selected="true" /> | ||
422 | <filter-element type="OBJECT" id="function" selected="true" /> | ||
423 | <filter-element type="OBJECT" id="package" selected="true" /> | ||
424 | <filter-element type="OBJECT" id="type" selected="true" /> | ||
425 | <filter-element type="OBJECT" id="dimension" selected="true" /> | ||
426 | <filter-element type="OBJECT" id="cluster" selected="true" /> | ||
427 | <filter-element type="OBJECT" id="dblink" selected="true" /> | ||
428 | </any-schema> | ||
429 | </extended-filter> | ||
430 | </filters> | ||
431 | <sorting enabled="true"> | ||
432 | <sorting-element type="RESERVED_WORD" id="keyword" /> | ||
433 | <sorting-element type="RESERVED_WORD" id="datatype" /> | ||
434 | <sorting-element type="OBJECT" id="column" /> | ||
435 | <sorting-element type="OBJECT" id="table" /> | ||
436 | <sorting-element type="OBJECT" id="view" /> | ||
437 | <sorting-element type="OBJECT" id="materialized view" /> | ||
438 | <sorting-element type="OBJECT" id="index" /> | ||
439 | <sorting-element type="OBJECT" id="constraint" /> | ||
440 | <sorting-element type="OBJECT" id="trigger" /> | ||
441 | <sorting-element type="OBJECT" id="synonym" /> | ||
442 | <sorting-element type="OBJECT" id="sequence" /> | ||
443 | <sorting-element type="OBJECT" id="procedure" /> | ||
444 | <sorting-element type="OBJECT" id="function" /> | ||
445 | <sorting-element type="OBJECT" id="package" /> | ||
446 | <sorting-element type="OBJECT" id="type" /> | ||
447 | <sorting-element type="OBJECT" id="dimension" /> | ||
448 | <sorting-element type="OBJECT" id="cluster" /> | ||
449 | <sorting-element type="OBJECT" id="dblink" /> | ||
450 | <sorting-element type="OBJECT" id="schema" /> | ||
451 | <sorting-element type="OBJECT" id="role" /> | ||
452 | <sorting-element type="OBJECT" id="user" /> | ||
453 | <sorting-element type="RESERVED_WORD" id="function" /> | ||
454 | <sorting-element type="RESERVED_WORD" id="parameter" /> | ||
455 | </sorting> | ||
456 | <format> | ||
457 | <enforce-code-style-case value="true" /> | ||
458 | </format> | ||
459 | </code-completion-settings> | ||
460 | <execution-engine-settings> | ||
461 | <statement-execution> | ||
462 | <fetch-block-size value="100" /> | ||
463 | <execution-timeout value="20" /> | ||
464 | <debug-execution-timeout value="600" /> | ||
465 | <focus-result value="false" /> | ||
466 | <prompt-execution value="false" /> | ||
467 | </statement-execution> | ||
468 | <script-execution> | ||
469 | <command-line-interfaces /> | ||
470 | <execution-timeout value="300" /> | ||
471 | </script-execution> | ||
472 | <method-execution> | ||
473 | <execution-timeout value="30" /> | ||
474 | <debug-execution-timeout value="600" /> | ||
475 | <parameter-history-size value="10" /> | ||
476 | </method-execution> | ||
477 | </execution-engine-settings> | ||
478 | <operation-settings> | ||
479 | <transactions> | ||
480 | <uncommitted-changes> | ||
481 | <on-project-close value="ASK" /> | ||
482 | <on-disconnect value="ASK" /> | ||
483 | <on-autocommit-toggle value="ASK" /> | ||
484 | </uncommitted-changes> | ||
485 | <multiple-uncommitted-changes> | ||
486 | <on-commit value="ASK" /> | ||
487 | <on-rollback value="ASK" /> | ||
488 | </multiple-uncommitted-changes> | ||
489 | </transactions> | ||
490 | <session-browser> | ||
491 | <disconnect-session value="ASK" /> | ||
492 | <kill-session value="ASK" /> | ||
493 | <reload-on-filter-change value="false" /> | ||
494 | </session-browser> | ||
495 | <compiler> | ||
496 | <compile-type value="KEEP" /> | ||
497 | <compile-dependencies value="ASK" /> | ||
498 | <always-show-controls value="false" /> | ||
499 | </compiler> | ||
500 | <debugger> | ||
501 | <debugger-type value="ASK" /> | ||
502 | <use-generic-runners value="true" /> | ||
503 | </debugger> | ||
504 | </operation-settings> | ||
505 | <ddl-file-settings> | ||
506 | <extensions> | ||
507 | <mapping file-type-id="VIEW" extensions="vw" /> | ||
508 | <mapping file-type-id="TRIGGER" extensions="trg" /> | ||
509 | <mapping file-type-id="PROCEDURE" extensions="prc" /> | ||
510 | <mapping file-type-id="FUNCTION" extensions="fnc" /> | ||
511 | <mapping file-type-id="PACKAGE" extensions="pkg" /> | ||
512 | <mapping file-type-id="PACKAGE_SPEC" extensions="pks" /> | ||
513 | <mapping file-type-id="PACKAGE_BODY" extensions="pkb" /> | ||
514 | <mapping file-type-id="TYPE" extensions="tpe" /> | ||
515 | <mapping file-type-id="TYPE_SPEC" extensions="tps" /> | ||
516 | <mapping file-type-id="TYPE_BODY" extensions="tpb" /> | ||
517 | </extensions> | ||
518 | <general> | ||
519 | <lookup-ddl-files value="true" /> | ||
520 | <create-ddl-files value="false" /> | ||
521 | <synchronize-ddl-files value="true" /> | ||
522 | <use-qualified-names value="false" /> | ||
523 | <make-scripts-rerunnable value="true" /> | ||
524 | </general> | ||
525 | </ddl-file-settings> | ||
526 | <general-settings> | ||
527 | <regional-settings> | ||
528 | <date-format value="MEDIUM" /> | ||
529 | <number-format value="UNGROUPED" /> | ||
530 | <locale value="SYSTEM_DEFAULT" /> | ||
531 | <use-custom-formats value="false" /> | ||
532 | </regional-settings> | ||
533 | <environment> | ||
534 | <environment-types> | ||
535 | <environment-type id="development" name="Development" description="Development environment" color="-2430209/-12296320" readonly-code="false" readonly-data="false" /> | ||
536 | <environment-type id="integration" name="Integration" description="Integration environment" color="-2621494/-12163514" readonly-code="true" readonly-data="false" /> | ||
537 | <environment-type id="production" name="Production" description="Productive environment" color="-11574/-10271420" readonly-code="true" readonly-data="true" /> | ||
538 | <environment-type id="other" name="Other" description="" color="-1576/-10724543" readonly-code="false" readonly-data="false" /> | ||
539 | </environment-types> | ||
540 | <visibility-settings> | ||
541 | <connection-tabs value="true" /> | ||
542 | <dialog-headers value="true" /> | ||
543 | <object-editor-tabs value="true" /> | ||
544 | <script-editor-tabs value="false" /> | ||
545 | <execution-result-tabs value="true" /> | ||
546 | </visibility-settings> | ||
547 | </environment> | ||
548 | </general-settings> | ||
549 | </component> | ||
550 | <component name="DBNavigator.Project.StatementExecutionManager"> | ||
551 | <execution-variables /> | ||
552 | </component> | ||
553 | </project> |
.idea/jarRepositories.xml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <project version="4"> | 2 | <project version="4"> |
3 | <component name="RemoteRepositoriesConfiguration"> | 3 | <component name="RemoteRepositoriesConfiguration"> |
4 | <remote-repository> | 4 | <remote-repository> |
5 | <option name="id" value="central" /> | 5 | <option name="id" value="central" /> |
6 | <option name="name" value="Maven Central repository" /> | 6 | <option name="name" value="Maven Central repository" /> |
7 | <option name="url" value="https://repo1.maven.org/maven2" /> | 7 | <option name="url" value="https://repo1.maven.org/maven2" /> |
8 | </remote-repository> | 8 | </remote-repository> |
9 | <remote-repository> | 9 | <remote-repository> |
10 | <option name="id" value="jboss.community" /> | 10 | <option name="id" value="jboss.community" /> |
11 | <option name="name" value="JBoss Community repository" /> | 11 | <option name="name" value="JBoss Community repository" /> |
12 | <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> | 12 | <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> |
13 | </remote-repository> | 13 | </remote-repository> |
14 | <remote-repository> | 14 | <remote-repository> |
15 | <option name="id" value="BintrayJCenter" /> | 15 | <option name="id" value="BintrayJCenter" /> |
16 | <option name="name" value="BintrayJCenter" /> | 16 | <option name="name" value="BintrayJCenter" /> |
17 | <option name="url" value="https://jcenter.bintray.com/" /> | 17 | <option name="url" value="https://jcenter.bintray.com/" /> |
18 | </remote-repository> | 18 | </remote-repository> |
19 | <remote-repository> | 19 | <remote-repository> |
20 | <option name="id" value="Google" /> | 20 | <option name="id" value="Google" /> |
21 | <option name="name" value="Google" /> | 21 | <option name="name" value="Google" /> |
22 | <option name="url" value="https://dl.google.com/dl/android/maven2/" /> | 22 | <option name="url" value="https://dl.google.com/dl/android/maven2/" /> |
23 | </remote-repository> | 23 | </remote-repository> |
24 | <remote-repository> | ||
25 | <option name="id" value="IDEScout, Inc." /> | ||
26 | <option name="name" value="IDEScout, Inc." /> | ||
27 | <option name="url" value="http://www.idescout.com/maven/repo/" /> | ||
28 | </remote-repository> | ||
24 | </component> | 29 | </component> |
25 | </project> | 30 | </project> |
.idea/sqlandroid.xml
File was created | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <project version="4"> | ||
3 | <component name="SQLAndroidSettings"> | ||
4 | <option name="storageVersion" value="2" /> | ||
5 | </component> | ||
6 | </project> |
Solicitudes API Articulos y Time.docx
No preview for this file type
Solicitudes API Articulos y Time.pdf
No preview for this file type
app/build.gradle
1 | apply plugin: 'com.android.application' | 1 | apply plugin: 'com.android.application' |
2 | apply plugin: 'kotlin-android' | 2 | apply plugin: 'kotlin-android' |
3 | apply plugin: 'kotlin-android-extensions' | 3 | apply plugin: 'kotlin-android-extensions' |
4 | 4 | apply plugin: 'kotlin-kapt' | |
5 | 5 | ||
6 | android { | 6 | android { |
7 | compileSdkVersion 30 | 7 | compileSdkVersion 30 |
8 | buildToolsVersion "29.0.3" | 8 | buildToolsVersion "29.0.3" |
9 | 9 | ||
10 | defaultConfig { | 10 | defaultConfig { |
11 | applicationId "com.focasoftware.deboinventariov20" | 11 | applicationId "com.focasoftware.deboinventariov20" |
12 | minSdkVersion 26 | 12 | minSdkVersion 26 |
13 | targetSdkVersion 30 | 13 | targetSdkVersion 30 |
14 | versionCode 1 | 14 | versionCode 1 |
15 | versionName "1.0" | 15 | versionName "1.0" |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
17 | javaCompileOptions { | 17 | javaCompileOptions { |
18 | annotationProcessorOptions { | 18 | annotationProcessorOptions { |
19 | arguments = ["room.incremental":"true"] | 19 | arguments = ["room.incremental":"true"] |
20 | } | 20 | } |
21 | } | 21 | } |
22 | } | 22 | } |
23 | 23 | ||
24 | buildTypes { | 24 | buildTypes { |
25 | release { | 25 | release { |
26 | minifyEnabled false | 26 | minifyEnabled false |
27 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | 27 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
28 | } | 28 | } |
29 | } | 29 | } |
30 | compileOptions { | 30 | compileOptions { |
31 | sourceCompatibility JavaVersion.VERSION_1_8 | 31 | sourceCompatibility JavaVersion.VERSION_1_8 |
32 | targetCompatibility JavaVersion.VERSION_1_8 | 32 | targetCompatibility JavaVersion.VERSION_1_8 |
33 | 33 | ||
34 | } | 34 | } |
35 | kotlinOptions { | 35 | kotlinOptions { |
36 | jvmTarget = '1.8' | 36 | jvmTarget = '1.8' |
37 | } | 37 | } |
38 | } | 38 | } |
39 | 39 | ||
40 | dependencies { | 40 | dependencies { |
41 | implementation fileTree(dir: "libs", include: ["*.jar"]) | 41 | implementation fileTree(dir: "libs", include: ["*.jar"]) |
42 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | 42 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" |
43 | implementation 'androidx.core:core-ktx:1.3.1' | 43 | implementation 'androidx.core:core-ktx:1.3.1' |
44 | implementation 'androidx.appcompat:appcompat:1.2.0' | 44 | implementation 'androidx.appcompat:appcompat:1.2.0' |
45 | implementation 'androidx.legacy:legacy-support-v4:1.0.0' | 45 | implementation 'androidx.legacy:legacy-support-v4:1.0.0' |
46 | implementation 'com.google.android.material:material:1.2.0' | 46 | implementation 'com.google.android.material:material:1.2.1' |
47 | implementation 'androidx.constraintlayout:constraintlayout:2.0.1' | 47 | implementation 'androidx.constraintlayout:constraintlayout:2.0.1' |
48 | implementation 'androidx.navigation:navigation-fragment:2.3.0' | 48 | implementation 'androidx.navigation:navigation-fragment:2.3.0' |
49 | implementation 'androidx.navigation:navigation-ui:2.3.0' | 49 | implementation 'androidx.navigation:navigation-ui:2.3.0' |
50 | implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' | 50 | implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' |
51 | implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0' | 51 | implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0' |
52 | implementation 'androidx.navigation:navigation-ui-ktx:2.3.0' | 52 | implementation 'androidx.navigation:navigation-ui-ktx:2.3.0' |
53 | implementation 'androidx.recyclerview:recyclerview:1.1.0' | 53 | implementation 'androidx.recyclerview:recyclerview:1.1.0' |
54 | testImplementation 'junit:junit:4.13' | 54 | testImplementation 'junit:junit:4.13' |
55 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' | 55 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' |
56 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' | 56 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' |
57 | 57 | ||
58 | 58 | ||
59 | //Room | 59 | //Room |
60 | implementation 'androidx.room:room-ktx:2.2.5' | 60 | implementation 'androidx.room:room-ktx:2.2.5' |
61 | implementation "androidx.room:room-runtime:2.2.5" | 61 | implementation "androidx.room:room-runtime:2.2.5" |
62 | annotationProcessor 'androidx.room:room-compiler:2.2.5' | 62 | debugImplementation 'com.idescout.sql:sqlscout-server:4.1' |
63 | kapt "androidx.room:room-compiler:2.2.5" | ||
64 | // annotationProcessor 'androidx.room:room-compiler:2.2.5' | ||
63 | 65 | ||
64 | //Retrofit | 66 | //Retrofit |
65 | implementation 'com.squareup.retrofit2:retrofit:2.9.0' | ||
66 | implementation 'com.google.code.gson:gson:2.8.6' | 67 | implementation 'com.google.code.gson:gson:2.8.6' |
68 | implementation 'com.squareup.retrofit2:retrofit:2.9.0' | ||
67 | implementation 'com.squareup.retrofit2:converter-gson:2.9.0' | 69 | implementation 'com.squareup.retrofit2:converter-gson:2.9.0' |
68 | implementation 'com.squareup.okhttp3:logging-interceptor:4.8.1' | 70 | implementation 'com.squareup.okhttp3:logging-interceptor:4.8.1' |
69 | 71 | ||
70 | //Gson library | 72 | //Gson library |
71 | implementation "com.google.code.gson:gson:2.8.6" | 73 | implementation "com.google.code.gson:gson:2.8.6" |
72 | 74 | ||
73 | // ViewModel and LiveData | 75 | // ViewModel and LiveData |
74 | implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' | 76 | implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' |
75 | annotationProcessor 'androidx.lifecycle:lifecycle-common-java8:2.2.0' | 77 | kapt 'androidx.lifecycle:lifecycle-common-java8:2.2.0' |
78 | releaseImplementation 'com.idescout.sql:sqlscout-server-noop:4.1' |
app/src/main/AndroidManifest.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:tools="http://schemas.android.com/tools" | ||
3 | package="com.focasoftware.deboinventariov20"> | 4 | package="com.focasoftware.deboinventariov20"> |
4 | 5 | ||
5 | <uses-permission android:name="android.permission.WAKE_LOCK"/> | ||
6 | <uses-permission android:name="android.permission.VIBRATE" /> | 6 | <uses-permission android:name="android.permission.VIBRATE" /> |
7 | <uses-permission android:name="android.permission.INTERNET" /> | 7 | <uses-permission android:name="android.permission.INTERNET" /> |
8 | 8 | ||
9 | <application | 9 | <application |
10 | android:exported="false" | ||
10 | android:allowBackup="true" | 11 | android:allowBackup="true" |
11 | android:icon="@drawable/icono_inventario_big" | 12 | android:icon="@drawable/icono_inventario_big" |
12 | android:label="@string/app_name" | 13 | android:label="@string/app_name" |
13 | android:roundIcon="@drawable/icono_inventario_big" | 14 | android:roundIcon="@drawable/icono_inventario_big" |
14 | android:supportsRtl="true" | 15 | android:supportsRtl="true" |
15 | android:theme="@style/AppTheme" | 16 | android:theme="@style/AppTheme" |
16 | android:usesCleartextTraffic="true"> | 17 | android:usesCleartextTraffic="true"> |
17 | <activity | 18 | <activity |
18 | android:name=".ui.SplashActivity" | 19 | android:name=".UI.SplashActivity" |
19 | android:label="@string/app_name" | 20 | android:label="@string/app_name" |
20 | android:theme="@style/AppTheme.NoActionBar"> | 21 | android:theme="@style/AppTheme.NoActionBar"> |
21 | <intent-filter> | 22 | <intent-filter> |
22 | <action android:name="android.intent.action.MAIN" /> | 23 | <action android:name="android.intent.action.MAIN" /> |
23 | 24 | ||
24 | <category android:name="android.intent.category.LAUNCHER" /> | 25 | <category android:name="android.intent.category.LAUNCHER" /> |
25 | </intent-filter> | 26 | </intent-filter> |
26 | </activity> | 27 | </activity> |
27 | <activity | 28 | <activity |
28 | android:name=".ui.MainActivity" | 29 | android:name=".UI.MainActivity" |
29 | android:label="@string/app_name" | 30 | android:label="@string/app_name" |
30 | android:theme="@style/AppTheme.NoActionBar"> | 31 | android:theme="@style/AppTheme.NoActionBar"> |
31 | 32 | ||
32 | </activity> | 33 | </activity> |
33 | </application> | 34 | </application> |
34 | 35 |
app/src/main/java/com/focasoftware/deboinventariov20/DB/Constans/Constans.kt
1 | package com.focasoftware.deboinventario.ui.actualizacionMaestros | 1 | package com.focasoftware.deboinventariov20.DB.Constans |
2 | 2 | ||
3 | class Constans { | 3 | class Constans { |
4 | 4 | ||
5 | companion object { | 5 | companion object { |
6 | const val DB_NAME="DebInv" | 6 | const val DB_NAME="DebInv" |
7 | const val TABLA_ART="Articles" | 7 | const val TABLA_ART="Articles" |
8 | const val TABLA_INV_H="InvHead" | 8 | const val TABLA_INV_H="InvHead" |
9 | const val TABLA_INV_B="InvBody" | 9 | const val TABLA_INV_B="InvBody" |
10 | const val TABLA_SERV_INV="ServeInv" | 10 | const val TABLA_SERV_INV="ServeInv" |
11 | } | 11 | } |
12 | 12 | ||
13 | } | 13 | } |
app/src/main/java/com/focasoftware/deboinventariov20/DB/DAO/ArticulosDAO.kt
1 | package com.focasoftware.deboinventariov20.DB.DAO | 1 | package com.focasoftware.deboinventariov20.DB.DAO |
2 | 2 | ||
3 | import androidx.room.* | 3 | import androidx.room.Dao |
4 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_ART | 4 | import androidx.room.Insert |
5 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_B | 5 | import androidx.room.OnConflictStrategy |
6 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_H | 6 | import androidx.room.Query |
7 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_SERV_INV | 7 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_ART |
8 | import com.focasoftware.deboinventariov20.Model.* | 8 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_B |
9 | import java.util.ArrayList | 9 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_H |
10 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_SERV_INV | ||
11 | import com.focasoftware.deboinventariov20.Model.Articles | ||
12 | import com.focasoftware.deboinventariov20.Model.InvBody | ||
13 | import com.focasoftware.deboinventariov20.Model.InvHead | ||
14 | import com.focasoftware.deboinventariov20.Model.ServeInv | ||
10 | 15 | ||
11 | @Dao | 16 | @Dao |
12 | interface ArticulosDAO { | 17 | interface ArticulosDAO { |
13 | 18 | ||
14 | // TABLA ARTICULOS | 19 | // TABLA ARTICULOS |
15 | @Insert(onConflict = OnConflictStrategy.REPLACE) | 20 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
16 | suspend fun insertArticulos(articulos: Articles?) | 21 | suspend fun insertArticulos(articulos: Articles?) |
17 | 22 | ||
18 | @Query("SELECT * FROM $TABLA_ART ORDER BY DES DESC") | 23 | @Query("SELECT * FROM $TABLA_ART ORDER BY DES DESC") |
19 | suspend fun findAllArticulos(): List<Articles> | 24 | suspend fun findAllArticulos(): List<Articles> |
20 | 25 | ||
21 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DES LIKE '%' || :description || '%' GROUP BY DES ORDER BY DES") | 26 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DES LIKE '%' || :description || '%' GROUP BY DES ORDER BY DES") |
22 | suspend fun findArticuloByDesc(description: String?, dep: Int): List<Articles> | 27 | suspend fun findArticuloByDesc(description: String?, dep: Int): List<Articles> |
23 | 28 | ||
24 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND CB LIKE :codBarra") | 29 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND CB LIKE :codBarra") |
25 | suspend fun findArticuloByCodBar(codBarra: String?, dep: Int): Articles? | 30 | suspend fun findArticuloByCodBar(codBarra: String?, dep: Int): Articles? |
26 | 31 | ||
32 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND CBC LIKE :CodOrigen") | ||
33 | suspend fun findArticuloByCodOri(CodOrigen: String?, dep: Int): Articles? | ||
34 | |||
27 | @Query("DELETE FROM $TABLA_ART") | 35 | @Query("DELETE FROM $TABLA_ART") |
28 | suspend fun deleteAllArticulos() | 36 | suspend fun deleteAllArticulos() |
29 | 37 | ||
30 | @Query("SELECT * FROM $TABLA_ART WHERE SEC=:sector AND COD=:codigo") | 38 | @Query("SELECT * FROM $TABLA_ART WHERE SEC=:sector AND COD=:codigo") |
31 | suspend fun fetchArticuloByCodSec(sector: String?, codigo: String?): Articles? | 39 | suspend fun fetchArticuloByCodSec(sector: String?, codigo: String?): Articles? |
32 | } | 40 | } |
33 | 41 | ||
34 | @Dao | 42 | @Dao |
35 | interface InvHeadDAO { | 43 | interface InvHeadDAO { |
36 | @Insert() | 44 | @Insert() |
37 | suspend fun insertInvHead(invHead: InvHead?) | 45 | suspend fun insertInvHead(invHead: InvHead?) |
38 | 46 | ||
39 | @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC") | 47 | @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC") |
40 | suspend fun findLastInv(): Int | 48 | suspend fun findLastInv(): Int |
41 | 49 | ||
42 | @Query("DELETE FROM $TABLA_INV_H") | 50 | @Query("DELETE FROM $TABLA_INV_H") |
43 | suspend fun deleteAllArticulos() | 51 | suspend fun deleteAllArticulos() |
44 | 52 | ||
45 | @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven") | 53 | @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven") |
46 | suspend fun deleteinvHead(inven: Int) | 54 | suspend fun deleteinvHead(inven: Int) |
47 | 55 | ||
48 | @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") | 56 | @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") |
49 | suspend fun fetchAllInvHead(): List<InvHead> | 57 | suspend fun fetchAllInvHead(): List<InvHead> |
50 | 58 | ||
59 | @Query("SELECT INV_PRODCONT FROM $TABLA_INV_H WHERE INV_NUM=:inven") | ||
60 | suspend fun consultaCantidadInvH (inven: Int): Int | ||
61 | |||
51 | @Query("UPDATE $TABLA_INV_H SET INV_PRODCONT=:cant WHERE INV_NUM=:inven") | 62 | @Query("UPDATE $TABLA_INV_H SET INV_PRODCONT=:cant WHERE INV_NUM=:inven") |
52 | suspend fun UpdateInvBody(cant: Float, inven: Int) | 63 | suspend fun updateInvBody(inven: Int,cant: Int) |
53 | } | 64 | } |
54 | 65 | ||
55 | @Dao | 66 | @Dao |
56 | interface InvBodyDAO { | 67 | interface InvBodyDAO { |
57 | @Insert() | 68 | @Insert() |
58 | suspend fun insertInvBody(invBody: InvBody?) | 69 | suspend fun insertInvBody(invBody: InvBody?) |
59 | 70 | ||
60 | @Query("DELETE FROM $TABLA_INV_B") | 71 | @Query("DELETE FROM $TABLA_INV_B") |
61 | suspend fun deleteAllInvBody() | 72 | suspend fun deleteAllInvBody() |
62 | 73 | ||
63 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") | 74 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") |
64 | suspend fun deleteInvBody(inven: Int) | 75 | suspend fun deleteInvBody(inven: Int) |
65 | 76 | ||
66 | @Query("UPDATE $TABLA_INV_B SET CANT=:cant WHERE SEC=:sec AND COD=:cod") | 77 | @Query("UPDATE $TABLA_INV_B SET CANT=:cant WHERE SEC=:sec AND COD=:cod") |
67 | suspend fun UpdateInvBody(cant: Float, sec: String, cod: String) | 78 | suspend fun UpdateInvBody(cant: Float, sec: String, cod: String) |
68 | 79 | ||
69 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC") | 80 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC") |
70 | suspend fun fetchAllInvBody(inven:Int): List<InvBody> | 81 | suspend fun fetchAllInvBody(inven: Int): List<InvBody> |
71 | 82 | ||
72 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") | 83 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") |
73 | suspend fun fetchArtInInvBody(sector: String, codigo: String, numInventario: String): InvBody | 84 | suspend fun fetchArtInInvBody(sector: String, codigo: String, numInventario: String): InvBody |
74 | 85 | ||
75 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") | 86 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") |
76 | suspend fun deleteItemFromInvBody(sector: String, codigo: String, numInventario: String): Int | 87 | suspend fun deleteItemFromInvBody(sector: String, codigo: String, numInventario: String): Int |
77 | } | 88 | } |
89 | |||
78 | @Dao | 90 | @Dao |
79 | interface ServeInvDao { | 91 | interface ServeInvDao { |
80 | @Insert(onConflict = OnConflictStrategy.REPLACE) | 92 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
81 | fun insertServer(servidor: ServeInv) | 93 | fun insertServer(servidor: ServeInv) |
82 | 94 | ||
83 | @Query("SELECT * FROM $TABLA_SERV_INV ORDER BY SER_NUM") | 95 | @Query("SELECT * FROM $TABLA_SERV_INV ORDER BY SER_NUM") |
84 | suspend fun fetchAllServers(): List<ServeInv> | 96 | suspend fun fetchAllServers(): List<ServeInv> |
85 | 97 | ||
86 | @Query("DELETE FROM $TABLA_SERV_INV WHERE SER_DESC LIKE :description AND SER_DIR LIKE :dir") | 98 | @Query("DELETE FROM $TABLA_SERV_INV WHERE SER_DESC LIKE :description AND SER_DIR LIKE :dir") |
87 | suspend fun deleteServer(description: String, dir: String) | 99 | suspend fun deleteServer(description: String, dir: String) |
88 | 100 | ||
89 | @Query("SELECT SER_NUM FROM $TABLA_SERV_INV ORDER BY SER_NUM DESC") | 101 | @Query("SELECT SER_NUM FROM $TABLA_SERV_INV ORDER BY SER_NUM DESC") |
90 | suspend fun findLastServer(): Int | 102 | suspend fun findLastServer(): Int |
91 | 103 | ||
92 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=0") | 104 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=0") |
93 | suspend fun UpdateServerPreInZero() | 105 | suspend fun UpdateServerPreInZero() |
94 | 106 | ||
95 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=1 WHERE SER_NUM = :numero") | 107 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=1 WHERE SER_NUM = :numero") |
96 | suspend fun UpdateServerPre(numero: Int) | 108 | suspend fun UpdateServerPre(numero: Int) |
97 | 109 | ||
98 | @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_PRE= 1") | 110 | @Query("SELECT SER_DIR FROM $TABLA_SERV_INV WHERE SER_PRE= 1") |
99 | suspend fun fetchServerPreOne(): ServeInv | 111 | suspend fun fetchServerPreOne(): String |
100 | } | 112 | } |
app/src/main/java/com/focasoftware/deboinventariov20/DB/DataBase/AppDb.kt
1 | package com.focasoftware.deboinventariov20.DB.DataBase | 1 | package com.focasoftware.deboinventariov20.DB.DataBase |
2 | 2 | ||
3 | import android.content.Context | 3 | import android.content.Context |
4 | import androidx.room.Database | 4 | import androidx.room.Database |
5 | import androidx.room.Room | 5 | import androidx.room.Room |
6 | import androidx.room.RoomDatabase | 6 | import androidx.room.RoomDatabase |
7 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans | 7 | import com.focasoftware.deboinventariov20.DB.Constans.Constans |
8 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_ART | ||
9 | import com.focasoftware.deboinventariov20.DB.DAO.* | 8 | import com.focasoftware.deboinventariov20.DB.DAO.* |
10 | import com.focasoftware.deboinventariov20.Model.Articles | 9 | import com.focasoftware.deboinventariov20.Model.Articles |
11 | import com.focasoftware.deboinventariov20.Model.InvBody | 10 | import com.focasoftware.deboinventariov20.Model.InvBody |
12 | import com.focasoftware.deboinventariov20.Model.InvHead | 11 | import com.focasoftware.deboinventariov20.Model.InvHead |
13 | import com.focasoftware.deboinventariov20.Model.ServeInv | 12 | import com.focasoftware.deboinventariov20.Model.ServeInv |
14 | 13 | ||
15 | 14 | ||
16 | @Database(entities = [Articles::class, InvHead::class, InvBody::class, ServeInv::class], version = 1, exportSchema = false) | 15 | @Database(entities = [Articles::class, InvHead::class, InvBody::class, ServeInv::class], version = 1, exportSchema = false) |
17 | abstract class AppDb : RoomDatabase() { | 16 | abstract class AppDb : RoomDatabase() { |
18 | abstract fun ArticulosDAO(): ArticulosDAO? | 17 | abstract fun ArticulosDAO(): ArticulosDAO? |
19 | abstract fun InvHeadDAO(): InvHeadDAO? | 18 | abstract fun InvHeadDAO(): InvHeadDAO? |
20 | abstract fun InvBodyDAO(): InvBodyDAO? | 19 | abstract fun InvBodyDAO(): InvBodyDAO? |
21 | abstract fun ServeInvDao(): ServeInvDao? | 20 | abstract fun ServeInvDao(): ServeInvDao? |
22 | 21 | ||
23 | companion object { | 22 | companion object { |
24 | private var INSTANCE: AppDb? = null | 23 | private var INSTANCE: AppDb? = null |
25 | fun getAppDb(context: Context): AppDb? { | 24 | fun getAppDb(context: Context): AppDb? { |
26 | if (INSTANCE == null) { | 25 | if (INSTANCE == null) { |
27 | INSTANCE = Room.databaseBuilder( | 26 | INSTANCE = Room.databaseBuilder(context.applicationContext, AppDb::class.java, Constans.DB_NAME) |
28 | context.applicationContext, | ||
29 | AppDb::class.java, | ||
30 | Constans.DB_NAME | ||
31 | ) | ||
32 | .allowMainThreadQueries() | 27 | .allowMainThreadQueries() |
33 | .build() | 28 | .build() |
34 | } | 29 | } |
35 | return INSTANCE | 30 | return INSTANCE |
36 | } | 31 | } |
37 | 32 | ||
38 | fun destroyInstance() { | 33 | fun destroyInstance() { |
39 | INSTANCE = null | 34 | INSTANCE = null |
40 | } | 35 | } |
41 | } | 36 | } |
42 | } | 37 | } |
app/src/main/java/com/focasoftware/deboinventariov20/Model/ProductosService.kt
1 | package com.focasoftware.deboinventariov20.Model | 1 | package com.focasoftware.deboinventariov20.Model |
2 | 2 | ||
3 | import com.focasoftware.deboinventariov20.ui.actualizacionMaestros.BASE_URL | 3 | import com.focasoftware.deboinventariov20.UI.actualizacionMaestros.BASE_URL |
4 | import retrofit2.Retrofit | 4 | import retrofit2.Retrofit |
5 | import retrofit2.converter.gson.GsonConverterFactory | 5 | import retrofit2.converter.gson.GsonConverterFactory |
6 | 6 | ||
7 | object ProductosService { | 7 | object ProductosService { |
8 | // private val BASE_URL ="http://10.0.2.2:3000/" | ||
9 | // // //"http://192.168.0.2:3000/" | ||
10 | |||
11 | |||
12 | fun getProductosService(): ProductosApi { | 8 | fun getProductosService(): ProductosApi { |
13 | return Retrofit.Builder() | 9 | return Retrofit.Builder() |
14 | .baseUrl(BASE_URL) | 10 | .baseUrl(BASE_URL) |
15 | .addConverterFactory(GsonConverterFactory.create()) | 11 | .addConverterFactory(GsonConverterFactory.create()) |
16 | .build() | 12 | .build() |
17 | .create(ProductosApi::class.java) | 13 | .create(ProductosApi::class.java) |
18 | } | 14 | } |
19 | } | 15 | } |
app/src/main/java/com/focasoftware/deboinventariov20/Model/Tablas.kt
1 | package com.focasoftware.deboinventariov20.Model | 1 | package com.focasoftware.deboinventariov20.Model |
2 | 2 | ||
3 | import androidx.room.ColumnInfo | 3 | import androidx.room.ColumnInfo |
4 | import androidx.room.Entity | 4 | import androidx.room.Entity |
5 | import androidx.room.PrimaryKey | 5 | import androidx.room.PrimaryKey |
6 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_ART | 6 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_ART |
7 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_B | 7 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_B |
8 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_H | 8 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_H |
9 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_SERV_INV | 9 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_SERV_INV |
10 | import com.google.gson.annotations.SerializedName | 10 | import com.google.gson.annotations.SerializedName |
11 | import java.io.Serializable | 11 | import java.io.Serializable |
12 | 12 | ||
13 | data class Productos(@SerializedName("SEC") var sector: String?, | 13 | data class Productos(@SerializedName("SEC") var sector: String?, |
14 | @SerializedName("COD") var codigo: String?, | 14 | @SerializedName("COD") var codigo: String?, |
15 | @SerializedName("DESC") var descripcion: String?, | 15 | @SerializedName("DESC") var descripcion: String?, |
16 | @SerializedName("CB") var codBar: String?, | 16 | @SerializedName("CB") var codBar: String?, |
17 | @SerializedName("CBC") var codOrigen: String?, | 17 | @SerializedName("CBC") var codOrigen: String?, |
18 | @SerializedName("PRE_VTA") var precio: String?, | 18 | @SerializedName("PRE_VTA") var precio: String?, |
19 | @SerializedName("PRE_COS") var costo: String?, | 19 | @SerializedName("PRE_COS") var costo: String?, |
20 | @SerializedName( "EV") var exiVenta: String?, | 20 | @SerializedName( "EV") var exiVenta: String?, |
21 | @SerializedName( "ED") var exiDeposito: String?, | 21 | @SerializedName( "ED") var exiDeposito: String?, |
22 | @SerializedName( "DE") var de: String?, | 22 | @SerializedName( "DE") var de: String?, |
23 | @SerializedName( "BAL") var balanza: Int?, | 23 | @SerializedName( "BAL") var balanza: Int?, |
24 | @SerializedName("DEPSN") var depSn: Int?, | 24 | @SerializedName("DEPSN") var depSn: Int?, |
25 | @SerializedName("FOTO") var imagen: String?) | 25 | @SerializedName("FOTO") var imagen: String?) |
26 | 26 | ||
27 | @Entity(tableName = TABLA_ART) | 27 | @Entity(tableName = TABLA_ART) |
28 | data class Articles(@ColumnInfo(name = "SEC") var sector: String?, | 28 | data class Articles(@ColumnInfo(name = "SEC") var sector: String?, |
29 | @ColumnInfo(name = "COD") var codigo: String?, | 29 | @ColumnInfo(name = "COD") var codigo: String?, |
30 | @ColumnInfo(name = "DES") var descripcion: String?, | 30 | @ColumnInfo(name = "DES") var descripcion: String?, |
31 | @ColumnInfo(name = "CB") var codBar: String?, | 31 | @ColumnInfo(name = "CB") var codBar: String?, |
32 | @ColumnInfo(name = "CBC") var codOrigen: String?, | 32 | @ColumnInfo(name = "CBC") var codOrigen: String?, |
33 | @ColumnInfo(name = "PRE_VTA") var precio: String?, | 33 | @ColumnInfo(name = "PRE_VTA") var precio: String?, |
34 | @ColumnInfo(name = "PRE_COS") var costo: String?, | 34 | @ColumnInfo(name = "PRE_COS") var costo: String?, |
35 | @ColumnInfo(name = "EV") var exiVenta: String?, | 35 | @ColumnInfo(name = "EV") var exiVenta: String?, |
36 | @ColumnInfo(name = "ED") var exiDeposito: String?, | 36 | @ColumnInfo(name = "ED") var exiDeposito: String?, |
37 | @ColumnInfo(name = "DE") var de: String?, | 37 | @ColumnInfo(name = "DE") var de: String?, |
38 | @ColumnInfo(name = "BAL") var balanza: Int?, | 38 | @ColumnInfo(name = "BAL") var balanza: Int?, |
39 | @ColumnInfo(name = "DEPSN") var depSn: Int?, | 39 | @ColumnInfo(name = "DEPSN") var depSn: Int?, |
40 | @ColumnInfo(name = "FOTO") var imagen: String?) : Serializable { | 40 | @ColumnInfo(name = "FOTO") var imagen: String?) : Serializable { |
41 | @PrimaryKey(autoGenerate = true) | 41 | @PrimaryKey(autoGenerate = true) |
42 | @ColumnInfo(name = "id") | 42 | @ColumnInfo(name = "id") |
43 | var id: Long = 0 | 43 | var id: Long = 0 |
44 | } | 44 | } |
45 | 45 | ||
46 | 46 | ||
47 | @Entity(tableName = TABLA_INV_H) | 47 | @Entity(tableName = TABLA_INV_H) |
48 | data class InvHead(@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "INV_NUM") var invNum: Int, | 48 | data class InvHead(@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "INV_NUM") var invNum: Int, |
49 | @ColumnInfo(name = "INV_DESC") var descripcion: String?, | 49 | @ColumnInfo(name = "INV_DESC") var descripcion: String?, |
50 | @ColumnInfo(name = "ESTADO") var estado: Int?, | 50 | @ColumnInfo(name = "ESTADO") var estado: Int?, |
51 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, | 51 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, |
52 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?, | 52 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?, |
53 | // productos contados en el inventario | 53 | // productos contados en el inventario |
54 | @ColumnInfo(name = "INV_PRODCONT") var prodContados: Long?, | 54 | @ColumnInfo(name = "INV_PRODCONT") var prodContados: Long?, |
55 | @ColumnInfo(name = "INV_LUG") var lugar: Int?, | 55 | @ColumnInfo(name = "INV_LUG") var lugar: Int?, |
56 | // Solo se ajustan los productos incluidos en el conteo=0 | 56 | // Solo se ajustan los productos incluidos en el conteo=0 |
57 | // Ajusta productos no incluidos en el conteo con stock en cero=1 | 57 | // Ajusta productos no incluidos en el conteo con stock en cero=1 |
58 | @ColumnInfo(name = "PRO_NO_CONTA") var stDesc: Int?, | 58 | @ColumnInfo(name = "PRO_NO_CONTA") var stDesc: Int?, |
59 | // Mostror stock en el sistema al momento de la descarga del maestro. | 59 | // Mostror stock en el sistema al momento de la descarga del maestro. |
60 | @ColumnInfo(name = "MOSTRAR_STOCK") var proNoCont: Int?) | 60 | @ColumnInfo(name = "MOSTRAR_STOCK") var proNoCont: Int?) |
61 | 61 | ||
62 | 62 | ||
63 | @Entity(tableName = TABLA_INV_B) | 63 | @Entity(tableName = TABLA_INV_B) |
64 | data class InvBody(@ColumnInfo(name = "INV_NUM") var invNum: Int, | 64 | data class InvBody(@ColumnInfo(name = "INV_NUM") var invNum: Int, |
65 | @ColumnInfo(name = "SEC") var sector: String?, | 65 | @ColumnInfo(name = "SEC") var sector: String?, |
66 | @ColumnInfo(name = "COD") var codigo: String?, | 66 | @ColumnInfo(name = "COD") var codigo: String?, |
67 | @ColumnInfo(name = "DES") var descripcion: String?, | 67 | @ColumnInfo(name = "DES") var descripcion: String?, |
68 | @ColumnInfo(name = "CANT") var cantTomada: String?, | 68 | @ColumnInfo(name = "CANT") var cantTomada: String?, |
69 | @ColumnInfo(name = "CB") var codBar: String?, | 69 | @ColumnInfo(name = "CB") var codBar: String?, |
70 | @ColumnInfo(name = "CBC") var codOrigen: String?, | 70 | @ColumnInfo(name = "CBC") var codOrigen: String?, |
71 | @ColumnInfo(name = "PRE_VTA") var precio: String?, | 71 | @ColumnInfo(name = "PRE_VTA") var precio: String?, |
72 | @ColumnInfo(name = "PRE_COS") var costo: String?, | 72 | @ColumnInfo(name = "PRE_COS") var costo: String?, |
73 | @ColumnInfo(name = "BAL") var balanza: Int?, | 73 | @ColumnInfo(name = "BAL") var balanza: Int?, |
74 | @ColumnInfo(name = "DSN") var depSn: Int?, | 74 | @ColumnInfo(name = "DSN") var depSn: Int?, |
75 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, | 75 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, |
76 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?) : Serializable { | 76 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?) : Serializable { |
77 | @PrimaryKey(autoGenerate = true) | 77 | @PrimaryKey(autoGenerate = true) |
78 | @ColumnInfo(name = "id") | 78 | @ColumnInfo(name = "id") |
79 | var id: Long = 0 | 79 | var id: Long = 0 |
80 | } | 80 | } |
81 | 81 | ||
82 | @Entity(tableName = TABLA_SERV_INV) | 82 | @Entity(tableName = TABLA_SERV_INV) |
83 | data class ServeInv( | 83 | data class ServeInv( |
84 | @ColumnInfo(name = "SER_DESC") var descripcion: String?, | 84 | @ColumnInfo(name = "SER_DESC") var descripcion: String?, |
85 | @ColumnInfo(name = "SER_DIR") var direccion: String?, | 85 | @ColumnInfo(name = "SER_DIR") var direccion: String?, |
86 | @ColumnInfo(name = "SER_PRE") var predeterminado: Int?): | 86 | @ColumnInfo(name = "SER_PRE") var predeterminado: Int?): |
87 | Serializable { @PrimaryKey(autoGenerate = true) | 87 | Serializable { @PrimaryKey(autoGenerate = true) |
88 | @ColumnInfo(name = "SER_NUM") | 88 | @ColumnInfo(name = "SER_NUM") |
89 | var servNum: Int=0 | 89 | var servNum: Int=0 |
90 | } | 90 | } |
91 | 91 | ||
92 | 92 | ||
93 | 93 |
app/src/main/java/com/focasoftware/deboinventariov20/UI/MainActivity.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI | |
2 | |||
3 | import android.os.Bundle | ||
4 | import android.view.Menu | ||
5 | import com.google.android.material.navigation.NavigationView | ||
6 | import androidx.navigation.findNavController | ||
7 | import androidx.navigation.ui.AppBarConfiguration | ||
8 | import androidx.navigation.ui.navigateUp | ||
9 | import androidx.navigation.ui.setupActionBarWithNavController | ||
10 | import androidx.navigation.ui.setupWithNavController | ||
11 | import androidx.drawerlayout.widget.DrawerLayout | ||
12 | import androidx.appcompat.app.AppCompatActivity | ||
13 | import androidx.appcompat.widget.Toolbar | ||
14 | import com.focasoftware.deboinventariov20.R | ||
15 | |||
16 | class MainActivity : AppCompatActivity() { | ||
17 | |||
18 | private lateinit var appBarConfiguration: AppBarConfiguration | ||
19 | |||
20 | override fun onCreate(savedInstanceState: Bundle?) { | ||
21 | super.onCreate(savedInstanceState) | ||
22 | setContentView(R.layout.activity_main) | ||
23 | val toolbar: Toolbar = findViewById(R.id.toolbar) | ||
24 | setSupportActionBar(toolbar) | ||
25 | |||
26 | |||
27 | val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout) | ||
28 | val navView: NavigationView = findViewById(R.id.nav_view) | ||
29 | val navController = findNavController(R.id.nav_host_fragment) | ||
30 | |||
31 | appBarConfiguration = AppBarConfiguration(setOf(R.id.mainFragment2, R.id.inventarioFragment, R.id.actuaMaestrosFragment, R.id.configuracionFragment), drawerLayout) | ||
32 | setupActionBarWithNavController(navController, appBarConfiguration) | ||
33 | navView.setupWithNavController(navController) | ||
34 | } | ||
35 | |||
36 | override fun onCreateOptionsMenu(menu: Menu): Boolean { | ||
37 | // Inflate the menu; this adds items to the action bar if it is present. | ||
38 | menuInflater.inflate(R.menu.main, menu) | ||
39 | return true | ||
40 | } | ||
41 | |||
42 | override fun onSupportNavigateUp(): Boolean { | ||
43 | val navController = findNavController(R.id.nav_host_fragment) | ||
44 | return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() | ||
45 | } | ||
46 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/SplashActivity.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI | |
2 | |||
3 | import android.app.Activity | ||
4 | import android.content.Intent | ||
5 | import android.os.Bundle | ||
6 | import com.focasoftware.deboinventariov20.R | ||
7 | |||
8 | class SplashActivity : Activity() { | ||
9 | |||
10 | override fun onCreate(savedInstanceState: Bundle?) { | ||
11 | super.onCreate(savedInstanceState) | ||
12 | setContentView(R.layout.activity_splash) | ||
13 | //window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | ||
14 | |||
15 | val bac = object : Thread(){ | ||
16 | override fun run(){ | ||
17 | try { | ||
18 | Thread.sleep(5) | ||
19 | val intent = Intent(baseContext, MainActivity:: class.java) | ||
20 | startActivity(intent) | ||
21 | finish() | ||
22 | } catch (e : Exception){ | ||
23 | e.printStackTrace() | ||
24 | } | ||
25 | } | ||
26 | } | ||
27 | bac.start() | ||
28 | } | ||
29 | } | ||
30 |
app/src/main/java/com/focasoftware/deboinventariov20/UI/Utils/BaseViewHolder.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.Utils | |
2 | |||
3 | import android.view.View | ||
4 | import androidx.recyclerview.widget.RecyclerView | ||
5 | |||
6 | abstract class BaseViewHolder<T>(itemView: View):RecyclerView.ViewHolder(itemView) { | ||
7 | abstract fun bind(item: T, position: Int) | ||
8 | } | ||
9 | |||
10 |
app/src/main/java/com/focasoftware/deboinventariov20/UI/Utils/Utils.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.Utils | |
2 | |||
3 | import android.app.AlertDialog | ||
4 | import android.app.Dialog | ||
5 | import android.content.Context | ||
6 | import android.os.Bundle | ||
7 | import androidx.fragment.app.DialogFragment | ||
8 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
9 | import kotlinx.coroutines.Dispatchers | ||
10 | import kotlinx.coroutines.GlobalScope | ||
11 | import kotlinx.coroutines.async | ||
12 | |||
13 | fun modificarCantidadEnCabecera(inventarioActual: Int, b: Boolean,context: Context) { | ||
14 | GlobalScope.async(Dispatchers.IO) { | ||
15 | var cantProductos = 0 | ||
16 | cantProductos = AppDb.getAppDb(context)!!.InvHeadDAO()!!.consultaCantidadInvH(inventarioActual) | ||
17 | if (b) { | ||
18 | AppDb.getAppDb(context)!!.InvHeadDAO()!!.updateInvBody(inventarioActual, cantProductos + 1) | ||
19 | } else { | ||
20 | AppDb.getAppDb(context)!!.InvHeadDAO()!!.updateInvBody(inventarioActual, cantProductos - 1) | ||
21 | } | ||
22 | } | ||
23 | } | ||
24 | |||
25 | open class AlertDialogBorrarInv : DialogFragment() { | ||
26 | |||
27 | interface OnBorrarInvClickListener { | ||
28 | fun onPositiveClick() | ||
29 | fun onCancelClick() | ||
30 | } | ||
31 | |||
32 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
33 | return activity?.let { | ||
34 | val title = "Borrar Inventario" | ||
35 | val content = "ยฟSeguro que desea Borrar el inventario?" | ||
36 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | ||
37 | builder.setTitle(title).setMessage(content) | ||
38 | .setPositiveButton(android.R.string.ok) { _, _ -> | ||
39 | val listener = activity as OnBorrarInvClickListener? | ||
40 | listener!!.onPositiveClick() | ||
41 | } | ||
42 | .setNegativeButton(android.R.string.cancel) { _, _ -> | ||
43 | val listener = activity as OnBorrarInvClickListener? | ||
44 | listener!!.onCancelClick() | ||
45 | } | ||
46 | return builder.create() | ||
47 | } ?: throw IllegalStateException("Activity cannot be null") | ||
48 | } | ||
49 | public fun Int.twoDigits() = | ||
50 | if (this <= 9) "0$this" else this.toString()} | ||
51 | |||
52 | public class NoEncontradoSimple : DialogFragment() { | ||
53 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
54 | return activity?.let { | ||
55 | val title = "" | ||
56 | val content = "ยกEl producto buscado NO fue encontrado!" | ||
57 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | ||
58 | builder.setTitle(title).setMessage(content).setPositiveButton(android.R.string.ok) { _, _ -> | ||
59 | //Todo OK click | ||
60 | } | ||
61 | |||
62 | return builder.create() | ||
63 | } ?: throw IllegalStateException("Activity cannot be null") | ||
64 | } | ||
65 | } | ||
66 | public class noServerConf : DialogFragment() { | ||
67 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
68 | return activity?.let { | ||
69 | val title = "" | ||
70 | val content = "ยกAntes de importar debe configurar un servidor!" | ||
71 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | ||
72 | builder.setTitle(title).setMessage(content) | ||
73 | .setPositiveButton(android.R.string.ok) { _, _ -> | ||
74 | activity?.onBackPressed(); | ||
75 | } | ||
76 | |||
77 | return builder.create() | ||
78 | } ?: throw IllegalStateException("Activity cannot be null") | ||
79 | } | ||
80 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/actualizacionMaestros/ActuaMaestrosFragment.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.actualizacionMaestros | |
2 | |||
3 | import android.os.Bundle | ||
4 | import android.view.LayoutInflater | ||
5 | import android.view.View | ||
6 | import android.view.ViewGroup | ||
7 | import android.widget.Button | ||
8 | import androidx.fragment.app.Fragment | ||
9 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
10 | import com.focasoftware.deboinventariov20.Model.Articles | ||
11 | import com.focasoftware.deboinventariov20.Model.ProductosService | ||
12 | import com.focasoftware.deboinventariov20.R | ||
13 | import com.focasoftware.deboinventariov20.UI.Utils.noServerConf | ||
14 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* | ||
15 | import kotlinx.coroutines.* | ||
16 | import kotlinx.coroutines.Dispatchers.IO | ||
17 | import kotlinx.coroutines.Dispatchers.Main | ||
18 | |||
19 | var BASE_URL = "" | ||
20 | |||
21 | class ActuaMaestrosFragment : Fragment() { | ||
22 | |||
23 | override fun onCreate(savedInstanceState: Bundle?) { | ||
24 | super.onCreate(savedInstanceState) | ||
25 | GlobalScope.launch(Main) { | ||
26 | val serverPre = fetchServerPreOne() | ||
27 | if (serverPre.isNullOrEmpty()) { | ||
28 | val modalDialog = noServerConf() | ||
29 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | ||
30 | } else { | ||
31 | BASE_URL = serverPre.toString() | ||
32 | } | ||
33 | } | ||
34 | // mostrarArticulos() | ||
35 | } | ||
36 | |||
37 | private suspend fun fetchServerPreOne(): String? { | ||
38 | return GlobalScope.async(IO) { | ||
39 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServerPreOne() | ||
40 | }.await() | ||
41 | } | ||
42 | |||
43 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
44 | // Inflate the layout for this fragment | ||
45 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) | ||
46 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) | ||
47 | bConfirmarAct.setOnClickListener { | ||
48 | loading_view.visibility = View.VISIBLE | ||
49 | countriesList.text = "Obteniendo artรญculos del servidor $BASE_URL, aguarde por favor." | ||
50 | GlobalScope.launch(Main) { | ||
51 | obtenerArticulos() | ||
52 | } | ||
53 | } | ||
54 | return v | ||
55 | } | ||
56 | |||
57 | |||
58 | private suspend fun obtenerArticulos() { | ||
59 | |||
60 | val productosService = ProductosService.getProductosService() | ||
61 | var index: Long = 1 | ||
62 | withContext(IO) { | ||
63 | val job = CoroutineScope(Dispatchers.IO).launch { | ||
64 | // TODO: BORRO TODO LOS ARTICULOS DE LA BASE PARA CARGARLOS DE NUEVO | ||
65 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!.deleteAllArticulos() | ||
66 | |||
67 | val response = productosService.getProductos() | ||
68 | if (response.isSuccessful) { | ||
69 | for (pro in response.body()!!) { | ||
70 | val artiAcargar = Articles(pro.sector, | ||
71 | pro.codigo, | ||
72 | pro.descripcion, | ||
73 | pro.codBar, | ||
74 | pro.codOrigen, | ||
75 | pro.precio, | ||
76 | pro.costo, | ||
77 | pro.exiVenta, | ||
78 | pro.exiDeposito, | ||
79 | pro.de, | ||
80 | pro.balanza, | ||
81 | pro.depSn, | ||
82 | pro.imagen) | ||
83 | index += index | ||
84 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!.insertArticulos(artiAcargar) | ||
85 | } | ||
86 | withContext(Main) { | ||
87 | countriesList.visibility = View.VISIBLE | ||
88 | countriesList.text = "ยกDatos Importados Correctamente!" | ||
89 | loading_view.visibility = View.GONE | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | if (job == null) { | ||
94 | withContext(Main) { | ||
95 | countriesList.visibility = View.VISIBLE | ||
96 | countriesList.text = "No se puedo realizar la conexiรณn al Servidor" | ||
97 | loading_view.visibility = View.GONE | ||
98 | } | ||
99 | } | ||
100 | } | ||
101 | |||
102 | // withContext(Dispatchers.Main) { | ||
103 | // if (response.isSuccessful) { | ||
104 | // val call = WebService | ||
105 | // .instance | ||
106 | // ?.createService(WebServiceApi::class.java) | ||
107 | // ?.articulos | ||
108 | // call?.enqueue(object : Callback<List<productos?>?> { | ||
109 | // override fun onResponse( | ||
110 | // call: Call<List<productos?>?>, | ||
111 | // response: Response<List<productos?>?> | ||
112 | // ) { | ||
113 | // if (response.code() == 200) { | ||
114 | // for (i in response.body()!!.indices) { | ||
115 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) | ||
116 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") | ||
117 | //// Log.d( | ||
118 | //// "TAG1", "Nombre Curso: " + response.body()!![i]?.sector | ||
119 | //// + "Codigo Profesor: " + response.body()!![i]?.descripcion | ||
120 | //// ) | ||
121 | // mostrarArticulos() | ||
122 | // } | ||
123 | // } else if (response.code() == 404) { | ||
124 | // Log.d("TAG1", "No hay cursos") | ||
125 | // } | ||
126 | // | ||
127 | // } | ||
128 | // | ||
129 | // override fun onFailure(call: Call<List<productos?>?>, t: Throwable) {} | ||
130 | // }) | ||
131 | } | ||
132 | |||
133 | fun mostrarArticulos() { | ||
134 | val Job = GlobalScope.launch { | ||
135 | var listArticulos: List<Articles>? = null | ||
136 | var temp: String = "" | ||
137 | listArticulos = AppDb.getAppDb(requireActivity())?.ArticulosDAO()?.findAllArticulos() | ||
138 | if (listArticulos != null) { | ||
139 | |||
140 | for (i in listArticulos.indices) temp += listArticulos[i].codigo.toString() | ||
141 | } | ||
142 | withContext(Dispatchers.Main) { | ||
143 | countriesList.visibility = View.VISIBLE | ||
144 | loading_view.visibility = View.GONE | ||
145 | countriesList?.text = temp | ||
146 | } | ||
147 | } | ||
148 | // for (professor in listArticulos!!) { | ||
149 | // editT.text= professor.id.toString() | ||
150 | // } | ||
151 | } | ||
152 | |||
153 | |||
154 | // fun observeViewModel() { | ||
155 | // | ||
156 | // val productosService = ProductosService.getProductosService() | ||
157 | // var job: Job? = null | ||
158 | // | ||
159 | // | ||
160 | // //countriesList.text="Procesando..." | ||
161 | // //countriesList.visibility = View.VISIBLE | ||
162 | // // GlobalScope1.launch(Dispatchers.IO) { | ||
163 | // val response = productosService.getProductos() | ||
164 | // if (response.isSuccessful) { | ||
165 | //// countriesList.layoutManager = LinearLayoutManager(context) | ||
166 | //// countriesList.itemAnimator = DefaultItemAnimator() | ||
167 | // | ||
168 | //// ProductAdapter.updateCountries(it) | ||
169 | // // cargarArticulos(response.body()) | ||
170 | // | ||
171 | // | ||
172 | // val artiAcargar: Articulos? = null | ||
173 | // var index: Long = 1 | ||
174 | // | ||
175 | // for (pro in response.body()!!) { | ||
176 | // //artiAcargar.id =index+1 | ||
177 | // artiAcargar!!.sector = pro.sector | ||
178 | // artiAcargar.codigo = pro.codigo | ||
179 | // artiAcargar.descripcion = pro.descripcion | ||
180 | // artiAcargar.codBar = pro.codBar | ||
181 | // artiAcargar.precio = pro.precio | ||
182 | // artiAcargar.costo = pro.costo | ||
183 | // artiAcargar.balanza = pro.balanza | ||
184 | // artiAcargar.depSn = pro.depSn | ||
185 | // artiAcargar.imagen = pro.imagen | ||
186 | // index += index | ||
187 | // | ||
188 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | ||
189 | // .insertArticulos(artiAcargar) | ||
190 | // } | ||
191 | // } | ||
192 | // // } | ||
193 | // | ||
194 | // //job.cancel() | ||
195 | // | ||
196 | // | ||
197 | // } | ||
198 | |||
199 | // fun cargarArticulos(Productos: List<Productos>?) { | ||
200 | // val artiAcargar: Articulos? = null | ||
201 | // var index: Long = 1 | ||
202 | // //val job4 = CoroutineScope(Dispatchers.Default).launch { | ||
203 | // for (pro in Productos!!) { | ||
204 | // //artiAcargar.id =index+1 | ||
205 | // artiAcargar!!.sector = pro.sector | ||
206 | // artiAcargar.codigo = pro.codigo | ||
207 | // artiAcargar.descripcion = pro.descripcion | ||
208 | // artiAcargar.codBar = pro.codBar | ||
209 | // artiAcargar.precio = pro.precio | ||
210 | // artiAcargar.costo = pro.costo | ||
211 | // artiAcargar.balanza = pro.balanza | ||
212 | // artiAcargar.depSn = pro.depSn | ||
213 | // artiAcargar.imagen = pro.imagen | ||
214 | // index += index | ||
215 | // | ||
216 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | ||
217 | // .insertArticulos(artiAcargar) | ||
218 | // } | ||
219 | // } | ||
220 | } | ||
221 | |||
222 |
app/src/main/java/com/focasoftware/deboinventariov20/UI/configuracion/ConfiguracionFragment.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.configuracion | |
2 | |||
3 | import android.content.Context | ||
4 | import android.content.SharedPreferences | ||
5 | import android.os.Bundle | ||
6 | import android.view.LayoutInflater | ||
7 | import android.view.View | ||
8 | import android.view.ViewGroup | ||
9 | import android.widget.* | ||
10 | import androidx.fragment.app.Fragment | ||
11 | import androidx.fragment.app.FragmentActivity | ||
12 | import androidx.lifecycle.lifecycleScope | ||
13 | import androidx.navigation.NavController | ||
14 | import androidx.navigation.Navigation | ||
15 | import androidx.navigation.fragment.findNavController | ||
16 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
17 | import com.focasoftware.deboinventariov20.Model.ServeInv | ||
18 | import com.focasoftware.deboinventariov20.R | ||
19 | import kotlinx.android.synthetic.main.fragment_configuracion.* | ||
20 | import kotlinx.coroutines.* | ||
21 | import kotlinx.coroutines.Dispatchers.Main | ||
22 | |||
23 | class ConfiguracionFragment : Fragment() { | ||
24 | |||
25 | lateinit var sharedPreferences: SharedPreferences | ||
26 | private lateinit var navController: NavController | ||
27 | var itemSelect: Int = 0 | ||
28 | var indexSelect: Int = 0 | ||
29 | |||
30 | override fun onCreate(savedInstanceState: Bundle?) { | ||
31 | super.onCreate(savedInstanceState) | ||
32 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | ||
33 | } | ||
34 | |||
35 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
36 | super.onViewCreated(view, savedInstanceState) | ||
37 | navController = Navigation.findNavController(view) | ||
38 | GlobalScope.launch(Main) { | ||
39 | val listServer = mutableListOf<String>() | ||
40 | for (server in getDescServers()) { | ||
41 | listServer.add((if (server.servNum < 9) "0" + server.servNum.toString() else server.servNum.toString()) + " - " + server.descripcion.toString()) | ||
42 | } | ||
43 | val adapterSpServer = ArrayAdapter(requireContext(), R.layout.support_simple_spinner_dropdown_item, listServer) | ||
44 | spServidor.adapter = adapterSpServer | ||
45 | if (sharedPreferences.contains("ServerPredeterminado")) { | ||
46 | spServidor.setSelection(sharedPreferences.getString("ServerPredeterminado", "").toString().toInt()) | ||
47 | } else (spServidor.setSelection(0)) | ||
48 | } | ||
49 | } | ||
50 | |||
51 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
52 | |||
53 | val v = inflater.inflate(R.layout.fragment_configuracion, container, false) | ||
54 | val etRuta = v.findViewById<EditText>(R.id.etRuta) | ||
55 | val btnGuardar = v.findViewById<Button>(R.id.btnGuardar) | ||
56 | val rbProInclu = v.findViewById<RadioButton>(R.id.rbProInclu) | ||
57 | val rbProNoInclu = v.findViewById<RadioButton>(R.id.rbProNoInclu) | ||
58 | val cbHabiLectura = v.findViewById<CheckBox>(R.id.cbHabiLectura) | ||
59 | val cbMostrarStock = v.findViewById<CheckBox>(R.id.cbMostrarStock) | ||
60 | val rbCodigoBarras = v.findViewById<RadioButton>(R.id.rbCodigoBarras) | ||
61 | val rbCodigoDebo = v.findViewById<RadioButton>(R.id.rbCodigoDebo) | ||
62 | val rbCodigoOrigen = v.findViewById<RadioButton>(R.id.rbCodigoOrigen) | ||
63 | val rbDeposito = v.findViewById<RadioButton>(R.id.rbDeposito) | ||
64 | val rbVentas = v.findViewById<RadioButton>(R.id.rbVentas) | ||
65 | val cbMostrarExistencia = v.findViewById<CheckBox>(R.id.cbMostrarExistencia) | ||
66 | val cbMostrarPrecio = v.findViewById<CheckBox>(R.id.cbMostrarPrecio) | ||
67 | val btnAgregarServidor = v.findViewById<Button>(R.id.btnAgregarServidor) | ||
68 | val spServidor = v.findViewById<Spinner>(R.id.spServidor) | ||
69 | val btnValidarServidor = v.findViewById<Button>(R.id.btnValidarServidor) | ||
70 | |||
71 | if (sharedPreferences.contains("etRuta")) if (sharedPreferences.contains("rbProInclu")) { | ||
72 | if (sharedPreferences.getString("rbProInclu", "").toString() == "0") { | ||
73 | rbProInclu.isChecked = false | ||
74 | rbProNoInclu.isChecked = true | ||
75 | } else if (sharedPreferences.getString("rbProInclu", "").toString() == "1") { | ||
76 | rbProInclu.isChecked = true | ||
77 | rbProNoInclu.isChecked = false | ||
78 | } | ||
79 | } else (sharedPreferences.getString("rbProInclu", "").toString() == "") | ||
80 | |||
81 | if (sharedPreferences.contains("rbProNoInclu")) { | ||
82 | if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") { | ||
83 | rbProNoInclu.isChecked = false | ||
84 | rbProInclu.isChecked = true | ||
85 | } else if (sharedPreferences.getString("rbProNoInclu", "").toString() == "1") { | ||
86 | rbProNoInclu.isChecked = true | ||
87 | rbProInclu.isChecked = false | ||
88 | } | ||
89 | } else (sharedPreferences.getString("rbProNoInclu", "").toString() == "") | ||
90 | |||
91 | if (sharedPreferences.contains("cbHabiLectura")) { | ||
92 | if (sharedPreferences.getString("cbHabiLectura", "").toString() == "0") { | ||
93 | cbHabiLectura.isChecked = false | ||
94 | } else if (sharedPreferences.getString("cbHabiLectura", "").toString() == "1") { | ||
95 | cbHabiLectura.isChecked = true | ||
96 | } | ||
97 | } else (sharedPreferences.getString("cbHabiLectura", "").toString() == "") | ||
98 | |||
99 | if (sharedPreferences.contains("cbMostrarStock")) { | ||
100 | if (sharedPreferences.getString("cbMostrarStock", "").toString() == "0") { | ||
101 | cbMostrarStock.isChecked = false | ||
102 | } else if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") { | ||
103 | cbMostrarStock.isChecked = true | ||
104 | } | ||
105 | } else (sharedPreferences.getString("cbMostrarStock", "").toString() == "") | ||
106 | |||
107 | if (sharedPreferences.contains("rbVentas")) { | ||
108 | if (sharedPreferences.getString("rbVentas", "").toString() == "0") { | ||
109 | rbVentas.isChecked = false | ||
110 | rbDeposito.isChecked = true | ||
111 | } else if (sharedPreferences.getString("rbVentas", "").toString() == "1") { | ||
112 | rbVentas.isChecked = true | ||
113 | rbDeposito.isChecked = false | ||
114 | } | ||
115 | } else (sharedPreferences.getString("rbVentas", "").toString() == "") | ||
116 | |||
117 | if (sharedPreferences.contains("rbDeposito")) { | ||
118 | if (sharedPreferences.getString("rbDeposito", "").toString() == "0") { | ||
119 | rbDeposito.isChecked = false | ||
120 | rbVentas.isChecked = true | ||
121 | } else if (sharedPreferences.getString("rbDeposito", "").toString() == "1") { | ||
122 | rbDeposito.isChecked = true | ||
123 | rbVentas.isChecked = false | ||
124 | } | ||
125 | } else (sharedPreferences.getString("rbDeposito", "").toString() == "") | ||
126 | |||
127 | if (sharedPreferences.contains("rbCodigoDebo")) { | ||
128 | if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "0") { | ||
129 | rbCodigoDebo.isChecked = false | ||
130 | rbCodigoOrigen.isChecked = false | ||
131 | rbCodigoBarras.isChecked = false | ||
132 | } else if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "1") { | ||
133 | rbCodigoDebo.isChecked = true | ||
134 | rbCodigoOrigen.isChecked = false | ||
135 | rbCodigoBarras.isChecked = false | ||
136 | } | ||
137 | } else (sharedPreferences.getString("rbCodigoDebo", "").toString() == "") | ||
138 | |||
139 | if (sharedPreferences.contains("rbCodigoOrigen")) { | ||
140 | if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "0") { | ||
141 | rbCodigoOrigen.isChecked = false | ||
142 | } else if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "1") { | ||
143 | rbCodigoOrigen.isChecked = true | ||
144 | } | ||
145 | } else (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "") | ||
146 | |||
147 | if (sharedPreferences.contains("rbCodigoBarras")) { | ||
148 | if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "0") { | ||
149 | rbCodigoBarras.isChecked = false | ||
150 | } else if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "1") { | ||
151 | rbCodigoBarras.isChecked = true | ||
152 | } | ||
153 | } else (sharedPreferences.getString("rbCodigoBarras", "").toString() == "") | ||
154 | |||
155 | if (sharedPreferences.contains("cbMostrarExistencia")) { | ||
156 | if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "0") { | ||
157 | cbMostrarExistencia.isChecked = false | ||
158 | } else if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "1") { | ||
159 | cbMostrarExistencia.isChecked = true | ||
160 | } | ||
161 | } else (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "") | ||
162 | |||
163 | if (sharedPreferences.contains("cbMostrarPrecio")) { | ||
164 | if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "0") { | ||
165 | cbMostrarPrecio.isChecked = false | ||
166 | } else if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "1") { | ||
167 | cbMostrarPrecio.isChecked = true | ||
168 | } | ||
169 | } else (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "") | ||
170 | |||
171 | btnGuardar.setOnClickListener { | ||
172 | guardarPreferencias() | ||
173 | Toast.makeText(v.context, "Los Datos se guardaron correctamente", Toast.LENGTH_LONG).show() | ||
174 | navController.navigate(R.id.action_configuracionFragment_to_mainFragment2) | ||
175 | } | ||
176 | btnAgregarServidor.setOnClickListener { findNavController().navigate(R.id.servidoresFragment) } | ||
177 | |||
178 | btnValidarServidor.setOnClickListener { Toast.makeText(requireContext(), "Direcciรณn correcta", Toast.LENGTH_LONG).show() } | ||
179 | |||
180 | spServidor.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { | ||
181 | override fun onNothingSelected(parent: AdapterView<*>?) {} | ||
182 | override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { | ||
183 | itemSelect = parent!!.getItemAtPosition(position).toString().substring(0, 2).toInt() | ||
184 | indexSelect=position | ||
185 | } | ||
186 | } | ||
187 | return v | ||
188 | } | ||
189 | |||
190 | suspend fun getDescServers(): List<ServeInv> { | ||
191 | return GlobalScope.async(Dispatchers.IO) { | ||
192 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchAllServers() | ||
193 | }.await() | ||
194 | } | ||
195 | |||
196 | fun guardarPreferencias() { | ||
197 | // try { | ||
198 | val editor = sharedPreferences.edit() | ||
199 | |||
200 | if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString()) | ||
201 | |||
202 | if (rbProInclu.isChecked) editor?.putString("rbProInclu", "1") else editor?.putString("rbProInclu", "0") | ||
203 | if (rbProNoInclu.isChecked) editor?.putString("rbProNoInclu", "1") else editor?.putString("rbProNoInclu", "0") | ||
204 | |||
205 | if (cbHabiLectura.isChecked) editor?.putString("cbHabiLectura", "1") else editor?.putString("cbHabiLectura", "0") | ||
206 | if (cbMostrarStock.isChecked) editor?.putString("cbMostrarStock", "1") else editor?.putString("cbMostrarStock", "0") | ||
207 | if (rbVentas.isChecked) editor?.putString("rbVentas", "1") else editor?.putString("rbVentas", "0") | ||
208 | if (rbDeposito.isChecked) editor?.putString("rbDeposito", "1") else editor?.putString("rbDeposito", "0") | ||
209 | if (rbCodigoDebo.isChecked) editor?.putString("rbCodigoDebo", "1") else editor?.putString("rbCodigoDebo", "0") | ||
210 | if (rbCodigoOrigen.isChecked) editor?.putString("rbCodigoOrigen", "1") else editor?.putString("rbCodigoOrigen", "0") | ||
211 | if (rbCodigoBarras.isChecked) editor?.putString("rbCodigoBarras", "1") else editor?.putString("rbCodigoBarras", "0") | ||
212 | if (cbMostrarExistencia.isChecked) editor?.putString("cbMostrarExistencia", "1") else editor?.putString("cbMostrarExistencia", "0") | ||
213 | if (cbMostrarPrecio.isChecked) editor?.putString("cbMostrarPrecio", "1") else editor?.putString("cbMostrarPrecio", "0") | ||
214 | editor?.putString("ServerPredeterminado", indexSelect.toString()) | ||
215 | updateServerPreInZero() | ||
216 | updateServerPre(itemSelect) | ||
217 | |||
218 | editor?.apply() | ||
219 | editor.commit() | ||
220 | |||
221 | // } catch (e: Exception) { | ||
222 | // Toast.makeText(requireContext(), "Error ", Toast.LENGTH_LONG).show() | ||
223 | // e.printStackTrace() | ||
224 | // } | ||
225 | } | ||
226 | |||
227 | private fun updateServerPreInZero() { | ||
228 | lifecycleScope.launch { | ||
229 | withContext(Dispatchers.IO) { | ||
230 | val activity: FragmentActivity? = activity | ||
231 | if (activity != null && isAdded) { | ||
232 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.UpdateServerPreInZero() | ||
233 | } | ||
234 | } | ||
235 | } | ||
236 | } | ||
237 | |||
238 | private fun updateServerPre(server: Int) { | ||
239 | lifecycleScope.launch { | ||
240 | withContext(Dispatchers.IO) { | ||
241 | val activity: FragmentActivity? = activity | ||
242 | if (activity != null) { | ||
243 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.UpdateServerPre(server) | ||
244 | } | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/descripcionFragment/DescripcionFragment.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.descripcionFragment | |
2 | |||
3 | import android.app.Activity | ||
4 | import android.app.AlertDialog | ||
5 | import android.content.Context | ||
6 | import android.content.SharedPreferences | ||
7 | import android.graphics.Canvas | ||
8 | import android.graphics.Color | ||
9 | import android.graphics.drawable.ColorDrawable | ||
10 | import android.os.Bundle | ||
11 | import android.text.InputType | ||
12 | import android.view.LayoutInflater | ||
13 | import android.view.View | ||
14 | import android.view.ViewGroup | ||
15 | import android.view.WindowManager | ||
16 | import android.view.inputmethod.InputMethodManager | ||
17 | import androidx.core.content.ContextCompat.getSystemService | ||
18 | import androidx.fragment.app.Fragment | ||
19 | import androidx.fragment.app.FragmentActivity | ||
20 | import androidx.lifecycle.lifecycleScope | ||
21 | import androidx.navigation.NavController | ||
22 | import androidx.navigation.Navigation | ||
23 | import androidx.recyclerview.widget.ItemTouchHelper | ||
24 | import androidx.recyclerview.widget.LinearLayoutManager | ||
25 | import androidx.recyclerview.widget.RecyclerView | ||
26 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
27 | import com.focasoftware.deboinventariov20.Model.Articles | ||
28 | import com.focasoftware.deboinventariov20.Model.InvBody | ||
29 | import com.focasoftware.deboinventariov20.R | ||
30 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera | ||
31 | import com.focasoftware.deboinventariov20.UI.inventario.InventarioFragment | ||
32 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | ||
33 | import kotlinx.android.synthetic.main.login_dialog.view.* | ||
34 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar | ||
35 | import kotlinx.coroutines.* | ||
36 | |||
37 | |||
38 | class DescripcionFragment : Fragment() { | ||
39 | private var artAcargar2: List<Articles>? = null | ||
40 | private var listArticulos2: List<Articles>? = null | ||
41 | lateinit var viewAdapter2: RecyclerView.Adapter<*> | ||
42 | private lateinit var viewManager2: RecyclerView.LayoutManager | ||
43 | private lateinit var rcDescripcion: RecyclerView | ||
44 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) | ||
45 | private var cantidad = 0F | ||
46 | private var numeroInventario = 0 | ||
47 | lateinit var navController: NavController | ||
48 | lateinit var sharedPreferences: SharedPreferences | ||
49 | private var indice = 0 | ||
50 | private var artCargadoEnBD: InvBody? = null | ||
51 | |||
52 | override fun onCreate(savedInstanceState: Bundle?) { | ||
53 | super.onCreate(savedInstanceState) | ||
54 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | ||
55 | arguments.apply { | ||
56 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> | ||
57 | numeroInventario = requireArguments().getInt("numeroInv") | ||
58 | } | ||
59 | |||
60 | } | ||
61 | private fun showSoftKeyboard(view: View) { | ||
62 | if (view.requestFocus()) { | ||
63 | val imm = requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | ||
64 | imm.showSoftInput(view, InputMethodManager.HIDE_IMPLICIT_ONLY) | ||
65 | } | ||
66 | } | ||
67 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
68 | super.onViewCreated(view, savedInstanceState) | ||
69 | navController = Navigation.findNavController(view) | ||
70 | showSoftKeyboard(view) | ||
71 | } | ||
72 | |||
73 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
74 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) | ||
75 | rcDescripcion = v.findViewById(R.id.rcDescripcion) | ||
76 | // val btnSalir = v.findViewById<Button>(R.id.btnSalir) | ||
77 | |||
78 | |||
79 | IngresarRecicler(artAcargar2) | ||
80 | showSoftKeyboard(v) | ||
81 | // btnSalir.setOnClickListener { | ||
82 | // activity?.onBackPressed(); | ||
83 | //// VolverAinventario() | ||
84 | // } | ||
85 | return v | ||
86 | } | ||
87 | |||
88 | fun IngresarRecicler(articulos: List<Articles>?) { | ||
89 | |||
90 | viewAdapter2 = DescripcionListAdapter(articulos) | ||
91 | viewManager2 = LinearLayoutManager(requireContext()) | ||
92 | |||
93 | rcDescripcion.apply { | ||
94 | adapter = viewAdapter2 | ||
95 | layoutManager = viewManager2 | ||
96 | } | ||
97 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { | ||
98 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | ||
99 | return false | ||
100 | } | ||
101 | |||
102 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | ||
103 | |||
104 | var indice = 0 | ||
105 | indice = viewHolder.layoutPosition | ||
106 | GlobalScope.launch(Dispatchers.Main) { | ||
107 | //TODO BUSCO EN BASE DE DATOS | ||
108 | artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.sector.toString(), | ||
109 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.codigo.toString(), | ||
110 | numeroInventario.toString()) | ||
111 | if (artCargadoEnBD == null) { | ||
112 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) | ||
113 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) | ||
114 | //TODO: DEPENDIENDO DEL TIPO DE ARTICULO PERMITER INGRESAR DECIMALES O NO | ||
115 | if ((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza==1 || (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza==3 || (viewAdapter2 as DescripcionListAdapter).items2?.get( | ||
116 | indice)!!.balanza==7) | ||
117 | mDialogView.etCantidad.inputType= InputType.TYPE_CLASS_NUMBER | ||
118 | |||
119 | |||
120 | mDialogView.tvTitulo.text = "${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}" | ||
121 | val mAlertDialog = mBuilder.show() | ||
122 | mDialogView.etCantidad.requestFocus() | ||
123 | mAlertDialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | ||
124 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | ||
125 | mDialogView.btnAceptar.setOnClickListener { | ||
126 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { | ||
127 | mDialogView.etCantidad.error = "No vacio" | ||
128 | mDialogView.etCantidad.requestFocus() | ||
129 | mDialogView.etCantidad.hint = "Ingrese un valor" | ||
130 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | ||
131 | cantidad = mDialogView.etCantidad.text.toString().toFloat() | ||
132 | val body = InvBody(numeroInventario, | ||
133 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector, | ||
134 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD | ||
135 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo, | ||
136 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion, | ||
137 | cantidad.toString(), | ||
138 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codBar, | ||
139 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codOrigen, | ||
140 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | ||
141 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | ||
142 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza, | ||
143 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.depSn, | ||
144 | InventarioFragment().ObtenerFechaActual(), | ||
145 | InventarioFragment().ObtenerFechaActual()) | ||
146 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS | ||
147 | modificarCantidadEnCabecera(numeroInventario, true, requireActivity()) | ||
148 | // VolverAinventario() | ||
149 | activity?.onBackPressed() | ||
150 | mAlertDialog.dismiss() | ||
151 | } | ||
152 | } | ||
153 | } else if (artCargadoEnBD != null) { | ||
154 | |||
155 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | ||
156 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${artCargadoEnBD!!.descripcion}', se encuentra cargado.").setCancelable(false) | ||
157 | if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7")) mDialogView.tvNuevaCantidad.inputType= InputType.TYPE_CLASS_NUMBER | ||
158 | mDialogView.tvCantInicial.text =String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat()) | ||
159 | |||
160 | val mAlertDialog = mBuilder.show() | ||
161 | mDialogView.tvNuevaCantidad.requestFocus() | ||
162 | |||
163 | |||
164 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | ||
165 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | ||
166 | |||
167 | mDialogView.rbSumar.setOnClickListener { | ||
168 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
169 | mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat())) | ||
170 | mDialogView.tvNuevaCantidad.isEnabled=false | ||
171 | } | ||
172 | } | ||
173 | mDialogView.rbRestar.setOnClickListener { | ||
174 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
175 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | ||
176 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) | ||
177 | mDialogView.tvNuevaCantidad.isEnabled = false | ||
178 | }else{ | ||
179 | mDialogView.tvResultado.text="" | ||
180 | mDialogView.tvResultado.error = "Operaciรณn No Valida" | ||
181 | mDialogView.tvResultado.requestFocus() | ||
182 | mDialogView.tvResultado.hint = "Error" | ||
183 | } | ||
184 | } | ||
185 | } | ||
186 | mDialogView.rbMdodificar.setOnClickListener { | ||
187 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
188 | mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvNuevaCantidad.text.toString().toFloat())) | ||
189 | mDialogView.tvNuevaCantidad.isEnabled = false | ||
190 | } | ||
191 | } | ||
192 | mDialogView.btnAceptar.setOnClickListener { | ||
193 | if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) { | ||
194 | if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) { | ||
195 | |||
196 | updateCantidad((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector.toString(), | ||
197 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo.toString(), | ||
198 | mDialogView.tvResultado.text.toString().toFloat()) | ||
199 | // VolverAinventario() | ||
200 | activity?.onBackPressed(); | ||
201 | mAlertDialog.dismiss() | ||
202 | } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | ||
203 | mDialogView.tvResultado.error = "Operaciรณn Requerida" | ||
204 | mDialogView.tvResultado.requestFocus() | ||
205 | mDialogView.tvResultado.hint = "Seleccione Operaciรณn" | ||
206 | } | ||
207 | } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | ||
208 | mDialogView.tvNuevaCantidad.error = "Completar" | ||
209 | mDialogView.tvNuevaCantidad.requestFocus() | ||
210 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | ||
211 | } | ||
212 | } | ||
213 | mDialogView.dialogCancelBtn.setOnClickListener { | ||
214 | activity?.onBackPressed(); | ||
215 | mAlertDialog.dismiss() | ||
216 | } | ||
217 | } | ||
218 | } | ||
219 | } | ||
220 | |||
221 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | ||
222 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | ||
223 | val itemView = viewHolder.itemView | ||
224 | |||
225 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | ||
226 | |||
227 | if (dX > 0) { | ||
228 | |||
229 | c.drawColor(Color.RED) | ||
230 | } else if (dX < 0) { | ||
231 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) | ||
232 | c.drawColor(Color.YELLOW) | ||
233 | } | ||
234 | swipeBackground.draw(c) | ||
235 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | ||
236 | } | ||
237 | } | ||
238 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) | ||
239 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) | ||
240 | |||
241 | } | ||
242 | |||
243 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | ||
244 | lifecycleScope.launch { | ||
245 | withContext(Dispatchers.IO) { | ||
246 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | ||
247 | } | ||
248 | } | ||
249 | } | ||
250 | |||
251 | // fun VolverAinventario() { | ||
252 | // | ||
253 | // val editor = sharedPreferences.edit() | ||
254 | // editor?.putString("Inventario", numeroInventario.toString()) | ||
255 | // editor?.apply() | ||
256 | // editor.commit() | ||
257 | // navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) | ||
258 | // } | ||
259 | |||
260 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { | ||
261 | //TODO BUSQUEDA POR CODIGO DE BARRAS | ||
262 | var busqueda: InvBody? = null | ||
263 | return GlobalScope.async(Dispatchers.IO) { | ||
264 | busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector, codigo, numInventario) | ||
265 | return@async busqueda | ||
266 | }.await() | ||
267 | } | ||
268 | |||
269 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | ||
270 | lifecycleScope.launch { | ||
271 | withContext(Dispatchers.IO) { | ||
272 | val activity: FragmentActivity? = activity | ||
273 | if (activity != null && isAdded) { | ||
274 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) | ||
275 | } | ||
276 | } | ||
277 | } | ||
278 | } | ||
279 | } | ||
280 | |||
281 | |||
282 |
app/src/main/java/com/focasoftware/deboinventariov20/UI/descripcionFragment/DescripcionListAdapter.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.descripcionFragment | |
2 | |||
3 | import android.view.LayoutInflater | ||
4 | import android.view.View | ||
5 | import android.view.ViewGroup | ||
6 | import androidx.recyclerview.widget.RecyclerView | ||
7 | import com.focasoftware.deboinventariov20.Model.Articles | ||
8 | import com.focasoftware.deboinventariov20.R | ||
9 | import kotlinx.android.synthetic.main.item.view.* | ||
10 | |||
11 | class DescripcionListAdapter(private val productos: List<Articles>?) : | ||
12 | RecyclerView.Adapter<DescripcionListAdapter.ItemsViewHolder>() { | ||
13 | internal var items2: List<Articles>? = null | ||
14 | |||
15 | init { | ||
16 | this.items2 = productos | ||
17 | } | ||
18 | |||
19 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder( | ||
20 | LayoutInflater.from(parent.context).inflate(R.layout.item_descripcion, parent, false) | ||
21 | ) | ||
22 | |||
23 | override fun getItemCount() = productos!!.size | ||
24 | |||
25 | override fun onBindViewHolder(holder: ItemsViewHolder, position: Int) { | ||
26 | when (holder) { | ||
27 | is ItemsViewHolder -> { | ||
28 | holder.bind(items2!![position]) | ||
29 | } | ||
30 | } | ||
31 | } | ||
32 | |||
33 | |||
34 | class ItemsViewHolder constructor(view: View) : RecyclerView.ViewHolder(view) { | ||
35 | |||
36 | val sector = view.tvSector | ||
37 | val codigo = view.tvCodigo | ||
38 | val descripcion = view.tvDescripcion | ||
39 | val codigoBarras = view.tvCodigoBarras | ||
40 | |||
41 | fun bind(pro: Articles) { | ||
42 | sector.text = pro.sector | ||
43 | codigo.text = pro.codigo | ||
44 | descripcion.text = pro.descripcion | ||
45 | codigoBarras.text = pro.codBar | ||
46 | } | ||
47 | } | ||
48 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/descripcionFragment/ItemDescripcion.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.descripcionFragment | |
2 | |||
3 | data class ItemDescripcion(val sector: String?,val codigo: String?, val descripcion: String?, val codigoBarras: String?) |
app/src/main/java/com/focasoftware/deboinventariov20/UI/detalleProducto/DetalleArtFragment.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.detalleProducto | |
2 | |||
3 | import android.content.Context | ||
4 | import android.content.SharedPreferences | ||
5 | import android.os.Bundle | ||
6 | import android.view.LayoutInflater | ||
7 | import android.view.View | ||
8 | import android.view.ViewGroup | ||
9 | import androidx.fragment.app.Fragment | ||
10 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
11 | import com.focasoftware.deboinventariov20.Model.Articles | ||
12 | import com.focasoftware.deboinventariov20.R | ||
13 | import kotlinx.android.synthetic.main.fragment_detalle_art.* | ||
14 | import kotlinx.coroutines.Dispatchers | ||
15 | import kotlinx.coroutines.GlobalScope | ||
16 | import kotlinx.coroutines.async | ||
17 | import kotlinx.coroutines.launch | ||
18 | |||
19 | class DetalleArtFragment : Fragment() { | ||
20 | |||
21 | private var Inventario: Int = 0 | ||
22 | private var sector: String? = null | ||
23 | private var codigo: String? = null | ||
24 | private var artSerch: Articles? = null | ||
25 | lateinit var sharedPreferences: SharedPreferences | ||
26 | |||
27 | override fun onCreate(savedInstanceState: Bundle?) { | ||
28 | super.onCreate(savedInstanceState) | ||
29 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | ||
30 | arguments?.let { | ||
31 | sector = it.getString("sector") | ||
32 | codigo = it.getString("codigo") | ||
33 | Inventario= it.getInt("numeroInv") | ||
34 | } | ||
35 | marcarInventario() | ||
36 | GlobalScope.launch(Dispatchers.Main) { | ||
37 | |||
38 | artSerch = buscarCodigoDeboEnBD(sector, codigo) | ||
39 | if (artSerch == null) { | ||
40 | |||
41 | // val type = InputType.TYPE_CLASS_NUMBER | ||
42 | // MaterialDialog(requireContext()).show { | ||
43 | // | ||
44 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") | ||
45 | // message(R.string.sCantidadNueva) | ||
46 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | ||
47 | // fCant = 0F | ||
48 | // fCant = charSequence.toString().toFloat() | ||
49 | // } | ||
50 | // positiveButton(R.string.btnOk) { | ||
51 | // //TODO ACTUALIZO CANTIADAD EN BD | ||
52 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | ||
53 | // //TODO ACTUALIZO CANTIDAD EN RV | ||
54 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
55 | // viewAdapter.notifyDataSetChanged() | ||
56 | // dismiss() | ||
57 | // } | ||
58 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | ||
59 | } else if (artSerch != null) { | ||
60 | tvSector.text=sector | ||
61 | tvCodigo.text=codigo | ||
62 | tvDeposito.text=if(artSerch!!.depSn!!.toInt() ==0)"No" else "Si" | ||
63 | tvDescripcion.text=artSerch!!.descripcion.toString() | ||
64 | tvCodigoBarras.text=artSerch!!.codBar.toString() | ||
65 | tvCodigoOrigen.text=artSerch!!.codOrigen.toString() | ||
66 | tvExiVenta.text=artSerch!!.exiVenta.toString() | ||
67 | tvExiDeposito.text=artSerch!!.exiDeposito.toString() | ||
68 | tvBal.text=artSerch!!.balanza.toString() | ||
69 | tvDE.text=artSerch!!.de.toString() | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | |||
74 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
75 | |||
76 | return inflater.inflate(R.layout.fragment_detalle_art, container, false) | ||
77 | } | ||
78 | |||
79 | suspend fun buscarCodigoDeboEnBD(sector: String?, codigo: String?): Articles? { | ||
80 | //TODO BUSQUEDA POR CODIGO DE BARRAS | ||
81 | var busqueda: Articles? = null | ||
82 | return GlobalScope.async(Dispatchers.IO) { | ||
83 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.fetchArticuloByCodSec(sector, codigo) | ||
84 | return@async busqueda | ||
85 | }.await() | ||
86 | } | ||
87 | fun marcarInventario() { | ||
88 | |||
89 | val editor = sharedPreferences.edit() | ||
90 | editor?.putString("Inventario", Inventario.toString()) | ||
91 | editor?.apply() | ||
92 | editor.commit() | ||
93 | // navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) | ||
94 | } | ||
95 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/inventario/InventarioFragment.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.inventario | |
2 | |||
3 | import android.annotation.SuppressLint | ||
4 | import android.app.AlertDialog | ||
5 | import android.content.Context | ||
6 | import android.content.Context.INPUT_METHOD_SERVICE | ||
7 | import android.content.DialogInterface | ||
8 | import android.content.SharedPreferences | ||
9 | import android.graphics.Canvas | ||
10 | import android.graphics.Color | ||
11 | import android.graphics.drawable.Drawable | ||
12 | import android.os.Bundle | ||
13 | import android.text.InputType.TYPE_CLASS_NUMBER | ||
14 | import android.view.* | ||
15 | import android.view.inputmethod.InputMethodManager | ||
16 | import android.widget.EditText | ||
17 | import android.widget.TextView | ||
18 | import android.widget.Toast | ||
19 | import androidx.core.content.ContextCompat | ||
20 | import androidx.core.os.bundleOf | ||
21 | import androidx.fragment.app.Fragment | ||
22 | import androidx.lifecycle.lifecycleScope | ||
23 | import androidx.navigation.NavController | ||
24 | import androidx.navigation.Navigation | ||
25 | import androidx.recyclerview.widget.ItemTouchHelper | ||
26 | import androidx.recyclerview.widget.LinearLayoutManager | ||
27 | import androidx.recyclerview.widget.RecyclerView | ||
28 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
29 | import com.focasoftware.deboinventariov20.Model.Articles | ||
30 | import com.focasoftware.deboinventariov20.Model.InvBody | ||
31 | import com.focasoftware.deboinventariov20.Model.InvHead | ||
32 | import com.focasoftware.deboinventariov20.R | ||
33 | import com.focasoftware.deboinventariov20.UI.Utils.NoEncontradoSimple | ||
34 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera | ||
35 | import kotlinx.android.synthetic.main.fragment_inventario.* | ||
36 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | ||
37 | import kotlinx.android.synthetic.main.login_dialog.view.* | ||
38 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar | ||
39 | import kotlinx.coroutines.* | ||
40 | import java.time.LocalDateTime | ||
41 | import java.time.format.DateTimeFormatter | ||
42 | import java.util.* | ||
43 | |||
44 | class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener { | ||
45 | |||
46 | private lateinit var sharedPreferences: SharedPreferences | ||
47 | private var iArea: Int = 0 | ||
48 | private lateinit var invHead: InvHead | ||
49 | private lateinit var rcInventarios: RecyclerView | ||
50 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | ||
51 | private lateinit var viewManager: RecyclerView.LayoutManager | ||
52 | private lateinit var sChangeUpper: String | ||
53 | private var listArticulos = ArrayList<ItemsRecycler>() | ||
54 | private lateinit var navController: NavController | ||
55 | var InventarioNuevo: Int = 0 | ||
56 | private var iEstado = 0 | ||
57 | private var iBusquedaPor = 0 | ||
58 | private var fCant = 0F | ||
59 | private var bFirst = false | ||
60 | private lateinit var deleteIcon: Drawable | ||
61 | |||
62 | @SuppressLint("MissingPermission") | ||
63 | override fun onCreate(savedInstanceState: Bundle?) { | ||
64 | super.onCreate(savedInstanceState) | ||
65 | |||
66 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | ||
67 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { | ||
68 | InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() | ||
69 | val editor = sharedPreferences.edit() | ||
70 | editor?.putString("Inventario", "-1") | ||
71 | editor?.apply() | ||
72 | editor.commit() | ||
73 | } | ||
74 | // val c = Calendar.getInstance() | ||
75 | // c[2009, 9, 9, 12, 0] = 0 | ||
76 | // val am: AlarmManager = requireActivity().getSystemService(Context.ALARM_SERVICE) as AlarmManager | ||
77 | // am.setTime(c.timeInMillis) | ||
78 | } | ||
79 | // private fun setupTimeZone(timeZoneName: String) { | ||
80 | // val am = requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager | ||
81 | // am.setTimeZone("Europe/Madrid") | ||
82 | // } | ||
83 | |||
84 | |||
85 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
86 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) | ||
87 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | ||
88 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) | ||
89 | rcInventarios = v.findViewById(R.id.rcInventarios) | ||
90 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) | ||
91 | |||
92 | if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO | ||
93 | GlobalScope.launch(Dispatchers.Main) { | ||
94 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO | ||
95 | InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 | ||
96 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO | ||
97 | invHead = InvHead(InventarioNuevo, if (SerchArea() == 0) "Ventas" else "Deposito", 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, SerchArea(), AjusteProductos(), ProdNoCont()) | ||
98 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) | ||
99 | tvTitulo.text = "Inventario Dinamico" + " Nยฐ $InventarioNuevo" | ||
100 | } | ||
101 | } else {// TODO (SI VENGO DE FRAGMENT DESCRIPCION) | ||
102 | listArticulos.clear() | ||
103 | CargarDeBdInventario(InventarioNuevo) | ||
104 | tvTitulo.text = "Inventario Dinamico" + " Nยฐ $InventarioNuevo" | ||
105 | } | ||
106 | |||
107 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> | ||
108 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { | ||
109 | sChangeUpper = tCodigoBarras.text.toString() | ||
110 | var indiceDelArtEncontrado = 0 | ||
111 | |||
112 | if (tCodigoBarras.text.isNullOrBlank()) { | ||
113 | tCodigoBarras.error = "No puede estar vacio" | ||
114 | tCodigoBarras.requestFocus() | ||
115 | tCodigoBarras.hint = "No puede estar vacio" | ||
116 | } else { | ||
117 | |||
118 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS | ||
119 | when (iBusquedaPor) { | ||
120 | 0 -> { | ||
121 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER | ||
122 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | ||
123 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | ||
124 | |||
125 | GlobalScope.launch(Dispatchers.Main) { | ||
126 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice | ||
127 | //TODO (Si no lo encuentra devuelve -1) | ||
128 | if (indiceDelArtEncontrado != -1) { | ||
129 | if (swSumaUno!!.isChecked) { | ||
130 | // fCant = 0F | ||
131 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | ||
132 | // fCant += 1F | ||
133 | //TODO ACTUALIZO LA CANTIDAD EN LA BD | ||
134 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), | ||
135 | listArticulos[indiceDelArtEncontrado].codigo.toString(), | ||
136 | listArticulos[indiceDelArtEncontrado].cantTomada + 1) | ||
137 | //TODO ACTUALIZO LA CANTIDAD EN EL RV | ||
138 | listArticulos[indiceDelArtEncontrado].cantTomada = listArticulos[indiceDelArtEncontrado].cantTomada + 1 | ||
139 | viewAdapter.notifyDataSetChanged() | ||
140 | } else { | ||
141 | dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false) | ||
142 | } | ||
143 | |||
144 | } else if (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | ||
145 | //TODO BUSCO EN BASE DE DATOS | ||
146 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | ||
147 | ContinuarCargaCB(artEncontrado)//TODO SE MANDA CERO POR QUE ES UN ARTICULO ESCANEADO NUEVO PARA QUE SEA COMPATIBLE | ||
148 | } | ||
149 | tCodigoBarras.focusable = View.FOCUSABLE | ||
150 | tCodigoBarras.setText("") | ||
151 | tCodigoBarras.selectAll() | ||
152 | } | ||
153 | return@setOnKeyListener true | ||
154 | |||
155 | |||
156 | } | ||
157 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** | ||
158 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER | ||
159 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | ||
160 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | ||
161 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice | ||
162 | // //TODO Si no lo encuentra devuelve -1 | ||
163 | // if (indiceDelArtEncontrado != -1) { | ||
164 | //// if (swSumaUno!!.isChecked) { | ||
165 | //// fCant = 0F | ||
166 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | ||
167 | //// fCant += 1F | ||
168 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
169 | //// viewAdapter.notifyDataSetChanged() | ||
170 | //// } else { | ||
171 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | ||
172 | // MaterialDialog(requireContext()).show { | ||
173 | // title(R.string.sTituloNueva) | ||
174 | // message(R.string.sCantidadNueva) | ||
175 | // input { materialDialog, charSequence -> | ||
176 | // fCant = 0F | ||
177 | // fCant = charSequence.toString().toFloat() | ||
178 | // } | ||
179 | // positiveButton(R.string.btnOk) { | ||
180 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
181 | // viewAdapter.notifyDataSetChanged() | ||
182 | // dismiss() | ||
183 | // } | ||
184 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | ||
185 | //// } | ||
186 | // | ||
187 | // } else if | ||
188 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | ||
189 | GlobalScope.launch(Dispatchers.Main) { | ||
190 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | ||
191 | ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) | ||
192 | } | ||
193 | // } | ||
194 | |||
195 | return@setOnKeyListener true | ||
196 | } | ||
197 | 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** | ||
198 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | ||
199 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | ||
200 | |||
201 | GlobalScope.launch(Dispatchers.Main) { | ||
202 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 2)//TODO Si encuentra el articulo en el RV devuelve el indice | ||
203 | // //TODO Si no lo encuentra devuelve -1 | ||
204 | if (indiceDelArtEncontrado != -1) { | ||
205 | if (swSumaUno!!.isChecked) { | ||
206 | fCant = 0F | ||
207 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada | ||
208 | fCant += 1F | ||
209 | //TODO ACTUALIZO LA CANTIDAD EN LA BD | ||
210 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | ||
211 | //TODO ACTUALIZO LA CANTIDAD EN EL RV | ||
212 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
213 | viewAdapter.notifyDataSetChanged() | ||
214 | } else { | ||
215 | dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false) | ||
216 | } | ||
217 | // } else { | ||
218 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | ||
219 | // val mBuilder = | ||
220 | // AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") | ||
221 | // .setCancelable(false) | ||
222 | // mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() | ||
223 | // val mAlertDialog = mBuilder.show() | ||
224 | // mDialogView.rbSumar.setOnClickListener { | ||
225 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
226 | // mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
227 | // } | ||
228 | // } | ||
229 | // mDialogView.rbRestar.setOnClickListener { | ||
230 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
231 | // if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | ||
232 | // mDialogView.tvgenerico4.text = | ||
233 | // (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
234 | // } | ||
235 | // } | ||
236 | // } | ||
237 | // mDialogView.rbMdodificar.setOnClickListener { | ||
238 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
239 | // mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
240 | // } | ||
241 | // } | ||
242 | // mDialogView.btnAceptar.setOnClickListener { | ||
243 | // mAlertDialog.dismiss() | ||
244 | // val name = mDialogView.tvgenerico4.text.toString().toFloat() | ||
245 | // fCant = 0F | ||
246 | // fCant = name | ||
247 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
248 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | ||
249 | // viewAdapter.notifyDataSetChanged() | ||
250 | // } | ||
251 | // mDialogView.dialogCancelBtn.setOnClickListener { | ||
252 | // mAlertDialog.dismiss() | ||
253 | // } | ||
254 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | ||
255 | // val type = InputType.TYPE_CLASS_NUMBER | ||
256 | // MaterialDialog(requireContext()).show { | ||
257 | // | ||
258 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") | ||
259 | // message(R.string.sCantidadNueva) | ||
260 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | ||
261 | // fCant = 0F | ||
262 | // fCant = charSequence.toString().toFloat() | ||
263 | // } | ||
264 | // positiveButton(R.string.btnOk) { | ||
265 | // //TODO ACTUALIZO CANTIADAD EN BD | ||
266 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | ||
267 | // //TODO ACTUALIZO CANTIDAD EN RV | ||
268 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
269 | // viewAdapter.notifyDataSetChanged() | ||
270 | // dismiss() | ||
271 | // } | ||
272 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | ||
273 | // } | ||
274 | } else if (indiceDelArtEncontrado == -1) { | ||
275 | // no lo encontro en el RV, lo va a buscar en al BD | ||
276 | |||
277 | GlobalScope.launch(Dispatchers.Main) { | ||
278 | //TODO BUSCO EN BASE DE DATOS | ||
279 | listArticulos[indiceDelArtEncontrado].cantTomada | ||
280 | val artEncontrado = buscarCodiogoOriEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | ||
281 | ContinuarCargaCB(artEncontrado) | ||
282 | } | ||
283 | } | ||
284 | } | ||
285 | return@setOnKeyListener true | ||
286 | } | ||
287 | } | ||
288 | } | ||
289 | } | ||
290 | return@setOnKeyListener false | ||
291 | } | ||
292 | return v | ||
293 | } | ||
294 | |||
295 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
296 | super.onViewCreated(view, savedInstanceState) | ||
297 | navController = Navigation.findNavController(view) | ||
298 | etCodigoBarras.requestFocus() | ||
299 | // val modalDialog = NoEncontradoSimple() | ||
300 | // modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | ||
301 | |||
302 | btnBorrarInv.setOnClickListener { | ||
303 | AlertDialog.Builder(requireContext()).setTitle("Eliminaciรณn de Inventarios").setMessage("ยฟConfirma que desea eliminar el inventario?") | ||
304 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> | ||
305 | BorrarInvActual() | ||
306 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() | ||
307 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | ||
308 | InventarioNuevo = 0 | ||
309 | |||
310 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> | ||
311 | //botรณn cancel pulsado | ||
312 | }).show() | ||
313 | } | ||
314 | |||
315 | btnExportarInv.setOnClickListener { | ||
316 | AlertDialog.Builder(requireContext()).setTitle(R.string.sTituloExportar).setMessage(R.string.sMensajeExportar) | ||
317 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> | ||
318 | BorrarInvActual() | ||
319 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | ||
320 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | ||
321 | InventarioNuevo = 0 | ||
322 | |||
323 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> }).show() | ||
324 | } | ||
325 | ivCamara.setOnClickListener { | ||
326 | if (!bFirst) { | ||
327 | iEstado = 1 | ||
328 | bFirst = true | ||
329 | } | ||
330 | |||
331 | when (iEstado) { | ||
332 | 0 -> { | ||
333 | ivCamara.setImageResource(R.drawable.codbar) | ||
334 | etCodigoBarras.hint = "Busqueda por C. Barras" | ||
335 | swSumaUno.visibility = View.VISIBLE | ||
336 | iBusquedaPor = 0 | ||
337 | iEstado = 1 | ||
338 | } | ||
339 | 1 -> { | ||
340 | ivCamara.setImageResource(R.drawable.desc) | ||
341 | etCodigoBarras.hint = "Busqueda por Descripciรณn" | ||
342 | swSumaUno.visibility = View.GONE | ||
343 | iBusquedaPor = 1 | ||
344 | iEstado = 2 | ||
345 | } | ||
346 | 2 -> { | ||
347 | ivCamara.setImageResource(R.drawable.cod_origen) | ||
348 | etCodigoBarras.hint = "Busqueda por C. Origen" | ||
349 | swSumaUno.visibility = View.GONE | ||
350 | iBusquedaPor = 2 | ||
351 | iEstado = 0 | ||
352 | } | ||
353 | } | ||
354 | } | ||
355 | } | ||
356 | |||
357 | private fun BorrarInvActual() { | ||
358 | lifecycleScope.launch { | ||
359 | withContext(Dispatchers.IO) { | ||
360 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo) | ||
361 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo) | ||
362 | } | ||
363 | } | ||
364 | } | ||
365 | |||
366 | private fun CargarDeBdInventario(ultimoInv: Int) { | ||
367 | GlobalScope.launch(Dispatchers.Main) { | ||
368 | val invbody = cargarInventario(ultimoInv) | ||
369 | for ((i, _) in invbody!!.withIndex()) { | ||
370 | val art = Articles(invbody[i].sector, | ||
371 | invbody[i].codigo, | ||
372 | invbody[i].descripcion, | ||
373 | invbody[i].codBar, | ||
374 | invbody[i].codOrigen, | ||
375 | invbody[i].precio, | ||
376 | invbody[i].costo, | ||
377 | "", | ||
378 | "", | ||
379 | "", | ||
380 | invbody[i].balanza, | ||
381 | invbody[i].depSn, | ||
382 | invbody[i].costo) | ||
383 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) | ||
384 | } | ||
385 | } | ||
386 | } | ||
387 | |||
388 | // @SuppressLint("RestrictedApi") | ||
389 | private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { | ||
390 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS | ||
391 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV | ||
392 | |||
393 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD | ||
394 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | ||
395 | // fCant = 0F | ||
396 | // fCant += 1F | ||
397 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | ||
398 | // val acargarPorDesc = Articles(artAcargar[0].sector, | ||
399 | // artAcargar[0].codigo, | ||
400 | // artAcargar[0].descripcion, | ||
401 | // artAcargar[0].codBar, | ||
402 | // artAcargar[0].codOrigen, | ||
403 | // artAcargar[0].precio, | ||
404 | // artAcargar[0].costo, | ||
405 | // "", | ||
406 | // "", | ||
407 | // "", | ||
408 | // artAcargar[0].balanza, | ||
409 | // artAcargar[0].depSn, | ||
410 | // "") | ||
411 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | ||
412 | // cargarArtEnBd(acargarPorDesc, fCant) | ||
413 | // cargarRecicler(acargarPorDesc, fCant) | ||
414 | // } else { | ||
415 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER | ||
416 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | ||
417 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | ||
418 | var bundle = Bundle() | ||
419 | bundle = bundleOf("ArrayDesc" to artAcargar) | ||
420 | bundle.putInt("numeroInv", InventarioNuevo) | ||
421 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | ||
422 | //navController.backStack.removeLast() | ||
423 | // } | ||
424 | // } else {//SI NO ESTA +1 | ||
425 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | ||
426 | // fCant = listArticulos[0].cantTomada | ||
427 | // MaterialDialog(requireContext()).show { | ||
428 | // title(R.string.sTituloNueva) | ||
429 | // message(R.string.sCantidadNueva) | ||
430 | // input { materialDialog, charSequence -> | ||
431 | // fCant = 0F | ||
432 | // fCant = charSequence.toString().toFloat() | ||
433 | // } | ||
434 | // positiveButton(R.string.btnOk) { | ||
435 | // listArticulos[0].cantTomada = fCant | ||
436 | // viewAdapter.notifyDataSetChanged() | ||
437 | // dismiss() | ||
438 | // } | ||
439 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | ||
440 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | ||
441 | // val acargarPorDesc = Articles(artAcargar[0].sector, | ||
442 | // artAcargar[0].codigo, | ||
443 | // artAcargar[0].descripcion, | ||
444 | // artAcargar[0].codBar, | ||
445 | // artAcargar[0].cod_origen, | ||
446 | // artAcargar[0].precio, | ||
447 | // artAcargar[0].costo, | ||
448 | // artAcargar[0].balanza, | ||
449 | // artAcargar[0].depSn, | ||
450 | // "") | ||
451 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | ||
452 | // cargarArtEnBd(acargarPorDesc, fCant) | ||
453 | // cargarRecicler(acargarPorDesc, fCant) | ||
454 | // } else { | ||
455 | // var bundle = Bundle() | ||
456 | // bundle = bundleOf("ArrayDesc" to artAcargar) | ||
457 | // bundle.putInt("numeroInv", InventarioNuevo) | ||
458 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | ||
459 | // } | ||
460 | // } | ||
461 | } else {//TODO si no lo encuentra en la BD | ||
462 | val modalDialog = NoEncontradoSimple() | ||
463 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | ||
464 | } | ||
465 | etCodigoBarras.focusable = View.FOCUSABLE | ||
466 | etCodigoBarras.setText("") | ||
467 | etCodigoBarras.selectAll() | ||
468 | } | ||
469 | |||
470 | private fun ContinuarCargaCB(artAcargar: Articles?) { | ||
471 | |||
472 | if (artAcargar != null) {// TODO: Si lo encuentra en la BD | ||
473 | if (swSumaUno!!.isChecked) {//TODO: SI ESTA +1, PONE CANTIDAD 1 | ||
474 | fCant = 0F | ||
475 | fCant += 1F | ||
476 | cargarArtEnBd(artAcargar, String.format("%.3f", fCant)) | ||
477 | cargarRecicler(artAcargar, fCant) | ||
478 | } else {//TODO: SI NO ESTA +1 PREGUNTA CANTIDAD | ||
479 | |||
480 | DialogingresarCantidad(requireContext(), artAcargar) | ||
481 | |||
482 | } | ||
483 | } else {// TODO si no lo encuentra en la BD | ||
484 | val modalDialog = NoEncontradoSimple() | ||
485 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | ||
486 | } | ||
487 | etCodigoBarras.focusable = View.FOCUSABLE | ||
488 | etCodigoBarras.setText("") | ||
489 | etCodigoBarras.selectAll() | ||
490 | } | ||
491 | |||
492 | |||
493 | fun DialogingresarCantidad(cnxt: Context, artAcargar: Articles?): Float { | ||
494 | var cantidad = 0F | ||
495 | val mDialogView = LayoutInflater.from(cnxt).inflate(R.layout.ingresar_cantidad, null) | ||
496 | val mBuilder = AlertDialog.Builder(cnxt).setView(mDialogView).setCancelable(false) | ||
497 | if (artAcargar!!.balanza!!.toInt() == 1 || artAcargar.balanza!!.toInt() == 3 || artAcargar.balanza!!.toInt() == 7) mDialogView.etCantidad.inputType = TYPE_CLASS_NUMBER | ||
498 | mDialogView.tvTitulo.text = artAcargar.descripcion.toString() | ||
499 | val mAlertDialog = mBuilder.show() | ||
500 | mDialogView.etCantidad.requestFocus() | ||
501 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | ||
502 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | ||
503 | |||
504 | |||
505 | mDialogView.btnAceptar.setOnClickListener { | ||
506 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { | ||
507 | mDialogView.etCantidad.error = "No vacio" | ||
508 | mDialogView.etCantidad.requestFocus() | ||
509 | mDialogView.etCantidad.hint = "Ingrese un valor" | ||
510 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | ||
511 | mAlertDialog.dismiss() | ||
512 | cantidad = mDialogView.etCantidad.text.toString().toFloat() | ||
513 | cargarArtEnBd(artAcargar, String.format("%.2f", cantidad)) | ||
514 | cargarRecicler(artAcargar, cantidad) | ||
515 | modificarCantidadEnCabecera(InventarioNuevo, true, requireContext()) | ||
516 | } | ||
517 | } | ||
518 | return cantidad | ||
519 | } | ||
520 | |||
521 | fun dialogoSumaResta(context: Context, indiceDelArtEncontrado: Int, univta: String, cancelable: Boolean) { | ||
522 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | ||
523 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("${listArticulos[indiceDelArtEncontrado].descripcion} se encuentra cargado.").setCancelable(cancelable) | ||
524 | // TODO: SI PERMITE QUE INGRESE DECIMALES | ||
525 | if (univta.contains("1") || univta.contains("3") || univta.contains("7")) mDialogView.tvNuevaCantidad.inputType = TYPE_CLASS_NUMBER | ||
526 | |||
527 | mDialogView.tvCantInicial.text = String.format("%.2f", listArticulos[indiceDelArtEncontrado].cantTomada) | ||
528 | val mAlertDialog = mBuilder.show() | ||
529 | mDialogView.tvNuevaCantidad.requestFocus() | ||
530 | |||
531 | |||
532 | |||
533 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | ||
534 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | ||
535 | |||
536 | mDialogView.rbSumar.setOnClickListener { | ||
537 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
538 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()) | ||
539 | mDialogView.tvNuevaCantidad.isEnabled = false | ||
540 | } | ||
541 | } | ||
542 | mDialogView.rbRestar.setOnClickListener { | ||
543 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
544 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | ||
545 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) | ||
546 | mDialogView.tvNuevaCantidad.isEnabled = false | ||
547 | } else { | ||
548 | mDialogView.tvResultado.text = "" | ||
549 | mDialogView.tvResultado.error = "Operaciรณn No Valida" | ||
550 | mDialogView.tvResultado.requestFocus() | ||
551 | mDialogView.tvResultado.hint = "Error" | ||
552 | } | ||
553 | } | ||
554 | } | ||
555 | mDialogView.rbMdodificar.setOnClickListener { | ||
556 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
557 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat()) | ||
558 | mDialogView.tvNuevaCantidad.isEnabled = false | ||
559 | } | ||
560 | } | ||
561 | mDialogView.btnAceptar.setOnClickListener { | ||
562 | if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) { | ||
563 | if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) { | ||
564 | mAlertDialog.dismiss() | ||
565 | listArticulos[indiceDelArtEncontrado].cantTomada = String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat() | ||
566 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), | ||
567 | listArticulos[indiceDelArtEncontrado].codigo.toString(), | ||
568 | String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat()) | ||
569 | |||
570 | viewAdapter.notifyDataSetChanged() | ||
571 | } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | ||
572 | mDialogView.tvResultado.error = "Operaciรณn Requerida" | ||
573 | mDialogView.tvResultado.requestFocus() | ||
574 | mDialogView.tvResultado.hint = "Seleccione Operaciรณn" | ||
575 | } | ||
576 | } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | ||
577 | mDialogView.tvNuevaCantidad.error = "Completar" | ||
578 | mDialogView.tvNuevaCantidad.requestFocus() | ||
579 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | ||
580 | } | ||
581 | } | ||
582 | mDialogView.dialogCancelBtn.setOnClickListener { | ||
583 | mAlertDialog.dismiss() | ||
584 | } | ||
585 | } | ||
586 | suspend fun buscarCodiogoOriEnBD(CodOri: String): Articles? { | ||
587 | //TODO BUSQUEDA POR CODIGO DE BARRAS | ||
588 | var busqueda: Articles? = null | ||
589 | return GlobalScope.async(Dispatchers.IO) { | ||
590 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodOri(CodOri, SerchArea()) | ||
591 | return@async busqueda | ||
592 | }.await() | ||
593 | } | ||
594 | |||
595 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { | ||
596 | //TODO BUSQUEDA POR CODIGO DE BARRAS | ||
597 | var busqueda: Articles? = null | ||
598 | return GlobalScope.async(Dispatchers.IO) { | ||
599 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, SerchArea()) | ||
600 | return@async busqueda | ||
601 | }.await() | ||
602 | } | ||
603 | |||
604 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { | ||
605 | //TODO BUSQUEDA POR DESCRIPCION | ||
606 | var busqueda: List<Articles>? = null | ||
607 | return GlobalScope.async(Dispatchers.IO) { | ||
608 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, SerchArea()) | ||
609 | return@async busqueda | ||
610 | }.await() | ||
611 | } | ||
612 | |||
613 | suspend fun borrarArticulo(sector: String, codigo: String, inventario: String): Int? { | ||
614 | //TODO BUSQUEDA POR DESCRIPCION | ||
615 | var result: Int | ||
616 | return GlobalScope.async(Dispatchers.IO) { | ||
617 | result = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.deleteItemFromInvBody(sector, codigo, inventario) | ||
618 | return@async result | ||
619 | }.await() | ||
620 | } | ||
621 | |||
622 | private suspend fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { | ||
623 | return GlobalScope.async(Dispatchers.IO) { | ||
624 | var indice = 0 | ||
625 | var bEncontrado = false | ||
626 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS | ||
627 | // TODO CAMBIO DE CB A CODIGO DEBO | ||
628 | val any = cambioCBporCodigoDebo(codigoBarras) | ||
629 | if (any != null) { | ||
630 | for (item in listArticulos) { | ||
631 | if (item.sector!!.toInt() == any.sector!!.toInt() && item.codigo!!.toInt() == any.codigo!!.toInt()) { | ||
632 | bEncontrado = true | ||
633 | break | ||
634 | } | ||
635 | indice += 1 | ||
636 | } | ||
637 | } | ||
638 | |||
639 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION | ||
640 | for (item in listArticulos) { | ||
641 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | ||
642 | bEncontrado = true | ||
643 | break | ||
644 | } | ||
645 | indice += 1 | ||
646 | } | ||
647 | } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN | ||
648 | for (item in listArticulos) { | ||
649 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | ||
650 | bEncontrado = true | ||
651 | break | ||
652 | } | ||
653 | indice += 1 | ||
654 | } | ||
655 | } | ||
656 | return@async if (bEncontrado) indice else -1 | ||
657 | }.await() | ||
658 | } | ||
659 | |||
660 | suspend fun cambioCBporCodigoDebo(codigoBarras: String): Articles? { | ||
661 | //TODO BUSQUEDA POR DESCRIPCION | ||
662 | var busqueda: Articles? = null | ||
663 | return GlobalScope.async(Dispatchers.IO) { | ||
664 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(codigoBarras, SerchArea()) | ||
665 | return@async busqueda | ||
666 | }.await() | ||
667 | } | ||
668 | |||
669 | private fun cargarArtEnBd(articulos: Articles, cant: String) { | ||
670 | val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD | ||
671 | articulos.sector, | ||
672 | articulos.codigo, | ||
673 | articulos.descripcion, | ||
674 | cant, | ||
675 | articulos.codBar, | ||
676 | articulos.codOrigen, | ||
677 | articulos.precio, | ||
678 | articulos.precio, | ||
679 | articulos.balanza, | ||
680 | articulos.depSn, | ||
681 | ObtenerFechaActual(), | ||
682 | ObtenerFechaActual()) | ||
683 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS | ||
684 | } | ||
685 | |||
686 | fun cargarRecicler(articulos: Articles, cant: Float) { | ||
687 | //TODO CARGO EN LE RV | ||
688 | val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen, articulos.balanza.toString(), articulos.de.toString()) | ||
689 | listArticulos.add(item) | ||
690 | |||
691 | viewAdapter = ProductosListAdapter(requireContext(), listArticulos, this) | ||
692 | viewManager = LinearLayoutManager(requireContext()) | ||
693 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! | ||
694 | rcInventarios.apply { | ||
695 | adapter = viewAdapter | ||
696 | layoutManager = viewManager | ||
697 | } | ||
698 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { | ||
699 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | ||
700 | return false | ||
701 | } | ||
702 | |||
703 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { | ||
704 | |||
705 | GlobalScope.launch(Dispatchers.Main) { | ||
706 | borrarArticulo(listArticulos[viewHolder.adapterPosition].sector.toString(), listArticulos[viewHolder.adapterPosition].codigo.toString(), InventarioNuevo.toString()) | ||
707 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) | ||
708 | viewAdapter.notifyDataSetChanged() | ||
709 | modificarCantidadEnCabecera(InventarioNuevo, false, requireContext()) | ||
710 | } | ||
711 | } | ||
712 | |||
713 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | ||
714 | val itemView = viewHolder.itemView | ||
715 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 | ||
716 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | ||
717 | |||
718 | if (dX > 0) { | ||
719 | |||
720 | if (dX < c.width / 2) c.drawColor(Color.GREEN) | ||
721 | else c.drawColor(Color.RED) | ||
722 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) | ||
723 | } else { | ||
724 | } | ||
725 | |||
726 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | ||
727 | deleteIcon.draw(c) | ||
728 | } | ||
729 | } | ||
730 | |||
731 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) | ||
732 | itemTouchHelper.attachToRecyclerView(rcInventarios) | ||
733 | } | ||
734 | |||
735 | private fun ProdNoCont(): Int? { | ||
736 | var mostrarStock = 0 | ||
737 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 | ||
738 | return mostrarStock | ||
739 | } | ||
740 | |||
741 | private fun AjusteProductos(): Int? { | ||
742 | var prodInclu = 0 | ||
743 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 | ||
744 | |||
745 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 | ||
746 | return prodInclu | ||
747 | } | ||
748 | |||
749 | private fun SerchArea(): Int { | ||
750 | if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea = 0 | ||
751 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = 1 | ||
752 | return iArea | ||
753 | } | ||
754 | |||
755 | fun ObtenerFechaActual(): String? { | ||
756 | //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD | ||
757 | val current = LocalDateTime.now() | ||
758 | val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") | ||
759 | val dFechaHora = current.format(formatter) | ||
760 | return dFechaHora.toString() | ||
761 | } | ||
762 | |||
763 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | ||
764 | lifecycleScope.launch { | ||
765 | withContext(Dispatchers.IO) { | ||
766 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | ||
767 | } | ||
768 | } | ||
769 | } | ||
770 | |||
771 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | ||
772 | lifecycleScope.launch { | ||
773 | withContext(Dispatchers.IO) { | ||
774 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) | ||
775 | } | ||
776 | } | ||
777 | } | ||
778 | |||
779 | suspend fun cargarInventario(inventario: Int): List<InvBody>? { | ||
780 | return GlobalScope.async(Dispatchers.IO) { | ||
781 | return@async AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.fetchAllInvBody(inventario) | ||
782 | }.await() | ||
783 | } | ||
784 | |||
785 | override fun onImageDotsClick(sector: String?, codigo: String?) { | ||
786 | val bundle = Bundle() | ||
787 | bundle.putString("sector", sector) | ||
788 | bundle.putString("codigo", codigo) | ||
789 | bundle.putInt("numeroInv", InventarioNuevo) | ||
790 | navController.navigate(R.id.action_inventarioFragment_to_detalleArtFragment, bundle) | ||
791 | } | ||
792 | |||
793 | override fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) { | ||
794 | dialogoSumaResta(requireContext(), position.toInt(), listArticulos[position.toInt()].univta, true) | ||
795 | } | ||
796 | } | ||
797 | |||
798 | |||
799 | |||
800 | |||
801 | |||
802 | |||
803 | |||
804 | |||
805 | |||
806 | |||
807 | |||
808 | |||
809 | |||
810 | |||
811 |
app/src/main/java/com/focasoftware/deboinventariov20/UI/inventario/ItemsRecycler.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.inventario | |
2 | |||
3 | data class ItemsRecycler(val sector: String?,val codigo: String?, val descripcion: String?, var cantTomada: Float, val codigoBarras: String?, val codigoOrigen: String?,val univta: String,val dev:String) { | ||
4 | |||
5 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/inventario/ProductosListAdapter.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.inventario | |
2 | |||
3 | import android.content.Context | ||
4 | import android.view.LayoutInflater | ||
5 | import android.view.View | ||
6 | import android.view.ViewGroup | ||
7 | import androidx.recyclerview.widget.RecyclerView | ||
8 | import com.focasoftware.deboinventariov20.R | ||
9 | import com.focasoftware.deboinventariov20.UI.Utils.BaseViewHolder | ||
10 | import kotlinx.android.synthetic.main.item.view.* | ||
11 | |||
12 | |||
13 | class ProductosListAdapter(private val context: Context,private val productos: ArrayList<ItemsRecycler>, private val itemImageClickListener: OnImageDotsClickListener) : | ||
14 | RecyclerView.Adapter<BaseViewHolder<*>>() { | ||
15 | |||
16 | private var removePosition: Int = 0 | ||
17 | private var removedItem: ItemsRecycler? = null | ||
18 | |||
19 | interface OnImageDotsClickListener { | ||
20 | fun onImageDotsClick(sector: String?,codigo: String?) | ||
21 | fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) | ||
22 | } | ||
23 | |||
24 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item, parent, false)) | ||
25 | |||
26 | override fun getItemCount() = productos.size | ||
27 | |||
28 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { | ||
29 | when (holder) { | ||
30 | is ItemsViewHolder -> { holder.bind(productos[position], position) } | ||
31 | |||
32 | } | ||
33 | } | ||
34 | inner class ItemsViewHolder (itemView: View) : BaseViewHolder<ItemsRecycler>(itemView) { | ||
35 | override fun bind(item: ItemsRecycler, position: Int) { | ||
36 | itemView.ivDots.setOnClickListener {itemImageClickListener.onImageDotsClick(item.sector,item.codigo) } | ||
37 | itemView.ivPen.setOnClickListener {itemImageClickListener.onImagePenClick(item.sector,item.codigo,item.cantTomada.toString(),adapterPosition.toString()) } | ||
38 | |||
39 | itemView.tvSector.text=item.sector | ||
40 | itemView.tvCodigo.text=item.codigo | ||
41 | itemView.tvDescripcion.text=item.descripcion | ||
42 | itemView.tvCantidad.text=item.cantTomada.toString() | ||
43 | itemView.tvCodigoBarras.text=item.sector | ||
44 | itemView.tvCodigoOrigen.text=item.sector | ||
45 | itemView.ivPen.setImageResource(R.drawable.pen) | ||
46 | itemView.ivDots.setImageResource(R.drawable.more) | ||
47 | } | ||
48 | } | ||
49 | |||
50 | fun removeItem(viewHolder: RecyclerView.ViewHolder) { | ||
51 | removePosition = viewHolder.adapterPosition | ||
52 | removedItem = productos[viewHolder.adapterPosition] | ||
53 | |||
54 | productos.removeAt(viewHolder.adapterPosition) | ||
55 | notifyItemRemoved(viewHolder.adapterPosition) | ||
56 | } | ||
57 | |||
58 | |||
59 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/inventario/viewModel/InventarioViewModel.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.inventario.viewModel | |
2 | |||
3 | import androidx.lifecycle.ViewModel | ||
4 | |||
5 | class InventarioViewModel: ViewModel() { | ||
6 | var InventarioNuevo: Int = 0 | ||
7 | } | ||
8 |
app/src/main/java/com/focasoftware/deboinventariov20/UI/main/InventarioListAdapter.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.main | |
2 | |||
3 | import android.content.Context | ||
4 | import android.view.LayoutInflater | ||
5 | import android.view.View | ||
6 | import android.view.ViewGroup | ||
7 | import androidx.recyclerview.widget.RecyclerView | ||
8 | import com.focasoftware.deboinventariov20.Model.InvHead | ||
9 | import com.focasoftware.deboinventariov20.R | ||
10 | import com.focasoftware.deboinventariov20.UI.Utils.BaseViewHolder | ||
11 | import kotlinx.android.synthetic.main.item_principal.view.* | ||
12 | |||
13 | class InventarioListAdapter(private val context: Context, private val inv: List<InvHead>, private val itemClickListener: OnInventarioClickListener) : | ||
14 | RecyclerView.Adapter<BaseViewHolder<*>>() { | ||
15 | |||
16 | interface OnInventarioClickListener { | ||
17 | fun onItemClick(inventario: String?) | ||
18 | } | ||
19 | |||
20 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item_principal, parent, false)) | ||
21 | |||
22 | override fun getItemCount() = inv.size | ||
23 | |||
24 | |||
25 | inner class ItemsViewHolder(itemView: View) : BaseViewHolder<InvHead>(itemView) { | ||
26 | override fun bind(item: InvHead, position: Int) { | ||
27 | itemView.setOnClickListener {itemClickListener.onItemClick(item.invNum.toString())} | ||
28 | itemView.tvPrincipalinventario.text = if ( item.invNum < 10) "0${ item.invNum.toString()}" else item.invNum.toString() | ||
29 | |||
30 | itemView.tvDescription.text=item.descripcion.toString() | ||
31 | itemView.tvFecha.text=item.fechaInicio.toString() | ||
32 | itemView.tvCantContada.text=item.prodContados.toString() | ||
33 | } | ||
34 | } | ||
35 | |||
36 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { | ||
37 | when (holder) { | ||
38 | is ItemsViewHolder -> holder.bind(inv[position], position) | ||
39 | else -> IllegalArgumentException("No se pudo pasar el ViewHolder") | ||
40 | } | ||
41 | } | ||
42 | |||
43 | |||
44 | } | ||
45 | |||
46 | |||
47 | |||
48 |
app/src/main/java/com/focasoftware/deboinventariov20/UI/main/ItemPrincipal.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.main | |
2 | |||
3 | data class ItemInventario(val inventario: String?, val descripcion: String?) |
app/src/main/java/com/focasoftware/deboinventariov20/UI/main/MainFragment.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.main | |
2 | |||
3 | import android.content.Context | ||
4 | import android.content.SharedPreferences | ||
5 | import android.os.Bundle | ||
6 | import android.view.LayoutInflater | ||
7 | import android.view.View | ||
8 | import android.view.ViewGroup | ||
9 | import android.widget.* | ||
10 | import androidx.fragment.app.Fragment | ||
11 | import androidx.navigation.NavController | ||
12 | import androidx.navigation.Navigation | ||
13 | import androidx.recyclerview.widget.LinearLayoutManager | ||
14 | import androidx.recyclerview.widget.RecyclerView | ||
15 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
16 | import com.focasoftware.deboinventariov20.Model.InvHead | ||
17 | import com.focasoftware.deboinventariov20.R | ||
18 | import kotlinx.coroutines.Dispatchers | ||
19 | import kotlinx.coroutines.GlobalScope | ||
20 | import kotlinx.coroutines.async | ||
21 | import kotlinx.coroutines.launch | ||
22 | import java.util.* | ||
23 | |||
24 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { | ||
25 | private lateinit var inventarios: List<InvHead> | ||
26 | private lateinit var ordenado: List<InvHead> | ||
27 | private lateinit var rcInventario: RecyclerView | ||
28 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | ||
29 | private lateinit var viewManager: RecyclerView.LayoutManager | ||
30 | // private var listIvn2 = List<InvHead>() | ||
31 | private var listIvn2 = ArrayList<InvHead>() | ||
32 | private lateinit var navController: NavController | ||
33 | private lateinit var sharedPreferences: SharedPreferences | ||
34 | private var cantidadInventarios: Int = 0 | ||
35 | |||
36 | override fun onCreate(savedInstanceState: Bundle?) { | ||
37 | super.onCreate(savedInstanceState) | ||
38 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | ||
39 | } | ||
40 | |||
41 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
42 | var bAbiertoCerrado = false | ||
43 | val v = inflater.inflate(R.layout.fragment_main, container, false) | ||
44 | val tvInvDinamicos = v.findViewById<TextView>(R.id.tvInvDinamicos) | ||
45 | val txtDeposito = v.findViewById<TextView>(R.id.txtDeposito) | ||
46 | val ivSort19= v.findViewById<ImageButton>(R.id.ivSort19) | ||
47 | val ivSort91= v.findViewById<ImageButton>(R.id.ivSort91) | ||
48 | val cbVentas= v.findViewById<CheckBox>(R.id.cbVentas) | ||
49 | val cbDeposito= v.findViewById<CheckBox>(R.id.cbDeposito) | ||
50 | val tvTipo = v.findViewById<TextView>(R.id.tvTipo) | ||
51 | rcInventario = v.findViewById(R.id.rcInventario) | ||
52 | |||
53 | GlobalScope.launch(Dispatchers.Main) { | ||
54 | inventarios = buscarEnBDInvHead() | ||
55 | for ((i, item) in inventarios.withIndex()) { | ||
56 | val inv = InvHead(inventarios[i].invNum, | ||
57 | inventarios[i].descripcion, | ||
58 | inventarios[i].estado, | ||
59 | inventarios[i].fechaInicio, | ||
60 | inventarios[i].fechaFinal, | ||
61 | inventarios[i].prodContados, | ||
62 | inventarios[i].lugar, | ||
63 | inventarios[i].stDesc, | ||
64 | inventarios[i].proNoCont) | ||
65 | cargarRecicler(inv) | ||
66 | cantidadInventarios = i + 1 | ||
67 | } | ||
68 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) +" | ||
69 | tvInvDinamicos.setOnClickListener { | ||
70 | if (!bAbiertoCerrado) { | ||
71 | bAbiertoCerrado = true | ||
72 | txtDeposito.visibility = View.GONE | ||
73 | rcInventario.visibility = View.VISIBLE | ||
74 | ivSort91.visibility = View.INVISIBLE | ||
75 | ivSort19.visibility = View.VISIBLE | ||
76 | cbVentas.visibility = View.VISIBLE | ||
77 | cbDeposito.visibility = View.VISIBLE | ||
78 | tvTipo.visibility = View.VISIBLE | ||
79 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) -" | ||
80 | } else { | ||
81 | bAbiertoCerrado = false | ||
82 | rcInventario.visibility = View.GONE | ||
83 | ivSort91.visibility = View.GONE | ||
84 | ivSort19.visibility = View.GONE | ||
85 | txtDeposito.visibility = View.VISIBLE | ||
86 | cbVentas.visibility = View.GONE | ||
87 | cbDeposito.visibility = View.GONE | ||
88 | tvTipo.visibility = View.GONE | ||
89 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) +" | ||
90 | } | ||
91 | } | ||
92 | ivSort19.setOnClickListener { | ||
93 | ordenado= inventarios.sortedByDescending { | ||
94 | it.invNum | ||
95 | } | ||
96 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | ||
97 | viewManager = LinearLayoutManager(requireContext()) | ||
98 | |||
99 | rcInventario.apply { | ||
100 | adapter = viewAdapter | ||
101 | layoutManager = viewManager | ||
102 | } | ||
103 | viewAdapter.notifyDataSetChanged() | ||
104 | ivSort19.visibility=View.INVISIBLE | ||
105 | ivSort91.visibility=View.VISIBLE | ||
106 | } | ||
107 | ivSort91.setOnClickListener { | ||
108 | ordenado= inventarios.sortedBy { | ||
109 | it.invNum | ||
110 | } | ||
111 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | ||
112 | viewManager = LinearLayoutManager(requireContext()) | ||
113 | |||
114 | rcInventario.apply { | ||
115 | adapter = viewAdapter | ||
116 | layoutManager = viewManager | ||
117 | } | ||
118 | viewAdapter.notifyDataSetChanged() | ||
119 | ivSort91.visibility=View.INVISIBLE | ||
120 | ivSort19.visibility=View.VISIBLE | ||
121 | } | ||
122 | } | ||
123 | return v | ||
124 | } | ||
125 | |||
126 | suspend fun buscarEnBDInvHead(): List<InvHead> { | ||
127 | //TODO BUSQUEDA POR DESCRIPCION | ||
128 | var busqueda: List<InvHead> | ||
129 | return GlobalScope.async(Dispatchers.IO) { | ||
130 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() | ||
131 | return@async busqueda | ||
132 | }.await() | ||
133 | } | ||
134 | |||
135 | fun cargarRecicler(inv: InvHead) { | ||
136 | //TODO CARGO EN LE RV | ||
137 | |||
138 | // val number = if (inv.invNum.toLong() < 10) "0${inv.invNum.toLong()}" else inv.invNum.toString() | ||
139 | // val item = ItemInventario("Nยฐ $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") | ||
140 | |||
141 | // listIvn.add(item) | ||
142 | listIvn2.add(inv) | ||
143 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this) | ||
144 | viewManager = LinearLayoutManager(requireContext()) | ||
145 | |||
146 | rcInventario.apply { | ||
147 | adapter = viewAdapter | ||
148 | layoutManager = viewManager | ||
149 | } | ||
150 | } | ||
151 | |||
152 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
153 | super.onViewCreated(view, savedInstanceState) | ||
154 | navController = Navigation.findNavController(view) | ||
155 | listIvn2.clear() | ||
156 | } | ||
157 | |||
158 | override fun onItemClick(inventario: String?) { | ||
159 | |||
160 | val editor = sharedPreferences.edit() | ||
161 | // var invSel: String = inventario.toString() | ||
162 | // invSel = invSel.substring(3, 5) | ||
163 | editor?.putString("Inventario", inventario) | ||
164 | editor?.apply() | ||
165 | editor.commit() | ||
166 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) | ||
167 | } | ||
168 | |||
169 | |||
170 | } | ||
171 | |||
172 |
app/src/main/java/com/focasoftware/deboinventariov20/UI/servidores/AdapterServidores.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.servidores | |
2 | |||
3 | import android.content.Context | ||
4 | import android.view.LayoutInflater | ||
5 | import android.view.View | ||
6 | import android.view.ViewGroup | ||
7 | import androidx.recyclerview.widget.RecyclerView | ||
8 | import com.focasoftware.deboinventariov20.R | ||
9 | import kotlinx.android.synthetic.main.item_servidores.view.* | ||
10 | |||
11 | class AdapterServidores(private val servidor: ArrayList<ItemsServidores>, private var contexto: Context) : | ||
12 | RecyclerView.Adapter<AdapterServidores.ViewHolder>() { | ||
13 | private var removePosition: Int = 0 | ||
14 | private var removedItem: ItemsServidores? = null | ||
15 | |||
16 | class ViewHolder(var vista: View) : RecyclerView.ViewHolder(vista) { | ||
17 | fun bind(itemsServidores: ItemsServidores) { | ||
18 | vista.tvDescServidor.text = itemsServidores.descripcion | ||
19 | vista.tvDireccionServidor.text = itemsServidores.direccion | ||
20 | |||
21 | } | ||
22 | } | ||
23 | |||
24 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { | ||
25 | return ViewHolder( | ||
26 | LayoutInflater.from(parent.context).inflate(R.layout.item_servidores, parent, false) | ||
27 | ) | ||
28 | } | ||
29 | |||
30 | override fun getItemCount(): Int { | ||
31 | return servidor.size | ||
32 | } | ||
33 | |||
34 | override fun onBindViewHolder(holder: ViewHolder, position: Int) { | ||
35 | holder.bind(servidor[position]) | ||
36 | } | ||
37 | fun removeItem(viewHolder: RecyclerView.ViewHolder) { | ||
38 | removePosition = viewHolder.adapterPosition | ||
39 | removedItem = servidor[viewHolder.adapterPosition] | ||
40 | |||
41 | servidor.removeAt(viewHolder.adapterPosition) | ||
42 | notifyItemRemoved(viewHolder.adapterPosition) | ||
43 | } | ||
44 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/servidores/ItemsServidores.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.servidores | |
2 | |||
3 | data class ItemsServidores(val descripcion: String?, var direccion: String?, var predeterminado: String?) |
app/src/main/java/com/focasoftware/deboinventariov20/UI/servidores/ServidoresFragment.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.servidores | |
2 | |||
3 | import android.graphics.Canvas | ||
4 | import android.graphics.Color | ||
5 | import android.graphics.drawable.Drawable | ||
6 | import android.os.Bundle | ||
7 | import android.view.LayoutInflater | ||
8 | import android.view.View | ||
9 | import android.view.ViewGroup | ||
10 | import android.widget.Toast | ||
11 | import androidx.core.content.ContextCompat | ||
12 | import androidx.fragment.app.Fragment | ||
13 | import androidx.lifecycle.lifecycleScope | ||
14 | import androidx.recyclerview.widget.ItemTouchHelper | ||
15 | import androidx.recyclerview.widget.LinearLayoutManager | ||
16 | import androidx.recyclerview.widget.RecyclerView | ||
17 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
18 | import com.focasoftware.deboinventariov20.Model.ServeInv | ||
19 | import com.focasoftware.deboinventariov20.R | ||
20 | import kotlinx.android.synthetic.main.fragment_servidores.* | ||
21 | import kotlinx.coroutines.* | ||
22 | |||
23 | class ServidoresFragment : Fragment() { | ||
24 | |||
25 | private lateinit var rvServidores: RecyclerView | ||
26 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | ||
27 | private lateinit var viewManager: RecyclerView.LayoutManager | ||
28 | private var listServ = ArrayList<ItemsServidores>() | ||
29 | private lateinit var servidores: List<ServeInv> | ||
30 | private lateinit var deleteIcon: Drawable | ||
31 | |||
32 | override fun onCreate(savedInstanceState: Bundle?) { | ||
33 | super.onCreate(savedInstanceState) | ||
34 | CargarRV() | ||
35 | } | ||
36 | |||
37 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
38 | super.onViewCreated(view, savedInstanceState) | ||
39 | |||
40 | btnGuardarServidores.setOnClickListener { | ||
41 | if (etNombreServidor.text.isNullOrBlank()) { | ||
42 | etNombreServidor.error = "Nombre no valido" | ||
43 | etNombreServidor.requestFocus() | ||
44 | etNombreServidor.hint = "Nombre no valido" | ||
45 | } | ||
46 | if (etDireccionServidor.text.isNullOrBlank()) { | ||
47 | etDireccionServidor.error = "Direcciรณn no valida" | ||
48 | etDireccionServidor.requestFocus() | ||
49 | etDireccionServidor.hint = "Direcciรณn no valida" | ||
50 | } | ||
51 | if (!etDireccionServidor.text.isNullOrBlank() || !etNombreServidor.text.isNullOrBlank()) { | ||
52 | // GlobalScope.launch(Dispatchers.Main) { | ||
53 | // ServerNew =AppDb.getAppDb(requireContext())?.ServeInvDao()?.findLastServer()?.plus(1) ?: 1 | ||
54 | val servidor = ServeInv(etNombreServidor.text.toString(), "http://${etDireccionServidor.text}/", 0) | ||
55 | ingresarDatos(servidor) | ||
56 | cargarRecicler(servidor) | ||
57 | Toast.makeText(requireContext(), "Servidor ${etNombreServidor.text} Guardado", Toast.LENGTH_LONG).show() | ||
58 | etNombreServidor.text.clear() | ||
59 | etDireccionServidor.text.clear() | ||
60 | // } | ||
61 | } | ||
62 | } | ||
63 | } | ||
64 | |||
65 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
66 | val v = inflater.inflate(R.layout.fragment_servidores, container, false) | ||
67 | rvServidores = v.findViewById(R.id.rvServidores) | ||
68 | return v | ||
69 | } | ||
70 | |||
71 | fun ingresarDatos(servidor: ServeInv) { | ||
72 | val Job = GlobalScope.launch { | ||
73 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.insertServer(servidor) | ||
74 | } | ||
75 | } | ||
76 | |||
77 | suspend fun buscarEnBD(): List<ServeInv> { | ||
78 | var busqueda: List<ServeInv> | ||
79 | return GlobalScope.async(Dispatchers.IO) { | ||
80 | busqueda = AppDb.getAppDb(requireContext())!!.ServeInvDao()!!.fetchAllServers() | ||
81 | return@async busqueda | ||
82 | }.await() | ||
83 | } | ||
84 | |||
85 | fun CargarRV() { | ||
86 | GlobalScope.launch(Dispatchers.Main) { | ||
87 | servidores = buscarEnBD() | ||
88 | for ((i, item) in servidores.withIndex()) { | ||
89 | val ser = ServeInv(servidores[i].descripcion, servidores[i].direccion, servidores[i].predeterminado) | ||
90 | cargarRecicler(ser) | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | |||
95 | fun cargarRecicler(ser: ServeInv) { | ||
96 | //TODO CARGO EN LE RV | ||
97 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! | ||
98 | val item = ItemsServidores(ser.descripcion, ser.direccion, ser.predeterminado.toString()) | ||
99 | |||
100 | listServ.add(item) | ||
101 | |||
102 | viewAdapter = AdapterServidores(listServ, requireContext()) | ||
103 | viewManager = LinearLayoutManager(requireContext()) | ||
104 | |||
105 | rvServidores.apply { | ||
106 | adapter = viewAdapter | ||
107 | layoutManager = viewManager | ||
108 | } | ||
109 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { | ||
110 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | ||
111 | return false | ||
112 | } | ||
113 | |||
114 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | ||
115 | GlobalScope.launch(Dispatchers.Main) { | ||
116 | deleteServer(listServ[viewHolder.adapterPosition].descripcion.toString(), listServ[viewHolder.adapterPosition].direccion.toString()) | ||
117 | |||
118 | (viewAdapter as AdapterServidores).removeItem(viewHolder) | ||
119 | viewAdapter.notifyDataSetChanged() | ||
120 | } | ||
121 | } | ||
122 | |||
123 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | ||
124 | val itemView = viewHolder.itemView | ||
125 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 | ||
126 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | ||
127 | |||
128 | if (dX > 0) { | ||
129 | |||
130 | if (dX < c.width / 2) c.drawColor(Color.GREEN) | ||
131 | else c.drawColor(Color.RED) | ||
132 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) | ||
133 | } else { | ||
134 | } | ||
135 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | ||
136 | deleteIcon.draw(c) | ||
137 | } | ||
138 | } | ||
139 | |||
140 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) | ||
141 | itemTouchHelper.attachToRecyclerView(rvServidores) | ||
142 | } | ||
143 | |||
144 | suspend fun deleteServer(serverName: String, serverDir: String) { | ||
145 | lifecycleScope.launch { | ||
146 | withContext(Dispatchers.IO) { | ||
147 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.deleteServer(serverName, serverDir) | ||
148 | } | ||
149 | } | ||
150 | } | ||
151 | } | ||
152 |
app/src/main/java/com/focasoftware/deboinventariov20/UI/servidores/SpinnerAdapter.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.servidores | |
2 | |||
3 | import android.content.Context | ||
4 | import android.view.LayoutInflater | ||
5 | import android.view.View | ||
6 | import android.view.ViewGroup | ||
7 | import android.widget.BaseAdapter | ||
8 | import android.widget.TextView | ||
9 | import com.focasoftware.deboinventariov20.Model.ServeInv | ||
10 | import com.focasoftware.deboinventariov20.R | ||
11 | |||
12 | |||
13 | class SpinnerAdapterServidor internal constructor(internal var context: Context, internal var list: List<ServeInv>) : BaseAdapter() { | ||
14 | override fun getCount(): Int { | ||
15 | return list.size | ||
16 | } | ||
17 | |||
18 | override fun getItem(i: Int): Any? { | ||
19 | return null | ||
20 | } | ||
21 | |||
22 | override fun getItemId(i: Int): Long { | ||
23 | return 0 | ||
24 | } | ||
25 | |||
26 | override fun getView(i: Int, view1: View?, viewGroup: ViewGroup): View { | ||
27 | var views=view1 | ||
28 | if (views == null) { | ||
29 | val inflater = LayoutInflater.from(context) | ||
30 | |||
31 | views = inflater.inflate(R.layout.item_spinner, viewGroup, false) | ||
32 | } | ||
33 | |||
34 | val tvServidorDesc = views!!.findViewById<TextView>(R.id.tvServidorDesc) | ||
35 | tvServidorDesc.text="${list[i].servNum} - ${list[i].descripcion}" | ||
36 | return tvServidorDesc | ||
37 | |||
38 | } | ||
39 | } | ||
40 | |||
41 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/MainActivity.kt
1 | package com.focasoftware.deboinventariov20.ui | File was deleted | |
2 | |||
3 | import android.os.Bundle | ||
4 | import android.view.Menu | ||
5 | import com.google.android.material.navigation.NavigationView | ||
6 | import androidx.navigation.findNavController | ||
7 | import androidx.navigation.ui.AppBarConfiguration | ||
8 | import androidx.navigation.ui.navigateUp | ||
9 | import androidx.navigation.ui.setupActionBarWithNavController | ||
10 | import androidx.navigation.ui.setupWithNavController | ||
11 | import androidx.drawerlayout.widget.DrawerLayout | ||
12 | import androidx.appcompat.app.AppCompatActivity | ||
13 | import androidx.appcompat.widget.Toolbar | ||
14 | import com.focasoftware.deboinventariov20.R | ||
15 | |||
16 | class MainActivity : AppCompatActivity() { | ||
17 | |||
18 | private lateinit var appBarConfiguration: AppBarConfiguration | ||
19 | |||
20 | override fun onCreate(savedInstanceState: Bundle?) { | ||
21 | super.onCreate(savedInstanceState) | ||
22 | setContentView(R.layout.activity_main) | ||
23 | val toolbar: Toolbar = findViewById(R.id.toolbar) | ||
24 | setSupportActionBar(toolbar) | ||
25 | |||
26 | |||
27 | val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout) | ||
28 | val navView: NavigationView = findViewById(R.id.nav_view) | ||
29 | val navController = findNavController(R.id.nav_host_fragment) | ||
30 | |||
31 | appBarConfiguration = AppBarConfiguration(setOf(R.id.mainFragment2, R.id.inventarioFragment, R.id.actuaMaestrosFragment, R.id.configuracionFragment), drawerLayout) | ||
32 | setupActionBarWithNavController(navController, appBarConfiguration) | ||
33 | navView.setupWithNavController(navController) | ||
34 | } | ||
35 | |||
36 | override fun onCreateOptionsMenu(menu: Menu): Boolean { | ||
37 | // Inflate the menu; this adds items to the action bar if it is present. | ||
38 | menuInflater.inflate(R.menu.main, menu) | ||
39 | return true | ||
40 | } | ||
41 | |||
42 | override fun onSupportNavigateUp(): Boolean { | ||
43 | val navController = findNavController(R.id.nav_host_fragment) | ||
44 | return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() | ||
45 | } | ||
46 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/SplashActivity.kt
1 | package com.focasoftware.deboinventariov20.ui | File was deleted | |
2 | |||
3 | import android.app.Activity | ||
4 | import android.content.Intent | ||
5 | import android.os.Bundle | ||
6 | import com.focasoftware.deboinventariov20.R | ||
7 | |||
8 | class SplashActivity : Activity() { | ||
9 | |||
10 | override fun onCreate(savedInstanceState: Bundle?) { | ||
11 | super.onCreate(savedInstanceState) | ||
12 | setContentView(R.layout.activity_splash) | ||
13 | //window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | ||
14 | |||
15 | val bac = object : Thread(){ | ||
16 | override fun run(){ | ||
17 | try { | ||
18 | Thread.sleep(5) | ||
19 | val intent = Intent(baseContext, MainActivity:: class.java) | ||
20 | startActivity(intent) | ||
21 | finish() | ||
22 | } catch (e : Exception){ | ||
23 | e.printStackTrace() | ||
24 | } | ||
25 | } | ||
26 | } | ||
27 | bac.start() | ||
28 | } | ||
29 | } | ||
30 | 1 | package com.focasoftware.deboinventariov20.ui |
app/src/main/java/com/focasoftware/deboinventariov20/ui/actualizacionMaestros/ActuaMaestrosFragment.kt
1 | package com.focasoftware.deboinventariov20.ui.actualizacionMaestros | File was deleted | |
2 | |||
3 | import android.os.Bundle | ||
4 | import android.view.LayoutInflater | ||
5 | import android.view.View | ||
6 | import android.view.ViewGroup | ||
7 | import android.widget.Button | ||
8 | import androidx.fragment.app.Fragment | ||
9 | import androidx.fragment.app.FragmentActivity | ||
10 | import androidx.lifecycle.lifecycleScope | ||
11 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
12 | import com.focasoftware.deboinventariov20.Model.* | ||
13 | import com.focasoftware.deboinventariov20.R | ||
14 | import com.google.android.material.bottomappbar.BottomAppBarTopEdgeTreatment | ||
15 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* | ||
16 | import kotlinx.coroutines.* | ||
17 | |||
18 | public var BASE_URL ="" | ||
19 | class ActuaMaestrosFragment : Fragment() { | ||
20 | |||
21 | var job: Job? = null | ||
22 | |||
23 | |||
24 | override fun onCreate(savedInstanceState: Bundle?) { | ||
25 | super.onCreate(savedInstanceState) | ||
26 | // GlobalScope.launch(Dispatchers.Main) { | ||
27 | // val invbody = fetchServerPreOne() | ||
28 | //BASE_URL= invbody!!.direccion.toString() | ||
29 | BASE_URL="http://10.0.2.2:3000/" | ||
30 | // } | ||
31 | // mostrarArticulos() | ||
32 | } | ||
33 | |||
34 | private suspend fun fetchServerPreOne(): ServeInv? { | ||
35 | return GlobalScope.async(Dispatchers.IO) { | ||
36 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServerPreOne() | ||
37 | }.await() | ||
38 | } | ||
39 | |||
40 | // return "http://10.0.2.2:3000/" | ||
41 | // } | ||
42 | |||
43 | |||
44 | override fun onCreateView( | ||
45 | inflater: LayoutInflater, container: ViewGroup?, | ||
46 | savedInstanceState: Bundle? | ||
47 | ): View? { | ||
48 | // Inflate the layout for this fragment | ||
49 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) | ||
50 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) | ||
51 | bConfirmarAct.setOnClickListener { | ||
52 | loading_view.visibility = View.VISIBLE | ||
53 | countriesList.text = "Obteniendo Maestros de artรญculos, aguarde por favor." | ||
54 | obtenerArticulos() | ||
55 | } | ||
56 | return v | ||
57 | } | ||
58 | |||
59 | |||
60 | private fun obtenerArticulos() { | ||
61 | |||
62 | val productosService = ProductosService.getProductosService() | ||
63 | var index: Long = 1 | ||
64 | job = CoroutineScope(Dispatchers.IO).launch { | ||
65 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | ||
66 | .deleteAllArticulos() | ||
67 | val response = productosService.getProductos() | ||
68 | if (response.isSuccessful) { | ||
69 | for (pro in response.body()!!) { | ||
70 | val artiAcargar = Articles( | ||
71 | pro.sector, | ||
72 | pro.codigo, | ||
73 | pro.descripcion, | ||
74 | pro.codBar, | ||
75 | pro.codOrigen, | ||
76 | pro.precio, | ||
77 | pro.costo, | ||
78 | pro.exiVenta, | ||
79 | pro.exiDeposito, | ||
80 | pro.de, | ||
81 | pro.balanza, | ||
82 | pro.depSn, | ||
83 | pro.imagen | ||
84 | ) | ||
85 | index += index | ||
86 | |||
87 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | ||
88 | .insertArticulos(artiAcargar) | ||
89 | } | ||
90 | withContext(Dispatchers.Main) { | ||
91 | countriesList.visibility = View.VISIBLE | ||
92 | countriesList.text = "ยกDatos Importados Correctamente!" | ||
93 | loading_view.visibility = View.GONE | ||
94 | } | ||
95 | // | ||
96 | } else { | ||
97 | countriesList.text = "Error: ${response.message()}" | ||
98 | } | ||
99 | } | ||
100 | |||
101 | // withContext(Dispatchers.Main) { | ||
102 | // if (response.isSuccessful) { | ||
103 | // val call = WebService | ||
104 | // .instance | ||
105 | // ?.createService(WebServiceApi::class.java) | ||
106 | // ?.articulos | ||
107 | // call?.enqueue(object : Callback<List<productos?>?> { | ||
108 | // override fun onResponse( | ||
109 | // call: Call<List<productos?>?>, | ||
110 | // response: Response<List<productos?>?> | ||
111 | // ) { | ||
112 | // if (response.code() == 200) { | ||
113 | // for (i in response.body()!!.indices) { | ||
114 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) | ||
115 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") | ||
116 | //// Log.d( | ||
117 | //// "TAG1", "Nombre Curso: " + response.body()!![i]?.sector | ||
118 | //// + "Codigo Profesor: " + response.body()!![i]?.descripcion | ||
119 | //// ) | ||
120 | // mostrarArticulos() | ||
121 | // } | ||
122 | // } else if (response.code() == 404) { | ||
123 | // Log.d("TAG1", "No hay cursos") | ||
124 | // } | ||
125 | // | ||
126 | // } | ||
127 | // | ||
128 | // override fun onFailure(call: Call<List<productos?>?>, t: Throwable) {} | ||
129 | // }) | ||
130 | } | ||
131 | |||
132 | fun mostrarArticulos() { | ||
133 | val Job = GlobalScope.launch { | ||
134 | var listArticulos: List<Articles>? = null | ||
135 | var temp: String = "" | ||
136 | listArticulos = | ||
137 | AppDb.getAppDb(requireActivity())?.ArticulosDAO()?.findAllArticulos() | ||
138 | if (listArticulos != null) { | ||
139 | |||
140 | for (i in listArticulos.indices) | ||
141 | temp += listArticulos[i].codigo.toString() | ||
142 | } | ||
143 | withContext(Dispatchers.Main) { | ||
144 | countriesList.visibility = View.VISIBLE | ||
145 | loading_view.visibility = View.GONE | ||
146 | countriesList?.text = temp | ||
147 | } | ||
148 | } | ||
149 | // for (professor in listArticulos!!) { | ||
150 | // editT.text= professor.id.toString() | ||
151 | // } | ||
152 | } | ||
153 | |||
154 | |||
155 | // fun observeViewModel() { | ||
156 | // | ||
157 | // val productosService = ProductosService.getProductosService() | ||
158 | // var job: Job? = null | ||
159 | // | ||
160 | // | ||
161 | // //countriesList.text="Procesando..." | ||
162 | // //countriesList.visibility = View.VISIBLE | ||
163 | // // GlobalScope1.launch(Dispatchers.IO) { | ||
164 | // val response = productosService.getProductos() | ||
165 | // if (response.isSuccessful) { | ||
166 | //// countriesList.layoutManager = LinearLayoutManager(context) | ||
167 | //// countriesList.itemAnimator = DefaultItemAnimator() | ||
168 | // | ||
169 | //// ProductAdapter.updateCountries(it) | ||
170 | // // cargarArticulos(response.body()) | ||
171 | // | ||
172 | // | ||
173 | // val artiAcargar: Articulos? = null | ||
174 | // var index: Long = 1 | ||
175 | // | ||
176 | // for (pro in response.body()!!) { | ||
177 | // //artiAcargar.id =index+1 | ||
178 | // artiAcargar!!.sector = pro.sector | ||
179 | // artiAcargar.codigo = pro.codigo | ||
180 | // artiAcargar.descripcion = pro.descripcion | ||
181 | // artiAcargar.codBar = pro.codBar | ||
182 | // artiAcargar.precio = pro.precio | ||
183 | // artiAcargar.costo = pro.costo | ||
184 | // artiAcargar.balanza = pro.balanza | ||
185 | // artiAcargar.depSn = pro.depSn | ||
186 | // artiAcargar.imagen = pro.imagen | ||
187 | // index += index | ||
188 | // | ||
189 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | ||
190 | // .insertArticulos(artiAcargar) | ||
191 | // } | ||
192 | // } | ||
193 | // // } | ||
194 | // | ||
195 | // //job.cancel() | ||
196 | // | ||
197 | // | ||
198 | // } | ||
199 | |||
200 | // fun cargarArticulos(Productos: List<Productos>?) { | ||
201 | // val artiAcargar: Articulos? = null | ||
202 | // var index: Long = 1 | ||
203 | // //val job4 = CoroutineScope(Dispatchers.Default).launch { | ||
204 | // for (pro in Productos!!) { | ||
205 | // //artiAcargar.id =index+1 | ||
206 | // artiAcargar!!.sector = pro.sector | ||
207 | // artiAcargar.codigo = pro.codigo | ||
208 | // artiAcargar.descripcion = pro.descripcion | ||
209 | // artiAcargar.codBar = pro.codBar | ||
210 | // artiAcargar.precio = pro.precio | ||
211 | // artiAcargar.costo = pro.costo | ||
212 | // artiAcargar.balanza = pro.balanza | ||
213 | // artiAcargar.depSn = pro.depSn | ||
214 | // artiAcargar.imagen = pro.imagen | ||
215 | // index += index | ||
216 | // | ||
217 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | ||
218 | // .insertArticulos(artiAcargar) | ||
219 | // } | ||
220 | // } | ||
221 | } | ||
222 | |||
223 | 1 | package com.focasoftware.deboinventariov20.ui.actualizacionMaestros |
app/src/main/java/com/focasoftware/deboinventariov20/ui/configuracion/ConfiguracionFragment.kt
1 | package com.focasoftware.deboinventariov20.ui.configuracion | File was deleted | |
2 | |||
3 | import android.content.Context | ||
4 | import android.content.SharedPreferences | ||
5 | import android.os.Bundle | ||
6 | import android.view.LayoutInflater | ||
7 | import android.view.View | ||
8 | import android.view.ViewGroup | ||
9 | import android.widget.* | ||
10 | import androidx.fragment.app.Fragment | ||
11 | import androidx.fragment.app.FragmentActivity | ||
12 | import androidx.lifecycle.lifecycleScope | ||
13 | import androidx.navigation.NavController | ||
14 | import androidx.navigation.Navigation | ||
15 | import androidx.navigation.fragment.findNavController | ||
16 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
17 | import com.focasoftware.deboinventariov20.Model.ServeInv | ||
18 | import com.focasoftware.deboinventariov20.R | ||
19 | import com.focasoftware.deboinventariov20.ui.servidores.SpinnerAdapterServidor | ||
20 | import kotlinx.android.synthetic.main.fragment_configuracion.* | ||
21 | import kotlinx.coroutines.* | ||
22 | |||
23 | class ConfiguracionFragment : Fragment() { | ||
24 | |||
25 | lateinit var sharedPreferences: SharedPreferences | ||
26 | private lateinit var navController: NavController | ||
27 | lateinit var adapterSpinnerServidor: SpinnerAdapterServidor | ||
28 | var itemSelect: Int = 0 | ||
29 | |||
30 | override fun onCreate(savedInstanceState: Bundle?) { | ||
31 | super.onCreate(savedInstanceState) | ||
32 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | ||
33 | } | ||
34 | |||
35 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
36 | super.onViewCreated(view, savedInstanceState) | ||
37 | navController = Navigation.findNavController(view) | ||
38 | |||
39 | } | ||
40 | |||
41 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
42 | |||
43 | val v = inflater.inflate(R.layout.fragment_configuracion, container, false) | ||
44 | val etRuta = v.findViewById<EditText>(R.id.etRuta) | ||
45 | val btnGuardar = v.findViewById<Button>(R.id.btnGuardar) | ||
46 | val rbProInclu = v.findViewById<RadioButton>(R.id.rbProInclu) | ||
47 | val rbProNoInclu = v.findViewById<RadioButton>(R.id.rbProNoInclu) | ||
48 | val cbHabiLectura = v.findViewById<CheckBox>(R.id.cbHabiLectura) | ||
49 | val cbMostrarStock = v.findViewById<CheckBox>(R.id.cbMostrarStock) | ||
50 | val rbCodigoBarras = v.findViewById<RadioButton>(R.id.rbCodigoBarras) | ||
51 | val rbCodigoDebo = v.findViewById<RadioButton>(R.id.rbCodigoDebo) | ||
52 | val rbCodigoOrigen = v.findViewById<RadioButton>(R.id.rbCodigoOrigen) | ||
53 | val rbDeposito = v.findViewById<RadioButton>(R.id.rbDeposito) | ||
54 | val rbVentas = v.findViewById<RadioButton>(R.id.rbVentas) | ||
55 | val cbMostrarExistencia = v.findViewById<CheckBox>(R.id.cbMostrarExistencia) | ||
56 | val cbMostrarPrecio = v.findViewById<CheckBox>(R.id.cbMostrarPrecio) | ||
57 | val btnAgregarServidor = v.findViewById<Button>(R.id.btnAgregarServidor) | ||
58 | val spServidor = v.findViewById<Spinner>(R.id.spServidor) | ||
59 | val btnValidarServidor = v.findViewById<Button>(R.id.btnValidarServidor) | ||
60 | |||
61 | if (sharedPreferences.contains("etRuta")) if (sharedPreferences.contains("rbProInclu")) { | ||
62 | if (sharedPreferences.getString("rbProInclu", "").toString() == "0") { | ||
63 | rbProInclu.isChecked = false | ||
64 | rbProNoInclu.isChecked = true | ||
65 | } else if (sharedPreferences.getString("rbProInclu", "").toString() == "1") { | ||
66 | rbProInclu.isChecked = true | ||
67 | rbProNoInclu.isChecked = false | ||
68 | } | ||
69 | } else (sharedPreferences.getString("rbProInclu", "").toString() == "") | ||
70 | |||
71 | if (sharedPreferences.contains("rbProNoInclu")) { | ||
72 | if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") { | ||
73 | rbProNoInclu.isChecked = false | ||
74 | rbProInclu.isChecked = true | ||
75 | } else if (sharedPreferences.getString("rbProNoInclu", "").toString() == "1") { | ||
76 | rbProNoInclu.isChecked = true | ||
77 | rbProInclu.isChecked = false | ||
78 | } | ||
79 | } else (sharedPreferences.getString("rbProNoInclu", "").toString() == "") | ||
80 | |||
81 | if (sharedPreferences.contains("cbHabiLectura")) { | ||
82 | if (sharedPreferences.getString("cbHabiLectura", "").toString() == "0") { | ||
83 | cbHabiLectura.isChecked = false | ||
84 | } else if (sharedPreferences.getString("cbHabiLectura", "").toString() == "1") { | ||
85 | cbHabiLectura.isChecked = true | ||
86 | } | ||
87 | } else (sharedPreferences.getString("cbHabiLectura", "").toString() == "") | ||
88 | |||
89 | if (sharedPreferences.contains("cbMostrarStock")) { | ||
90 | if (sharedPreferences.getString("cbMostrarStock", "").toString() == "0") { | ||
91 | cbMostrarStock.isChecked = false | ||
92 | } else if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") { | ||
93 | cbMostrarStock.isChecked = true | ||
94 | } | ||
95 | } else (sharedPreferences.getString("cbMostrarStock", "").toString() == "") | ||
96 | |||
97 | if (sharedPreferences.contains("rbVentas")) { | ||
98 | if (sharedPreferences.getString("rbVentas", "").toString() == "0") { | ||
99 | rbVentas.isChecked = false | ||
100 | rbDeposito.isChecked = true | ||
101 | } else if (sharedPreferences.getString("rbVentas", "").toString() == "1") { | ||
102 | rbVentas.isChecked = true | ||
103 | rbDeposito.isChecked = false | ||
104 | } | ||
105 | } else (sharedPreferences.getString("rbVentas", "").toString() == "") | ||
106 | |||
107 | if (sharedPreferences.contains("rbDeposito")) { | ||
108 | if (sharedPreferences.getString("rbDeposito", "").toString() == "0") { | ||
109 | rbDeposito.isChecked = false | ||
110 | rbVentas.isChecked = true | ||
111 | } else if (sharedPreferences.getString("rbDeposito", "").toString() == "1") { | ||
112 | rbDeposito.isChecked = true | ||
113 | rbVentas.isChecked = false | ||
114 | } | ||
115 | } else (sharedPreferences.getString("rbDeposito", "").toString() == "") | ||
116 | |||
117 | if (sharedPreferences.contains("rbCodigoDebo")) { | ||
118 | if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "0") { | ||
119 | rbCodigoDebo.isChecked = false | ||
120 | rbCodigoOrigen.isChecked = false | ||
121 | rbCodigoBarras.isChecked = false | ||
122 | } else if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "1") { | ||
123 | rbCodigoDebo.isChecked = true | ||
124 | rbCodigoOrigen.isChecked = false | ||
125 | rbCodigoBarras.isChecked = false | ||
126 | } | ||
127 | } else (sharedPreferences.getString("rbCodigoDebo", "").toString() == "") | ||
128 | |||
129 | if (sharedPreferences.contains("rbCodigoOrigen")) { | ||
130 | if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "0") { | ||
131 | rbCodigoOrigen.isChecked = false | ||
132 | } else if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "1") { | ||
133 | rbCodigoOrigen.isChecked = true | ||
134 | } | ||
135 | } else (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "") | ||
136 | |||
137 | if (sharedPreferences.contains("rbCodigoBarras")) { | ||
138 | if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "0") { | ||
139 | rbCodigoBarras.isChecked = false | ||
140 | } else if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "1") { | ||
141 | rbCodigoBarras.isChecked = true | ||
142 | } | ||
143 | } else (sharedPreferences.getString("rbCodigoBarras", "").toString() == "") | ||
144 | |||
145 | if (sharedPreferences.contains("cbMostrarExistencia")) { | ||
146 | if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "0") { | ||
147 | cbMostrarExistencia.isChecked = false | ||
148 | } else if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "1") { | ||
149 | cbMostrarExistencia.isChecked = true | ||
150 | } | ||
151 | } else (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "") | ||
152 | |||
153 | if (sharedPreferences.contains("cbMostrarPrecio")) { | ||
154 | if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "0") { | ||
155 | cbMostrarPrecio.isChecked = false | ||
156 | } else if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "1") { | ||
157 | cbMostrarPrecio.isChecked = true | ||
158 | } | ||
159 | } else (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "") | ||
160 | |||
161 | btnGuardar.setOnClickListener { | ||
162 | guardarPreferencias() | ||
163 | Toast.makeText(v.context, "Los Datos se guardaron correctamente", Toast.LENGTH_LONG).show() | ||
164 | navController.navigate(R.id.action_configuracionFragment_to_mainFragment2) | ||
165 | } | ||
166 | btnAgregarServidor.setOnClickListener { findNavController().navigate(R.id.servidoresFragment) } | ||
167 | btnValidarServidor.setOnClickListener { Toast.makeText(requireContext(), "Direcciรณn correcta", Toast.LENGTH_LONG).show() } | ||
168 | GlobalScope.launch(Dispatchers.Main) { | ||
169 | adapterSpinnerServidor = SpinnerAdapterServidor(requireContext(), getDescServers()) | ||
170 | spServidor.adapter = adapterSpinnerServidor | ||
171 | if (sharedPreferences.contains("ServerPredeterminado")) { | ||
172 | spServidor.setSelection(sharedPreferences.getString("ServerPredeterminado", "").toString().toInt()) | ||
173 | } else (spServidor.setSelection(0)) | ||
174 | } | ||
175 | spServidor?.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { | ||
176 | override fun onNothingSelected(parent: AdapterView<*>?) {} | ||
177 | override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { | ||
178 | itemSelect = position | ||
179 | } | ||
180 | } | ||
181 | return v | ||
182 | } | ||
183 | |||
184 | suspend fun getDescServers(): List<ServeInv> { | ||
185 | return GlobalScope.async(Dispatchers.IO) { | ||
186 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchAllServers() | ||
187 | }.await() | ||
188 | } | ||
189 | |||
190 | fun guardarPreferencias() { | ||
191 | // try { | ||
192 | val editor = sharedPreferences.edit() | ||
193 | |||
194 | if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString()) | ||
195 | |||
196 | if (rbProInclu.isChecked) editor?.putString("rbProInclu", "1") else editor?.putString("rbProInclu", "0") | ||
197 | if (rbProNoInclu.isChecked) editor?.putString("rbProNoInclu", "1") else editor?.putString("rbProNoInclu", "0") | ||
198 | |||
199 | if (cbHabiLectura.isChecked) editor?.putString("cbHabiLectura", "1") else editor?.putString("cbHabiLectura", "0") | ||
200 | if (cbMostrarStock.isChecked) editor?.putString("cbMostrarStock", "1") else editor?.putString("cbMostrarStock", "0") | ||
201 | if (rbVentas.isChecked) editor?.putString("rbVentas", "1") else editor?.putString("rbVentas", "0") | ||
202 | if (rbDeposito.isChecked) editor?.putString("rbDeposito", "1") else editor?.putString("rbDeposito", "0") | ||
203 | if (rbCodigoDebo.isChecked) editor?.putString("rbCodigoDebo", "1") else editor?.putString("rbCodigoDebo", "0") | ||
204 | if (rbCodigoOrigen.isChecked) editor?.putString("rbCodigoOrigen", "1") else editor?.putString("rbCodigoOrigen", "0") | ||
205 | if (rbCodigoBarras.isChecked) editor?.putString("rbCodigoBarras", "1") else editor?.putString("rbCodigoBarras", "0") | ||
206 | if (cbMostrarExistencia.isChecked) editor?.putString("cbMostrarExistencia", "1") else editor?.putString("cbMostrarExistencia", "0") | ||
207 | if (cbMostrarPrecio.isChecked) editor?.putString("cbMostrarPrecio", "1") else editor?.putString("cbMostrarPrecio", "0") | ||
208 | editor?.putString("ServerPredeterminado", itemSelect.toString()) | ||
209 | updateServerPreInZero() | ||
210 | updateServerPre(itemSelect+1) | ||
211 | |||
212 | editor?.apply() | ||
213 | editor.commit() | ||
214 | |||
215 | // } catch (e: Exception) { | ||
216 | // Toast.makeText(requireContext(), "Error ", Toast.LENGTH_LONG).show() | ||
217 | // e.printStackTrace() | ||
218 | // } | ||
219 | } | ||
220 | |||
221 | private fun updateServerPreInZero() { | ||
222 | lifecycleScope.launch { | ||
223 | withContext(Dispatchers.IO) { | ||
224 | val activity: FragmentActivity? = activity | ||
225 | if (activity != null && isAdded) { | ||
226 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.UpdateServerPreInZero() | ||
227 | } | ||
228 | } | ||
229 | } | ||
230 | } | ||
231 | private fun updateServerPre(server:Int) { | ||
232 | lifecycleScope.launch { | ||
233 | withContext(Dispatchers.IO) { | ||
234 | val activity: FragmentActivity? = activity | ||
235 | if (activity != null && isAdded) { | ||
236 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.UpdateServerPre(server) | ||
237 | } | ||
238 | } | ||
239 | } | ||
240 | } | ||
241 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/descripcionFragment/DescripcionFragment.kt
1 | package com.focasoftware.deboinventariov20.ui.descripcionFragment | File was deleted | |
2 | |||
3 | import android.app.AlertDialog | ||
4 | import android.content.Context | ||
5 | import android.content.SharedPreferences | ||
6 | import android.graphics.Canvas | ||
7 | import android.graphics.Color | ||
8 | import android.graphics.drawable.ColorDrawable | ||
9 | import android.os.Bundle | ||
10 | import android.text.InputType | ||
11 | import android.view.LayoutInflater | ||
12 | import android.view.View | ||
13 | import android.view.ViewGroup | ||
14 | import android.widget.Button | ||
15 | import androidx.fragment.app.Fragment | ||
16 | import androidx.fragment.app.FragmentActivity | ||
17 | import androidx.lifecycle.lifecycleScope | ||
18 | import androidx.navigation.NavController | ||
19 | import androidx.navigation.Navigation | ||
20 | import androidx.recyclerview.widget.ItemTouchHelper | ||
21 | import androidx.recyclerview.widget.LinearLayoutManager | ||
22 | import androidx.recyclerview.widget.RecyclerView | ||
23 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
24 | import com.focasoftware.deboinventariov20.Model.Articles | ||
25 | import com.focasoftware.deboinventariov20.Model.InvBody | ||
26 | import com.focasoftware.deboinventariov20.R | ||
27 | import com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment | ||
28 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | ||
29 | import kotlinx.android.synthetic.main.login_dialog.view.* | ||
30 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar | ||
31 | import kotlinx.coroutines.* | ||
32 | |||
33 | class DescripcionFragment : Fragment() { | ||
34 | private var artAcargar2: List<Articles>? = null | ||
35 | private var listArticulos2: List<Articles>? = null | ||
36 | lateinit var viewAdapter2: RecyclerView.Adapter<*> | ||
37 | private lateinit var viewManager2: RecyclerView.LayoutManager | ||
38 | private lateinit var rcDescripcion: RecyclerView | ||
39 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) | ||
40 | private var cantidad = 0F | ||
41 | private var numeroInventario = 0 | ||
42 | lateinit var navController: NavController | ||
43 | lateinit var sharedPreferences: SharedPreferences | ||
44 | private var indice = 0 | ||
45 | private var artCargadoEnBD: InvBody? = null | ||
46 | |||
47 | override fun onCreate(savedInstanceState: Bundle?) { | ||
48 | super.onCreate(savedInstanceState) | ||
49 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | ||
50 | arguments.apply { | ||
51 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> | ||
52 | numeroInventario = requireArguments().getInt("numeroInv") | ||
53 | } | ||
54 | } | ||
55 | |||
56 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
57 | super.onViewCreated(view, savedInstanceState) | ||
58 | navController = Navigation.findNavController(view) | ||
59 | } | ||
60 | |||
61 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
62 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) | ||
63 | rcDescripcion = v.findViewById(R.id.rcDescripcion) | ||
64 | // val btnSalir = v.findViewById<Button>(R.id.btnSalir) | ||
65 | |||
66 | IngresarRecicler(artAcargar2) | ||
67 | |||
68 | // btnSalir.setOnClickListener { | ||
69 | // activity?.onBackPressed(); | ||
70 | //// VolverAinventario() | ||
71 | // } | ||
72 | return v | ||
73 | } | ||
74 | |||
75 | fun IngresarRecicler(articulos: List<Articles>?) { | ||
76 | |||
77 | viewAdapter2 = DescripcionListAdapter(articulos) | ||
78 | viewManager2 = LinearLayoutManager(requireContext()) | ||
79 | |||
80 | rcDescripcion.apply { | ||
81 | adapter = viewAdapter2 | ||
82 | layoutManager = viewManager2 | ||
83 | } | ||
84 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { | ||
85 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | ||
86 | return false | ||
87 | } | ||
88 | |||
89 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | ||
90 | |||
91 | var indice = 0 | ||
92 | indice = viewHolder.layoutPosition | ||
93 | GlobalScope.launch(Dispatchers.Main) { | ||
94 | //TODO BUSCO EN BASE DE DATOS | ||
95 | artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.sector.toString(), | ||
96 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.codigo.toString(), | ||
97 | numeroInventario.toString()) | ||
98 | if (artCargadoEnBD == null) { | ||
99 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) | ||
100 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView) | ||
101 | .setCancelable(false) | ||
102 | if ((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza==1 || (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza==3 || (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza==7) | ||
103 | mDialogView.etCantidad.inputType= InputType.TYPE_CLASS_NUMBER | ||
104 | mDialogView.tvTitulo.text = "${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}" | ||
105 | val mAlertDialog = mBuilder.show() | ||
106 | mDialogView.btnAceptar.setOnClickListener { | ||
107 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { | ||
108 | mDialogView.etCantidad.error = "No vacio" | ||
109 | mDialogView.etCantidad.requestFocus() | ||
110 | mDialogView.etCantidad.hint = "Ingrese un valor" | ||
111 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | ||
112 | cantidad = mDialogView.etCantidad.text.toString().toFloat() | ||
113 | val body = InvBody(numeroInventario, | ||
114 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector, | ||
115 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD | ||
116 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo, | ||
117 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion, | ||
118 | cantidad.toString(), | ||
119 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codBar, | ||
120 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codOrigen, | ||
121 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | ||
122 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | ||
123 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza, | ||
124 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.depSn, | ||
125 | InventarioFragment().ObtenerFechaActual(), | ||
126 | InventarioFragment().ObtenerFechaActual()) | ||
127 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS | ||
128 | // VolverAinventario() | ||
129 | activity?.onBackPressed() | ||
130 | mAlertDialog.dismiss() | ||
131 | } | ||
132 | } | ||
133 | } else if (artCargadoEnBD != null) { | ||
134 | |||
135 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | ||
136 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${artCargadoEnBD!!.descripcion}', se encuentra cargado.").setCancelable(false) | ||
137 | if (artCargadoEnBD!!.balanza.toString().contains("1" ) || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7")) mDialogView.tvNuevaCantidad.inputType= InputType.TYPE_CLASS_NUMBER | ||
138 | mDialogView.tvCantInicial.text =String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat()) | ||
139 | |||
140 | val mAlertDialog = mBuilder.show() | ||
141 | mDialogView.rbSumar.setOnClickListener { | ||
142 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
143 | mDialogView.tvResultado.text = String.format("%.2f",(mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat())) | ||
144 | mDialogView.tvNuevaCantidad.isEnabled=false | ||
145 | } | ||
146 | } | ||
147 | mDialogView.rbRestar.setOnClickListener { | ||
148 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
149 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | ||
150 | mDialogView.tvResultado.text = String.format("%.2f",mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) | ||
151 | mDialogView.tvNuevaCantidad.isEnabled = false | ||
152 | }else{ | ||
153 | mDialogView.tvResultado.text="" | ||
154 | mDialogView.tvResultado.error = "Operaciรณn No Valida" | ||
155 | mDialogView.tvResultado.requestFocus() | ||
156 | mDialogView.tvResultado.hint = "Error" | ||
157 | } | ||
158 | } | ||
159 | } | ||
160 | mDialogView.rbMdodificar.setOnClickListener { | ||
161 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
162 | mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvNuevaCantidad.text.toString().toFloat())) | ||
163 | mDialogView.tvNuevaCantidad.isEnabled = false | ||
164 | } | ||
165 | } | ||
166 | mDialogView.btnAceptar.setOnClickListener { | ||
167 | if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) { | ||
168 | if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) { | ||
169 | |||
170 | updateCantidad((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector.toString(), | ||
171 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo.toString(), | ||
172 | mDialogView.tvResultado.text.toString().toFloat()) | ||
173 | // VolverAinventario() | ||
174 | activity?.onBackPressed(); | ||
175 | mAlertDialog.dismiss() | ||
176 | } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | ||
177 | mDialogView.tvResultado.error = "Operaciรณn Requerida" | ||
178 | mDialogView.tvResultado.requestFocus() | ||
179 | mDialogView.tvResultado.hint = "Seleccione Operaciรณn" | ||
180 | } | ||
181 | } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | ||
182 | mDialogView.tvNuevaCantidad.error = "Completar" | ||
183 | mDialogView.tvNuevaCantidad.requestFocus() | ||
184 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | ||
185 | } | ||
186 | } | ||
187 | mDialogView.dialogCancelBtn.setOnClickListener { | ||
188 | activity?.onBackPressed(); | ||
189 | mAlertDialog.dismiss() | ||
190 | } | ||
191 | } | ||
192 | } | ||
193 | } | ||
194 | |||
195 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | ||
196 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | ||
197 | val itemView = viewHolder.itemView | ||
198 | |||
199 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | ||
200 | |||
201 | if (dX > 0) { | ||
202 | |||
203 | c.drawColor(Color.RED) | ||
204 | } else if (dX < 0) { | ||
205 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) | ||
206 | c.drawColor(Color.YELLOW) | ||
207 | } | ||
208 | swipeBackground.draw(c) | ||
209 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | ||
210 | } | ||
211 | } | ||
212 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) | ||
213 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) | ||
214 | |||
215 | } | ||
216 | |||
217 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | ||
218 | lifecycleScope.launch { | ||
219 | withContext(Dispatchers.IO) { | ||
220 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | ||
221 | } | ||
222 | } | ||
223 | } | ||
224 | |||
225 | // fun VolverAinventario() { | ||
226 | // | ||
227 | // val editor = sharedPreferences.edit() | ||
228 | // editor?.putString("Inventario", numeroInventario.toString()) | ||
229 | // editor?.apply() | ||
230 | // editor.commit() | ||
231 | // navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) | ||
232 | // } | ||
233 | |||
234 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { | ||
235 | //TODO BUSQUEDA POR CODIGO DE BARRAS | ||
236 | var busqueda: InvBody? = null | ||
237 | return GlobalScope.async(Dispatchers.IO) { | ||
238 | busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector, codigo, numInventario) | ||
239 | return@async busqueda | ||
240 | }.await() | ||
241 | } | ||
242 | |||
243 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | ||
244 | lifecycleScope.launch { | ||
245 | withContext(Dispatchers.IO) { | ||
246 | val activity: FragmentActivity? = activity | ||
247 | if (activity != null && isAdded) { | ||
248 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) | ||
249 | } | ||
250 | } | ||
251 | } | ||
252 | } | ||
253 | } | ||
254 | |||
255 | 1 | package com.focasoftware.deboinventariov20.ui.descripcionFragment |
app/src/main/java/com/focasoftware/deboinventariov20/ui/descripcionFragment/DescripcionListAdapter.kt
1 | package com.focasoftware.deboinventariov20.ui.descripcionFragment | File was deleted | |
2 | |||
3 | import android.view.LayoutInflater | ||
4 | import android.view.View | ||
5 | import android.view.ViewGroup | ||
6 | import androidx.recyclerview.widget.RecyclerView | ||
7 | import com.focasoftware.deboinventariov20.Model.Articles | ||
8 | import com.focasoftware.deboinventariov20.R | ||
9 | import kotlinx.android.synthetic.main.item.view.* | ||
10 | |||
11 | class DescripcionListAdapter(private val productos: List<Articles>?) : | ||
12 | RecyclerView.Adapter<DescripcionListAdapter.ItemsViewHolder>() { | ||
13 | internal var items2: List<Articles>? = null | ||
14 | |||
15 | init { | ||
16 | this.items2 = productos | ||
17 | } | ||
18 | |||
19 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder( | ||
20 | LayoutInflater.from(parent.context).inflate(R.layout.item_descripcion, parent, false) | ||
21 | ) | ||
22 | |||
23 | override fun getItemCount() = productos!!.size | ||
24 | |||
25 | override fun onBindViewHolder(holder: ItemsViewHolder, position: Int) { | ||
26 | when (holder) { | ||
27 | is ItemsViewHolder -> { | ||
28 | holder.bind(items2!![position]) | ||
29 | } | ||
30 | } | ||
31 | } | ||
32 | |||
33 | |||
34 | class ItemsViewHolder constructor(view: View) : RecyclerView.ViewHolder(view) { | ||
35 | |||
36 | val sector = view.tvSector | ||
37 | val codigo = view.tvCodigo | ||
38 | val descripcion = view.tvDescripcion | ||
39 | val codigoBarras = view.tvCodigoBarras | ||
40 | |||
41 | fun bind(pro: Articles) { | ||
42 | sector.text = pro.sector | ||
43 | codigo.text = pro.codigo | ||
44 | descripcion.text = pro.descripcion | ||
45 | codigoBarras.text = pro.codBar | ||
46 | } | ||
47 | } | ||
48 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/descripcionFragment/ItemDescripcion.kt
1 | package com.focasoftware.deboinventariov20.ui.descripcionFragment | File was deleted | |
2 | |||
3 | data class ItemDescripcion(val sector: String?,val codigo: String?, val descripcion: String?, val codigoBarras: String?) |
app/src/main/java/com/focasoftware/deboinventariov20/ui/detalleProducto/DetalleArtFragment.kt
1 | package com.focasoftware.deboinventariov20.ui.detalleProducto | File was deleted | |
2 | |||
3 | import android.content.Context | ||
4 | import android.content.SharedPreferences | ||
5 | import android.os.Bundle | ||
6 | import android.view.LayoutInflater | ||
7 | import android.view.View | ||
8 | import android.view.ViewGroup | ||
9 | import androidx.fragment.app.Fragment | ||
10 | import androidx.navigation.NavController | ||
11 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
12 | import com.focasoftware.deboinventariov20.Model.Articles | ||
13 | import com.focasoftware.deboinventariov20.R | ||
14 | import kotlinx.android.synthetic.main.fragment_detalle_art.* | ||
15 | import kotlinx.coroutines.Dispatchers | ||
16 | import kotlinx.coroutines.GlobalScope | ||
17 | import kotlinx.coroutines.async | ||
18 | import kotlinx.coroutines.launch | ||
19 | |||
20 | class DetalleArtFragment : Fragment() { | ||
21 | |||
22 | private var Inventario: Int = 0 | ||
23 | private var sector: String? = null | ||
24 | private var codigo: String? = null | ||
25 | private var artSerch: Articles? = null | ||
26 | lateinit var sharedPreferences: SharedPreferences | ||
27 | |||
28 | override fun onCreate(savedInstanceState: Bundle?) { | ||
29 | super.onCreate(savedInstanceState) | ||
30 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | ||
31 | arguments?.let { | ||
32 | sector = it.getString("sector") | ||
33 | codigo = it.getString("codigo") | ||
34 | Inventario= it.getInt("numeroInv") | ||
35 | } | ||
36 | marcarInventario() | ||
37 | GlobalScope.launch(Dispatchers.Main) { | ||
38 | |||
39 | artSerch = buscarCodigoDeboEnBD(sector, codigo) | ||
40 | if (artSerch == null) { | ||
41 | |||
42 | // val type = InputType.TYPE_CLASS_NUMBER | ||
43 | // MaterialDialog(requireContext()).show { | ||
44 | // | ||
45 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") | ||
46 | // message(R.string.sCantidadNueva) | ||
47 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | ||
48 | // fCant = 0F | ||
49 | // fCant = charSequence.toString().toFloat() | ||
50 | // } | ||
51 | // positiveButton(R.string.btnOk) { | ||
52 | // //TODO ACTUALIZO CANTIADAD EN BD | ||
53 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | ||
54 | // //TODO ACTUALIZO CANTIDAD EN RV | ||
55 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
56 | // viewAdapter.notifyDataSetChanged() | ||
57 | // dismiss() | ||
58 | // } | ||
59 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | ||
60 | } else if (artSerch != null) { | ||
61 | tvSector.text=sector | ||
62 | tvCodigo.text=codigo | ||
63 | tvDeposito.text=if(artSerch!!.depSn!!.toInt() ==0)"No" else "Si" | ||
64 | tvDescripcion.text=artSerch!!.descripcion.toString() | ||
65 | tvCodigoBarras.text=artSerch!!.codBar.toString() | ||
66 | tvCodigoOrigen.text=artSerch!!.codOrigen.toString() | ||
67 | tvExiVenta.text=artSerch!!.exiVenta.toString() | ||
68 | tvExiDeposito.text=artSerch!!.exiDeposito.toString() | ||
69 | tvBal.text=artSerch!!.balanza.toString() | ||
70 | tvDE.text=artSerch!!.de.toString() | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | |||
75 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
76 | |||
77 | return inflater.inflate(R.layout.fragment_detalle_art, container, false) | ||
78 | } | ||
79 | |||
80 | suspend fun buscarCodigoDeboEnBD(sector: String?, codigo: String?): Articles? { | ||
81 | //TODO BUSQUEDA POR CODIGO DE BARRAS | ||
82 | var busqueda: Articles? = null | ||
83 | return GlobalScope.async(Dispatchers.IO) { | ||
84 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.fetchArticuloByCodSec(sector, codigo) | ||
85 | return@async busqueda | ||
86 | }.await() | ||
87 | } | ||
88 | fun marcarInventario() { | ||
89 | |||
90 | val editor = sharedPreferences.edit() | ||
91 | editor?.putString("Inventario", Inventario.toString()) | ||
92 | editor?.apply() | ||
93 | editor.commit() | ||
94 | // navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) | ||
95 | } | ||
96 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/InventarioFragment.kt
1 | package com.focasoftware.deboinventariov20.ui.inventario | File was deleted | |
2 | |||
3 | import android.annotation.SuppressLint | ||
4 | import android.app.AlertDialog | ||
5 | import android.content.Context | ||
6 | import android.content.DialogInterface | ||
7 | import android.content.SharedPreferences | ||
8 | import android.graphics.Canvas | ||
9 | import android.graphics.Color | ||
10 | import android.graphics.drawable.Drawable | ||
11 | import android.os.Bundle | ||
12 | import android.text.InputType.TYPE_CLASS_NUMBER | ||
13 | import android.view.KeyEvent | ||
14 | import android.view.LayoutInflater | ||
15 | import android.view.View | ||
16 | import android.view.ViewGroup | ||
17 | import android.widget.EditText | ||
18 | import android.widget.TextView | ||
19 | import android.widget.Toast | ||
20 | import androidx.core.content.ContextCompat | ||
21 | import androidx.core.os.bundleOf | ||
22 | import androidx.fragment.app.Fragment | ||
23 | import androidx.lifecycle.lifecycleScope | ||
24 | import androidx.navigation.NavController | ||
25 | import androidx.navigation.Navigation | ||
26 | import androidx.recyclerview.widget.ItemTouchHelper | ||
27 | import androidx.recyclerview.widget.LinearLayoutManager | ||
28 | import androidx.recyclerview.widget.RecyclerView | ||
29 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
30 | import com.focasoftware.deboinventariov20.Model.Articles | ||
31 | import com.focasoftware.deboinventariov20.Model.InvBody | ||
32 | import com.focasoftware.deboinventariov20.Model.InvHead | ||
33 | import com.focasoftware.deboinventariov20.R | ||
34 | import com.focasoftware.deboinventariov20.ui.util.Base.dialogos.DialogNoEncontrado | ||
35 | import kotlinx.android.synthetic.main.fragment_inventario.* | ||
36 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | ||
37 | import kotlinx.android.synthetic.main.login_dialog.view.* | ||
38 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar | ||
39 | import kotlinx.coroutines.* | ||
40 | import java.time.LocalDateTime | ||
41 | import java.time.format.DateTimeFormatter | ||
42 | import java.util.* | ||
43 | |||
44 | |||
45 | class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener { | ||
46 | |||
47 | private lateinit var sharedPreferences: SharedPreferences | ||
48 | private var iArea: Int = 0 | ||
49 | private lateinit var invHead: InvHead | ||
50 | private lateinit var rcInventarios: RecyclerView | ||
51 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | ||
52 | private lateinit var viewManager: RecyclerView.LayoutManager | ||
53 | private lateinit var sChangeUpper: String | ||
54 | private var listArticulos = ArrayList<ItemsRecycler>() | ||
55 | private lateinit var navController: NavController | ||
56 | private var InventarioNuevo: Int = 0 | ||
57 | private var iEstado = 0 | ||
58 | private var iBusquedaPor = 0 | ||
59 | private var fCant = 0F | ||
60 | private var bFirst = false | ||
61 | private lateinit var deleteIcon: Drawable | ||
62 | |||
63 | override fun onCreate(savedInstanceState: Bundle?) { | ||
64 | super.onCreate(savedInstanceState) | ||
65 | |||
66 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | ||
67 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { | ||
68 | InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() | ||
69 | val editor = sharedPreferences.edit() | ||
70 | editor?.putString("Inventario", "-1") | ||
71 | editor?.apply() | ||
72 | editor.commit() | ||
73 | } | ||
74 | } | ||
75 | |||
76 | |||
77 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
78 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) | ||
79 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | ||
80 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) | ||
81 | rcInventarios = v.findViewById(R.id.rcInventarios) | ||
82 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) | ||
83 | |||
84 | if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO | ||
85 | GlobalScope.launch(Dispatchers.Main) { | ||
86 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO | ||
87 | InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 | ||
88 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO | ||
89 | invHead = InvHead(InventarioNuevo, if (SerchArea() == 0) "Ventas" else "Deposito", 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, SerchArea(), AjusteProductos(), ProdNoCont()) | ||
90 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) | ||
91 | tvTitulo.text = "Inventario Dinamico" + " Nยฐ $InventarioNuevo" | ||
92 | } | ||
93 | } else {// TODO (SI VENGO DE FRAGMENT DESCRIPCION) | ||
94 | listArticulos.clear() | ||
95 | CargarDeBdInventario(InventarioNuevo) | ||
96 | tvTitulo.text = "Inventario Dinamico" + " Nยฐ $InventarioNuevo" | ||
97 | } | ||
98 | |||
99 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> | ||
100 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { | ||
101 | sChangeUpper = tCodigoBarras.text.toString() | ||
102 | var indiceDelArtEncontrado = 0 | ||
103 | |||
104 | if (tCodigoBarras.text.isNullOrBlank()) { | ||
105 | tCodigoBarras.error = "No puede estar vacio" | ||
106 | tCodigoBarras.requestFocus() | ||
107 | tCodigoBarras.hint = "No puede estar vacio" | ||
108 | } else { | ||
109 | |||
110 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS | ||
111 | when (iBusquedaPor) { | ||
112 | 0 -> { | ||
113 | GlobalScope.launch(Dispatchers.Main) { | ||
114 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice | ||
115 | //TODO (Si no lo encuentra devuelve -1) | ||
116 | if (indiceDelArtEncontrado != -1) { | ||
117 | if (swSumaUno!!.isChecked) { | ||
118 | // fCant = 0F | ||
119 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | ||
120 | // fCant += 1F | ||
121 | //TODO ACTUALIZO LA CANTIDAD EN LA BD | ||
122 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), | ||
123 | listArticulos[indiceDelArtEncontrado].codigo.toString(), | ||
124 | listArticulos[indiceDelArtEncontrado].cantTomada + 1) | ||
125 | //TODO ACTUALIZO LA CANTIDAD EN EL RV | ||
126 | listArticulos[indiceDelArtEncontrado].cantTomada = listArticulos[indiceDelArtEncontrado].cantTomada + 1 | ||
127 | viewAdapter.notifyDataSetChanged() | ||
128 | } else { | ||
129 | dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false) | ||
130 | } | ||
131 | |||
132 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | ||
133 | |||
134 | |||
135 | //TODO BUSCO EN BASE DE DATOS | ||
136 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | ||
137 | ContinuarCargaCB(artEncontrado)//TODO SE MANDA CERO POR QUE ES UN ARTICULO ESCANEADO NUEVO PARA QUE SEA COMPATIBLE | ||
138 | } | ||
139 | |||
140 | |||
141 | tCodigoBarras.focusable = View.FOCUSABLE | ||
142 | tCodigoBarras.setText("") | ||
143 | tCodigoBarras.selectAll() | ||
144 | } | ||
145 | return@setOnKeyListener true | ||
146 | |||
147 | |||
148 | } | ||
149 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** | ||
150 | // | ||
151 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice | ||
152 | // //TODO Si no lo encuentra devuelve -1 | ||
153 | // if (indiceDelArtEncontrado != -1) { | ||
154 | //// if (swSumaUno!!.isChecked) { | ||
155 | //// fCant = 0F | ||
156 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | ||
157 | //// fCant += 1F | ||
158 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
159 | //// viewAdapter.notifyDataSetChanged() | ||
160 | //// } else { | ||
161 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | ||
162 | // MaterialDialog(requireContext()).show { | ||
163 | // title(R.string.sTituloNueva) | ||
164 | // message(R.string.sCantidadNueva) | ||
165 | // input { materialDialog, charSequence -> | ||
166 | // fCant = 0F | ||
167 | // fCant = charSequence.toString().toFloat() | ||
168 | // } | ||
169 | // positiveButton(R.string.btnOk) { | ||
170 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
171 | // viewAdapter.notifyDataSetChanged() | ||
172 | // dismiss() | ||
173 | // } | ||
174 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | ||
175 | //// } | ||
176 | // | ||
177 | // } else if | ||
178 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | ||
179 | GlobalScope.launch(Dispatchers.Main) { | ||
180 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | ||
181 | ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) | ||
182 | } | ||
183 | // } | ||
184 | |||
185 | return@setOnKeyListener true | ||
186 | } | ||
187 | // 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** | ||
188 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 3)//TODO Si encuentra el articulo en el RV devuelve el indice | ||
189 | // //TODO Si no lo encuentra devuelve -1 | ||
190 | // if (indiceDelArtEncontrado != -1) { | ||
191 | // if (swSumaUno!!.isChecked) { | ||
192 | // fCant = 0F | ||
193 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | ||
194 | // fCant += 1F | ||
195 | // //TODO ACTUALIZO LA CANTIDAD EN LA BD | ||
196 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | ||
197 | // //TODO ACTUALIZO LA CANTIDAD EN EL RV | ||
198 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
199 | // viewAdapter.notifyDataSetChanged() | ||
200 | // } else { | ||
201 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | ||
202 | // val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") | ||
203 | // .setCancelable(false) | ||
204 | // mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() | ||
205 | // val mAlertDialog = mBuilder.show() | ||
206 | // mDialogView.rbSumar.setOnClickListener { | ||
207 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
208 | // mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
209 | // } | ||
210 | // } | ||
211 | // mDialogView.rbRestar.setOnClickListener { | ||
212 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
213 | // if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | ||
214 | // mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
215 | // } | ||
216 | // } | ||
217 | // } | ||
218 | // mDialogView.rbMdodificar.setOnClickListener { | ||
219 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
220 | // mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
221 | // } | ||
222 | // } | ||
223 | // mDialogView.btnAceptar.setOnClickListener { | ||
224 | // mAlertDialog.dismiss() | ||
225 | // val name = mDialogView.tvgenerico4.text.toString().toFloat() | ||
226 | // fCant = 0F | ||
227 | // fCant = name | ||
228 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
229 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | ||
230 | // viewAdapter.notifyDataSetChanged() | ||
231 | // } | ||
232 | // mDialogView.dialogCancelBtn.setOnClickListener { | ||
233 | // mAlertDialog.dismiss() | ||
234 | // } | ||
235 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | ||
236 | //// val type = InputType.TYPE_CLASS_NUMBER | ||
237 | //// MaterialDialog(requireContext()).show { | ||
238 | //// | ||
239 | //// title(text = "Producto '$sChangeUpper', se encuentra cargado.") | ||
240 | //// message(R.string.sCantidadNueva) | ||
241 | //// input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | ||
242 | //// fCant = 0F | ||
243 | //// fCant = charSequence.toString().toFloat() | ||
244 | //// } | ||
245 | //// positiveButton(R.string.btnOk) { | ||
246 | //// //TODO ACTUALIZO CANTIADAD EN BD | ||
247 | //// updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | ||
248 | //// //TODO ACTUALIZO CANTIDAD EN RV | ||
249 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
250 | //// viewAdapter.notifyDataSetChanged() | ||
251 | //// dismiss() | ||
252 | //// } | ||
253 | //// }.cancelOnTouchOutside(false).cornerRadius(10F) | ||
254 | // } | ||
255 | // } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | ||
256 | // | ||
257 | // GlobalScope.launch(Dispatchers.Main) { | ||
258 | // //TODO BUSCO EN BASE DE DATOS | ||
259 | // listArticulos[indiceDelArtEncontrado].cantTomada | ||
260 | // val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | ||
261 | // ContinuarCargaCB(artEncontrado) | ||
262 | // } | ||
263 | // } | ||
264 | // return@setOnKeyListener true | ||
265 | // } | ||
266 | } | ||
267 | } | ||
268 | } | ||
269 | return@setOnKeyListener false | ||
270 | } | ||
271 | return v | ||
272 | } | ||
273 | |||
274 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
275 | super.onViewCreated(view, savedInstanceState) | ||
276 | navController = Navigation.findNavController(view) | ||
277 | etCodigoBarras.requestFocus() | ||
278 | // val modalDialog = NoEncontradoSimple() | ||
279 | // modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | ||
280 | |||
281 | btnBorrarInv.setOnClickListener { | ||
282 | AlertDialog.Builder(requireContext()).setTitle("Eliminaciรณn de Inventarios").setMessage("ยฟConfirma que desea eliminar el inventario?") | ||
283 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> | ||
284 | BorrarInvActual() | ||
285 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() | ||
286 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | ||
287 | InventarioNuevo = 0 | ||
288 | |||
289 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> | ||
290 | //botรณn cancel pulsado | ||
291 | }).show() | ||
292 | } | ||
293 | |||
294 | btnExportarInv.setOnClickListener { | ||
295 | AlertDialog.Builder(requireContext()).setTitle(R.string.sTituloExportar).setMessage(R.string.sMensajeExportar) | ||
296 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> | ||
297 | BorrarInvActual() | ||
298 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | ||
299 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | ||
300 | InventarioNuevo = 0 | ||
301 | |||
302 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> | ||
303 | //botรณn cancel pulsado | ||
304 | }).show() | ||
305 | |||
306 | // MaterialDialog(requireContext()).show { | ||
307 | // title(R.string.sTituloExportar) | ||
308 | // message(R.string.sMensajeExportar) | ||
309 | // positiveButton(R.string.btnOk) { | ||
310 | // BorrarInvActual() | ||
311 | // Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | ||
312 | // navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | ||
313 | // InventarioNuevo = 0 | ||
314 | // dismiss() | ||
315 | // } | ||
316 | // negativeButton { | ||
317 | // dismiss() | ||
318 | // } | ||
319 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | ||
320 | } | ||
321 | ivCamara.setOnClickListener { | ||
322 | if (!bFirst) { | ||
323 | iEstado = 1 | ||
324 | bFirst = true | ||
325 | } | ||
326 | |||
327 | when (iEstado) { | ||
328 | 0 -> { | ||
329 | ivCamara.setImageResource(R.drawable.codbar) | ||
330 | etCodigoBarras.hint = "Busqueda por C. Barras" | ||
331 | swSumaUno.visibility = View.VISIBLE | ||
332 | iBusquedaPor = 0 | ||
333 | iEstado = 1 | ||
334 | } | ||
335 | 1 -> { | ||
336 | ivCamara.setImageResource(R.drawable.desc) | ||
337 | etCodigoBarras.hint = "Busqueda por Descripciรณn" | ||
338 | swSumaUno.visibility = View.GONE | ||
339 | iBusquedaPor = 1 | ||
340 | iEstado = 2 | ||
341 | } | ||
342 | 2 -> { | ||
343 | ivCamara.setImageResource(R.drawable.cod_origen) | ||
344 | etCodigoBarras.hint = "Busqueda por C. Origen" | ||
345 | swSumaUno.visibility = View.GONE | ||
346 | iBusquedaPor = 2 | ||
347 | iEstado = 0 | ||
348 | } | ||
349 | } | ||
350 | } | ||
351 | } | ||
352 | |||
353 | private fun BorrarInvActual() { | ||
354 | lifecycleScope.launch { | ||
355 | withContext(Dispatchers.IO) { | ||
356 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo) | ||
357 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo) | ||
358 | } | ||
359 | } | ||
360 | } | ||
361 | |||
362 | private fun CargarDeBdInventario(ultimoInv: Int) { | ||
363 | GlobalScope.launch(Dispatchers.Main) { | ||
364 | val invbody = cargarInventario(ultimoInv) | ||
365 | for ((i, item) in invbody!!.withIndex()) { | ||
366 | val art = Articles(invbody[i].sector, | ||
367 | invbody[i].codigo, | ||
368 | invbody[i].descripcion, | ||
369 | invbody[i].codBar, | ||
370 | invbody[i].codOrigen, | ||
371 | invbody[i].precio, | ||
372 | invbody[i].costo, | ||
373 | "", | ||
374 | "", | ||
375 | "", | ||
376 | invbody[i].balanza, | ||
377 | invbody[i].depSn, | ||
378 | invbody[i].costo) | ||
379 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) | ||
380 | } | ||
381 | } | ||
382 | |||
383 | } | ||
384 | |||
385 | @SuppressLint("RestrictedApi") | ||
386 | private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { | ||
387 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS | ||
388 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV | ||
389 | |||
390 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD | ||
391 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | ||
392 | // fCant = 0F | ||
393 | // fCant += 1F | ||
394 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | ||
395 | // val acargarPorDesc = Articles(artAcargar[0].sector, | ||
396 | // artAcargar[0].codigo, | ||
397 | // artAcargar[0].descripcion, | ||
398 | // artAcargar[0].codBar, | ||
399 | // artAcargar[0].codOrigen, | ||
400 | // artAcargar[0].precio, | ||
401 | // artAcargar[0].costo, | ||
402 | // "", | ||
403 | // "", | ||
404 | // "", | ||
405 | // artAcargar[0].balanza, | ||
406 | // artAcargar[0].depSn, | ||
407 | // "") | ||
408 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | ||
409 | // cargarArtEnBd(acargarPorDesc, fCant) | ||
410 | // cargarRecicler(acargarPorDesc, fCant) | ||
411 | // } else { | ||
412 | var bundle = Bundle() | ||
413 | bundle = bundleOf("ArrayDesc" to artAcargar) | ||
414 | bundle.putInt("numeroInv", InventarioNuevo) | ||
415 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | ||
416 | //navController.backStack.removeLast() | ||
417 | // } | ||
418 | // } else {//SI NO ESTA +1 | ||
419 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | ||
420 | // fCant = listArticulos[0].cantTomada | ||
421 | // MaterialDialog(requireContext()).show { | ||
422 | // title(R.string.sTituloNueva) | ||
423 | // message(R.string.sCantidadNueva) | ||
424 | // input { materialDialog, charSequence -> | ||
425 | // fCant = 0F | ||
426 | // fCant = charSequence.toString().toFloat() | ||
427 | // } | ||
428 | // positiveButton(R.string.btnOk) { | ||
429 | // listArticulos[0].cantTomada = fCant | ||
430 | // viewAdapter.notifyDataSetChanged() | ||
431 | // dismiss() | ||
432 | // } | ||
433 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | ||
434 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | ||
435 | // val acargarPorDesc = Articles(artAcargar[0].sector, | ||
436 | // artAcargar[0].codigo, | ||
437 | // artAcargar[0].descripcion, | ||
438 | // artAcargar[0].codBar, | ||
439 | // artAcargar[0].cod_origen, | ||
440 | // artAcargar[0].precio, | ||
441 | // artAcargar[0].costo, | ||
442 | // artAcargar[0].balanza, | ||
443 | // artAcargar[0].depSn, | ||
444 | // "") | ||
445 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | ||
446 | // cargarArtEnBd(acargarPorDesc, fCant) | ||
447 | // cargarRecicler(acargarPorDesc, fCant) | ||
448 | // } else { | ||
449 | // var bundle = Bundle() | ||
450 | // bundle = bundleOf("ArrayDesc" to artAcargar) | ||
451 | // bundle.putInt("numeroInv", InventarioNuevo) | ||
452 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | ||
453 | // } | ||
454 | // } | ||
455 | } else {//TODO si no lo encuentra en la BD | ||
456 | val modalDialog = DialogNoEncontrado() | ||
457 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | ||
458 | } | ||
459 | etCodigoBarras.focusable = View.FOCUSABLE | ||
460 | etCodigoBarras.setText("") | ||
461 | etCodigoBarras.selectAll() | ||
462 | } | ||
463 | |||
464 | private fun ContinuarCargaCB(artAcargar: Articles?) { | ||
465 | |||
466 | if (artAcargar != null) {// TODO: Si lo encuentra en la BD | ||
467 | if (swSumaUno!!.isChecked) {//TODO: SI ESTA +1, PONE CANTIDAD 1 | ||
468 | fCant = 0F | ||
469 | fCant += 1F | ||
470 | cargarArtEnBd(artAcargar, String.format("%.3f", fCant)) | ||
471 | cargarRecicler(artAcargar, fCant) | ||
472 | } else {//SI NO ESTA +1 PREGUNTA CANTIDAD | ||
473 | |||
474 | DialogingresarCantidad(requireContext(), artAcargar) | ||
475 | } | ||
476 | } else {// TODO si no lo encuentra en la BD | ||
477 | val modalDialog = DialogNoEncontrado() | ||
478 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | ||
479 | } | ||
480 | etCodigoBarras.focusable = View.FOCUSABLE | ||
481 | etCodigoBarras.setText("") | ||
482 | etCodigoBarras.selectAll() | ||
483 | } | ||
484 | |||
485 | fun DialogingresarCantidad(cnxt: Context, artAcargar: Articles?) { | ||
486 | val mDialogView = LayoutInflater.from(cnxt).inflate(R.layout.ingresar_cantidad, null) | ||
487 | val mBuilder = AlertDialog.Builder(cnxt).setView(mDialogView).setCancelable(false) | ||
488 | if (artAcargar!!.balanza!!.toInt() == 1 || artAcargar.balanza!!.toInt() == 3 || artAcargar.balanza!!.toInt() == 7) mDialogView.etCantidad.inputType = TYPE_CLASS_NUMBER | ||
489 | mDialogView.tvTitulo.text = artAcargar.descripcion.toString() | ||
490 | val mAlertDialog = mBuilder.show() | ||
491 | mDialogView.btnAceptar.setOnClickListener { | ||
492 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { | ||
493 | mDialogView.etCantidad.error = "No vacio" | ||
494 | mDialogView.etCantidad.requestFocus() | ||
495 | mDialogView.etCantidad.hint = "Ingrese un valor" | ||
496 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | ||
497 | mAlertDialog.dismiss() | ||
498 | cargarArtEnBd(artAcargar, String.format("%.2f", mDialogView.etCantidad.text.toString().toFloat())) | ||
499 | cargarRecicler(artAcargar, mDialogView.etCantidad.text.toString().toFloat()) | ||
500 | } | ||
501 | } | ||
502 | } | ||
503 | |||
504 | fun dialogoSumaResta(context: Context, indiceDelArtEncontrado: Int, univta: String, cancelable: Boolean) { | ||
505 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | ||
506 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("${listArticulos[indiceDelArtEncontrado].descripcion} se encuentra cargado.").setCancelable(cancelable) | ||
507 | // TODO: SI PERMITE QUE INGRESE DECIMALES | ||
508 | if (univta.contains("1") || univta.contains("3") || univta.contains("7")) mDialogView.tvNuevaCantidad.inputType = TYPE_CLASS_NUMBER | ||
509 | |||
510 | mDialogView.tvCantInicial.text = String.format("%.2f", listArticulos[indiceDelArtEncontrado].cantTomada) | ||
511 | val mAlertDialog = mBuilder.show() | ||
512 | mDialogView.rbSumar.setOnClickListener { | ||
513 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
514 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()) | ||
515 | mDialogView.tvNuevaCantidad.isEnabled = false | ||
516 | } | ||
517 | } | ||
518 | mDialogView.rbRestar.setOnClickListener { | ||
519 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
520 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | ||
521 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) | ||
522 | mDialogView.tvNuevaCantidad.isEnabled = false | ||
523 | } else { | ||
524 | mDialogView.tvResultado.text = "" | ||
525 | mDialogView.tvResultado.error = "Operaciรณn No Valida" | ||
526 | mDialogView.tvResultado.requestFocus() | ||
527 | mDialogView.tvResultado.hint = "Error" | ||
528 | } | ||
529 | } | ||
530 | } | ||
531 | mDialogView.rbMdodificar.setOnClickListener { | ||
532 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
533 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat()) | ||
534 | mDialogView.tvNuevaCantidad.isEnabled = false | ||
535 | } | ||
536 | } | ||
537 | mDialogView.btnAceptar.setOnClickListener { | ||
538 | if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) { | ||
539 | if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) { | ||
540 | mAlertDialog.dismiss() | ||
541 | listArticulos[indiceDelArtEncontrado].cantTomada = String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat() | ||
542 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), | ||
543 | String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat()) | ||
544 | |||
545 | viewAdapter.notifyDataSetChanged() | ||
546 | } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | ||
547 | mDialogView.tvResultado.error = "Operaciรณn Requerida" | ||
548 | mDialogView.tvResultado.requestFocus() | ||
549 | mDialogView.tvResultado.hint = "Seleccione Operaciรณn" | ||
550 | } | ||
551 | } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | ||
552 | mDialogView.tvNuevaCantidad.error = "Completar" | ||
553 | mDialogView.tvNuevaCantidad.requestFocus() | ||
554 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | ||
555 | } | ||
556 | } | ||
557 | mDialogView.dialogCancelBtn.setOnClickListener { | ||
558 | mAlertDialog.dismiss() | ||
559 | } | ||
560 | } | ||
561 | |||
562 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { | ||
563 | //TODO BUSQUEDA POR CODIGO DE BARRAS | ||
564 | var busqueda: Articles? = null | ||
565 | return GlobalScope.async(Dispatchers.IO) { | ||
566 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, SerchArea()) | ||
567 | return@async busqueda | ||
568 | }.await() | ||
569 | } | ||
570 | |||
571 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { | ||
572 | //TODO BUSQUEDA POR DESCRIPCION | ||
573 | var busqueda: List<Articles>? = null | ||
574 | return GlobalScope.async(Dispatchers.IO) { | ||
575 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, SerchArea()) | ||
576 | return@async busqueda | ||
577 | }.await() | ||
578 | } | ||
579 | |||
580 | suspend fun borrarArticulo(sector: String, codigo: String, inventario: String): Int? { | ||
581 | //TODO BUSQUEDA POR DESCRIPCION | ||
582 | var result: Int | ||
583 | return GlobalScope.async(Dispatchers.IO) { | ||
584 | result = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.deleteItemFromInvBody(sector, codigo, inventario) | ||
585 | return@async result | ||
586 | }.await() | ||
587 | } | ||
588 | |||
589 | private suspend fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { | ||
590 | |||
591 | return GlobalScope.async(Dispatchers.IO) { | ||
592 | var indice = 0 | ||
593 | var bEncontrado = false | ||
594 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS | ||
595 | // TODO CAMBIO DE CB A CODIGO DEBO | ||
596 | val any = cambioCBporCodigoDebo(codigoBarras) | ||
597 | if (any != null) { | ||
598 | for (item in listArticulos) { | ||
599 | if (item.sector!!.toInt() == any.sector!!.toInt() && item.codigo!!.toInt() == any.codigo!!.toInt()) { | ||
600 | bEncontrado = true | ||
601 | break | ||
602 | } | ||
603 | indice += 1 | ||
604 | } | ||
605 | } | ||
606 | |||
607 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION | ||
608 | for (item in listArticulos) { | ||
609 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | ||
610 | bEncontrado = true | ||
611 | break | ||
612 | } | ||
613 | indice += 1 | ||
614 | } | ||
615 | } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN | ||
616 | for (item in listArticulos) { | ||
617 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | ||
618 | bEncontrado = true | ||
619 | break | ||
620 | } | ||
621 | indice += 1 | ||
622 | } | ||
623 | } | ||
624 | return@async if (bEncontrado) indice else -1 | ||
625 | }.await() | ||
626 | } | ||
627 | |||
628 | suspend fun cambioCBporCodigoDebo(codigoBarras: String): Articles? { | ||
629 | //TODO BUSQUEDA POR DESCRIPCION | ||
630 | var busqueda: Articles? = null | ||
631 | return GlobalScope.async(Dispatchers.IO) { | ||
632 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(codigoBarras, SerchArea()) | ||
633 | return@async busqueda | ||
634 | }.await() | ||
635 | } | ||
636 | |||
637 | private fun cargarArtEnBd(articulos: Articles, cant: String) { | ||
638 | val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD | ||
639 | articulos.sector, | ||
640 | articulos.codigo, | ||
641 | articulos.descripcion, | ||
642 | cant, | ||
643 | articulos.codBar, | ||
644 | articulos.codOrigen, | ||
645 | articulos.precio, | ||
646 | articulos.precio, | ||
647 | articulos.balanza, | ||
648 | articulos.depSn, | ||
649 | ObtenerFechaActual(), | ||
650 | ObtenerFechaActual()) | ||
651 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS | ||
652 | } | ||
653 | |||
654 | fun cargarRecicler(articulos: Articles, cant: Float) { | ||
655 | //TODO CARGO EN LE RV | ||
656 | val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen, articulos.balanza.toString(), articulos.de.toString()) | ||
657 | listArticulos.add(item) | ||
658 | |||
659 | viewAdapter = ProductosListAdapter(requireContext(), listArticulos, this) | ||
660 | viewManager = LinearLayoutManager(requireContext()) | ||
661 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! | ||
662 | rcInventarios.apply { | ||
663 | adapter = viewAdapter | ||
664 | layoutManager = viewManager | ||
665 | } | ||
666 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { | ||
667 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | ||
668 | return false | ||
669 | } | ||
670 | |||
671 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { | ||
672 | |||
673 | GlobalScope.launch(Dispatchers.Main) { | ||
674 | borrarArticulo(listArticulos[viewHolder.adapterPosition].sector.toString(), listArticulos[viewHolder.adapterPosition].codigo.toString(), InventarioNuevo.toString()) | ||
675 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) | ||
676 | viewAdapter.notifyDataSetChanged() | ||
677 | } | ||
678 | } | ||
679 | |||
680 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | ||
681 | val itemView = viewHolder.itemView | ||
682 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 | ||
683 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | ||
684 | |||
685 | if (dX > 0) { | ||
686 | |||
687 | if (dX < c.width / 2) c.drawColor(Color.GREEN) | ||
688 | else c.drawColor(Color.RED) | ||
689 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) | ||
690 | } else { | ||
691 | } | ||
692 | |||
693 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | ||
694 | deleteIcon.draw(c) | ||
695 | } | ||
696 | } | ||
697 | |||
698 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) | ||
699 | itemTouchHelper.attachToRecyclerView(rcInventarios) | ||
700 | } | ||
701 | |||
702 | private fun ProdNoCont(): Int? { | ||
703 | var mostrarStock = 0 | ||
704 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 | ||
705 | return mostrarStock | ||
706 | } | ||
707 | |||
708 | private fun AjusteProductos(): Int? { | ||
709 | var prodInclu = 0 | ||
710 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 | ||
711 | |||
712 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 | ||
713 | return prodInclu | ||
714 | } | ||
715 | |||
716 | private fun SerchArea(): Int { | ||
717 | if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea = 0 | ||
718 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = 1 | ||
719 | return iArea | ||
720 | } | ||
721 | |||
722 | fun ObtenerFechaActual(): String? { | ||
723 | //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD | ||
724 | val current = LocalDateTime.now() | ||
725 | val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") | ||
726 | val dFechaHora = current.format(formatter) | ||
727 | return dFechaHora.toString() | ||
728 | } | ||
729 | |||
730 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | ||
731 | lifecycleScope.launch { | ||
732 | withContext(Dispatchers.IO) { | ||
733 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | ||
734 | } | ||
735 | } | ||
736 | } | ||
737 | |||
738 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | ||
739 | lifecycleScope.launch { | ||
740 | withContext(Dispatchers.IO) { | ||
741 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) | ||
742 | } | ||
743 | } | ||
744 | } | ||
745 | |||
746 | suspend fun cargarInventario(inventario: Int): List<InvBody>? { | ||
747 | return GlobalScope.async(Dispatchers.IO) { | ||
748 | return@async AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.fetchAllInvBody(inventario) | ||
749 | }.await() | ||
750 | } | ||
751 | |||
752 | override fun onImageDotsClick(sector: String?, codigo: String?) { | ||
753 | val bundle = Bundle() | ||
754 | bundle.putString("sector", sector) | ||
755 | bundle.putString("codigo", codigo) | ||
756 | bundle.putInt("numeroInv", InventarioNuevo) | ||
757 | navController.navigate(R.id.action_inventarioFragment_to_detalleArtFragment, bundle) | ||
758 | } | ||
759 | |||
760 | override fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) { | ||
761 | dialogoSumaResta(requireContext(), position.toInt(), listArticulos[position.toInt()].univta, true) | ||
762 | |||
763 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | ||
764 | // val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("${listArticulos[position.toInt()].descripcion}") | ||
765 | //// .setCancelable(false) | ||
766 | // mDialogView.tvCantInicial.text = cantidad | ||
767 | // val mAlertDialog = mBuilder.show() | ||
768 | // mDialogView.rbSumar.setOnClickListener { | ||
769 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
770 | // mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
771 | // mDialogView.tvNuevaCantidad.isEnabled=false | ||
772 | // } | ||
773 | // } | ||
774 | // mDialogView.rbRestar.setOnClickListener { | ||
775 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
776 | // if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | ||
777 | // mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
778 | // mDialogView.tvNuevaCantidad.isEnabled=false | ||
779 | // } | ||
780 | // } | ||
781 | // } | ||
782 | // mDialogView.rbMdodificar.setOnClickListener { | ||
783 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
784 | // mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
785 | // mDialogView.tvNuevaCantidad.isEnabled=false | ||
786 | // } | ||
787 | // } | ||
788 | // mDialogView.btnAceptar.setOnClickListener { | ||
789 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
790 | // mAlertDialog.dismiss() | ||
791 | // val name = mDialogView.tvgenerico4.text.toString().toFloat() | ||
792 | // fCant = 0F | ||
793 | // fCant = name | ||
794 | // listArticulos[position.toInt()].cantTomada = fCant | ||
795 | // updateCantidad(listArticulos[position.toInt()].sector.toString(), listArticulos[position.toInt()].codigo.toString(), fCant) | ||
796 | // viewAdapter.notifyDataSetChanged() | ||
797 | // } else if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
798 | // mDialogView.tvNuevaCantidad.error = "No vacio" | ||
799 | // mDialogView.tvNuevaCantidad.requestFocus() | ||
800 | // mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | ||
801 | // } | ||
802 | // } | ||
803 | // mDialogView.dialogCancelBtn.setOnClickListener { | ||
804 | // mAlertDialog.dismiss() | ||
805 | // } | ||
806 | } | ||
807 | } | ||
808 | |||
809 | |||
810 | |||
811 | |||
812 | |||
813 | |||
814 | |||
815 | |||
816 | |||
817 | |||
818 | |||
819 | |||
820 | 1 | package com.focasoftware.deboinventariov20.ui.inventario |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/ItemsRecycler.kt
1 | package com.focasoftware.deboinventariov20.ui.inventario | File was deleted | |
2 | |||
3 | import android.widget.ImageView | ||
4 | |||
5 | data class ItemsRecycler(val sector: String?,val codigo: String?, val descripcion: String?, var cantTomada: Float, val codigoBarras: String?, val codigoOrigen: String?,val univta: String,val dev:String) { | ||
6 | |||
7 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/ProductosListAdapter.kt
1 | package com.focasoftware.deboinventariov20.ui.inventario | File was deleted | |
2 | |||
3 | import android.content.Context | ||
4 | import android.view.LayoutInflater | ||
5 | import android.view.View | ||
6 | import android.view.ViewGroup | ||
7 | import androidx.recyclerview.widget.RecyclerView | ||
8 | import com.focasoftware.deboinventariov20.R | ||
9 | import com.focasoftware.deboinventariov20.ui.main.ItemInventario | ||
10 | import com.focasoftware.deboinventariov20.ui.util.Base.BaseViewHolder | ||
11 | import com.google.android.material.snackbar.Snackbar | ||
12 | import kotlinx.android.synthetic.main.item.view.* | ||
13 | |||
14 | |||
15 | class ProductosListAdapter(private val context: Context,private val productos: ArrayList<ItemsRecycler>, private val itemImageClickListener: OnImageDotsClickListener) : | ||
16 | RecyclerView.Adapter<BaseViewHolder<*>>() { | ||
17 | |||
18 | private var removePosition: Int = 0 | ||
19 | private var removedItem: ItemsRecycler? = null | ||
20 | |||
21 | interface OnImageDotsClickListener { | ||
22 | fun onImageDotsClick(sector: String?,codigo: String?) | ||
23 | fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) | ||
24 | } | ||
25 | |||
26 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item, parent, false)) | ||
27 | |||
28 | override fun getItemCount() = productos.size | ||
29 | |||
30 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { | ||
31 | when (holder) { | ||
32 | is ItemsViewHolder -> { holder.bind(productos[position], position) } | ||
33 | |||
34 | } | ||
35 | } | ||
36 | inner class ItemsViewHolder (itemView: View) : BaseViewHolder<ItemsRecycler>(itemView) { | ||
37 | override fun bind(item: ItemsRecycler, position: Int) { | ||
38 | itemView.ivDots.setOnClickListener {itemImageClickListener.onImageDotsClick(item.sector,item.codigo) } | ||
39 | itemView.ivPen.setOnClickListener {itemImageClickListener.onImagePenClick(item.sector,item.codigo,item.cantTomada.toString(),adapterPosition.toString()) } | ||
40 | |||
41 | itemView.tvSector.text=item.sector | ||
42 | itemView.tvCodigo.text=item.codigo | ||
43 | itemView.tvDescripcion.text=item.descripcion | ||
44 | itemView.tvCantidad.text=item.cantTomada.toString() | ||
45 | itemView.tvCodigoBarras.text=item.sector | ||
46 | itemView.tvCodigoOrigen.text=item.sector | ||
47 | itemView.ivPen.setImageResource(R.drawable.pen) | ||
48 | itemView.ivDots.setImageResource(R.drawable.more) | ||
49 | } | ||
50 | } | ||
51 | |||
52 | fun removeItem(viewHolder: RecyclerView.ViewHolder) { | ||
53 | removePosition = viewHolder.adapterPosition | ||
54 | removedItem = productos[viewHolder.adapterPosition] | ||
55 | |||
56 | productos.removeAt(viewHolder.adapterPosition) | ||
57 | notifyItemRemoved(viewHolder.adapterPosition) | ||
58 | } | ||
59 | |||
60 | |||
61 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/InventarioListAdapter.kt
1 | package com.focasoftware.deboinventariov20.ui.main | File was deleted | |
2 | |||
3 | import android.content.Context | ||
4 | import android.view.LayoutInflater | ||
5 | import android.view.View | ||
6 | import android.view.ViewGroup | ||
7 | import androidx.recyclerview.widget.RecyclerView | ||
8 | import com.focasoftware.deboinventariov20.Model.InvHead | ||
9 | import com.focasoftware.deboinventariov20.R | ||
10 | import com.focasoftware.deboinventariov20.ui.util.Base.BaseViewHolder | ||
11 | import kotlinx.android.synthetic.main.item_principal.view.* | ||
12 | |||
13 | class InventarioListAdapter(private val context: Context, private val inv: List<InvHead>, private val itemClickListener: OnInventarioClickListener) : | ||
14 | RecyclerView.Adapter<BaseViewHolder<*>>() { | ||
15 | |||
16 | interface OnInventarioClickListener { | ||
17 | fun onItemClick(inventario: String?) | ||
18 | } | ||
19 | |||
20 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item_principal, parent, false)) | ||
21 | |||
22 | override fun getItemCount() = inv.size | ||
23 | |||
24 | |||
25 | inner class ItemsViewHolder(itemView: View) : BaseViewHolder<InvHead>(itemView) { | ||
26 | override fun bind(item: InvHead, position: Int) { | ||
27 | itemView.setOnClickListener {itemClickListener.onItemClick(item.invNum.toString())} | ||
28 | itemView.tvPrincipalinventario.text = if ( item.invNum < 10) "0${ item.invNum.toString()}" else item.invNum.toString() | ||
29 | |||
30 | itemView.tvDescription.text=item.descripcion.toString() | ||
31 | itemView.tvFecha.text=item.fechaInicio.toString() | ||
32 | itemView.tvCantContada.text=item.prodContados.toString() | ||
33 | } | ||
34 | } | ||
35 | |||
36 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { | ||
37 | when (holder) { | ||
38 | is ItemsViewHolder -> holder.bind(inv[position], position) | ||
39 | else -> IllegalArgumentException("No se pudo pasar el ViewHolder") | ||
40 | } | ||
41 | } | ||
42 | |||
43 | |||
44 | } | ||
45 | |||
46 | |||
47 | |||
48 | 1 | package com.focasoftware.deboinventariov20.ui.main |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/ItemPrincipal.kt
1 | package com.focasoftware.deboinventariov20.ui.main | File was deleted | |
2 | |||
3 | data class ItemInventario(val inventario: String?, val descripcion: String?) |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/MainFragment.kt
1 | package com.focasoftware.deboinventariov20.ui.main | File was deleted | |
2 | |||
3 | import android.content.Context | ||
4 | import android.content.SharedPreferences | ||
5 | import android.os.Bundle | ||
6 | import android.view.LayoutInflater | ||
7 | import android.view.View | ||
8 | import android.view.ViewGroup | ||
9 | import android.widget.* | ||
10 | import androidx.fragment.app.Fragment | ||
11 | import androidx.navigation.NavController | ||
12 | import androidx.navigation.Navigation | ||
13 | import androidx.recyclerview.widget.LinearLayoutManager | ||
14 | import androidx.recyclerview.widget.RecyclerView | ||
15 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
16 | import com.focasoftware.deboinventariov20.Model.InvHead | ||
17 | import com.focasoftware.deboinventariov20.R | ||
18 | import com.focasoftware.deboinventariov20.ui.inventario.ItemsRecycler | ||
19 | import kotlinx.coroutines.Dispatchers | ||
20 | import kotlinx.coroutines.GlobalScope | ||
21 | import kotlinx.coroutines.async | ||
22 | import kotlinx.coroutines.launch | ||
23 | import java.util.* | ||
24 | |||
25 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { | ||
26 | private lateinit var inventarios: List<InvHead> | ||
27 | private lateinit var ordenado: List<InvHead> | ||
28 | private lateinit var rcInventario: RecyclerView | ||
29 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | ||
30 | private lateinit var viewManager: RecyclerView.LayoutManager | ||
31 | // private var listIvn2 = List<InvHead>() | ||
32 | private var listIvn2 = ArrayList<InvHead>() | ||
33 | private lateinit var navController: NavController | ||
34 | private lateinit var sharedPreferences: SharedPreferences | ||
35 | private var cantidadInventarios: Int = 0 | ||
36 | |||
37 | override fun onCreate(savedInstanceState: Bundle?) { | ||
38 | super.onCreate(savedInstanceState) | ||
39 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | ||
40 | } | ||
41 | |||
42 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
43 | var bAbiertoCerrado = false | ||
44 | val v = inflater.inflate(R.layout.fragment_main, container, false) | ||
45 | val tvInvDinamicos = v.findViewById<TextView>(R.id.tvInvDinamicos) | ||
46 | val txtDeposito = v.findViewById<TextView>(R.id.txtDeposito) | ||
47 | val ivSort19= v.findViewById<ImageButton>(R.id.ivSort19) | ||
48 | val ivSort91= v.findViewById<ImageButton>(R.id.ivSort91) | ||
49 | val cbVentas= v.findViewById<CheckBox>(R.id.cbVentas) | ||
50 | val cbDeposito= v.findViewById<CheckBox>(R.id.cbDeposito) | ||
51 | val tvTipo = v.findViewById<TextView>(R.id.tvTipo) | ||
52 | rcInventario = v.findViewById(R.id.rcInventario) | ||
53 | |||
54 | GlobalScope.launch(Dispatchers.Main) { | ||
55 | inventarios = buscarEnBDInvHead() | ||
56 | for ((i, item) in inventarios.withIndex()) { | ||
57 | val inv = InvHead(inventarios[i].invNum, | ||
58 | inventarios[i].descripcion, | ||
59 | inventarios[i].estado, | ||
60 | inventarios[i].fechaInicio, | ||
61 | inventarios[i].fechaFinal, | ||
62 | inventarios[i].prodContados, | ||
63 | inventarios[i].lugar, | ||
64 | inventarios[i].stDesc, | ||
65 | inventarios[i].proNoCont) | ||
66 | cargarRecicler(inv) | ||
67 | cantidadInventarios = i + 1 | ||
68 | } | ||
69 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) +" | ||
70 | tvInvDinamicos.setOnClickListener { | ||
71 | if (!bAbiertoCerrado) { | ||
72 | bAbiertoCerrado = true | ||
73 | txtDeposito.visibility = View.GONE | ||
74 | rcInventario.visibility = View.VISIBLE | ||
75 | ivSort91.visibility = View.INVISIBLE | ||
76 | ivSort19.visibility = View.VISIBLE | ||
77 | cbVentas.visibility = View.VISIBLE | ||
78 | cbDeposito.visibility = View.VISIBLE | ||
79 | tvTipo.visibility = View.VISIBLE | ||
80 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) -" | ||
81 | } else { | ||
82 | bAbiertoCerrado = false | ||
83 | rcInventario.visibility = View.GONE | ||
84 | ivSort91.visibility = View.GONE | ||
85 | ivSort19.visibility = View.GONE | ||
86 | txtDeposito.visibility = View.VISIBLE | ||
87 | cbVentas.visibility = View.GONE | ||
88 | cbDeposito.visibility = View.GONE | ||
89 | tvTipo.visibility = View.GONE | ||
90 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) +" | ||
91 | } | ||
92 | } | ||
93 | ivSort19.setOnClickListener { | ||
94 | ordenado= inventarios.sortedByDescending { | ||
95 | it.invNum | ||
96 | } | ||
97 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | ||
98 | viewManager = LinearLayoutManager(requireContext()) | ||
99 | |||
100 | rcInventario.apply { | ||
101 | adapter = viewAdapter | ||
102 | layoutManager = viewManager | ||
103 | } | ||
104 | viewAdapter.notifyDataSetChanged() | ||
105 | ivSort19.visibility=View.INVISIBLE | ||
106 | ivSort91.visibility=View.VISIBLE | ||
107 | } | ||
108 | ivSort91.setOnClickListener { | ||
109 | ordenado= inventarios.sortedBy { | ||
110 | it.invNum | ||
111 | } | ||
112 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | ||
113 | viewManager = LinearLayoutManager(requireContext()) | ||
114 | |||
115 | rcInventario.apply { | ||
116 | adapter = viewAdapter | ||
117 | layoutManager = viewManager | ||
118 | } | ||
119 | viewAdapter.notifyDataSetChanged() | ||
120 | ivSort91.visibility=View.INVISIBLE | ||
121 | ivSort19.visibility=View.VISIBLE | ||
122 | } | ||
123 | } | ||
124 | return v | ||
125 | } | ||
126 | |||
127 | suspend fun buscarEnBDInvHead(): List<InvHead> { | ||
128 | //TODO BUSQUEDA POR DESCRIPCION | ||
129 | var busqueda: List<InvHead> | ||
130 | return GlobalScope.async(Dispatchers.IO) { | ||
131 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() | ||
132 | return@async busqueda | ||
133 | }.await() | ||
134 | } | ||
135 | |||
136 | fun cargarRecicler(inv: InvHead) { | ||
137 | //TODO CARGO EN LE RV | ||
138 | |||
139 | // val number = if (inv.invNum.toLong() < 10) "0${inv.invNum.toLong()}" else inv.invNum.toString() | ||
140 | // val item = ItemInventario("Nยฐ $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") | ||
141 | |||
142 | // listIvn.add(item) | ||
143 | listIvn2.add(inv) | ||
144 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this) | ||
145 | viewManager = LinearLayoutManager(requireContext()) | ||
146 | |||
147 | rcInventario.apply { | ||
148 | adapter = viewAdapter | ||
149 | layoutManager = viewManager | ||
150 | } | ||
151 | } | ||
152 | |||
153 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
154 | super.onViewCreated(view, savedInstanceState) | ||
155 | navController = Navigation.findNavController(view) | ||
156 | listIvn2.clear() | ||
157 | } | ||
158 | |||
159 | override fun onItemClick(inventario: String?) { | ||
160 | |||
161 | val editor = sharedPreferences.edit() | ||
162 | // var invSel: String = inventario.toString() | ||
163 | // invSel = invSel.substring(3, 5) | ||
164 | editor?.putString("Inventario", inventario) | ||
165 | editor?.apply() | ||
166 | editor.commit() | ||
167 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) | ||
168 | } | ||
169 | |||
170 | |||
171 | } | ||
172 | |||
173 | 1 | package com.focasoftware.deboinventariov20.ui.main |
app/src/main/java/com/focasoftware/deboinventariov20/ui/servidores/AdapterServidores.kt
1 | package com.focasoftware.deboinventariov20.ui.servidores | File was deleted | |
2 | |||
3 | import android.content.Context | ||
4 | import android.view.LayoutInflater | ||
5 | import android.view.View | ||
6 | import android.view.ViewGroup | ||
7 | import androidx.recyclerview.widget.RecyclerView | ||
8 | import com.focasoftware.deboinventariov20.R | ||
9 | import com.focasoftware.deboinventariov20.ui.inventario.ItemsRecycler | ||
10 | import com.google.android.material.snackbar.Snackbar | ||
11 | import kotlinx.android.synthetic.main.item_servidores.view.* | ||
12 | |||
13 | class AdapterServidores(private val servidor: ArrayList<ItemsServidores>, private var contexto: Context) : | ||
14 | RecyclerView.Adapter<AdapterServidores.ViewHolder>() { | ||
15 | private var removePosition: Int = 0 | ||
16 | private var removedItem: ItemsServidores? = null | ||
17 | |||
18 | class ViewHolder(var vista: View) : RecyclerView.ViewHolder(vista) { | ||
19 | fun bind(itemsServidores: ItemsServidores) { | ||
20 | vista.tvDescServidor.text = itemsServidores.descripcion | ||
21 | vista.tvDireccionServidor.text = itemsServidores.direccion | ||
22 | |||
23 | } | ||
24 | } | ||
25 | |||
26 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { | ||
27 | return ViewHolder( | ||
28 | LayoutInflater.from(parent.context).inflate(R.layout.item_servidores, parent, false) | ||
29 | ) | ||
30 | } | ||
31 | |||
32 | override fun getItemCount(): Int { | ||
33 | return servidor.size | ||
34 | } | ||
35 | |||
36 | override fun onBindViewHolder(holder: ViewHolder, position: Int) { | ||
37 | holder.bind(servidor[position]) | ||
38 | } | ||
39 | fun removeItem(viewHolder: RecyclerView.ViewHolder) { | ||
40 | removePosition = viewHolder.adapterPosition | ||
41 | removedItem = servidor[viewHolder.adapterPosition] | ||
42 | |||
43 | servidor.removeAt(viewHolder.adapterPosition) | ||
44 | notifyItemRemoved(viewHolder.adapterPosition) | ||
45 | } | ||
46 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/servidores/ItemsServidores.kt
1 | package com.focasoftware.deboinventariov20.ui.servidores | File was deleted | |
2 | |||
3 | data class ItemsServidores(val descripcion: String?, var direccion: String?, var predeterminado: String?) |
app/src/main/java/com/focasoftware/deboinventariov20/ui/servidores/ServidoresFragment.kt
1 | package com.focasoftware.deboinventariov20.ui.servidores | File was deleted | |
2 | |||
3 | import android.graphics.Canvas | ||
4 | import android.graphics.Color | ||
5 | import android.graphics.drawable.Drawable | ||
6 | import android.os.Bundle | ||
7 | import android.view.LayoutInflater | ||
8 | import android.view.View | ||
9 | import android.view.ViewGroup | ||
10 | import android.widget.Toast | ||
11 | import androidx.core.content.ContextCompat | ||
12 | import androidx.fragment.app.Fragment | ||
13 | import androidx.lifecycle.lifecycleScope | ||
14 | import androidx.recyclerview.widget.ItemTouchHelper | ||
15 | import androidx.recyclerview.widget.LinearLayoutManager | ||
16 | import androidx.recyclerview.widget.RecyclerView | ||
17 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
18 | import com.focasoftware.deboinventariov20.Model.ServeInv | ||
19 | import com.focasoftware.deboinventariov20.R | ||
20 | import kotlinx.android.synthetic.main.fragment_servidores.* | ||
21 | import kotlinx.coroutines.* | ||
22 | |||
23 | class ServidoresFragment : Fragment() { | ||
24 | |||
25 | private lateinit var rvServidores: RecyclerView | ||
26 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | ||
27 | private lateinit var viewManager: RecyclerView.LayoutManager | ||
28 | private var listServ = ArrayList<ItemsServidores>() | ||
29 | private lateinit var servidores: List<ServeInv> | ||
30 | private lateinit var deleteIcon: Drawable | ||
31 | |||
32 | override fun onCreate(savedInstanceState: Bundle?) { | ||
33 | super.onCreate(savedInstanceState) | ||
34 | CargarRV() | ||
35 | } | ||
36 | |||
37 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
38 | super.onViewCreated(view, savedInstanceState) | ||
39 | |||
40 | btnGuardarServidores.setOnClickListener { | ||
41 | if (etNombreServidor.text.isNullOrBlank()) { | ||
42 | etNombreServidor.error = "Nombre no valido" | ||
43 | etNombreServidor.requestFocus() | ||
44 | etNombreServidor.hint = "Nombre no valido" | ||
45 | } | ||
46 | if (etDireccionServidor.text.isNullOrBlank()) { | ||
47 | etDireccionServidor.error = "Direcciรณn no valida" | ||
48 | etDireccionServidor.requestFocus() | ||
49 | etDireccionServidor.hint = "Direcciรณn no valida" | ||
50 | } | ||
51 | if (!etDireccionServidor.text.isNullOrBlank() || !etNombreServidor.text.isNullOrBlank()) { | ||
52 | // GlobalScope.launch(Dispatchers.Main) { | ||
53 | // ServerNew =AppDb.getAppDb(requireContext())?.ServeInvDao()?.findLastServer()?.plus(1) ?: 1 | ||
54 | val servidor = ServeInv(etNombreServidor.text.toString(), "http://${etDireccionServidor.text}/", 0) | ||
55 | ingresarDatos(servidor) | ||
56 | cargarRecicler(servidor) | ||
57 | Toast.makeText(requireContext(), "Servidor ${etNombreServidor.text} Guardado", Toast.LENGTH_LONG).show() | ||
58 | etNombreServidor.text.clear() | ||
59 | etDireccionServidor.text.clear() | ||
60 | // } | ||
61 | } | ||
62 | } | ||
63 | } | ||
64 | |||
65 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
66 | val v = inflater.inflate(R.layout.fragment_servidores, container, false) | ||
67 | rvServidores = v.findViewById(R.id.rvServidores) | ||
68 | return v | ||
69 | } | ||
70 | |||
71 | fun ingresarDatos(servidor: ServeInv) { | ||
72 | val Job = GlobalScope.launch { | ||
73 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.insertServer(servidor) | ||
74 | } | ||
75 | } | ||
76 | |||
77 | suspend fun buscarEnBD(): List<ServeInv> { | ||
78 | var busqueda: List<ServeInv> | ||
79 | return GlobalScope.async(Dispatchers.IO) { | ||
80 | busqueda = AppDb.getAppDb(requireContext())!!.ServeInvDao()!!.fetchAllServers() | ||
81 | return@async busqueda | ||
82 | }.await() | ||
83 | } | ||
84 | |||
85 | fun CargarRV() { | ||
86 | GlobalScope.launch(Dispatchers.Main) { | ||
87 | servidores = buscarEnBD() | ||
88 | for ((i, item) in servidores.withIndex()) { | ||
89 | val ser = ServeInv(servidores[i].descripcion, servidores[i].direccion, servidores[i].predeterminado) | ||
90 | cargarRecicler(ser) | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | |||
95 | fun cargarRecicler(ser: ServeInv) { | ||
96 | //TODO CARGO EN LE RV | ||
97 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! | ||
98 | val item = ItemsServidores(ser.descripcion, ser.direccion, ser.predeterminado.toString()) | ||
99 | |||
100 | listServ.add(item) | ||
101 | |||
102 | viewAdapter = AdapterServidores(listServ, requireContext()) | ||
103 | viewManager = LinearLayoutManager(requireContext()) | ||
104 | |||
105 | rvServidores.apply { | ||
106 | adapter = viewAdapter | ||
107 | layoutManager = viewManager | ||
108 | } | ||
109 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { | ||
110 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | ||
111 | return false | ||
112 | } | ||
113 | |||
114 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | ||
115 | GlobalScope.launch(Dispatchers.Main) { | ||
116 | deleteServer(listServ[viewHolder.adapterPosition].descripcion.toString(), listServ[viewHolder.adapterPosition].direccion.toString()) | ||
117 | |||
118 | (viewAdapter as AdapterServidores).removeItem(viewHolder) | ||
119 | viewAdapter.notifyDataSetChanged() | ||
120 | } | ||
121 | } | ||
122 | |||
123 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | ||
124 | val itemView = viewHolder.itemView | ||
125 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 | ||
126 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | ||
127 | |||
128 | if (dX > 0) { | ||
129 | |||
130 | if (dX < c.width / 2) c.drawColor(Color.GREEN) | ||
131 | else c.drawColor(Color.RED) | ||
132 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) | ||
133 | } else { | ||
134 | } | ||
135 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | ||
136 | deleteIcon.draw(c) | ||
137 | } | ||
138 | } | ||
139 | |||
140 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) | ||
141 | itemTouchHelper.attachToRecyclerView(rvServidores) | ||
142 | } | ||
143 | |||
144 | suspend fun deleteServer(serverName: String, serverDir: String) { | ||
145 | lifecycleScope.launch { | ||
146 | withContext(Dispatchers.IO) { | ||
147 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.deleteServer(serverName, serverDir) | ||
148 | } | ||
149 | } | ||
150 | } | ||
151 | } | ||
152 | 1 | package com.focasoftware.deboinventariov20.ui.servidores |
app/src/main/java/com/focasoftware/deboinventariov20/ui/servidores/SpinnerAdapter.kt
1 | package com.focasoftware.deboinventariov20.ui.servidores | File was deleted | |
2 | |||
3 | import android.content.Context | ||
4 | import android.view.LayoutInflater | ||
5 | import android.view.View | ||
6 | import android.view.ViewGroup | ||
7 | import android.widget.BaseAdapter | ||
8 | import android.widget.TextView | ||
9 | import com.focasoftware.deboinventariov20.Model.ServeInv | ||
10 | import com.focasoftware.deboinventariov20.R | ||
11 | |||
12 | |||
13 | class SpinnerAdapterServidor internal constructor(internal var context: Context, internal var list: List<ServeInv>) : BaseAdapter() { | ||
14 | override fun getCount(): Int { | ||
15 | return list.size | ||
16 | } | ||
17 | |||
18 | override fun getItem(i: Int): Any? { | ||
19 | return null | ||
20 | } | ||
21 | |||
22 | override fun getItemId(i: Int): Long { | ||
23 | return 0 | ||
24 | } | ||
25 | |||
26 | override fun getView(i: Int, view1: View?, viewGroup: ViewGroup): View { | ||
27 | var views=view1 | ||
28 | if (views == null) { | ||
29 | val inflater = LayoutInflater.from(context) | ||
30 | |||
31 | views = inflater.inflate(R.layout.item_spinner, viewGroup, false) | ||
32 | } | ||
33 | |||
34 | val tvServidorDesc = views!!.findViewById<TextView>(R.id.tvServidorDesc) | ||
35 | tvServidorDesc.text=list[i].descripcion | ||
36 | return tvServidorDesc | ||
37 | |||
38 | } | ||
39 | } | ||
40 | |||
41 | 1 | package com.focasoftware.deboinventariov20.ui.servidores |
app/src/main/java/com/focasoftware/deboinventariov20/ui/util/Base/BaseViewHolder.kt
1 | package com.focasoftware.deboinventariov20.ui.util.Base | File was deleted | |
2 | |||
3 | import android.app.AlertDialog | ||
4 | import android.app.Dialog | ||
5 | import android.os.Bundle | ||
6 | import android.view.View | ||
7 | import androidx.fragment.app.DialogFragment | ||
8 | import androidx.recyclerview.widget.RecyclerView | ||
9 | |||
10 | abstract class BaseViewHolder<T>(itemView:View):RecyclerView.ViewHolder(itemView) { | ||
11 | abstract fun bind(item:T, position:Int) | ||
12 | } | ||
13 | class NoEncontradoSimple : DialogFragment() { | ||
14 | |||
15 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
16 | return activity?.let { | ||
17 | val title = "" | ||
18 | val content = "ยกEl producto buscado NO fue encontrado!" | ||
19 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | ||
20 | builder.setTitle(title).setMessage(content) | ||
21 | .setPositiveButton(android.R.string.ok) { _, _ -> | ||
22 | //Todo OK click | ||
23 | } | ||
24 | |||
25 | return builder.create() | ||
26 | } ?: throw IllegalStateException("Activity cannot be null") | ||
27 | } | ||
28 | |||
29 | } | ||
30 | |||
31 | class AlertDialogBorrarInv : DialogFragment() { | ||
32 | |||
33 | interface OnBorrarInvClickListener { | ||
34 | fun onPositiveClick() | ||
35 | fun onCancelClick() | ||
36 | } | ||
37 | |||
38 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
39 | return activity?.let { | ||
40 | val title = "Borrar Inventario" | ||
41 | val content = "ยฟSeguro que desea Borrar el inventario?" | ||
42 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | ||
43 | builder.setTitle(title).setMessage(content) | ||
44 | .setPositiveButton(android.R.string.ok) { _, _ -> | ||
45 | val listener = activity as OnBorrarInvClickListener? | ||
46 | listener!!.onPositiveClick() | ||
47 | } | ||
48 | .setNegativeButton(android.R.string.cancel) { _, _ -> | ||
49 | val listener = activity as OnBorrarInvClickListener? | ||
50 | listener!!.onCancelClick() | ||
51 | } | ||
52 | return builder.create() | ||
53 | } ?: throw IllegalStateException("Activity cannot be null") | ||
54 | } | ||
55 | |||
56 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/util/Base/dialogos/DialogNoEncontrado.kt
1 | package com.focasoftware.deboinventariov20.ui.util.Base.dialogos | File was deleted | |
2 | |||
3 | import android.app.AlertDialog | ||
4 | import android.app.Dialog | ||
5 | import android.os.Bundle | ||
6 | import androidx.fragment.app.DialogFragment | ||
7 | |||
8 | class DialogNoEncontrado : DialogFragment() { | ||
9 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
10 | return activity?.let { | ||
11 | val title = "Busqueda de Productos" | ||
12 | val content = "Producto no encotrado." | ||
13 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | ||
14 | builder.setTitle(title).setMessage(content).setPositiveButton(android.R.string.ok) { _, _ -> | ||
15 | //Todo OK click | ||
16 | } | ||
17 | return builder.create() | ||
18 | } ?: throw IllegalStateException("Activity cannot be null") | ||
19 | } | ||
20 | } | ||
21 | 1 | package com.focasoftware.deboinventariov20.ui.util.Base.dialogos |
app/src/main/java/com/focasoftware/deboinventariov20/ui/util/Base/dialogos/DialogoLogin.kt
1 | package com.focasoftware.deboinventariov20.ui.util.Base.dialogos | File was deleted | |
2 | |||
3 | import android.app.AlertDialog | ||
4 | import android.app.Dialog | ||
5 | import android.content.SharedPreferences | ||
6 | import android.os.Bundle | ||
7 | import androidx.fragment.app.DialogFragment | ||
8 | import com.focasoftware.deboinventariov20.R | ||
9 | |||
10 | class DialogoLogin() : DialogFragment() { | ||
11 | private lateinit var sharedPreferences: SharedPreferences | ||
12 | |||
13 | interface OnContinueCancelClickListener { | ||
14 | fun onPositiveClick() | ||
15 | fun onCancelClick() | ||
16 | } | ||
17 | |||
18 | fun newInstance(s: String): DialogoLogin? { | ||
19 | val dialog = DialogoLogin() | ||
20 | |||
21 | val args = Bundle() | ||
22 | args.putString("title", s) | ||
23 | dialog.arguments = args | ||
24 | |||
25 | return dialog | ||
26 | } | ||
27 | |||
28 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
29 | return activity?.let { | ||
30 | val builder = AlertDialog.Builder(it) | ||
31 | |||
32 | val inflater = requireActivity().layoutInflater; | ||
33 | |||
34 | builder.setView(inflater.inflate(R.layout.login_dialog, null)).setTitle("El producto ya fue escaneado").setPositiveButton(android.R.string.ok) { _, _ -> | ||
35 | val listener = activity as OnContinueCancelClickListener? | ||
36 | listener!!.onPositiveClick() | ||
37 | }.setNegativeButton(android.R.string.cancel) { _, _ -> | ||
38 | val listener = activity as OnContinueCancelClickListener? | ||
39 | listener!!.onCancelClick() | ||
40 | } | ||
41 | builder.create() | ||
42 | } ?: throw IllegalStateException("Activity cannot be null") | ||
43 | } | ||
44 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/util/Base/dialogos/InsertCant.kt
1 | package com.focasoftware.deboinventariov20.ui.util.Base.dialogos | File was deleted | |
2 | |||
3 | import android.app.AlertDialog | ||
4 | import android.app.Dialog | ||
5 | import android.content.SharedPreferences | ||
6 | import android.os.Bundle | ||
7 | import androidx.fragment.app.DialogFragment | ||
8 | import com.focasoftware.deboinventariov20.R | ||
9 | |||
10 | class InsertCant() : DialogFragment() { | ||
11 | |||
12 | private lateinit var sharedPreferences: SharedPreferences | ||
13 | |||
14 | interface OnContinueCancelClickListener { | ||
15 | fun onPositiveClick() | ||
16 | fun onCancelClick() | ||
17 | } | ||
18 | |||
19 | fun newInstance(s: String): InsertCant? { | ||
20 | val dialog = InsertCant() | ||
21 | |||
22 | val args = Bundle() | ||
23 | args.putString("title", s) | ||
24 | dialog.arguments = args | ||
25 | |||
26 | return dialog | ||
27 | } | ||
28 | |||
29 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
30 | return activity?.let { | ||
31 | val builder = AlertDialog.Builder(it) | ||
32 | |||
33 | val inflater = requireActivity().layoutInflater; | ||
34 | |||
35 | builder.setView(inflater.inflate(R.layout.ingresar_cantidad, null)).setTitle("").setPositiveButton(android.R.string.ok) { _, _ -> | ||
36 | val listener = activity as OnContinueCancelClickListener? | ||
37 | listener!!.onPositiveClick() | ||
38 | }.setNegativeButton(android.R.string.cancel) { _, _ -> | ||
39 | val listener = activity as OnContinueCancelClickListener? | ||
40 | listener!!.onCancelClick() | ||
41 | } | ||
42 | builder.create() | ||
43 | } ?: throw IllegalStateException("Activity cannot be null") | ||
44 | } | ||
45 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/util/Base/dialogos/SingleChoiceAlertDialog.kt
1 | package com.focasoftware.deboinventariov20.ui.util.Base.dialogos | File was deleted | |
2 | |||
3 | import android.app.AlertDialog | ||
4 | import android.app.Dialog | ||
5 | import android.os.Bundle | ||
6 | import androidx.fragment.app.DialogFragment | ||
7 | |||
8 | class SingleChoiceAlertDialog : DialogFragment() { | ||
9 | |||
10 | interface OnDialogSelectorListener { | ||
11 | fun onSelectedOption(dialogId: Int) | ||
12 | } | ||
13 | |||
14 | |||
15 | var mDialogSelectorCallback: OnDialogSelectorListener? = null | ||
16 | |||
17 | fun newInstance(title: String, values: Array<String>, selected: Int = -1): SingleChoiceAlertDialog? { | ||
18 | val dialog = SingleChoiceAlertDialog() | ||
19 | |||
20 | val args = Bundle() | ||
21 | args.putString("title", title) | ||
22 | args.putStringArray("values", values) | ||
23 | args.putInt("selected", selected) | ||
24 | dialog.arguments = args | ||
25 | |||
26 | return dialog | ||
27 | |||
28 | } | ||
29 | |||
30 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
31 | |||
32 | return activity?.let { | ||
33 | |||
34 | val args = requireArguments() | ||
35 | val title = args.getString("title") | ||
36 | val values = args.getStringArray("values") | ||
37 | val selectedIndex = args.getInt("selected") | ||
38 | |||
39 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | ||
40 | |||
41 | builder.setSingleChoiceItems(values, selectedIndex) { _, which -> | ||
42 | //val item = values?.get(which) | ||
43 | mDialogSelectorCallback?.onSelectedOption(which) | ||
44 | dialog?.dismiss() | ||
45 | } | ||
46 | builder.setTitle(title) | ||
47 | |||
48 | return builder.create() | ||
49 | } ?: throw IllegalStateException("Activity cannot be null") | ||
50 | } | ||
51 | |||
52 | |||
53 | } |
app/src/main/res/layout-land/fragment_configuracion.xml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <ScrollView | 2 | <ScrollView |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | tools:context=".ui.configuracion.ConfiguracionFragment" | 5 | tools:context=".UI.configuracion.ConfiguracionFragment" |
6 | xmlns:android="http://schemas.android.com/apk/res/android" | 6 | xmlns:android="http://schemas.android.com/apk/res/android" |
7 | android:layout_width="match_parent" | 7 | android:layout_width="match_parent" |
8 | android:layout_height="wrap_content"> | 8 | android:layout_height="wrap_content"> |
9 | 9 | ||
10 | <androidx.constraintlayout.widget.ConstraintLayout | 10 | <androidx.constraintlayout.widget.ConstraintLayout |
11 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
12 | android:layout_height="wrap_content"> | 12 | android:layout_height="wrap_content"> |
13 | 13 | ||
14 | <androidx.appcompat.widget.AppCompatTextView | 14 | <androidx.appcompat.widget.AppCompatTextView |
15 | android:id="@+id/textView2" | 15 | android:id="@+id/textView2" |
16 | android:layout_width="match_parent" | 16 | android:layout_width="match_parent" |
17 | android:layout_height="wrap_content" | 17 | android:layout_height="wrap_content" |
18 | android:layout_marginTop="@dimen/MarginTopTitulos" | 18 | android:layout_marginTop="@dimen/MarginTopTitulos" |
19 | android:gravity="center" | 19 | android:gravity="center" |
20 | android:lines="1" | 20 | android:lines="1" |
21 | android:text="@string/tvTituloConf" | 21 | android:text="@string/tvTituloConf" |
22 | android:textColor="@color/colorAccent" | 22 | android:textColor="@color/colorAccent" |
23 | android:textSize="@dimen/Titulos" | 23 | android:textSize="@dimen/Titulos" |
24 | app:fontFamily="sans-serif-condensed" | 24 | app:fontFamily="sans-serif-condensed" |
25 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" | 25 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" |
26 | app:layout_constraintEnd_toEndOf="parent" | 26 | app:layout_constraintEnd_toEndOf="parent" |
27 | app:layout_constraintStart_toStartOf="parent" | 27 | app:layout_constraintStart_toStartOf="parent" |
28 | app:layout_constraintTop_toTopOf="parent" /> | 28 | app:layout_constraintTop_toTopOf="parent" /> |
29 | 29 | ||
30 | <TextView | 30 | <TextView |
31 | android:id="@+id/tvSeleccioneServidor" | 31 | android:id="@+id/tvSeleccioneServidor" |
32 | android:layout_width="0dp" | 32 | android:layout_width="0dp" |
33 | android:layout_height="wrap_content" | 33 | android:layout_height="wrap_content" |
34 | 34 | ||
35 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 35 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
36 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 36 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
37 | android:gravity="start" | 37 | android:gravity="start" |
38 | android:lines="1" | 38 | android:lines="1" |
39 | android:text="@string/tvSeleccioneServidor" | 39 | android:text="@string/tvSeleccioneServidor" |
40 | android:textColor="@android:color/black" | 40 | android:textColor="@android:color/black" |
41 | android:textSize="@dimen/SubTitulos" | 41 | android:textSize="@dimen/SubTitulos" |
42 | app:fontFamily="sans-serif-condensed" | 42 | app:fontFamily="sans-serif-condensed" |
43 | app:layout_constraintBottom_toTopOf="@+id/spServidor" | 43 | app:layout_constraintBottom_toTopOf="@+id/spServidor" |
44 | app:layout_constraintEnd_toEndOf="parent" | 44 | app:layout_constraintEnd_toEndOf="parent" |
45 | app:layout_constraintStart_toStartOf="parent" | 45 | app:layout_constraintStart_toStartOf="parent" |
46 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> | 46 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> |
47 | 47 | ||
48 | <Spinner | 48 | <Spinner |
49 | android:id="@+id/spServidor" | 49 | android:id="@+id/spServidor" |
50 | android:layout_width="0dp" | 50 | android:layout_width="0dp" |
51 | android:layout_height="wrap_content" | 51 | android:layout_height="wrap_content" |
52 | android:backgroundTint="@color/LightGray" | 52 | android:backgroundTint="@color/LightGray" |
53 | android:elevation="5dp" | 53 | android:elevation="5dp" |
54 | android:fadeScrollbars="true" | 54 | android:fadeScrollbars="true" |
55 | android:foregroundTint="@android:color/holo_orange_dark" | 55 | android:foregroundTint="@android:color/holo_orange_dark" |
56 | android:soundEffectsEnabled="true" | 56 | android:soundEffectsEnabled="true" |
57 | android:spinnerMode="dialog" | 57 | android:spinnerMode="dialog" |
58 | android:splitMotionEvents="false" | 58 | android:splitMotionEvents="false" |
59 | android:textAlignment="center" | 59 | android:textAlignment="center" |
60 | android:textSize="@dimen/NormalText" | 60 | android:textSize="@dimen/NormalText" |
61 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" | 61 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" |
62 | app:layout_constraintEnd_toStartOf="@+id/btnValidarServidor" | 62 | app:layout_constraintEnd_toStartOf="@+id/btnValidarServidor" |
63 | app:layout_constraintHorizontal_chainStyle="packed" | 63 | app:layout_constraintHorizontal_chainStyle="packed" |
64 | app:layout_constraintStart_toStartOf="parent" | 64 | app:layout_constraintStart_toStartOf="parent" |
65 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" | 65 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" |
66 | android:entries="@array/spinnerServidor" | 66 | android:entries="@array/spinnerServidor" |
67 | android:prompt="@string/leyendaSpinner"/> | 67 | android:prompt="@string/leyendaSpinner"/> |
68 | 68 | ||
69 | <Button | 69 | <Button |
70 | android:id="@+id/btnValidarServidor" | 70 | android:id="@+id/btnValidarServidor" |
71 | android:layout_width="wrap_content" | 71 | android:layout_width="wrap_content" |
72 | android:layout_height="wrap_content" | 72 | android:layout_height="wrap_content" |
73 | android:textColor="@android:color/white" | 73 | android:textColor="@android:color/white" |
74 | android:padding="10dp" | 74 | android:padding="10dp" |
75 | android:background="@drawable/boton_borde_redondeado" | 75 | android:background="@drawable/boton_borde_redondeado" |
76 | android:text="@string/btnValidarServidor" | 76 | android:text="@string/btnValidarServidor" |
77 | android:textSize="@dimen/NormalText" | 77 | android:textSize="@dimen/NormalText" |
78 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" | 78 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" |
79 | app:layout_constraintEnd_toEndOf="parent" | 79 | app:layout_constraintEnd_toEndOf="parent" |
80 | app:layout_constraintHorizontal_chainStyle="packed" | 80 | app:layout_constraintHorizontal_chainStyle="packed" |
81 | app:layout_constraintStart_toEndOf="@id/spServidor" | 81 | app:layout_constraintStart_toEndOf="@id/spServidor" |
82 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" /> | 82 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" /> |
83 | 83 | ||
84 | <Button | 84 | <Button |
85 | android:id="@+id/btnAgregarServidor" | 85 | android:id="@+id/btnAgregarServidor" |
86 | android:layout_width="0dp" | 86 | android:layout_width="0dp" |
87 | android:layout_height="wrap_content" | 87 | android:layout_height="wrap_content" |
88 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 88 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
89 | android:layout_marginEnd="@dimen/MarginBotAgreSer" | 89 | android:layout_marginEnd="@dimen/MarginBotAgreSer" |
90 | android:text="@string/btnAgregarServidor" | 90 | android:text="@string/btnAgregarServidor" |
91 | android:textSize="@dimen/NormalText" | 91 | android:textSize="@dimen/NormalText" |
92 | android:textColor="@android:color/white" | 92 | android:textColor="@android:color/white" |
93 | android:padding="10dp" | 93 | android:padding="10dp" |
94 | android:background="@drawable/boton_borde_redondeado" | 94 | android:background="@drawable/boton_borde_redondeado" |
95 | app:layout_constraintBottom_toTopOf="@+id/tvUbicacionCarpetas" | 95 | app:layout_constraintBottom_toTopOf="@+id/tvUbicacionCarpetas" |
96 | app:layout_constraintEnd_toEndOf="parent" | 96 | app:layout_constraintEnd_toEndOf="parent" |
97 | app:layout_constraintStart_toStartOf="parent" | 97 | app:layout_constraintStart_toStartOf="parent" |
98 | app:layout_constraintTop_toBottomOf="@+id/btnValidarServidor" /> | 98 | app:layout_constraintTop_toBottomOf="@+id/btnValidarServidor" /> |
99 | 99 | ||
100 | 100 | ||
101 | <TextView | 101 | <TextView |
102 | android:id="@+id/tvUbicacionCarpetas" | 102 | android:id="@+id/tvUbicacionCarpetas" |
103 | android:layout_width="0dp" | 103 | android:layout_width="0dp" |
104 | android:layout_height="wrap_content" | 104 | android:layout_height="wrap_content" |
105 | 105 | ||
106 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 106 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
107 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 107 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
108 | android:gravity="start" | 108 | android:gravity="start" |
109 | android:lines="1" | 109 | android:lines="1" |
110 | android:text="@string/tvUbicacionCarpetas" | 110 | android:text="@string/tvUbicacionCarpetas" |
111 | android:textColor="@android:color/black" | 111 | android:textColor="@android:color/black" |
112 | android:textSize="@dimen/SubTitulos" | 112 | android:textSize="@dimen/SubTitulos" |
113 | app:fontFamily="sans-serif-condensed" | 113 | app:fontFamily="sans-serif-condensed" |
114 | app:layout_constraintBottom_toTopOf="@+id/ibSearch" | 114 | app:layout_constraintBottom_toTopOf="@+id/ibSearch" |
115 | app:layout_constraintEnd_toEndOf="parent" | 115 | app:layout_constraintEnd_toEndOf="parent" |
116 | app:layout_constraintStart_toStartOf="parent" | 116 | app:layout_constraintStart_toStartOf="parent" |
117 | app:layout_constraintTop_toBottomOf="@+id/btnAgregarServidor" /> | 117 | app:layout_constraintTop_toBottomOf="@+id/btnAgregarServidor" /> |
118 | 118 | ||
119 | <ImageButton | 119 | <ImageButton |
120 | android:id="@+id/ibSearch" | 120 | android:id="@+id/ibSearch" |
121 | android:layout_width="36dp" | 121 | android:layout_width="36dp" |
122 | android:layout_height="37dp" | 122 | android:layout_height="37dp" |
123 | android:layout_margin="10dp" | 123 | android:layout_margin="10dp" |
124 | android:src="@drawable/search" | 124 | android:src="@drawable/search" |
125 | android:textColor="@android:color/white" | 125 | android:textColor="@android:color/white" |
126 | android:padding="10dp" | 126 | android:padding="10dp" |
127 | android:background="@drawable/boton_borde_redondeado" | 127 | android:background="@drawable/boton_borde_redondeado" |
128 | app:layout_constraintEnd_toStartOf="@+id/etRuta" | 128 | app:layout_constraintEnd_toStartOf="@+id/etRuta" |
129 | app:layout_constraintStart_toStartOf="parent" | 129 | app:layout_constraintStart_toStartOf="parent" |
130 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> | 130 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> |
131 | 131 | ||
132 | <EditText | 132 | <EditText |
133 | android:id="@+id/etRuta" | 133 | android:id="@+id/etRuta" |
134 | android:layout_width="0dp" | 134 | android:layout_width="0dp" |
135 | android:layout_height="wrap_content" | 135 | android:layout_height="wrap_content" |
136 | android:layout_marginTop="10dp" | 136 | android:layout_marginTop="10dp" |
137 | android:layout_marginEnd="10dp" | 137 | android:layout_marginEnd="10dp" |
138 | android:clickable="true" | 138 | android:clickable="true" |
139 | android:ems="10" | 139 | android:ems="10" |
140 | android:focusable="true" | 140 | android:focusable="true" |
141 | android:inputType="textPersonName" | 141 | android:inputType="textPersonName" |
142 | android:lines="1" | 142 | android:lines="1" |
143 | android:text="" | 143 | android:text="" |
144 | android:textSize="@dimen/NormalText" | 144 | android:textSize="@dimen/NormalText" |
145 | app:layout_constraintEnd_toEndOf="parent" | 145 | app:layout_constraintEnd_toEndOf="parent" |
146 | app:layout_constraintStart_toEndOf="@id/ibSearch" | 146 | app:layout_constraintStart_toEndOf="@id/ibSearch" |
147 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> | 147 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> |
148 | 148 | ||
149 | <TextView | 149 | <TextView |
150 | android:id="@+id/tvActuFecha" | 150 | android:id="@+id/tvActuFecha" |
151 | android:layout_width="0dp" | 151 | android:layout_width="0dp" |
152 | android:layout_height="wrap_content" | 152 | android:layout_height="wrap_content" |
153 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 153 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
154 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 154 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
155 | android:gravity="start" | 155 | android:gravity="start" |
156 | android:lines="1" | 156 | android:lines="1" |
157 | android:text="@string/tvTituloArea" | 157 | android:text="@string/tvTituloArea" |
158 | android:textColor="@android:color/black" | 158 | android:textColor="@android:color/black" |
159 | android:textSize="@dimen/SubTitulos" | 159 | android:textSize="@dimen/SubTitulos" |
160 | app:fontFamily="sans-serif-condensed" | 160 | app:fontFamily="sans-serif-condensed" |
161 | app:layout_constraintEnd_toEndOf="parent" | 161 | app:layout_constraintEnd_toEndOf="parent" |
162 | app:layout_constraintStart_toStartOf="parent" | 162 | app:layout_constraintStart_toStartOf="parent" |
163 | app:layout_constraintTop_toBottomOf="@+id/etRuta" /> | 163 | app:layout_constraintTop_toBottomOf="@+id/etRuta" /> |
164 | 164 | ||
165 | <RadioGroup | 165 | <RadioGroup |
166 | android:id="@+id/rgFechaHora" | 166 | android:id="@+id/rgFechaHora" |
167 | android:layout_width="0dp" | 167 | android:layout_width="0dp" |
168 | android:layout_height="wrap_content" | 168 | android:layout_height="wrap_content" |
169 | 169 | ||
170 | android:gravity="center" | 170 | android:gravity="center" |
171 | android:orientation="horizontal" | 171 | android:orientation="horizontal" |
172 | app:layout_constraintEnd_toEndOf="parent" | 172 | app:layout_constraintEnd_toEndOf="parent" |
173 | app:layout_constraintStart_toStartOf="parent" | 173 | app:layout_constraintStart_toStartOf="parent" |
174 | app:layout_constraintTop_toBottomOf="@+id/tvActuFecha"> | 174 | app:layout_constraintTop_toBottomOf="@+id/tvActuFecha"> |
175 | 175 | ||
176 | <RadioButton | 176 | <RadioButton |
177 | android:id="@+id/rbVentas" | 177 | android:id="@+id/rbVentas" |
178 | android:layout_width="wrap_content" | 178 | android:layout_width="wrap_content" |
179 | android:layout_height="wrap_content" | 179 | android:layout_height="wrap_content" |
180 | android:layout_margin="5dp" | 180 | android:layout_margin="5dp" |
181 | android:checked="true" | 181 | android:checked="true" |
182 | android:padding="5dp" | 182 | android:padding="5dp" |
183 | android:text="@string/rbVentas" | 183 | android:text="@string/rbVentas" |
184 | android:textSize="@dimen/NormalText" /> | 184 | android:textSize="@dimen/NormalText" /> |
185 | 185 | ||
186 | <RadioButton | 186 | <RadioButton |
187 | android:id="@+id/rbDeposito" | 187 | android:id="@+id/rbDeposito" |
188 | android:layout_width="wrap_content" | 188 | android:layout_width="wrap_content" |
189 | android:layout_height="wrap_content" | 189 | android:layout_height="wrap_content" |
190 | android:layout_margin="5dp" | 190 | android:layout_margin="5dp" |
191 | android:checked="false" | 191 | android:checked="false" |
192 | android:padding="5dp" | 192 | android:padding="5dp" |
193 | android:text="@string/rbDeposito" | 193 | android:text="@string/rbDeposito" |
194 | android:textSize="@dimen/NormalText" /> | 194 | android:textSize="@dimen/NormalText" /> |
195 | 195 | ||
196 | </RadioGroup> | 196 | </RadioGroup> |
197 | 197 | ||
198 | <TextView | 198 | <TextView |
199 | android:id="@+id/tvLosProductos" | 199 | android:id="@+id/tvLosProductos" |
200 | android:layout_width="0dp" | 200 | android:layout_width="0dp" |
201 | android:layout_height="wrap_content" | 201 | android:layout_height="wrap_content" |
202 | 202 | ||
203 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 203 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
204 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" | 204 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" |
205 | android:gravity="start" | 205 | android:gravity="start" |
206 | android:lines="1" | 206 | android:lines="1" |
207 | android:text="@string/tvLosProductos" | 207 | android:text="@string/tvLosProductos" |
208 | android:textColor="@android:color/black" | 208 | android:textColor="@android:color/black" |
209 | android:textSize="@dimen/SubTitulos" | 209 | android:textSize="@dimen/SubTitulos" |
210 | app:fontFamily="sans-serif-condensed" | 210 | app:fontFamily="sans-serif-condensed" |
211 | app:layout_constraintEnd_toEndOf="parent" | 211 | app:layout_constraintEnd_toEndOf="parent" |
212 | app:layout_constraintStart_toStartOf="parent" | 212 | app:layout_constraintStart_toStartOf="parent" |
213 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> | 213 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> |
214 | 214 | ||
215 | <RadioGroup | 215 | <RadioGroup |
216 | android:id="@+id/rgLosProductos" | 216 | android:id="@+id/rgLosProductos" |
217 | android:layout_width="0dp" | 217 | android:layout_width="0dp" |
218 | android:layout_height="wrap_content" | 218 | android:layout_height="wrap_content" |
219 | 219 | ||
220 | android:gravity="center" | 220 | android:gravity="center" |
221 | android:orientation="vertical" | 221 | android:orientation="vertical" |
222 | app:layout_constraintEnd_toEndOf="parent" | 222 | app:layout_constraintEnd_toEndOf="parent" |
223 | app:layout_constraintStart_toStartOf="parent" | 223 | app:layout_constraintStart_toStartOf="parent" |
224 | app:layout_constraintTop_toBottomOf="@+id/tvLosProductos"> | 224 | app:layout_constraintTop_toBottomOf="@+id/tvLosProductos"> |
225 | 225 | ||
226 | <RadioButton | 226 | <RadioButton |
227 | android:id="@+id/rbProInclu" | 227 | android:id="@+id/rbProInclu" |
228 | android:layout_width="match_parent" | 228 | android:layout_width="match_parent" |
229 | android:layout_height="wrap_content" | 229 | android:layout_height="wrap_content" |
230 | 230 | ||
231 | android:layout_margin="@dimen/PadingCbyRb" | 231 | android:layout_margin="@dimen/PadingCbyRb" |
232 | android:checked="true" | 232 | android:checked="true" |
233 | android:padding="@dimen/PadingCbyRb" | 233 | android:padding="@dimen/PadingCbyRb" |
234 | android:text="@string/rbProInclu" | 234 | android:text="@string/rbProInclu" |
235 | android:textSize="@dimen/NormalText" /> | 235 | android:textSize="@dimen/NormalText" /> |
236 | 236 | ||
237 | <RadioButton | 237 | <RadioButton |
238 | android:id="@+id/rbProNoInclu" | 238 | android:id="@+id/rbProNoInclu" |
239 | android:layout_width="match_parent" | 239 | android:layout_width="match_parent" |
240 | android:layout_height="wrap_content" | 240 | android:layout_height="wrap_content" |
241 | android:layout_margin="@dimen/PadingCbyRb" | 241 | android:layout_margin="@dimen/PadingCbyRb" |
242 | android:checked="false" | 242 | android:checked="false" |
243 | android:padding="@dimen/PadingCbyRb" | 243 | android:padding="@dimen/PadingCbyRb" |
244 | android:text="@string/rbProNoInclu" | 244 | android:text="@string/rbProNoInclu" |
245 | android:textSize="@dimen/NormalText" /> | 245 | android:textSize="@dimen/NormalText" /> |
246 | 246 | ||
247 | </RadioGroup> | 247 | </RadioGroup> |
248 | 248 | ||
249 | <CheckBox | 249 | <CheckBox |
250 | android:id="@+id/cbHabiLectura" | 250 | android:id="@+id/cbHabiLectura" |
251 | android:layout_width="0dp" | 251 | android:layout_width="0dp" |
252 | android:layout_height="wrap_content" | 252 | android:layout_height="wrap_content" |
253 | android:layout_margin="@dimen/PadingCbyRb" | 253 | android:layout_margin="@dimen/PadingCbyRb" |
254 | android:padding="@dimen/PadingCbyRb" | 254 | android:padding="@dimen/PadingCbyRb" |
255 | android:text="@string/cbHabiLectura" | 255 | android:text="@string/cbHabiLectura" |
256 | android:textSize="@dimen/NormalText" | 256 | android:textSize="@dimen/NormalText" |
257 | app:layout_constraintEnd_toEndOf="parent" | 257 | app:layout_constraintEnd_toEndOf="parent" |
258 | app:layout_constraintStart_toStartOf="parent" | 258 | app:layout_constraintStart_toStartOf="parent" |
259 | app:layout_constraintTop_toBottomOf="@+id/rgLosProductos" /> | 259 | app:layout_constraintTop_toBottomOf="@+id/rgLosProductos" /> |
260 | 260 | ||
261 | <CheckBox | 261 | <CheckBox |
262 | android:id="@+id/cbMostrarStock" | 262 | android:id="@+id/cbMostrarStock" |
263 | android:layout_width="0dp" | 263 | android:layout_width="0dp" |
264 | android:layout_height="wrap_content" | 264 | android:layout_height="wrap_content" |
265 | android:layout_margin="@dimen/PadingCbyRb" | 265 | android:layout_margin="@dimen/PadingCbyRb" |
266 | android:padding="@dimen/PadingCbyRb" | 266 | android:padding="@dimen/PadingCbyRb" |
267 | android:text="@string/cbMostrarStock" | 267 | android:text="@string/cbMostrarStock" |
268 | android:textSize="@dimen/NormalText" | 268 | android:textSize="@dimen/NormalText" |
269 | app:layout_constraintEnd_toEndOf="parent" | 269 | app:layout_constraintEnd_toEndOf="parent" |
270 | app:layout_constraintStart_toStartOf="parent" | 270 | app:layout_constraintStart_toStartOf="parent" |
271 | app:layout_constraintTop_toBottomOf="@+id/cbHabiLectura" /> | 271 | app:layout_constraintTop_toBottomOf="@+id/cbHabiLectura" /> |
272 | 272 | ||
273 | <TextView | 273 | <TextView |
274 | android:id="@+id/tvColumMostrar" | 274 | android:id="@+id/tvColumMostrar" |
275 | android:layout_width="0dp" | 275 | android:layout_width="0dp" |
276 | android:layout_height="wrap_content" | 276 | android:layout_height="wrap_content" |
277 | 277 | ||
278 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 278 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
279 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" | 279 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" |
280 | android:gravity="start" | 280 | android:gravity="start" |
281 | android:lines="1" | 281 | android:lines="1" |
282 | android:text="@string/tvColumMostrar" | 282 | android:text="@string/tvColumMostrar" |
283 | android:textColor="@android:color/black" | 283 | android:textColor="@android:color/black" |
284 | android:textSize="@dimen/SubTitulos" | 284 | android:textSize="@dimen/SubTitulos" |
285 | app:fontFamily="sans-serif-condensed" | 285 | app:fontFamily="sans-serif-condensed" |
286 | app:layout_constraintEnd_toEndOf="parent" | 286 | app:layout_constraintEnd_toEndOf="parent" |
287 | app:layout_constraintStart_toStartOf="parent" | 287 | app:layout_constraintStart_toStartOf="parent" |
288 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarStock" /> | 288 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarStock" /> |
289 | 289 | ||
290 | <RadioGroup | 290 | <RadioGroup |
291 | android:id="@+id/rgCodigosMostrar" | 291 | android:id="@+id/rgCodigosMostrar" |
292 | android:layout_width="0dp" | 292 | android:layout_width="0dp" |
293 | android:layout_height="wrap_content" | 293 | android:layout_height="wrap_content" |
294 | 294 | ||
295 | android:gravity="center" | 295 | android:gravity="center" |
296 | android:orientation="horizontal" | 296 | android:orientation="horizontal" |
297 | app:layout_constraintEnd_toEndOf="parent" | 297 | app:layout_constraintEnd_toEndOf="parent" |
298 | app:layout_constraintStart_toStartOf="parent" | 298 | app:layout_constraintStart_toStartOf="parent" |
299 | app:layout_constraintTop_toBottomOf="@+id/tvColumMostrar"> | 299 | app:layout_constraintTop_toBottomOf="@+id/tvColumMostrar"> |
300 | 300 | ||
301 | <RadioButton | 301 | <RadioButton |
302 | android:id="@+id/rbCodigoDebo" | 302 | android:id="@+id/rbCodigoDebo" |
303 | android:layout_width="wrap_content" | 303 | android:layout_width="wrap_content" |
304 | android:layout_height="wrap_content" | 304 | android:layout_height="wrap_content" |
305 | android:layout_margin="5dp" | 305 | android:layout_margin="5dp" |
306 | android:checked="true" | 306 | android:checked="true" |
307 | android:padding="5dp" | 307 | android:padding="5dp" |
308 | android:text="@string/rbCodigoDebo" | 308 | android:text="@string/rbCodigoDebo" |
309 | android:textSize="@dimen/NormalText" /> | 309 | android:textSize="@dimen/NormalText" /> |
310 | 310 | ||
311 | <RadioButton | 311 | <RadioButton |
312 | android:id="@+id/rbCodigoOrigen" | 312 | android:id="@+id/rbCodigoOrigen" |
313 | android:layout_width="wrap_content" | 313 | android:layout_width="wrap_content" |
314 | android:layout_height="wrap_content" | 314 | android:layout_height="wrap_content" |
315 | android:layout_margin="5dp" | 315 | android:layout_margin="5dp" |
316 | android:checked="false" | 316 | android:checked="false" |
317 | android:padding="5dp" | 317 | android:padding="5dp" |
318 | android:text="@string/rbCodigoOrigen" | 318 | android:text="@string/rbCodigoOrigen" |
319 | android:textSize="@dimen/NormalText" /> | 319 | android:textSize="@dimen/NormalText" /> |
320 | 320 | ||
321 | <RadioButton | 321 | <RadioButton |
322 | android:id="@+id/rbCodigoBarras" | 322 | android:id="@+id/rbCodigoBarras" |
323 | android:layout_width="wrap_content" | 323 | android:layout_width="wrap_content" |
324 | android:layout_height="wrap_content" | 324 | android:layout_height="wrap_content" |
325 | android:layout_margin="5dp" | 325 | android:layout_margin="5dp" |
326 | android:padding="5dp" | 326 | android:padding="5dp" |
327 | android:text="@string/rbCodigoBarras" | 327 | android:text="@string/rbCodigoBarras" |
328 | android:textSize="@dimen/NormalText" /> | 328 | android:textSize="@dimen/NormalText" /> |
329 | </RadioGroup> | 329 | </RadioGroup> |
330 | 330 | ||
331 | <CheckBox | 331 | <CheckBox |
332 | android:id="@+id/cbMostrarExistencia" | 332 | android:id="@+id/cbMostrarExistencia" |
333 | android:layout_width="wrap_content" | 333 | android:layout_width="wrap_content" |
334 | android:layout_height="wrap_content" | 334 | android:layout_height="wrap_content" |
335 | android:layout_margin="@dimen/PadingCbyRb" | 335 | android:layout_margin="@dimen/PadingCbyRb" |
336 | android:padding="@dimen/PadingCbyRb" | 336 | android:padding="@dimen/PadingCbyRb" |
337 | android:text="@string/cbMostrarExistencia" | 337 | android:text="@string/cbMostrarExistencia" |
338 | android:textSize="@dimen/NormalText" | 338 | android:textSize="@dimen/NormalText" |
339 | android:checked="false" | 339 | android:checked="false" |
340 | app:layout_constraintEnd_toStartOf="@+id/cbMostrarPrecio" | 340 | app:layout_constraintEnd_toStartOf="@+id/cbMostrarPrecio" |
341 | app:layout_constraintStart_toStartOf="parent" | 341 | app:layout_constraintStart_toStartOf="parent" |
342 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> | 342 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> |
343 | 343 | ||
344 | <CheckBox | 344 | <CheckBox |
345 | android:id="@+id/cbMostrarPrecio" | 345 | android:id="@+id/cbMostrarPrecio" |
346 | android:layout_width="wrap_content" | 346 | android:layout_width="wrap_content" |
347 | android:layout_height="wrap_content" | 347 | android:layout_height="wrap_content" |
348 | android:layout_margin="@dimen/PadingCbyRb" | 348 | android:layout_margin="@dimen/PadingCbyRb" |
349 | android:padding="@dimen/PadingCbyRb" | 349 | android:padding="@dimen/PadingCbyRb" |
350 | android:text="@string/cbMostrarPrecio" | 350 | android:text="@string/cbMostrarPrecio" |
351 | android:textSize="@dimen/NormalText" | 351 | android:textSize="@dimen/NormalText" |
352 | android:checked="false" | 352 | android:checked="false" |
353 | app:layout_constraintEnd_toEndOf="parent" | 353 | app:layout_constraintEnd_toEndOf="parent" |
354 | app:layout_constraintStart_toEndOf="@+id/cbMostrarExistencia" | 354 | app:layout_constraintStart_toEndOf="@+id/cbMostrarExistencia" |
355 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> | 355 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> |
356 | 356 | ||
357 | <Button | 357 | <Button |
358 | android:id="@+id/btnGuardar" | 358 | android:id="@+id/btnGuardar" |
359 | android:layout_width="wrap_content" | 359 | android:layout_width="wrap_content" |
360 | android:layout_height="wrap_content" | 360 | android:layout_height="wrap_content" |
361 | android:text="@string/btnGuardar" | 361 | android:text="@string/btnGuardar" |
362 | android:textSize="@dimen/NormalText" | 362 | android:textSize="@dimen/NormalText" |
363 | app:layout_constraintEnd_toEndOf="parent" | 363 | app:layout_constraintEnd_toEndOf="parent" |
364 | android:textColor="@android:color/white" | 364 | android:textColor="@android:color/white" |
365 | android:padding="10dp" | 365 | android:padding="10dp" |
366 | android:background="@drawable/boton_borde_redondeado" | 366 | android:background="@drawable/boton_borde_redondeado" |
367 | app:layout_constraintStart_toStartOf="parent" | 367 | app:layout_constraintStart_toStartOf="parent" |
368 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarPrecio" /> | 368 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarPrecio" /> |
369 | </androidx.constraintlayout.widget.ConstraintLayout> | 369 | </androidx.constraintlayout.widget.ConstraintLayout> |
370 | 370 | ||
371 | </ScrollView> | 371 | </ScrollView> |
app/src/main/res/layout-land/fragment_descripcion.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | ||
3 | 3 | ||
4 | <androidx.constraintlayout.widget.ConstraintLayout | 4 | <androidx.constraintlayout.widget.ConstraintLayout |
5 | xmlns:android="http://schemas.android.com/apk/res/android" | 5 | xmlns:android="http://schemas.android.com/apk/res/android" |
6 | xmlns:app="http://schemas.android.com/apk/res-auto" | 6 | xmlns:app="http://schemas.android.com/apk/res-auto" |
7 | xmlns:tools="http://schemas.android.com/tools" | 7 | xmlns:tools="http://schemas.android.com/tools" |
8 | android:layout_width="match_parent" | 8 | android:layout_width="match_parent" |
9 | android:layout_height="match_parent" | 9 | android:layout_height="match_parent" |
10 | tools:context=".ui.descripcionFragment.DescripcionFragment"> | 10 | tools:context=".UI.descripcionFragment.DescripcionFragment"> |
11 | 11 | ||
12 | 12 | ||
13 | <androidx.recyclerview.widget.RecyclerView | 13 | <androidx.recyclerview.widget.RecyclerView |
14 | android:id="@+id/rcDescripcion" | 14 | android:id="@+id/rcDescripcion" |
15 | android:layout_width="match_parent" | 15 | android:layout_width="match_parent" |
16 | android:layout_height="0dp" | 16 | android:layout_height="0dp" |
17 | android:background="@android:color/darker_gray" | 17 | android:background="@android:color/darker_gray" |
18 | android:scrollbars="vertical" | 18 | android:scrollbars="vertical" |
19 | app:layout_constraintTop_toBottomOf="@id/guideline4" | 19 | app:layout_constraintTop_toBottomOf="@id/guideline4" |
20 | app:layout_constraintBottom_toTopOf="@+id/guideline5" | 20 | app:layout_constraintBottom_toTopOf="@+id/guideline5" |
21 | app:layout_constraintEnd_toEndOf="parent" | 21 | app:layout_constraintEnd_toEndOf="parent" |
22 | app:layout_constraintStart_toStartOf="parent" | 22 | app:layout_constraintStart_toStartOf="parent" |
23 | tools:listitem="@layout/item" /> | 23 | tools:listitem="@layout/item" /> |
24 | 24 | ||
25 | <Button | 25 | <Button |
26 | android:id="@+id/btnSalir" | 26 | android:id="@+id/btnSalir" |
27 | android:layout_width="0dp" | 27 | android:layout_width="0dp" |
28 | android:layout_height="wrap_content" | 28 | android:layout_height="wrap_content" |
29 | android:text="@string/btnCancelar" | 29 | android:text="@string/btnCancelar" |
30 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
31 | android:padding="10dp" | 31 | android:padding="10dp" |
32 | android:background="@drawable/boton_borde_redondeado" | 32 | android:background="@drawable/boton_borde_redondeado" |
33 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" | 33 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" |
34 | app:layout_constraintEnd_toEndOf="parent" | 34 | app:layout_constraintEnd_toEndOf="parent" |
35 | app:layout_constraintHorizontal_chainStyle="spread" | 35 | app:layout_constraintHorizontal_chainStyle="spread" |
36 | app:layout_constraintStart_toStartOf="parent" | 36 | app:layout_constraintStart_toStartOf="parent" |
37 | app:layout_constraintTop_toBottomOf="@+id/rcInventarios" /> | 37 | app:layout_constraintTop_toBottomOf="@+id/rcInventarios" /> |
38 | 38 | ||
39 | <androidx.constraintlayout.widget.Guideline | 39 | <androidx.constraintlayout.widget.Guideline |
40 | android:id="@+id/guideline4" | 40 | android:id="@+id/guideline4" |
41 | android:layout_width="wrap_content" | 41 | android:layout_width="wrap_content" |
42 | android:layout_height="wrap_content" | 42 | android:layout_height="wrap_content" |
43 | android:orientation="horizontal" | 43 | android:orientation="horizontal" |
44 | app:layout_constraintGuide_percent="0.04" /> | 44 | app:layout_constraintGuide_percent="0.04" /> |
45 | 45 | ||
46 | <androidx.constraintlayout.widget.Guideline | 46 | <androidx.constraintlayout.widget.Guideline |
47 | android:id="@+id/guideline5" | 47 | android:id="@+id/guideline5" |
48 | android:layout_width="wrap_content" | 48 | android:layout_width="wrap_content" |
49 | android:layout_height="wrap_content" | 49 | android:layout_height="wrap_content" |
50 | android:orientation="horizontal" | 50 | android:orientation="horizontal" |
51 | app:layout_constraintGuide_percent="0.82" /> | 51 | app:layout_constraintGuide_percent="0.82" /> |
52 | 52 | ||
53 | <androidx.constraintlayout.widget.Guideline | 53 | <androidx.constraintlayout.widget.Guideline |
54 | android:id="@+id/guideline6" | 54 | android:id="@+id/guideline6" |
55 | android:layout_width="wrap_content" | 55 | android:layout_width="wrap_content" |
56 | android:layout_height="wrap_content" | 56 | android:layout_height="wrap_content" |
57 | android:orientation="horizontal" | 57 | android:orientation="horizontal" |
58 | app:layout_constraintGuide_percent="0.97" /> | 58 | app:layout_constraintGuide_percent="0.97" /> |
59 | </androidx.constraintlayout.widget.ConstraintLayout> | 59 | </androidx.constraintlayout.widget.ConstraintLayout> |
60 | 60 |
app/src/main/res/layout-land/fragment_inventario.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:id="@+id/frameLayout" | 5 | android:id="@+id/frameLayout" |
6 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
7 | android:layout_height="match_parent" | 7 | android:layout_height="match_parent" |
8 | tools:context=".ui.inventario.InventarioFragment"> | 8 | tools:context=".UI.inventario.InventarioFragment"> |
9 | 9 | ||
10 | <androidx.appcompat.widget.AppCompatTextView | 10 | <androidx.appcompat.widget.AppCompatTextView |
11 | android:id="@+id/tvTitulo" | 11 | android:id="@+id/tvTitulo" |
12 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
13 | android:layout_height="60dp" | 13 | android:layout_height="60dp" |
14 | android:autoSizeMaxTextSize="100sp" | 14 | android:autoSizeMaxTextSize="100sp" |
15 | android:autoSizeMinTextSize="20sp" | 15 | android:autoSizeMinTextSize="20sp" |
16 | android:autoSizeStepGranularity="5sp" | 16 | android:autoSizeStepGranularity="5sp" |
17 | android:autoSizeTextType="uniform" | 17 | android:autoSizeTextType="uniform" |
18 | android:gravity="center" | 18 | android:gravity="center" |
19 | android:lines="1" | 19 | android:lines="1" |
20 | android:text="@string/invTitulo" | 20 | android:text="@string/invTitulo" |
21 | android:textColor="@color/colorAccent" | 21 | android:textColor="@color/colorAccent" |
22 | app:fontFamily="sans-serif-condensed" | 22 | app:fontFamily="sans-serif-condensed" |
23 | app:layout_constraintBottom_toTopOf="@id/guideline2" | 23 | app:layout_constraintBottom_toTopOf="@id/guideline2" |
24 | app:layout_constraintEnd_toEndOf="parent" | 24 | app:layout_constraintEnd_toEndOf="parent" |
25 | app:layout_constraintStart_toStartOf="parent" | 25 | app:layout_constraintStart_toStartOf="parent" |
26 | app:layout_constraintTop_toTopOf="@id/guideline" /> | 26 | app:layout_constraintTop_toTopOf="@id/guideline" /> |
27 | 27 | ||
28 | 28 | ||
29 | <ImageButton | 29 | <ImageButton |
30 | android:id="@+id/ivCamara" | 30 | android:id="@+id/ivCamara" |
31 | android:layout_width="60dp" | 31 | android:layout_width="60dp" |
32 | android:layout_height="60dp" | 32 | android:layout_height="60dp" |
33 | android:layout_marginTop="15dp" | 33 | android:layout_marginTop="15dp" |
34 | android:clickable="true" | 34 | android:clickable="true" |
35 | android:contentDescription="@string/ibBusCB" | 35 | android:contentDescription="@string/ibBusCB" |
36 | android:elevation="5dp" | 36 | android:elevation="5dp" |
37 | android:background="@drawable/boton_redondo" | 37 | android:background="@drawable/boton_redondo" |
38 | android:layout_margin="10dp" | 38 | android:layout_margin="10dp" |
39 | android:focusable="false" | 39 | android:focusable="false" |
40 | android:scaleType="fitEnd" | 40 | android:scaleType="fitEnd" |
41 | app:layout_constraintCircleRadius="40dp" | 41 | app:layout_constraintCircleRadius="40dp" |
42 | android:src="@drawable/codbar" | 42 | android:src="@drawable/codbar" |
43 | app:layout_constraintBottom_toTopOf="@id/guideline3" | 43 | app:layout_constraintBottom_toTopOf="@id/guideline3" |
44 | app:layout_constraintEnd_toStartOf="@+id/etCodigoBarras" | 44 | app:layout_constraintEnd_toStartOf="@+id/etCodigoBarras" |
45 | app:layout_constraintHorizontal_bias="0.0" | 45 | app:layout_constraintHorizontal_bias="0.0" |
46 | app:layout_constraintStart_toStartOf="parent" | 46 | app:layout_constraintStart_toStartOf="parent" |
47 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> | 47 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> |
48 | 48 | ||
49 | <EditText | 49 | <EditText |
50 | android:id="@+id/etCodigoBarras" | 50 | android:id="@+id/etCodigoBarras" |
51 | android:layout_width="0dp" | 51 | android:layout_width="0dp" |
52 | android:layout_height="wrap_content" | 52 | android:layout_height="wrap_content" |
53 | android:autofillHints="" | 53 | android:autofillHints="" |
54 | android:clickable="true" | 54 | android:clickable="true" |
55 | android:ems="10" | 55 | android:ems="10" |
56 | android:focusable="true" | 56 | android:focusable="true" |
57 | android:hint="@string/ibBusCB" | 57 | android:hint="@string/ibBusCB" |
58 | android:inputType="textPersonName" | 58 | android:inputType="textPersonName" |
59 | android:lines="1" | 59 | android:lines="1" |
60 | android:textAllCaps="true" | 60 | android:textAllCaps="true" |
61 | android:textSize="20sp" | 61 | android:textSize="20sp" |
62 | app:layout_constraintBottom_toTopOf="@+id/guideline3" | 62 | app:layout_constraintBottom_toTopOf="@+id/guideline3" |
63 | app:layout_constraintEnd_toStartOf="@+id/swSumaUno" | 63 | app:layout_constraintEnd_toStartOf="@+id/swSumaUno" |
64 | app:layout_constraintHorizontal_bias="0.49" | 64 | app:layout_constraintHorizontal_bias="0.49" |
65 | app:layout_constraintHorizontal_chainStyle="packed" | 65 | app:layout_constraintHorizontal_chainStyle="packed" |
66 | app:layout_constraintStart_toEndOf="@+id/ivCamara" | 66 | app:layout_constraintStart_toEndOf="@+id/ivCamara" |
67 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> | 67 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> |
68 | 68 | ||
69 | 69 | ||
70 | <Switch | 70 | <Switch |
71 | android:id="@+id/swSumaUno" | 71 | android:id="@+id/swSumaUno" |
72 | android:layout_width="wrap_content" | 72 | android:layout_width="wrap_content" |
73 | android:layout_height="wrap_content" | 73 | android:layout_height="wrap_content" |
74 | android:text="@string/switch_1" | 74 | android:text="@string/switch_1" |
75 | app:layout_constraintBaseline_toBaselineOf="@+id/etCodigoBarras" | 75 | app:layout_constraintBaseline_toBaselineOf="@+id/etCodigoBarras" |
76 | app:layout_constraintEnd_toEndOf="parent" | 76 | app:layout_constraintEnd_toEndOf="parent" |
77 | app:layout_constraintStart_toEndOf="@id/etCodigoBarras" | 77 | app:layout_constraintStart_toEndOf="@id/etCodigoBarras" |
78 | tools:ignore="UseSwitchCompatOrMaterialXml" /> | 78 | tools:ignore="UseSwitchCompatOrMaterialXml" /> |
79 | 79 | ||
80 | <androidx.recyclerview.widget.RecyclerView | 80 | <androidx.recyclerview.widget.RecyclerView |
81 | android:id="@+id/rcInventarios" | 81 | android:id="@+id/rcInventarios" |
82 | android:layout_width="match_parent" | 82 | android:layout_width="match_parent" |
83 | android:layout_height="0dp" | 83 | android:layout_height="0dp" |
84 | android:background="@android:color/darker_gray" | 84 | android:background="@android:color/darker_gray" |
85 | app:layout_constraintBottom_toBottomOf="@+id/guideline5" | 85 | app:layout_constraintBottom_toBottomOf="@+id/guideline5" |
86 | app:layout_constraintEnd_toEndOf="parent" | 86 | app:layout_constraintEnd_toEndOf="parent" |
87 | app:layout_constraintStart_toStartOf="parent" | 87 | app:layout_constraintStart_toStartOf="parent" |
88 | app:layout_constraintTop_toBottomOf="@+id/guideline4" | 88 | app:layout_constraintTop_toBottomOf="@+id/guideline4" |
89 | tools:listitem="@layout/item" /> | 89 | tools:listitem="@layout/item" /> |
90 | 90 | ||
91 | 91 | ||
92 | <Button | 92 | <Button |
93 | android:id="@+id/btnExportarInv" | 93 | android:id="@+id/btnExportarInv" |
94 | android:layout_width="wrap_content" | 94 | android:layout_width="wrap_content" |
95 | android:layout_height="wrap_content" | 95 | android:layout_height="wrap_content" |
96 | android:text="@string/btnExportarInv" | 96 | android:text="@string/btnExportarInv" |
97 | android:textColor="@android:color/white" | 97 | android:textColor="@android:color/white" |
98 | android:padding="10dp" | 98 | android:padding="10dp" |
99 | android:background="@drawable/boton_borde_redondeado" | 99 | android:background="@drawable/boton_borde_redondeado" |
100 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" | 100 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" |
101 | app:layout_constraintEnd_toEndOf="parent" | 101 | app:layout_constraintEnd_toEndOf="parent" |
102 | app:layout_constraintHorizontal_chainStyle="spread" | 102 | app:layout_constraintHorizontal_chainStyle="spread" |
103 | app:layout_constraintStart_toEndOf="@+id/btnBorrarInv" | 103 | app:layout_constraintStart_toEndOf="@+id/btnBorrarInv" |
104 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> | 104 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> |
105 | 105 | ||
106 | <Button | 106 | <Button |
107 | android:id="@+id/btnBorrarInv" | 107 | android:id="@+id/btnBorrarInv" |
108 | android:layout_width="wrap_content" | 108 | android:layout_width="wrap_content" |
109 | android:layout_height="wrap_content" | 109 | android:layout_height="wrap_content" |
110 | android:text="@string/btnBorrarInv" | 110 | android:text="@string/btnBorrarInv" |
111 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" | 111 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" |
112 | app:layout_constraintEnd_toStartOf="@id/btnExportarInv" | 112 | app:layout_constraintEnd_toStartOf="@id/btnExportarInv" |
113 | app:layout_constraintHorizontal_chainStyle="spread" | 113 | app:layout_constraintHorizontal_chainStyle="spread" |
114 | app:layout_constraintStart_toStartOf="parent" | 114 | app:layout_constraintStart_toStartOf="parent" |
115 | android:textColor="@android:color/white" | 115 | android:textColor="@android:color/white" |
116 | android:padding="10dp" | 116 | android:padding="10dp" |
117 | android:background="@drawable/boton_borde_redondeado" | 117 | android:background="@drawable/boton_borde_redondeado" |
118 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> | 118 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> |
119 | 119 | ||
120 | <androidx.constraintlayout.widget.Guideline | 120 | <androidx.constraintlayout.widget.Guideline |
121 | android:id="@+id/guideline" | 121 | android:id="@+id/guideline" |
122 | android:layout_width="wrap_content" | 122 | android:layout_width="wrap_content" |
123 | android:layout_height="wrap_content" | 123 | android:layout_height="wrap_content" |
124 | android:orientation="horizontal" | 124 | android:orientation="horizontal" |
125 | app:layout_constraintGuide_percent="0.02" /> | 125 | app:layout_constraintGuide_percent="0.02" /> |
126 | 126 | ||
127 | <androidx.constraintlayout.widget.Guideline | 127 | <androidx.constraintlayout.widget.Guideline |
128 | android:id="@+id/guideline2" | 128 | android:id="@+id/guideline2" |
129 | android:layout_width="wrap_content" | 129 | android:layout_width="wrap_content" |
130 | android:layout_height="wrap_content" | 130 | android:layout_height="wrap_content" |
131 | android:orientation="horizontal" | 131 | android:orientation="horizontal" |
132 | app:layout_constraintGuide_percent="0.2" /> | 132 | app:layout_constraintGuide_percent="0.2" /> |
133 | 133 | ||
134 | <androidx.constraintlayout.widget.Guideline | 134 | <androidx.constraintlayout.widget.Guideline |
135 | android:id="@+id/guideline3" | 135 | android:id="@+id/guideline3" |
136 | android:layout_width="wrap_content" | 136 | android:layout_width="wrap_content" |
137 | android:layout_height="wrap_content" | 137 | android:layout_height="wrap_content" |
138 | android:orientation="horizontal" | 138 | android:orientation="horizontal" |
139 | app:layout_constraintGuide_percent="0.29" /> | 139 | app:layout_constraintGuide_percent="0.29" /> |
140 | 140 | ||
141 | <androidx.constraintlayout.widget.Guideline | 141 | <androidx.constraintlayout.widget.Guideline |
142 | android:id="@+id/guideline4" | 142 | android:id="@+id/guideline4" |
143 | android:layout_width="wrap_content" | 143 | android:layout_width="wrap_content" |
144 | android:layout_height="wrap_content" | 144 | android:layout_height="wrap_content" |
145 | android:orientation="horizontal" | 145 | android:orientation="horizontal" |
146 | app:layout_constraintGuide_percent="0.35" /> | 146 | app:layout_constraintGuide_percent="0.35" /> |
147 | 147 | ||
148 | <androidx.constraintlayout.widget.Guideline | 148 | <androidx.constraintlayout.widget.Guideline |
149 | android:id="@+id/guideline5" | 149 | android:id="@+id/guideline5" |
150 | android:layout_width="wrap_content" | 150 | android:layout_width="wrap_content" |
151 | android:layout_height="wrap_content" | 151 | android:layout_height="wrap_content" |
152 | android:orientation="horizontal" | 152 | android:orientation="horizontal" |
153 | app:layout_constraintGuide_percent="0.83" /> | 153 | app:layout_constraintGuide_percent="0.83" /> |
154 | 154 | ||
155 | <androidx.constraintlayout.widget.Guideline | 155 | <androidx.constraintlayout.widget.Guideline |
156 | android:id="@+id/guideline6" | 156 | android:id="@+id/guideline6" |
157 | android:layout_width="wrap_content" | 157 | android:layout_width="wrap_content" |
158 | android:layout_height="wrap_content" | 158 | android:layout_height="wrap_content" |
159 | android:orientation="horizontal" | 159 | android:orientation="horizontal" |
160 | app:layout_constraintGuide_percent="0.97" /> | 160 | app:layout_constraintGuide_percent="0.97" /> |
161 | 161 | ||
162 | 162 | ||
163 | </androidx.constraintlayout.widget.ConstraintLayout> | 163 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout-land/fragment_servidores.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <androidx.constraintlayout.widget.ConstraintLayout | 2 | <androidx.constraintlayout.widget.ConstraintLayout |
3 | xmlns:android="http://schemas.android.com/apk/res/android" | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
4 | xmlns:app="http://schemas.android.com/apk/res-auto" | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
5 | xmlns:tools="http://schemas.android.com/tools" | 5 | xmlns:tools="http://schemas.android.com/tools" |
6 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
7 | android:layout_height="match_parent" | 7 | android:layout_height="match_parent" |
8 | tools:context=".ui.servidores.ServidoresFragment"> | 8 | tools:context=".UI.servidores.ServidoresFragment"> |
9 | 9 | ||
10 | <androidx.appcompat.widget.AppCompatTextView | 10 | <androidx.appcompat.widget.AppCompatTextView |
11 | android:id="@+id/tvTitutloServer" | 11 | android:id="@+id/tvTitutloServer" |
12 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
13 | android:layout_height="60dp" | 13 | android:layout_height="40dp" |
14 | android:layout_marginStart="8dp" | 14 | android:layout_marginStart="8dp" |
15 | android:layout_marginTop="15dp" | 15 | android:layout_marginTop="15dp" |
16 | android:layout_marginEnd="8dp" | 16 | android:layout_marginEnd="8dp" |
17 | android:autoSizeMaxTextSize="100sp" | 17 | android:autoSizeMaxTextSize="100sp" |
18 | android:autoSizeMinTextSize="20sp" | 18 | android:autoSizeMinTextSize="20sp" |
19 | android:autoSizeStepGranularity="5sp" | 19 | android:autoSizeStepGranularity="5sp" |
20 | android:autoSizeTextType="uniform" | 20 | android:autoSizeTextType="uniform" |
21 | android:gravity="center" | 21 | android:gravity="center" |
22 | android:lines="1" | 22 | android:lines="1" |
23 | android:text="@string/tvTitutloServer" | 23 | android:text="@string/tvTitutloServer" |
24 | android:textColor="@color/colorAccent" | 24 | android:textColor="@color/colorAccent" |
25 | app:fontFamily="sans-serif-condensed" | 25 | app:fontFamily="sans-serif-condensed" |
26 | app:layout_constraintEnd_toEndOf="parent" | 26 | app:layout_constraintEnd_toEndOf="parent" |
27 | app:layout_constraintStart_toStartOf="parent" | 27 | app:layout_constraintStart_toStartOf="parent" |
28 | app:layout_constraintTop_toTopOf="parent" /> | 28 | app:layout_constraintTop_toTopOf="parent" /> |
29 | 29 | ||
30 | <TextView | 30 | <TextView |
31 | android:id="@+id/tvDirServer" | 31 | android:id="@+id/tvDirServer" |
32 | android:layout_width="match_parent" | 32 | android:layout_width="match_parent" |
33 | android:layout_height="wrap_content" | 33 | android:layout_height="wrap_content" |
34 | android:layout_margin="10dp" | 34 | |
35 | android:gravity="start" | 35 | android:gravity="start" |
36 | android:lines="1" | 36 | android:lines="1" |
37 | android:text="@string/tvDirServer" | 37 | android:text="@string/tvDirServer" |
38 | android:textColor="@android:color/black" | 38 | android:textColor="@android:color/black" |
39 | android:textSize="@dimen/SubTitulos" | 39 | android:textSize="@dimen/SubTitulos" |
40 | android:textStyle="bold|italic" | 40 | android:textStyle="bold|italic" |
41 | app:fontFamily="sans-serif-condensed" | 41 | app:fontFamily="sans-serif-condensed" |
42 | app:layout_constraintBottom_toTopOf="@+id/etDireccionServidor" | 42 | app:layout_constraintBottom_toTopOf="@+id/etDireccionServidor" |
43 | app:layout_constraintEnd_toEndOf="parent" | 43 | app:layout_constraintEnd_toEndOf="parent" |
44 | app:layout_constraintStart_toStartOf="parent" | 44 | app:layout_constraintStart_toStartOf="parent" |
45 | app:layout_constraintTop_toBottomOf="@id/tvTitutloServer" /> | 45 | app:layout_constraintTop_toBottomOf="@id/tvTitutloServer" /> |
46 | 46 | ||
47 | <EditText | 47 | <EditText |
48 | android:id="@+id/etDireccionServidor" | 48 | android:id="@+id/etDireccionServidor" |
49 | android:layout_width="0dp" | 49 | android:layout_width="0dp" |
50 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
51 | android:layout_margin="10dp" | 51 | android:clickable="true" |
52 | android:clickable="true" | ||
53 | android:ems="10" | 52 | android:ems="10" |
54 | android:focusable="true" | 53 | android:focusable="true" |
55 | android:hint="192.168.10.1:9090" | 54 | android:hint="192.168.10.1:9090" |
56 | android:inputType="text" | 55 | android:inputType="text" |
57 | android:lines="1" | 56 | android:lines="1" |
58 | android:textSize="10sp" | 57 | android:textSize="10sp" |
59 | app:layout_constraintEnd_toEndOf="parent" | 58 | app:layout_constraintEnd_toEndOf="parent" |
60 | app:layout_constraintStart_toStartOf="parent" | 59 | app:layout_constraintStart_toStartOf="parent" |
61 | app:layout_constraintTop_toBottomOf="@id/tvDirServer" /> | 60 | app:layout_constraintTop_toBottomOf="@id/tvDirServer" /> |
62 | 61 | ||
63 | <TextView | 62 | <TextView |
64 | android:id="@+id/tvNomServer" | 63 | android:id="@+id/tvNomServer" |
65 | android:layout_width="match_parent" | 64 | android:layout_width="match_parent" |
66 | android:layout_height="wrap_content" | 65 | android:layout_height="wrap_content" |
67 | android:layout_margin="10dp" | ||
68 | android:gravity="start" | 66 | android:gravity="start" |
69 | android:lines="1" | 67 | android:lines="1" |
70 | android:text="@string/tvNomServer" | 68 | android:text="@string/tvNomServer" |
71 | android:textColor="@android:color/black" | 69 | android:textColor="@android:color/black" |
72 | android:textSize="@dimen/SubTitulos" | 70 | android:textSize="@dimen/SubTitulos" |
73 | android:textStyle="bold|italic" | 71 | android:textStyle="bold|italic" |
74 | app:fontFamily="sans-serif-condensed" | 72 | app:fontFamily="sans-serif-condensed" |
75 | app:layout_constraintEnd_toEndOf="parent" | 73 | app:layout_constraintEnd_toEndOf="parent" |
76 | app:layout_constraintStart_toStartOf="parent" | 74 | app:layout_constraintStart_toStartOf="parent" |
77 | app:layout_constraintTop_toBottomOf="@id/etDireccionServidor" /> | 75 | app:layout_constraintTop_toBottomOf="@id/etDireccionServidor" /> |
78 | 76 | ||
79 | <EditText | 77 | <EditText |
80 | android:id="@+id/etNombreServidor" | 78 | android:id="@+id/etNombreServidor" |
81 | android:layout_width="match_parent" | 79 | android:layout_width="match_parent" |
82 | android:layout_height="wrap_content" | 80 | android:layout_height="wrap_content" |
83 | android:layout_margin="10dp" | ||
84 | android:autofillHints="" | 81 | android:autofillHints="" |
85 | android:clickable="true" | 82 | android:clickable="true" |
86 | android:ems="10" | 83 | android:ems="10" |
87 | android:focusable="true" | 84 | android:focusable="true" |
88 | android:inputType="text" | 85 | android:inputType="text" |
89 | android:lines="1" | 86 | android:lines="1" |
90 | android:hint="Servidor Local" | 87 | android:hint="Servidor Local" |
91 | android:textSize="10sp" | 88 | android:textSize="10sp" |
92 | app:layout_constraintEnd_toEndOf="parent" | 89 | app:layout_constraintEnd_toEndOf="parent" |
93 | app:layout_constraintStart_toStartOf="parent" | 90 | app:layout_constraintStart_toStartOf="parent" |
94 | app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> | 91 | app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> |
95 | 92 | ||
96 | 93 | ||
97 | <androidx.recyclerview.widget.RecyclerView | 94 | <androidx.recyclerview.widget.RecyclerView |
98 | android:id="@+id/rvServidores" | 95 | android:id="@+id/rvServidores" |
99 | android:layout_width="0dp" | 96 | android:layout_width="0dp" |
100 | android:layout_height="0dp" | 97 | android:layout_height="0dp" |
101 | android:layout_marginTop="10dp" | 98 | android:layout_marginTop="10dp" |
102 | android:background="@android:color/darker_gray" | 99 | android:background="@android:color/darker_gray" |
103 | app:layout_constraintBottom_toTopOf="@+id/btnGuardarServidores" | 100 | app:layout_constraintBottom_toTopOf="@+id/btnGuardarServidores" |
104 | app:layout_constraintEnd_toEndOf="parent" | 101 | app:layout_constraintEnd_toEndOf="parent" |
105 | app:layout_constraintHorizontal_bias="0.0" | 102 | app:layout_constraintHorizontal_bias="0.0" |
106 | app:layout_constraintStart_toStartOf="parent" | 103 | app:layout_constraintStart_toStartOf="parent" |
107 | app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" | 104 | app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" |
108 | app:layout_goneMarginEnd="10dp" | 105 | app:layout_goneMarginEnd="10dp" |
109 | tools:listitem="@layout/item_servidores" /> | 106 | tools:listitem="@layout/item_servidores" /> |
110 | 107 | ||
111 | <Button | 108 | <Button |
112 | android:id="@+id/btnGuardarServidores" | 109 | android:id="@+id/btnGuardarServidores" |
113 | android:layout_width="0dp" | 110 | android:layout_width="0dp" |
114 | android:layout_height="wrap_content" | 111 | android:layout_height="wrap_content" |
115 | android:layout_marginTop="10dp" | 112 | |
116 | android:layout_marginEnd="10dp" | ||
117 | android:text="@string/btnGuardarServidores" | 113 | android:text="@string/btnGuardarServidores" |
118 | android:textColor="@android:color/white" | 114 | android:textColor="@android:color/white" |
119 | android:padding="5dp" | 115 | android:padding="5dp" |
120 | android:background="@drawable/boton_borde_redondeado" | 116 | android:background="@drawable/boton_borde_redondeado" |
121 | app:layout_constraintTop_toBottomOf="@+id/rvServidores" | 117 | app:layout_constraintTop_toBottomOf="@+id/rvServidores" |
122 | app:layout_constraintEnd_toEndOf="parent" | 118 | app:layout_constraintEnd_toEndOf="parent" |
123 | app:layout_constraintStart_toStartOf="parent" | 119 | app:layout_constraintStart_toStartOf="parent" |
124 | app:layout_constraintBottom_toBottomOf="parent"/> | 120 | app:layout_constraintBottom_toBottomOf="parent"/> |
125 | 121 | ||
126 | </androidx.constraintlayout.widget.ConstraintLayout> | 122 | </androidx.constraintlayout.widget.ConstraintLayout> |
127 | 123 |
app/src/main/res/layout/activity_splash.xml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
7 | tools:context=".ui.SplashActivity"> | 7 | tools:context=".UI.SplashActivity"> |
8 | 8 | ||
9 | 9 | ||
10 | <androidx.appcompat.widget.AppCompatTextView | 10 | <androidx.appcompat.widget.AppCompatTextView |
11 | android:id="@+id/textView2" | 11 | android:id="@+id/textView2" |
12 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
13 | android:layout_height="100dp" | 13 | android:layout_height="100dp" |
14 | android:layout_margin="20dp" | 14 | android:layout_margin="20dp" |
15 | android:autoSizeMaxTextSize="1000sp" | 15 | android:autoSizeMaxTextSize="1000sp" |
16 | android:autoSizeMinTextSize="30sp" | 16 | android:autoSizeMinTextSize="30sp" |
17 | android:autoSizeStepGranularity="5sp" | 17 | android:autoSizeStepGranularity="5sp" |
18 | android:autoSizeTextType="uniform" | 18 | android:autoSizeTextType="uniform" |
19 | android:gravity="center" | 19 | android:gravity="center" |
20 | android:lines="1" | 20 | android:lines="1" |
21 | android:text="@string/bien" | 21 | android:text="@string/bien" |
22 | android:textColor="@color/colorAccent" | 22 | android:textColor="@color/colorAccent" |
23 | app:fontFamily="sans-serif-condensed" | 23 | app:fontFamily="sans-serif-condensed" |
24 | app:layout_constraintBottom_toTopOf="@+id/imageView" | 24 | app:layout_constraintBottom_toTopOf="@+id/imageView" |
25 | app:layout_constraintEnd_toEndOf="parent" | 25 | app:layout_constraintEnd_toEndOf="parent" |
26 | app:layout_constraintStart_toStartOf="parent" | 26 | app:layout_constraintStart_toStartOf="parent" |
27 | app:layout_constraintTop_toTopOf="parent" /> | 27 | app:layout_constraintTop_toTopOf="parent" /> |
28 | 28 | ||
29 | <ImageView | 29 | <ImageView |
30 | android:id="@+id/imageView" | 30 | android:id="@+id/imageView" |
31 | android:layout_width="wrap_content" | 31 | android:layout_width="wrap_content" |
32 | android:layout_height="wrap_content" | 32 | android:layout_height="wrap_content" |
33 | android:contentDescription="@string/todo" | 33 | android:contentDescription="@string/todo" |
34 | android:src="@drawable/ic_launcher_background" | 34 | android:src="@drawable/ic_launcher_background" |
35 | app:layout_constraintBottom_toTopOf="@id/textView3" | 35 | app:layout_constraintBottom_toTopOf="@id/textView3" |
36 | app:layout_constraintEnd_toEndOf="parent" | 36 | app:layout_constraintEnd_toEndOf="parent" |
37 | app:layout_constraintStart_toStartOf="parent" | 37 | app:layout_constraintStart_toStartOf="parent" |
38 | app:layout_constraintTop_toBottomOf="@+id/textView2" | 38 | app:layout_constraintTop_toBottomOf="@+id/textView2" |
39 | app:srcCompat="@drawable/suitedebo" /> | 39 | app:srcCompat="@drawable/suitedebo" /> |
40 | 40 | ||
41 | 41 | ||
42 | <TextView | 42 | <TextView |
43 | android:id="@+id/textView3" | 43 | android:id="@+id/textView3" |
44 | android:layout_width="match_parent" | 44 | android:layout_width="match_parent" |
45 | android:layout_height="100dp" | 45 | android:layout_height="100dp" |
46 | android:layout_margin="20dp" | 46 | android:layout_margin="20dp" |
47 | android:autoSizeMaxTextSize="1000sp" | 47 | android:autoSizeMaxTextSize="1000sp" |
48 | android:autoSizeMinTextSize="30sp" | 48 | android:autoSizeMinTextSize="30sp" |
49 | android:autoSizeStepGranularity="5sp" | 49 | android:autoSizeStepGranularity="5sp" |
50 | android:autoSizeTextType="uniform" | 50 | android:autoSizeTextType="uniform" |
51 | android:gravity="center" | 51 | android:gravity="center" |
52 | android:lines="1" | 52 | android:lines="1" |
53 | android:text="@string/debo" | 53 | android:text="@string/debo" |
54 | android:textColor="@color/colorAccent" | 54 | android:textColor="@color/colorAccent" |
55 | app:fontFamily="sans-serif-condensed" | 55 | app:fontFamily="sans-serif-condensed" |
56 | app:layout_constraintBottom_toTopOf="@+id/textView4" | 56 | app:layout_constraintBottom_toTopOf="@+id/textView4" |
57 | app:layout_constraintEnd_toEndOf="parent" | 57 | app:layout_constraintEnd_toEndOf="parent" |
58 | app:layout_constraintStart_toStartOf="parent" | 58 | app:layout_constraintStart_toStartOf="parent" |
59 | app:layout_constraintTop_toBottomOf="@+id/imageView" /> | 59 | app:layout_constraintTop_toBottomOf="@+id/imageView" /> |
60 | 60 | ||
61 | <androidx.appcompat.widget.AppCompatTextView | 61 | <androidx.appcompat.widget.AppCompatTextView |
62 | android:id="@+id/textView4" | 62 | android:id="@+id/textView4" |
63 | android:layout_width="match_parent" | 63 | android:layout_width="match_parent" |
64 | android:layout_height="110dp" | 64 | android:layout_height="110dp" |
65 | android:layout_margin="20dp" | 65 | android:layout_margin="20dp" |
66 | android:autoSizeMaxTextSize="1000sp" | 66 | android:autoSizeMaxTextSize="1000sp" |
67 | android:autoSizeMinTextSize="30sp" | 67 | android:autoSizeMinTextSize="30sp" |
68 | android:autoSizeStepGranularity="5sp" | 68 | android:autoSizeStepGranularity="5sp" |
69 | android:autoSizeTextType="uniform" | 69 | android:autoSizeTextType="uniform" |
70 | android:gravity="center" | 70 | android:gravity="center" |
71 | android:lines="1" | 71 | android:lines="1" |
72 | android:text="@string/inventario" | 72 | android:text="@string/inventario" |
73 | android:textColor="@color/colorAccent" | 73 | android:textColor="@color/colorAccent" |
74 | app:fontFamily="sans-serif-condensed" | 74 | app:fontFamily="sans-serif-condensed" |
75 | app:layout_constraintBottom_toBottomOf="parent" | 75 | app:layout_constraintBottom_toBottomOf="parent" |
76 | app:layout_constraintEnd_toEndOf="parent" | 76 | app:layout_constraintEnd_toEndOf="parent" |
77 | app:layout_constraintEnd_toStartOf="parent" | 77 | app:layout_constraintEnd_toStartOf="parent" |
78 | app:layout_constraintTop_toBottomOf="@id/textView3" /> | 78 | app:layout_constraintTop_toBottomOf="@id/textView3" /> |
79 | </androidx.constraintlayout.widget.ConstraintLayout> | 79 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/app_bar_main.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
7 | tools:context=".ui.MainActivity"> | 7 | tools:context=".UI.MainActivity"> |
8 | 8 | ||
9 | <com.google.android.material.appbar.AppBarLayout | 9 | <com.google.android.material.appbar.AppBarLayout |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
12 | android:theme="@style/AppTheme.AppBarOverlay"> | 12 | android:theme="@style/AppTheme.AppBarOverlay"> |
13 | 13 | ||
14 | <androidx.appcompat.widget.Toolbar | 14 | <androidx.appcompat.widget.Toolbar |
15 | android:id="@+id/toolbar" | 15 | android:id="@+id/toolbar" |
16 | android:layout_width="match_parent" | 16 | android:layout_width="match_parent" |
17 | android:layout_height="?attr/actionBarSize" | 17 | android:layout_height="?attr/actionBarSize" |
18 | android:background="?attr/colorPrimary" | 18 | android:background="?attr/colorPrimary" |
19 | app:popupTheme="@style/AppTheme.PopupOverlay" /> | 19 | app:popupTheme="@style/AppTheme.PopupOverlay" /> |
20 | 20 | ||
21 | </com.google.android.material.appbar.AppBarLayout> | 21 | </com.google.android.material.appbar.AppBarLayout> |
22 | 22 | ||
23 | <include layout="@layout/content_main" /> | 23 | <include layout="@layout/content_main" /> |
24 | 24 | ||
25 | 25 | ||
26 | </androidx.coordinatorlayout.widget.CoordinatorLayout> | 26 | </androidx.coordinatorlayout.widget.CoordinatorLayout> |
app/src/main/res/layout/fragment_actua_maestros.xml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
7 | tools:context=".ui.actualizacionMaestros.ActuaMaestrosFragment"> | 7 | tools:context=".UI.actualizacionMaestros.ActuaMaestrosFragment"> |
8 | 8 | ||
9 | 9 | ||
10 | <androidx.appcompat.widget.AppCompatTextView | 10 | <androidx.appcompat.widget.AppCompatTextView |
11 | android:id="@+id/tvActMaestros" | 11 | android:id="@+id/tvActMaestros" |
12 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
13 | android:layout_height="wrap_content" | 13 | android:layout_height="wrap_content" |
14 | android:layout_marginTop="@dimen/MarginTopTitulos" | 14 | android:layout_marginTop="@dimen/MarginTopTitulos" |
15 | android:gravity="center" | 15 | android:gravity="center" |
16 | 16 | ||
17 | android:text="@string/tvActMaestros" | 17 | android:text="@string/tvActMaestros" |
18 | android:textColor="@color/colorAccent" | 18 | android:textColor="@color/colorAccent" |
19 | android:textSize="@dimen/Titulos" | 19 | android:textSize="@dimen/Titulos" |
20 | app:fontFamily="sans-serif-condensed" | 20 | app:fontFamily="sans-serif-condensed" |
21 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" | 21 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" |
22 | app:layout_constraintEnd_toEndOf="parent" | 22 | app:layout_constraintEnd_toEndOf="parent" |
23 | app:layout_constraintStart_toStartOf="parent" | 23 | app:layout_constraintStart_toStartOf="parent" |
24 | app:layout_constraintTop_toTopOf="parent" /> | 24 | app:layout_constraintTop_toTopOf="parent" /> |
25 | 25 | ||
26 | <TextView | 26 | <TextView |
27 | android:id="@+id/tvSeleccioneServidor" | 27 | android:id="@+id/tvSeleccioneServidor" |
28 | android:layout_width="0dp" | 28 | android:layout_width="0dp" |
29 | android:layout_height="wrap_content" | 29 | android:layout_height="wrap_content" |
30 | android:layout_margin="30dp" | 30 | android:layout_margin="30dp" |
31 | android:gravity="center" | 31 | android:gravity="center" |
32 | android:lines="2" | 32 | android:lines="2" |
33 | android:text="@string/tvMedio" | 33 | android:text="@string/tvMedio" |
34 | android:textColor="@android:color/black" | 34 | android:textColor="@android:color/black" |
35 | android:textSize="@dimen/SubTitulos" | 35 | android:textSize="@dimen/SubTitulos" |
36 | app:fontFamily="sans-serif-condensed" | 36 | app:fontFamily="sans-serif-condensed" |
37 | app:layout_constraintEnd_toEndOf="parent" | 37 | app:layout_constraintEnd_toEndOf="parent" |
38 | app:layout_constraintStart_toStartOf="parent" | 38 | app:layout_constraintStart_toStartOf="parent" |
39 | app:layout_constraintTop_toBottomOf="@+id/tvActMaestros" /> | 39 | app:layout_constraintTop_toBottomOf="@+id/tvActMaestros" /> |
40 | 40 | ||
41 | <RadioGroup | 41 | <RadioGroup |
42 | android:id="@+id/rgTipoActualizacion" | 42 | android:id="@+id/rgTipoActualizacion" |
43 | android:layout_width="0dp" | 43 | android:layout_width="0dp" |
44 | android:layout_height="wrap_content" | 44 | android:layout_height="wrap_content" |
45 | android:layout_margin="25dp" | 45 | android:layout_margin="25dp" |
46 | android:gravity="center" | 46 | android:gravity="center" |
47 | android:orientation="horizontal" | 47 | android:orientation="horizontal" |
48 | app:layout_constraintEnd_toEndOf="parent" | 48 | app:layout_constraintEnd_toEndOf="parent" |
49 | app:layout_constraintStart_toStartOf="parent" | 49 | app:layout_constraintStart_toStartOf="parent" |
50 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor"> | 50 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor"> |
51 | 51 | ||
52 | <RadioButton | 52 | <RadioButton |
53 | android:id="@+id/obPorWifi" | 53 | android:id="@+id/obPorWifi" |
54 | android:layout_width="wrap_content" | 54 | android:layout_width="wrap_content" |
55 | android:layout_height="wrap_content" | 55 | android:layout_height="wrap_content" |
56 | android:layout_margin="5dp" | 56 | android:layout_margin="5dp" |
57 | android:checked="true" | 57 | android:checked="true" |
58 | android:padding="5dp" | 58 | android:padding="5dp" |
59 | android:text="@string/obPorWifi" | 59 | android:text="@string/obPorWifi" |
60 | android:textSize="@dimen/NormalText" /> | 60 | android:textSize="@dimen/NormalText" /> |
61 | 61 | ||
62 | <RadioButton | 62 | <RadioButton |
63 | android:id="@+id/obViaArchivo" | 63 | android:id="@+id/obViaArchivo" |
64 | android:layout_width="wrap_content" | 64 | android:layout_width="wrap_content" |
65 | android:layout_height="wrap_content" | 65 | android:layout_height="wrap_content" |
66 | android:layout_margin="5dp" | 66 | android:layout_margin="5dp" |
67 | android:checked="false" | 67 | android:checked="false" |
68 | android:padding="5dp" | 68 | android:padding="5dp" |
69 | android:text="@string/obViaArchivo" | 69 | android:text="@string/obViaArchivo" |
70 | android:textSize="@dimen/NormalText" /> | 70 | android:textSize="@dimen/NormalText" /> |
71 | 71 | ||
72 | 72 | ||
73 | </RadioGroup> | 73 | </RadioGroup> |
74 | 74 | ||
75 | 75 | ||
76 | <TextView | 76 | <TextView |
77 | android:id="@+id/countriesList" | 77 | android:id="@+id/countriesList" |
78 | android:layout_width="0dp" | 78 | android:layout_width="0dp" |
79 | android:layout_height="wrap_content" | 79 | android:layout_height="wrap_content" |
80 | android:layout_marginTop="@dimen/MarginTopTitulos" | 80 | android:layout_marginTop="@dimen/MarginTopTitulos" |
81 | android:gravity="center" | 81 | android:gravity="center" |
82 | android:text="" | 82 | android:text="" |
83 | android:textColor="@android:color/black" | 83 | android:textColor="@android:color/black" |
84 | android:textSize="@dimen/SubTitulos" | 84 | android:textSize="@dimen/SubTitulos" |
85 | android:visibility="visible" | 85 | android:visibility="visible" |
86 | app:fontFamily="sans-serif-condensed" | 86 | app:fontFamily="sans-serif-condensed" |
87 | app:layout_constraintBottom_toTopOf="@+id/btnConfirmarAct" | 87 | app:layout_constraintBottom_toTopOf="@+id/btnConfirmarAct" |
88 | app:layout_constraintEnd_toEndOf="parent" | 88 | app:layout_constraintEnd_toEndOf="parent" |
89 | app:layout_constraintHorizontal_bias="0.0" | 89 | app:layout_constraintHorizontal_bias="0.0" |
90 | app:layout_constraintStart_toStartOf="parent" | 90 | app:layout_constraintStart_toStartOf="parent" |
91 | app:layout_constraintTop_toBottomOf="@+id/rgTipoActualizacion" | 91 | app:layout_constraintTop_toBottomOf="@+id/rgTipoActualizacion" |
92 | app:layout_constraintVertical_bias="0.0" /> | 92 | app:layout_constraintVertical_bias="0.0" /> |
93 | 93 | ||
94 | <Button | 94 | <Button |
95 | android:id="@+id/btnConfirmarAct" | 95 | android:id="@+id/btnConfirmarAct" |
96 | android:layout_width="0dp" | 96 | android:layout_width="0dp" |
97 | android:layout_height="wrap_content" | 97 | android:layout_height="wrap_content" |
98 | android:layout_margin="20dp" | 98 | android:layout_margin="20dp" |
99 | android:text="@string/btnConfirmarAct" | 99 | android:text="@string/btnConfirmarAct" |
100 | android:textSize="@dimen/NormalText" | 100 | android:textSize="@dimen/NormalText" |
101 | android:textColor="@android:color/white" | 101 | android:textColor="@android:color/white" |
102 | android:padding="10dp" | 102 | android:padding="10dp" |
103 | android:background="@drawable/boton_borde_redondeado" | 103 | android:background="@drawable/boton_borde_redondeado" |
104 | app:layout_constraintBottom_toBottomOf="parent" | 104 | app:layout_constraintBottom_toBottomOf="parent" |
105 | app:layout_constraintEnd_toEndOf="parent" | 105 | app:layout_constraintEnd_toEndOf="parent" |
106 | app:layout_constraintStart_toStartOf="parent" /> | 106 | app:layout_constraintStart_toStartOf="parent" /> |
107 | 107 | ||
108 | 108 | ||
109 | <ProgressBar | 109 | <ProgressBar |
110 | android:id="@+id/loading_view" | 110 | android:id="@+id/loading_view" |
111 | android:layout_width="wrap_content" | 111 | android:layout_width="wrap_content" |
112 | android:layout_height="wrap_content" | 112 | android:layout_height="wrap_content" |
113 | android:layout_marginStart="8dp" | 113 | android:layout_marginStart="8dp" |
114 | android:layout_marginLeft="8dp" | 114 | android:layout_marginLeft="8dp" |
115 | android:layout_marginTop="8dp" | 115 | android:layout_marginTop="8dp" |
116 | android:layout_marginEnd="8dp" | 116 | android:layout_marginEnd="8dp" |
117 | android:layout_marginRight="8dp" | 117 | android:layout_marginRight="8dp" |
118 | android:layout_marginBottom="8dp" | 118 | android:layout_marginBottom="8dp" |
119 | android:visibility="gone" | 119 | android:visibility="gone" |
120 | app:layout_constraintBottom_toBottomOf="parent" | 120 | app:layout_constraintBottom_toBottomOf="parent" |
121 | app:layout_constraintEnd_toEndOf="parent" | 121 | app:layout_constraintEnd_toEndOf="parent" |
122 | app:layout_constraintStart_toStartOf="parent" | 122 | app:layout_constraintStart_toStartOf="parent" |
123 | app:layout_constraintTop_toTopOf="parent" /> | 123 | app:layout_constraintTop_toTopOf="parent" /> |
124 | 124 | ||
125 | </androidx.constraintlayout.widget.ConstraintLayout> | 125 | </androidx.constraintlayout.widget.ConstraintLayout> |
126 | 126 |
app/src/main/res/layout/fragment_configuracion.xml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
6 | android:layout_height="wrap_content" | 6 | android:layout_height="wrap_content" |
7 | tools:context=".ui.configuracion.ConfiguracionFragment"> | 7 | tools:context=".UI.configuracion.ConfiguracionFragment"> |
8 | 8 | ||
9 | 9 | ||
10 | <androidx.appcompat.widget.AppCompatTextView | 10 | <androidx.appcompat.widget.AppCompatTextView |
11 | android:id="@+id/textView2" | 11 | android:id="@+id/textView2" |
12 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
13 | android:layout_height="wrap_content" | 13 | android:layout_height="wrap_content" |
14 | 14 | ||
15 | android:layout_marginTop="@dimen/MarginTopTitulos" | 15 | android:layout_marginTop="@dimen/MarginTopTitulos" |
16 | android:gravity="center" | 16 | android:gravity="center" |
17 | 17 | ||
18 | android:lines="1" | 18 | android:lines="1" |
19 | android:text="@string/tvTituloConf" | 19 | android:text="@string/tvTituloConf" |
20 | android:textColor="@color/colorAccent" | 20 | android:textColor="@color/colorAccent" |
21 | android:textSize="@dimen/Titulos" | 21 | android:textSize="@dimen/Titulos" |
22 | app:fontFamily="sans-serif-condensed" | 22 | app:fontFamily="sans-serif-condensed" |
23 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" | 23 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" |
24 | app:layout_constraintEnd_toEndOf="parent" | 24 | app:layout_constraintEnd_toEndOf="parent" |
25 | app:layout_constraintStart_toStartOf="parent" | 25 | app:layout_constraintStart_toStartOf="parent" |
26 | app:layout_constraintTop_toTopOf="parent" /> | 26 | app:layout_constraintTop_toTopOf="parent" /> |
27 | 27 | ||
28 | <TextView | 28 | <TextView |
29 | android:id="@+id/tvSeleccioneServidor" | 29 | android:id="@+id/tvSeleccioneServidor" |
30 | android:layout_width="0dp" | 30 | android:layout_width="0dp" |
31 | android:layout_height="wrap_content" | 31 | android:layout_height="wrap_content" |
32 | 32 | ||
33 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 33 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
34 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 34 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
35 | android:gravity="start" | 35 | android:gravity="start" |
36 | android:lines="1" | 36 | android:lines="1" |
37 | android:text="@string/tvSeleccioneServidor" | 37 | android:text="@string/tvSeleccioneServidor" |
38 | android:textColor="@android:color/black" | 38 | android:textColor="@android:color/black" |
39 | android:textSize="@dimen/SubTitulos" | 39 | android:textSize="@dimen/SubTitulos" |
40 | app:fontFamily="sans-serif-condensed" | 40 | app:fontFamily="sans-serif-condensed" |
41 | app:layout_constraintBottom_toTopOf="@+id/spServidor" | 41 | app:layout_constraintBottom_toTopOf="@+id/spServidor" |
42 | app:layout_constraintEnd_toEndOf="parent" | 42 | app:layout_constraintEnd_toEndOf="parent" |
43 | app:layout_constraintStart_toStartOf="parent" | 43 | app:layout_constraintStart_toStartOf="parent" |
44 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> | 44 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> |
45 | 45 | ||
46 | <Spinner | 46 | <Spinner |
47 | android:id="@+id/spServidor" | 47 | android:id="@+id/spServidor" |
48 | style="@android:style/Widget.Holo.Light.Spinner" | 48 | style="@android:style/Widget.Holo.Light.Spinner" |
49 | android:layout_width="0dp" | 49 | android:layout_width="0dp" |
50 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
51 | android:elevation="5dp" | 51 | android:elevation="5dp" |
52 | 52 | ||
53 | android:textSize="@dimen/NormalText" | 53 | android:textSize="@dimen/NormalText" |
54 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" | 54 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" |
55 | app:layout_constraintEnd_toStartOf="@+id/btnValidarServidor" | 55 | app:layout_constraintEnd_toStartOf="@+id/btnValidarServidor" |
56 | app:layout_constraintHorizontal_chainStyle="packed" | 56 | app:layout_constraintHorizontal_chainStyle="packed" |
57 | app:layout_constraintStart_toStartOf="parent" | 57 | app:layout_constraintStart_toStartOf="parent" |
58 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" | 58 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" |
59 | /> | 59 | /> |
60 | 60 | ||
61 | <Button | 61 | <Button |
62 | android:id="@+id/btnValidarServidor" | 62 | android:id="@+id/btnValidarServidor" |
63 | android:layout_width="wrap_content" | 63 | android:layout_width="wrap_content" |
64 | android:layout_height="wrap_content" | 64 | android:layout_height="wrap_content" |
65 | android:textColor="@android:color/white" | 65 | android:textColor="@android:color/white" |
66 | android:padding="10dp" | 66 | android:padding="10dp" |
67 | android:background="@drawable/boton_borde_redondeado" | 67 | android:background="@drawable/boton_borde_redondeado" |
68 | android:text="@string/btnValidarServidor" | 68 | android:text="@string/btnValidarServidor" |
69 | android:textSize="@dimen/NormalText" | 69 | android:textSize="@dimen/NormalText" |
70 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" | 70 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" |
71 | app:layout_constraintEnd_toEndOf="parent" | 71 | app:layout_constraintEnd_toEndOf="parent" |
72 | app:layout_constraintHorizontal_chainStyle="packed" | 72 | app:layout_constraintHorizontal_chainStyle="packed" |
73 | app:layout_constraintStart_toEndOf="@id/spServidor" | 73 | app:layout_constraintStart_toEndOf="@id/spServidor" |
74 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" /> | 74 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" /> |
75 | 75 | ||
76 | <Button | 76 | <Button |
77 | android:id="@+id/btnAgregarServidor" | 77 | android:id="@+id/btnAgregarServidor" |
78 | android:layout_width="0dp" | 78 | android:layout_width="0dp" |
79 | android:layout_height="wrap_content" | 79 | android:layout_height="wrap_content" |
80 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 80 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
81 | android:layout_marginEnd="@dimen/MarginBotAgreSer" | 81 | android:layout_marginEnd="@dimen/MarginBotAgreSer" |
82 | android:text="@string/btnAgregarServidor" | 82 | android:text="@string/btnAgregarServidor" |
83 | android:textSize="@dimen/NormalText" | 83 | android:textSize="@dimen/NormalText" |
84 | android:textColor="@android:color/white" | 84 | android:textColor="@android:color/white" |
85 | android:padding="10dp" | 85 | android:padding="10dp" |
86 | android:background="@drawable/boton_borde_redondeado" | 86 | android:background="@drawable/boton_borde_redondeado" |
87 | app:layout_constraintBottom_toTopOf="@+id/tvUbicacionCarpetas" | 87 | app:layout_constraintBottom_toTopOf="@+id/tvUbicacionCarpetas" |
88 | app:layout_constraintEnd_toEndOf="parent" | 88 | app:layout_constraintEnd_toEndOf="parent" |
89 | app:layout_constraintStart_toStartOf="parent" | 89 | app:layout_constraintStart_toStartOf="parent" |
90 | app:layout_constraintTop_toBottomOf="@+id/btnValidarServidor" /> | 90 | app:layout_constraintTop_toBottomOf="@+id/btnValidarServidor" /> |
91 | 91 | ||
92 | 92 | ||
93 | <TextView | 93 | <TextView |
94 | android:id="@+id/tvUbicacionCarpetas" | 94 | android:id="@+id/tvUbicacionCarpetas" |
95 | android:layout_width="0dp" | 95 | android:layout_width="0dp" |
96 | android:layout_height="wrap_content" | 96 | android:layout_height="wrap_content" |
97 | 97 | ||
98 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 98 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
99 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 99 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
100 | android:gravity="start" | 100 | android:gravity="start" |
101 | android:lines="1" | 101 | android:lines="1" |
102 | android:text="@string/tvUbicacionCarpetas" | 102 | android:text="@string/tvUbicacionCarpetas" |
103 | android:textColor="@android:color/black" | 103 | android:textColor="@android:color/black" |
104 | android:textSize="@dimen/SubTitulos" | 104 | android:textSize="@dimen/SubTitulos" |
105 | app:fontFamily="sans-serif-condensed" | 105 | app:fontFamily="sans-serif-condensed" |
106 | app:layout_constraintBottom_toTopOf="@+id/ibSearch" | 106 | app:layout_constraintBottom_toTopOf="@+id/ibSearch" |
107 | app:layout_constraintEnd_toEndOf="parent" | 107 | app:layout_constraintEnd_toEndOf="parent" |
108 | app:layout_constraintStart_toStartOf="parent" | 108 | app:layout_constraintStart_toStartOf="parent" |
109 | app:layout_constraintTop_toBottomOf="@+id/btnAgregarServidor" /> | 109 | app:layout_constraintTop_toBottomOf="@+id/btnAgregarServidor" /> |
110 | 110 | ||
111 | <ImageButton | 111 | <ImageButton |
112 | android:id="@+id/ibSearch" | 112 | android:id="@+id/ibSearch" |
113 | android:layout_width="36dp" | 113 | android:layout_width="36dp" |
114 | android:layout_height="37dp" | 114 | android:layout_height="37dp" |
115 | android:layout_margin="10dp" | 115 | android:layout_margin="10dp" |
116 | android:src="@drawable/search" | 116 | android:src="@drawable/search" |
117 | android:textColor="@android:color/white" | 117 | android:textColor="@android:color/white" |
118 | android:padding="10dp" | 118 | android:padding="10dp" |
119 | android:background="@drawable/boton_borde_redondeado" | 119 | android:background="@drawable/boton_borde_redondeado" |
120 | app:layout_constraintEnd_toStartOf="@+id/etRuta" | 120 | app:layout_constraintEnd_toStartOf="@+id/etRuta" |
121 | app:layout_constraintStart_toStartOf="parent" | 121 | app:layout_constraintStart_toStartOf="parent" |
122 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> | 122 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> |
123 | 123 | ||
124 | <EditText | 124 | <EditText |
125 | android:id="@+id/etRuta" | 125 | android:id="@+id/etRuta" |
126 | android:layout_width="0dp" | 126 | android:layout_width="0dp" |
127 | android:layout_height="wrap_content" | 127 | android:layout_height="wrap_content" |
128 | android:layout_marginTop="10dp" | 128 | android:layout_marginTop="10dp" |
129 | android:layout_marginEnd="10dp" | 129 | android:layout_marginEnd="10dp" |
130 | android:clickable="true" | 130 | android:clickable="true" |
131 | android:ems="10" | 131 | android:ems="10" |
132 | android:focusable="true" | 132 | android:focusable="true" |
133 | android:inputType="textPersonName" | 133 | android:inputType="textPersonName" |
134 | android:lines="1" | 134 | android:lines="1" |
135 | android:text="" | 135 | android:text="" |
136 | android:textSize="@dimen/NormalText" | 136 | android:textSize="@dimen/NormalText" |
137 | app:layout_constraintEnd_toEndOf="parent" | 137 | app:layout_constraintEnd_toEndOf="parent" |
138 | app:layout_constraintStart_toEndOf="@id/ibSearch" | 138 | app:layout_constraintStart_toEndOf="@id/ibSearch" |
139 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> | 139 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> |
140 | 140 | ||
141 | <TextView | 141 | <TextView |
142 | android:id="@+id/tvActuFecha" | 142 | android:id="@+id/tvActuFecha" |
143 | android:layout_width="0dp" | 143 | android:layout_width="0dp" |
144 | android:layout_height="wrap_content" | 144 | android:layout_height="wrap_content" |
145 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 145 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
146 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 146 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
147 | android:gravity="start" | 147 | android:gravity="start" |
148 | android:lines="1" | 148 | android:lines="1" |
149 | android:text="@string/tvTituloArea" | 149 | android:text="@string/tvTituloArea" |
150 | android:textColor="@android:color/black" | 150 | android:textColor="@android:color/black" |
151 | android:textSize="@dimen/SubTitulos" | 151 | android:textSize="@dimen/SubTitulos" |
152 | app:fontFamily="sans-serif-condensed" | 152 | app:fontFamily="sans-serif-condensed" |
153 | app:layout_constraintEnd_toEndOf="parent" | 153 | app:layout_constraintEnd_toEndOf="parent" |
154 | app:layout_constraintStart_toStartOf="parent" | 154 | app:layout_constraintStart_toStartOf="parent" |
155 | app:layout_constraintTop_toBottomOf="@+id/etRuta" /> | 155 | app:layout_constraintTop_toBottomOf="@+id/etRuta" /> |
156 | 156 | ||
157 | <RadioGroup | 157 | <RadioGroup |
158 | android:id="@+id/rgFechaHora" | 158 | android:id="@+id/rgFechaHora" |
159 | android:layout_width="0dp" | 159 | android:layout_width="0dp" |
160 | android:layout_height="wrap_content" | 160 | android:layout_height="wrap_content" |
161 | 161 | ||
162 | android:gravity="center" | 162 | android:gravity="center" |
163 | android:orientation="horizontal" | 163 | android:orientation="horizontal" |
164 | app:layout_constraintEnd_toEndOf="parent" | 164 | app:layout_constraintEnd_toEndOf="parent" |
165 | app:layout_constraintStart_toStartOf="parent" | 165 | app:layout_constraintStart_toStartOf="parent" |
166 | app:layout_constraintTop_toBottomOf="@+id/tvActuFecha"> | 166 | app:layout_constraintTop_toBottomOf="@+id/tvActuFecha"> |
167 | 167 | ||
168 | <RadioButton | 168 | <RadioButton |
169 | android:id="@+id/rbVentas" | 169 | android:id="@+id/rbVentas" |
170 | android:layout_width="wrap_content" | 170 | android:layout_width="wrap_content" |
171 | android:layout_height="wrap_content" | 171 | android:layout_height="wrap_content" |
172 | android:layout_margin="5dp" | 172 | android:layout_margin="5dp" |
173 | android:checked="true" | 173 | android:checked="true" |
174 | android:padding="5dp" | 174 | android:padding="5dp" |
175 | android:text="@string/rbVentas" | 175 | android:text="@string/rbVentas" |
176 | android:textSize="@dimen/NormalText" /> | 176 | android:textSize="@dimen/NormalText" /> |
177 | 177 | ||
178 | <RadioButton | 178 | <RadioButton |
179 | android:id="@+id/rbDeposito" | 179 | android:id="@+id/rbDeposito" |
180 | android:layout_width="wrap_content" | 180 | android:layout_width="wrap_content" |
181 | android:layout_height="wrap_content" | 181 | android:layout_height="wrap_content" |
182 | android:layout_margin="5dp" | 182 | android:layout_margin="5dp" |
183 | android:checked="false" | 183 | android:checked="false" |
184 | android:padding="5dp" | 184 | android:padding="5dp" |
185 | android:text="@string/rbDeposito" | 185 | android:text="@string/rbDeposito" |
186 | android:textSize="@dimen/NormalText" /> | 186 | android:textSize="@dimen/NormalText" /> |
187 | 187 | ||
188 | </RadioGroup> | 188 | </RadioGroup> |
189 | 189 | ||
190 | <TextView | 190 | <TextView |
191 | android:id="@+id/tvLosProductos" | 191 | android:id="@+id/tvLosProductos" |
192 | android:layout_width="0dp" | 192 | android:layout_width="0dp" |
193 | android:layout_height="wrap_content" | 193 | android:layout_height="wrap_content" |
194 | 194 | ||
195 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 195 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
196 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" | 196 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" |
197 | android:gravity="start" | 197 | android:gravity="start" |
198 | android:lines="1" | 198 | android:lines="1" |
199 | android:text="@string/tvLosProductos" | 199 | android:text="@string/tvLosProductos" |
200 | android:textColor="@android:color/black" | 200 | android:textColor="@android:color/black" |
201 | android:textSize="@dimen/SubTitulos" | 201 | android:textSize="@dimen/SubTitulos" |
202 | app:fontFamily="sans-serif-condensed" | 202 | app:fontFamily="sans-serif-condensed" |
203 | app:layout_constraintEnd_toEndOf="parent" | 203 | app:layout_constraintEnd_toEndOf="parent" |
204 | app:layout_constraintStart_toStartOf="parent" | 204 | app:layout_constraintStart_toStartOf="parent" |
205 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> | 205 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> |
206 | 206 | ||
207 | <RadioGroup | 207 | <RadioGroup |
208 | android:id="@+id/rgLosProductos" | 208 | android:id="@+id/rgLosProductos" |
209 | android:layout_width="0dp" | 209 | android:layout_width="0dp" |
210 | android:layout_height="wrap_content" | 210 | android:layout_height="wrap_content" |
211 | 211 | ||
212 | android:gravity="center" | 212 | android:gravity="center" |
213 | android:orientation="vertical" | 213 | android:orientation="vertical" |
214 | app:layout_constraintEnd_toEndOf="parent" | 214 | app:layout_constraintEnd_toEndOf="parent" |
215 | app:layout_constraintStart_toStartOf="parent" | 215 | app:layout_constraintStart_toStartOf="parent" |
216 | app:layout_constraintTop_toBottomOf="@+id/tvLosProductos"> | 216 | app:layout_constraintTop_toBottomOf="@+id/tvLosProductos"> |
217 | 217 | ||
218 | <RadioButton | 218 | <RadioButton |
219 | android:id="@+id/rbProInclu" | 219 | android:id="@+id/rbProInclu" |
220 | android:layout_width="match_parent" | 220 | android:layout_width="match_parent" |
221 | android:layout_height="wrap_content" | 221 | android:layout_height="wrap_content" |
222 | 222 | ||
223 | android:layout_margin="@dimen/PadingCbyRb" | 223 | android:layout_margin="@dimen/PadingCbyRb" |
224 | android:checked="true" | 224 | android:checked="true" |
225 | android:padding="@dimen/PadingCbyRb" | 225 | android:padding="@dimen/PadingCbyRb" |
226 | android:text="@string/rbProInclu" | 226 | android:text="@string/rbProInclu" |
227 | android:textSize="@dimen/NormalText" /> | 227 | android:textSize="@dimen/NormalText" /> |
228 | 228 | ||
229 | <RadioButton | 229 | <RadioButton |
230 | android:id="@+id/rbProNoInclu" | 230 | android:id="@+id/rbProNoInclu" |
231 | android:layout_width="match_parent" | 231 | android:layout_width="match_parent" |
232 | android:layout_height="wrap_content" | 232 | android:layout_height="wrap_content" |
233 | android:layout_margin="@dimen/PadingCbyRb" | 233 | android:layout_margin="@dimen/PadingCbyRb" |
234 | android:checked="false" | 234 | android:checked="false" |
235 | android:padding="@dimen/PadingCbyRb" | 235 | android:padding="@dimen/PadingCbyRb" |
236 | android:text="@string/rbProNoInclu" | 236 | android:text="@string/rbProNoInclu" |
237 | android:textSize="@dimen/NormalText" /> | 237 | android:textSize="@dimen/NormalText" /> |
238 | 238 | ||
239 | </RadioGroup> | 239 | </RadioGroup> |
240 | 240 | ||
241 | <CheckBox | 241 | <CheckBox |
242 | android:id="@+id/cbHabiLectura" | 242 | android:id="@+id/cbHabiLectura" |
243 | android:layout_width="0dp" | 243 | android:layout_width="0dp" |
244 | android:layout_height="wrap_content" | 244 | android:layout_height="wrap_content" |
245 | android:layout_margin="@dimen/PadingCbyRb" | 245 | android:layout_margin="@dimen/PadingCbyRb" |
246 | android:padding="@dimen/PadingCbyRb" | 246 | android:padding="@dimen/PadingCbyRb" |
247 | android:text="@string/cbHabiLectura" | 247 | android:text="@string/cbHabiLectura" |
248 | android:textSize="@dimen/NormalText" | 248 | android:textSize="@dimen/NormalText" |
249 | app:layout_constraintEnd_toEndOf="parent" | 249 | app:layout_constraintEnd_toEndOf="parent" |
250 | app:layout_constraintStart_toStartOf="parent" | 250 | app:layout_constraintStart_toStartOf="parent" |
251 | app:layout_constraintTop_toBottomOf="@+id/rgLosProductos" /> | 251 | app:layout_constraintTop_toBottomOf="@+id/rgLosProductos" /> |
252 | 252 | ||
253 | <CheckBox | 253 | <CheckBox |
254 | android:id="@+id/cbMostrarStock" | 254 | android:id="@+id/cbMostrarStock" |
255 | android:layout_width="0dp" | 255 | android:layout_width="0dp" |
256 | android:layout_height="wrap_content" | 256 | android:layout_height="wrap_content" |
257 | android:layout_margin="@dimen/PadingCbyRb" | 257 | android:layout_margin="@dimen/PadingCbyRb" |
258 | android:padding="@dimen/PadingCbyRb" | 258 | android:padding="@dimen/PadingCbyRb" |
259 | android:text="@string/cbMostrarStock" | 259 | android:text="@string/cbMostrarStock" |
260 | android:textSize="@dimen/NormalText" | 260 | android:textSize="@dimen/NormalText" |
261 | app:layout_constraintEnd_toEndOf="parent" | 261 | app:layout_constraintEnd_toEndOf="parent" |
262 | app:layout_constraintStart_toStartOf="parent" | 262 | app:layout_constraintStart_toStartOf="parent" |
263 | app:layout_constraintTop_toBottomOf="@+id/cbHabiLectura" /> | 263 | app:layout_constraintTop_toBottomOf="@+id/cbHabiLectura" /> |
264 | 264 | ||
265 | <TextView | 265 | <TextView |
266 | android:id="@+id/tvColumMostrar" | 266 | android:id="@+id/tvColumMostrar" |
267 | android:layout_width="0dp" | 267 | android:layout_width="0dp" |
268 | android:layout_height="wrap_content" | 268 | android:layout_height="wrap_content" |
269 | 269 | ||
270 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 270 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
271 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" | 271 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" |
272 | android:gravity="start" | 272 | android:gravity="start" |
273 | android:lines="1" | 273 | android:lines="1" |
274 | android:text="@string/tvColumMostrar" | 274 | android:text="@string/tvColumMostrar" |
275 | android:textColor="@android:color/black" | 275 | android:textColor="@android:color/black" |
276 | android:textSize="@dimen/SubTitulos" | 276 | android:textSize="@dimen/SubTitulos" |
277 | app:fontFamily="sans-serif-condensed" | 277 | app:fontFamily="sans-serif-condensed" |
278 | app:layout_constraintEnd_toEndOf="parent" | 278 | app:layout_constraintEnd_toEndOf="parent" |
279 | app:layout_constraintStart_toStartOf="parent" | 279 | app:layout_constraintStart_toStartOf="parent" |
280 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarStock" /> | 280 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarStock" /> |
281 | 281 | ||
282 | <RadioGroup | 282 | <RadioGroup |
283 | android:id="@+id/rgCodigosMostrar" | 283 | android:id="@+id/rgCodigosMostrar" |
284 | android:layout_width="0dp" | 284 | android:layout_width="0dp" |
285 | android:layout_height="wrap_content" | 285 | android:layout_height="wrap_content" |
286 | 286 | ||
287 | android:gravity="center" | 287 | android:gravity="center" |
288 | android:orientation="horizontal" | 288 | android:orientation="horizontal" |
289 | app:layout_constraintEnd_toEndOf="parent" | 289 | app:layout_constraintEnd_toEndOf="parent" |
290 | app:layout_constraintStart_toStartOf="parent" | 290 | app:layout_constraintStart_toStartOf="parent" |
291 | app:layout_constraintTop_toBottomOf="@+id/tvColumMostrar"> | 291 | app:layout_constraintTop_toBottomOf="@+id/tvColumMostrar"> |
292 | 292 | ||
293 | <RadioButton | 293 | <RadioButton |
294 | android:id="@+id/rbCodigoDebo" | 294 | android:id="@+id/rbCodigoDebo" |
295 | android:layout_width="wrap_content" | 295 | android:layout_width="wrap_content" |
296 | android:layout_height="wrap_content" | 296 | android:layout_height="wrap_content" |
297 | android:layout_margin="5dp" | 297 | android:layout_margin="5dp" |
298 | android:checked="true" | 298 | android:checked="true" |
299 | android:padding="5dp" | 299 | android:padding="5dp" |
300 | android:text="@string/rbCodigoDebo" | 300 | android:text="@string/rbCodigoDebo" |
301 | android:textSize="@dimen/NormalText" /> | 301 | android:textSize="@dimen/NormalText" /> |
302 | 302 | ||
303 | <RadioButton | 303 | <RadioButton |
304 | android:id="@+id/rbCodigoOrigen" | 304 | android:id="@+id/rbCodigoOrigen" |
305 | android:layout_width="wrap_content" | 305 | android:layout_width="wrap_content" |
306 | android:layout_height="wrap_content" | 306 | android:layout_height="wrap_content" |
307 | android:layout_margin="5dp" | 307 | android:layout_margin="5dp" |
308 | android:checked="false" | 308 | android:checked="false" |
309 | android:padding="5dp" | 309 | android:padding="5dp" |
310 | android:text="@string/rbCodigoOrigen" | 310 | android:text="@string/rbCodigoOrigen" |
311 | android:textSize="@dimen/NormalText" /> | 311 | android:textSize="@dimen/NormalText" /> |
312 | 312 | ||
313 | <RadioButton | 313 | <RadioButton |
314 | android:id="@+id/rbCodigoBarras" | 314 | android:id="@+id/rbCodigoBarras" |
315 | android:layout_width="wrap_content" | 315 | android:layout_width="wrap_content" |
316 | android:layout_height="wrap_content" | 316 | android:layout_height="wrap_content" |
317 | android:layout_margin="5dp" | 317 | android:layout_margin="5dp" |
318 | android:padding="5dp" | 318 | android:padding="5dp" |
319 | android:text="@string/rbCodigoBarras" | 319 | android:text="@string/rbCodigoBarras" |
320 | android:textSize="@dimen/NormalText" /> | 320 | android:textSize="@dimen/NormalText" /> |
321 | </RadioGroup> | 321 | </RadioGroup> |
322 | 322 | ||
323 | <CheckBox | 323 | <CheckBox |
324 | android:id="@+id/cbMostrarExistencia" | 324 | android:id="@+id/cbMostrarExistencia" |
325 | android:layout_width="wrap_content" | 325 | android:layout_width="wrap_content" |
326 | android:layout_height="wrap_content" | 326 | android:layout_height="wrap_content" |
327 | android:layout_margin="@dimen/PadingCbyRb" | 327 | android:layout_margin="@dimen/PadingCbyRb" |
328 | android:padding="@dimen/PadingCbyRb" | 328 | android:padding="@dimen/PadingCbyRb" |
329 | android:text="@string/cbMostrarExistencia" | 329 | android:text="@string/cbMostrarExistencia" |
330 | android:textSize="@dimen/NormalText" | 330 | android:textSize="@dimen/NormalText" |
331 | android:checked="false" | 331 | android:checked="false" |
332 | app:layout_constraintEnd_toStartOf="@+id/cbMostrarPrecio" | 332 | app:layout_constraintEnd_toStartOf="@+id/cbMostrarPrecio" |
333 | app:layout_constraintStart_toStartOf="parent" | 333 | app:layout_constraintStart_toStartOf="parent" |
334 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> | 334 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> |
335 | 335 | ||
336 | <CheckBox | 336 | <CheckBox |
337 | android:id="@+id/cbMostrarPrecio" | 337 | android:id="@+id/cbMostrarPrecio" |
338 | android:layout_width="wrap_content" | 338 | android:layout_width="wrap_content" |
339 | android:layout_height="wrap_content" | 339 | android:layout_height="wrap_content" |
340 | android:layout_margin="@dimen/PadingCbyRb" | 340 | android:layout_margin="@dimen/PadingCbyRb" |
341 | android:padding="@dimen/PadingCbyRb" | 341 | android:padding="@dimen/PadingCbyRb" |
342 | android:text="@string/cbMostrarPrecio" | 342 | android:text="@string/cbMostrarPrecio" |
343 | android:textSize="@dimen/NormalText" | 343 | android:textSize="@dimen/NormalText" |
344 | android:checked="false" | 344 | android:checked="false" |
345 | app:layout_constraintEnd_toEndOf="parent" | 345 | app:layout_constraintEnd_toEndOf="parent" |
346 | app:layout_constraintStart_toEndOf="@+id/cbMostrarExistencia" | 346 | app:layout_constraintStart_toEndOf="@+id/cbMostrarExistencia" |
347 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> | 347 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> |
348 | 348 | ||
349 | <Button | 349 | <Button |
350 | android:id="@+id/btnGuardar" | 350 | android:id="@+id/btnGuardar" |
351 | android:layout_width="wrap_content" | 351 | android:layout_width="wrap_content" |
352 | android:layout_height="wrap_content" | 352 | android:layout_height="wrap_content" |
353 | android:text="@string/btnGuardar" | 353 | android:text="@string/btnGuardar" |
354 | android:textSize="@dimen/NormalText" | 354 | android:textSize="@dimen/NormalText" |
355 | app:layout_constraintEnd_toEndOf="parent" | 355 | app:layout_constraintEnd_toEndOf="parent" |
356 | android:textColor="@android:color/white" | 356 | android:textColor="@android:color/white" |
357 | android:padding="10dp" | 357 | android:padding="10dp" |
358 | android:background="@drawable/boton_borde_redondeado" | 358 | android:background="@drawable/boton_borde_redondeado" |
359 | app:layout_constraintStart_toStartOf="parent" | 359 | app:layout_constraintStart_toStartOf="parent" |
360 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarPrecio" /> | 360 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarPrecio" /> |
361 | 361 | ||
362 | </androidx.constraintlayout.widget.ConstraintLayout> | 362 | </androidx.constraintlayout.widget.ConstraintLayout> |
363 | 363 | ||
364 | 364 |
app/src/main/res/layout/fragment_descripcion.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | ||
3 | 3 | ||
4 | <androidx.constraintlayout.widget.ConstraintLayout | 4 | <androidx.constraintlayout.widget.ConstraintLayout |
5 | xmlns:android="http://schemas.android.com/apk/res/android" | 5 | xmlns:android="http://schemas.android.com/apk/res/android" |
6 | xmlns:app="http://schemas.android.com/apk/res-auto" | 6 | xmlns:app="http://schemas.android.com/apk/res-auto" |
7 | xmlns:tools="http://schemas.android.com/tools" | 7 | xmlns:tools="http://schemas.android.com/tools" |
8 | android:layout_width="match_parent" | 8 | android:layout_width="match_parent" |
9 | android:layout_height="match_parent" | 9 | android:layout_height="match_parent" |
10 | tools:context=".ui.descripcionFragment.DescripcionFragment"> | 10 | tools:context=".UI.descripcionFragment.DescripcionFragment"> |
11 | 11 | ||
12 | 12 | ||
13 | <androidx.recyclerview.widget.RecyclerView | 13 | <androidx.recyclerview.widget.RecyclerView |
14 | android:id="@+id/rcDescripcion" | 14 | android:id="@+id/rcDescripcion" |
15 | android:layout_width="match_parent" | 15 | android:layout_width="match_parent" |
16 | android:layout_height="0dp" | 16 | android:layout_height="0dp" |
17 | android:background="@android:color/darker_gray" | 17 | android:background="@android:color/darker_gray" |
18 | android:scrollbars="vertical" | 18 | android:scrollbars="vertical" |
19 | app:layout_constraintTop_toBottomOf="@id/guideline4" | 19 | app:layout_constraintTop_toBottomOf="@id/guideline4" |
20 | app:layout_constraintBottom_toTopOf="@+id/guideline6" | 20 | app:layout_constraintBottom_toTopOf="@+id/guideline6" |
21 | app:layout_constraintEnd_toEndOf="parent" | 21 | app:layout_constraintEnd_toEndOf="parent" |
22 | app:layout_constraintStart_toStartOf="parent" | 22 | app:layout_constraintStart_toStartOf="parent" |
23 | tools:listitem="@layout/item" /> | 23 | tools:listitem="@layout/item" /> |
24 | 24 | ||
25 | <!-- <Button--> | 25 | <!-- <Button--> |
26 | <!-- android:id="@+id/btnSalir"--> | 26 | <!-- android:id="@+id/btnSalir"--> |
27 | <!-- android:layout_width="0dp"--> | 27 | <!-- android:layout_width="0dp"--> |
28 | <!-- android:layout_height="wrap_content"--> | 28 | <!-- android:layout_height="wrap_content"--> |
29 | <!-- android:text="@string/btnCancelar"--> | 29 | <!-- android:text="@string/btnCancelar"--> |
30 | <!-- android:textColor="@android:color/white"--> | 30 | <!-- android:textColor="@android:color/white"--> |
31 | <!-- android:padding="10dp"--> | 31 | <!-- android:padding="10dp"--> |
32 | <!-- android:background="@drawable/boton_borde_redondeado"--> | 32 | <!-- android:background="@drawable/boton_borde_redondeado"--> |
33 | <!-- app:layout_constraintBottom_toBottomOf="@+id/guideline6"--> | 33 | <!-- app:layout_constraintBottom_toBottomOf="@+id/guideline6"--> |
34 | <!-- app:layout_constraintEnd_toEndOf="parent"--> | 34 | <!-- app:layout_constraintEnd_toEndOf="parent"--> |
35 | <!-- app:layout_constraintHorizontal_chainStyle="spread"--> | 35 | <!-- app:layout_constraintHorizontal_chainStyle="spread"--> |
36 | <!-- app:layout_constraintStart_toStartOf="parent"--> | 36 | <!-- app:layout_constraintStart_toStartOf="parent"--> |
37 | <!-- app:layout_constraintTop_toBottomOf="@+id/rcInventarios" />--> | 37 | <!-- app:layout_constraintTop_toBottomOf="@+id/rcInventarios" />--> |
38 | 38 | ||
39 | <androidx.constraintlayout.widget.Guideline | 39 | <androidx.constraintlayout.widget.Guideline |
40 | android:id="@+id/guideline4" | 40 | android:id="@+id/guideline4" |
41 | android:layout_width="wrap_content" | 41 | android:layout_width="wrap_content" |
42 | android:layout_height="wrap_content" | 42 | android:layout_height="wrap_content" |
43 | android:orientation="horizontal" | 43 | android:orientation="horizontal" |
44 | app:layout_constraintGuide_percent="0.06" /> | 44 | app:layout_constraintGuide_percent="0.06" /> |
45 | 45 | ||
46 | <androidx.constraintlayout.widget.Guideline | 46 | <androidx.constraintlayout.widget.Guideline |
47 | android:id="@+id/guideline5" | 47 | android:id="@+id/guideline5" |
48 | android:layout_width="wrap_content" | 48 | android:layout_width="wrap_content" |
49 | android:layout_height="wrap_content" | 49 | android:layout_height="wrap_content" |
50 | android:orientation="horizontal" | 50 | android:orientation="horizontal" |
51 | app:layout_constraintGuide_percent="0.88" /> | 51 | app:layout_constraintGuide_percent="0.88" /> |
52 | 52 | ||
53 | <androidx.constraintlayout.widget.Guideline | 53 | <androidx.constraintlayout.widget.Guideline |
54 | android:id="@+id/guideline6" | 54 | android:id="@+id/guideline6" |
55 | android:layout_width="wrap_content" | 55 | android:layout_width="wrap_content" |
56 | android:layout_height="wrap_content" | 56 | android:layout_height="wrap_content" |
57 | android:orientation="horizontal" | 57 | android:orientation="horizontal" |
58 | app:layout_constraintGuide_percent="0.97" /> | 58 | app:layout_constraintGuide_percent="0.97" /> |
59 | </androidx.constraintlayout.widget.ConstraintLayout> | 59 | </androidx.constraintlayout.widget.ConstraintLayout> |
60 | 60 |
app/src/main/res/layout/fragment_inventario.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:id="@+id/frameLayout" | 5 | android:id="@+id/frameLayout" |
6 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
7 | android:layout_height="match_parent" | 7 | android:layout_height="match_parent" |
8 | tools:context=".ui.inventario.InventarioFragment"> | 8 | tools:context=".UI.inventario.InventarioFragment"> |
9 | 9 | ||
10 | 10 | ||
11 | <androidx.appcompat.widget.AppCompatTextView | 11 | <androidx.appcompat.widget.AppCompatTextView |
12 | android:id="@+id/tvTitulo" | 12 | android:id="@+id/tvTitulo" |
13 | android:layout_width="match_parent" | 13 | android:layout_width="match_parent" |
14 | android:layout_height="90dp" | 14 | android:layout_height="90dp" |
15 | android:layout_marginStart="8dp" | 15 | android:layout_marginStart="8dp" |
16 | android:layout_marginEnd="8dp" | 16 | android:layout_marginEnd="8dp" |
17 | android:autoSizeMaxTextSize="100sp" | 17 | android:autoSizeMaxTextSize="100sp" |
18 | android:autoSizeMinTextSize="20sp" | 18 | android:autoSizeMinTextSize="20sp" |
19 | android:autoSizeStepGranularity="5sp" | 19 | android:autoSizeStepGranularity="5sp" |
20 | android:autoSizeTextType="uniform" | 20 | android:autoSizeTextType="uniform" |
21 | android:gravity="center" | 21 | android:gravity="center" |
22 | android:lines="1" | 22 | android:lines="1" |
23 | android:text="@string/invTitulo" | 23 | android:text="@string/invTitulo" |
24 | android:textColor="@color/colorAccent" | 24 | android:textColor="@color/colorAccent" |
25 | app:fontFamily="sans-serif-condensed" | 25 | app:fontFamily="sans-serif-condensed" |
26 | app:layout_constraintBottom_toTopOf="@id/guideline2" | 26 | app:layout_constraintBottom_toTopOf="@id/guideline2" |
27 | app:layout_constraintEnd_toEndOf="parent" | 27 | app:layout_constraintEnd_toEndOf="parent" |
28 | app:layout_constraintStart_toStartOf="parent" | 28 | app:layout_constraintStart_toStartOf="parent" |
29 | app:layout_constraintTop_toTopOf="@id/guideline" /> | 29 | app:layout_constraintTop_toTopOf="@id/guideline" /> |
30 | 30 | ||
31 | 31 | ||
32 | <ImageButton | 32 | <ImageButton |
33 | android:id="@+id/ivCamara" | 33 | android:id="@+id/ivCamara" |
34 | android:layout_width="80dp" | 34 | android:layout_width="80dp" |
35 | android:layout_height="80dp" | 35 | android:layout_height="80dp" |
36 | android:layout_marginTop="15dp" | 36 | android:layout_marginTop="15dp" |
37 | android:clickable="true" | 37 | android:clickable="true" |
38 | android:contentDescription="@string/ibBusCB" | 38 | android:contentDescription="@string/ibBusCB" |
39 | android:elevation="5dp" | 39 | android:elevation="5dp" |
40 | android:background="@drawable/boton_redondo" | 40 | android:background="@drawable/boton_redondo" |
41 | android:layout_margin="10dp" | 41 | android:layout_margin="10dp" |
42 | android:focusable="false" | 42 | android:focusable="false" |
43 | android:scaleType="fitEnd" | 43 | android:scaleType="fitEnd" |
44 | app:layout_constraintCircleRadius="40dp" | 44 | app:layout_constraintCircleRadius="40dp" |
45 | android:src="@drawable/codbar" | 45 | android:src="@drawable/codbar" |
46 | app:layout_constraintBottom_toTopOf="@id/guideline3" | 46 | app:layout_constraintBottom_toTopOf="@id/guideline3" |
47 | app:layout_constraintEnd_toStartOf="@+id/etCodigoBarras" | 47 | app:layout_constraintEnd_toStartOf="@+id/etCodigoBarras" |
48 | app:layout_constraintHorizontal_bias="0.0" | 48 | app:layout_constraintHorizontal_bias="0.0" |
49 | app:layout_constraintStart_toStartOf="parent" | 49 | app:layout_constraintStart_toStartOf="parent" |
50 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> | 50 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> |
51 | 51 | ||
52 | <EditText | 52 | <EditText |
53 | android:id="@+id/etCodigoBarras" | 53 | android:id="@+id/etCodigoBarras" |
54 | android:layout_width="0dp" | 54 | android:layout_width="0dp" |
55 | android:layout_height="wrap_content" | 55 | android:layout_height="wrap_content" |
56 | android:autofillHints="" | 56 | android:autofillHints="" |
57 | android:clickable="true" | 57 | android:clickable="true" |
58 | android:ems="10" | 58 | android:ems="10" |
59 | android:focusable="true" | 59 | android:focusable="true" |
60 | android:hint="@string/ibBusCB" | 60 | android:hint="@string/ibBusCB" |
61 | android:inputType="textPersonName" | 61 | android:inputType="textPersonName" |
62 | android:lines="1" | 62 | android:lines="1" |
63 | android:textAllCaps="true" | 63 | android:textAllCaps="true" |
64 | android:textSize="20sp" | 64 | android:textSize="20sp" |
65 | app:layout_constraintBottom_toTopOf="@+id/guideline3" | 65 | app:layout_constraintBottom_toTopOf="@+id/guideline3" |
66 | app:layout_constraintEnd_toStartOf="@+id/swSumaUno" | 66 | app:layout_constraintEnd_toStartOf="@+id/swSumaUno" |
67 | app:layout_constraintHorizontal_bias="0.49" | 67 | app:layout_constraintHorizontal_bias="0.49" |
68 | app:layout_constraintHorizontal_chainStyle="packed" | 68 | app:layout_constraintHorizontal_chainStyle="packed" |
69 | app:layout_constraintStart_toEndOf="@+id/ivCamara" | 69 | app:layout_constraintStart_toEndOf="@+id/ivCamara" |
70 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> | 70 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> |
71 | 71 | ||
72 | 72 | ||
73 | <Switch | 73 | <Switch |
74 | android:id="@+id/swSumaUno" | 74 | android:id="@+id/swSumaUno" |
75 | android:layout_width="wrap_content" | 75 | android:layout_width="wrap_content" |
76 | android:layout_height="wrap_content" | 76 | android:layout_height="wrap_content" |
77 | android:text="@string/switch_1" | 77 | android:text="@string/switch_1" |
78 | app:layout_constraintBaseline_toBaselineOf="@+id/etCodigoBarras" | 78 | app:layout_constraintBaseline_toBaselineOf="@+id/etCodigoBarras" |
79 | app:layout_constraintEnd_toEndOf="parent" | 79 | app:layout_constraintEnd_toEndOf="parent" |
80 | app:layout_constraintStart_toEndOf="@id/etCodigoBarras" | 80 | app:layout_constraintStart_toEndOf="@id/etCodigoBarras" |
81 | tools:ignore="UseSwitchCompatOrMaterialXml" /> | 81 | tools:ignore="UseSwitchCompatOrMaterialXml" /> |
82 | 82 | ||
83 | <androidx.recyclerview.widget.RecyclerView | 83 | <androidx.recyclerview.widget.RecyclerView |
84 | android:id="@+id/rcInventarios" | 84 | android:id="@+id/rcInventarios" |
85 | android:layout_width="match_parent" | 85 | android:layout_width="match_parent" |
86 | android:layout_height="0dp" | 86 | android:layout_height="0dp" |
87 | android:background="@android:color/darker_gray" | 87 | android:background="@android:color/darker_gray" |
88 | app:layout_constraintBottom_toBottomOf="@+id/guideline5" | 88 | app:layout_constraintBottom_toBottomOf="@+id/guideline5" |
89 | app:layout_constraintEnd_toEndOf="parent" | 89 | app:layout_constraintEnd_toEndOf="parent" |
90 | app:layout_constraintStart_toStartOf="parent" | 90 | app:layout_constraintStart_toStartOf="parent" |
91 | app:layout_constraintTop_toBottomOf="@+id/guideline4" | 91 | app:layout_constraintTop_toBottomOf="@+id/guideline4" |
92 | tools:listitem="@layout/item" /> | 92 | tools:listitem="@layout/item" /> |
93 | 93 | ||
94 | 94 | ||
95 | <Button | 95 | <Button |
96 | android:id="@+id/btnExportarInv" | 96 | android:id="@+id/btnExportarInv" |
97 | android:layout_width="wrap_content" | 97 | android:layout_width="wrap_content" |
98 | android:layout_height="wrap_content" | 98 | android:layout_height="wrap_content" |
99 | android:text="@string/btnExportarInv" | 99 | android:text="@string/btnExportarInv" |
100 | android:textColor="@android:color/white" | 100 | android:textColor="@android:color/white" |
101 | android:padding="10dp" | 101 | android:padding="10dp" |
102 | android:background="@drawable/boton_borde_redondeado" | 102 | android:background="@drawable/boton_borde_redondeado" |
103 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" | 103 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" |
104 | app:layout_constraintEnd_toEndOf="parent" | 104 | app:layout_constraintEnd_toEndOf="parent" |
105 | app:layout_constraintHorizontal_chainStyle="spread" | 105 | app:layout_constraintHorizontal_chainStyle="spread" |
106 | app:layout_constraintStart_toEndOf="@+id/btnBorrarInv" | 106 | app:layout_constraintStart_toEndOf="@+id/btnBorrarInv" |
107 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> | 107 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> |
108 | 108 | ||
109 | <Button | 109 | <Button |
110 | android:id="@+id/btnBorrarInv" | 110 | android:id="@+id/btnBorrarInv" |
111 | android:layout_width="wrap_content" | 111 | android:layout_width="wrap_content" |
112 | android:layout_height="wrap_content" | 112 | android:layout_height="wrap_content" |
113 | android:text="@string/btnBorrarInv" | 113 | android:text="@string/btnBorrarInv" |
114 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" | 114 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" |
115 | app:layout_constraintEnd_toStartOf="@id/btnExportarInv" | 115 | app:layout_constraintEnd_toStartOf="@id/btnExportarInv" |
116 | app:layout_constraintHorizontal_chainStyle="spread" | 116 | app:layout_constraintHorizontal_chainStyle="spread" |
117 | app:layout_constraintStart_toStartOf="parent" | 117 | app:layout_constraintStart_toStartOf="parent" |
118 | android:textColor="@android:color/white" | 118 | android:textColor="@android:color/white" |
119 | android:padding="10dp" | 119 | android:padding="10dp" |
120 | android:background="@drawable/boton_borde_redondeado" | 120 | android:background="@drawable/boton_borde_redondeado" |
121 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> | 121 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> |
122 | 122 | ||
123 | <androidx.constraintlayout.widget.Guideline | 123 | <androidx.constraintlayout.widget.Guideline |
124 | android:id="@+id/guideline" | 124 | android:id="@+id/guideline" |
125 | android:layout_width="wrap_content" | 125 | android:layout_width="wrap_content" |
126 | android:layout_height="wrap_content" | 126 | android:layout_height="wrap_content" |
127 | android:orientation="horizontal" | 127 | android:orientation="horizontal" |
128 | app:layout_constraintGuide_percent="0.02" /> | 128 | app:layout_constraintGuide_percent="0.02" /> |
129 | 129 | ||
130 | <androidx.constraintlayout.widget.Guideline | 130 | <androidx.constraintlayout.widget.Guideline |
131 | android:id="@+id/guideline2" | 131 | android:id="@+id/guideline2" |
132 | android:layout_width="wrap_content" | 132 | android:layout_width="wrap_content" |
133 | android:layout_height="wrap_content" | 133 | android:layout_height="wrap_content" |
134 | android:orientation="horizontal" | 134 | android:orientation="horizontal" |
135 | app:layout_constraintGuide_percent="0.12" /> | 135 | app:layout_constraintGuide_percent="0.12" /> |
136 | 136 | ||
137 | <androidx.constraintlayout.widget.Guideline | 137 | <androidx.constraintlayout.widget.Guideline |
138 | android:id="@+id/guideline3" | 138 | android:id="@+id/guideline3" |
139 | android:layout_width="wrap_content" | 139 | android:layout_width="wrap_content" |
140 | android:layout_height="wrap_content" | 140 | android:layout_height="wrap_content" |
141 | android:orientation="horizontal" | 141 | android:orientation="horizontal" |
142 | app:layout_constraintGuide_percent="0.29" /> | 142 | app:layout_constraintGuide_percent="0.29" /> |
143 | 143 | ||
144 | <androidx.constraintlayout.widget.Guideline | 144 | <androidx.constraintlayout.widget.Guideline |
145 | android:id="@+id/guideline4" | 145 | android:id="@+id/guideline4" |
146 | android:layout_width="wrap_content" | 146 | android:layout_width="wrap_content" |
147 | android:layout_height="wrap_content" | 147 | android:layout_height="wrap_content" |
148 | android:orientation="horizontal" | 148 | android:orientation="horizontal" |
149 | app:layout_constraintGuide_percent="0.35" /> | 149 | app:layout_constraintGuide_percent="0.35" /> |
150 | 150 | ||
151 | <androidx.constraintlayout.widget.Guideline | 151 | <androidx.constraintlayout.widget.Guideline |
152 | android:id="@+id/guideline5" | 152 | android:id="@+id/guideline5" |
153 | android:layout_width="wrap_content" | 153 | android:layout_width="wrap_content" |
154 | android:layout_height="wrap_content" | 154 | android:layout_height="wrap_content" |
155 | android:orientation="horizontal" | 155 | android:orientation="horizontal" |
156 | app:layout_constraintGuide_percent="0.88" /> | 156 | app:layout_constraintGuide_percent="0.88" /> |
157 | 157 | ||
158 | <androidx.constraintlayout.widget.Guideline | 158 | <androidx.constraintlayout.widget.Guideline |
159 | android:id="@+id/guideline6" | 159 | android:id="@+id/guideline6" |
160 | android:layout_width="wrap_content" | 160 | android:layout_width="wrap_content" |
161 | android:layout_height="wrap_content" | 161 | android:layout_height="wrap_content" |
162 | android:orientation="horizontal" | 162 | android:orientation="horizontal" |
163 | app:layout_constraintGuide_percent="0.97" /> | 163 | app:layout_constraintGuide_percent="0.97" /> |
164 | 164 | ||
165 | 165 | ||
166 | </androidx.constraintlayout.widget.ConstraintLayout> | 166 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/fragment_main.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
6 | android:layout_height="match_parent"> | 6 | android:layout_height="match_parent"> |
7 | 7 | ||
8 | <androidx.appcompat.widget.AppCompatTextView | 8 | <androidx.appcompat.widget.AppCompatTextView |
9 | android:id="@+id/tvInvDinamicos" | 9 | android:id="@+id/tvInvDinamicos" |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="90dp" | 11 | android:layout_height="90dp" |
12 | android:autoSizeMaxTextSize="150sp" | 12 | android:autoSizeMaxTextSize="150sp" |
13 | android:autoSizeMinTextSize="25sp" | 13 | android:autoSizeMinTextSize="25sp" |
14 | android:autoSizeStepGranularity="5sp" | 14 | android:autoSizeStepGranularity="5sp" |
15 | android:autoSizeTextType="uniform" | 15 | android:autoSizeTextType="uniform" |
16 | android:gravity="center" | 16 | android:gravity="start" |
17 | android:lines="1" | ||
17 | android:padding="10dp" | 18 | android:padding="10dp" |
18 | android:text="@string/invDinamicoVenta" | 19 | android:text="@string/invDinamicoVenta" |
19 | android:textColor="@color/colorAccent" | 20 | android:textColor="@color/colorAccent" |
20 | android:visibility="visible" | 21 | android:visibility="visible" |
21 | app:fontFamily="sans-serif" | 22 | app:fontFamily="sans-serif-condensed" |
22 | app:layout_constraintEnd_toEndOf="parent" | 23 | app:layout_constraintEnd_toEndOf="parent" |
23 | app:layout_constraintStart_toStartOf="parent" | 24 | app:layout_constraintStart_toStartOf="parent" |
24 | app:layout_constraintTop_toTopOf="parent" /> | 25 | app:layout_constraintTop_toTopOf="parent" /> |
25 | 26 | ||
26 | <androidx.appcompat.widget.AppCompatImageButton | 27 | <androidx.appcompat.widget.AppCompatImageButton |
27 | android:id="@+id/ivSort19" | 28 | android:id="@+id/ivSort19" |
28 | android:layout_width="50dp" | 29 | android:layout_width="50dp" |
29 | android:layout_height="50dp" | 30 | android:layout_height="50dp" |
30 | android:layout_marginStart="10dp" | 31 | android:layout_marginStart="10dp" |
31 | android:padding="5dp" | 32 | android:padding="5dp" |
32 | android:src="@drawable/ic_sort19" | 33 | android:src="@drawable/ic_sort19" |
33 | android:visibility="gone" | 34 | android:visibility="gone" |
34 | app:layout_constraintHorizontal_bias="0.0" | 35 | app:layout_constraintHorizontal_bias="0.0" |
35 | app:layout_constraintHorizontal_chainStyle="packed" | 36 | app:layout_constraintHorizontal_chainStyle="packed" |
36 | app:layout_constraintStart_toStartOf="parent" | 37 | app:layout_constraintStart_toStartOf="parent" |
37 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> | 38 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> |
38 | 39 | ||
39 | <androidx.appcompat.widget.AppCompatImageButton | 40 | <androidx.appcompat.widget.AppCompatImageButton |
40 | android:id="@+id/ivSort91" | 41 | android:id="@+id/ivSort91" |
41 | android:layout_width="50dp" | 42 | android:layout_width="50dp" |
42 | android:layout_height="50dp" | 43 | android:layout_height="50dp" |
43 | android:layout_marginStart="10dp" | 44 | android:layout_marginStart="10dp" |
44 | android:padding="5dp" | 45 | android:padding="5dp" |
45 | android:src="@drawable/ic_sort91" | 46 | android:src="@drawable/ic_sort91" |
46 | android:visibility="gone" | 47 | android:visibility="gone" |
47 | app:layout_constraintHorizontal_chainStyle="packed" | 48 | app:layout_constraintHorizontal_chainStyle="packed" |
48 | app:layout_constraintStart_toStartOf="parent" | 49 | app:layout_constraintStart_toStartOf="parent" |
49 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> | 50 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> |
50 | 51 | ||
51 | <TextView | 52 | <TextView |
52 | android:id="@+id/tvTipo" | 53 | android:id="@+id/tvTipo" |
53 | android:layout_width="wrap_content" | 54 | android:layout_width="wrap_content" |
54 | android:layout_height="wrap_content" | 55 | android:layout_height="wrap_content" |
55 | android:layout_margin="5dp" | 56 | android:layout_margin="5dp" |
56 | android:text="Tipo:" | 57 | android:text="Tipo:" |
57 | android:layout_marginTop="12dp" | 58 | android:layout_marginTop="12dp" |
58 | android:textSize="15sp" | 59 | android:textSize="15sp" |
59 | android:visibility="gone" | 60 | android:visibility="gone" |
60 | app:layout_constraintBaseline_toBaselineOf="@+id/cbVentas" | 61 | app:layout_constraintBaseline_toBaselineOf="@+id/cbVentas" |
61 | app:layout_constraintEnd_toStartOf="@+id/cbVentas" /> | 62 | app:layout_constraintEnd_toStartOf="@+id/cbVentas" /> |
62 | 63 | ||
63 | <com.google.android.material.checkbox.MaterialCheckBox | 64 | <com.google.android.material.checkbox.MaterialCheckBox |
64 | android:id="@+id/cbVentas" | 65 | android:id="@+id/cbVentas" |
65 | android:layout_width="wrap_content" | 66 | android:layout_width="wrap_content" |
66 | android:layout_height="wrap_content" | 67 | android:layout_height="wrap_content" |
67 | android:layout_margin="5dp" | 68 | android:layout_margin="5dp" |
68 | android:checked="true" | 69 | android:checked="true" |
69 | android:text="Ventas" | 70 | android:text="Ventas" |
70 | android:layout_marginTop="12dp" | 71 | android:layout_marginTop="12dp" |
71 | android:visibility="gone" | 72 | android:visibility="gone" |
72 | app:layout_constraintEnd_toStartOf="@+id/cbDeposito" | 73 | app:layout_constraintEnd_toStartOf="@+id/cbDeposito" |
73 | app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" /> | 74 | app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" /> |
74 | 75 | ||
75 | <com.google.android.material.checkbox.MaterialCheckBox | 76 | <com.google.android.material.checkbox.MaterialCheckBox |
76 | android:id="@+id/cbDeposito" | 77 | android:id="@+id/cbDeposito" |
77 | android:layout_width="wrap_content" | 78 | android:layout_width="wrap_content" |
78 | android:layout_height="wrap_content" | 79 | android:layout_height="wrap_content" |
79 | android:layout_margin="5dp" | 80 | android:layout_margin="5dp" |
80 | android:checked="true" | 81 | android:checked="true" |
81 | android:text="Deposito" | 82 | android:text="Deposito" |
82 | android:layout_marginTop="12dp" | 83 | android:layout_marginTop="12dp" |
83 | android:visibility="gone" | 84 | android:visibility="gone" |
84 | app:layout_constraintEnd_toEndOf="parent" | 85 | app:layout_constraintEnd_toEndOf="parent" |
85 | app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" /> | 86 | app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" /> |
86 | 87 | ||
87 | <androidx.recyclerview.widget.RecyclerView | 88 | <androidx.recyclerview.widget.RecyclerView |
88 | android:id="@+id/rcInventario" | 89 | android:id="@+id/rcInventario" |
89 | android:layout_width="match_parent" | 90 | android:layout_width="match_parent" |
90 | android:layout_height="0dp" | 91 | android:layout_height="0dp" |
91 | android:background="@android:color/darker_gray" | 92 | android:background="@android:color/darker_gray" |
92 | android:scrollbars="vertical" | 93 | android:scrollbars="vertical" |
93 | android:visibility="gone" | 94 | android:visibility="gone" |
94 | app:layout_constraintEnd_toEndOf="parent" | 95 | app:layout_constraintEnd_toEndOf="parent" |
95 | app:layout_constraintStart_toStartOf="parent" | 96 | app:layout_constraintStart_toStartOf="parent" |
96 | app:layout_constraintTop_toBottomOf="@id/ivSort19" | 97 | app:layout_constraintTop_toBottomOf="@id/ivSort19" |
97 | tools:listitem="@layout/item_principal" /> | 98 | tools:listitem="@layout/item_principal" /> |
98 | 99 | ||
99 | 100 | ||
100 | <androidx.appcompat.widget.AppCompatTextView | 101 | <androidx.appcompat.widget.AppCompatTextView |
101 | android:id="@+id/txtDeposito" | 102 | android:id="@+id/txtDeposito" |
102 | android:layout_width="match_parent" | 103 | android:layout_width="match_parent" |
103 | android:layout_height="90dp" | 104 | android:layout_height="90dp" |
104 | android:autoSizeMaxTextSize="150sp" | 105 | android:autoSizeMaxTextSize="150sp" |
105 | android:autoSizeMinTextSize="25sp" | 106 | android:autoSizeMinTextSize="25sp" |
106 | android:autoSizeStepGranularity="5sp" | 107 | android:autoSizeStepGranularity="5sp" |
107 | android:autoSizeTextType="uniform" | 108 | android:autoSizeTextType="uniform" |
108 | android:gravity="start" | 109 | android:gravity="start" |
109 | android:lines="1" | 110 | android:lines="1" |
110 | android:padding="10dp" | 111 | android:padding="10dp" |
111 | android:text="@string/invDinamicoCompra" | 112 | android:text="@string/invDinamicoCompra" |
112 | android:textColor="@color/colorAccent" | 113 | android:textColor="@color/colorAccent" |
113 | android:visibility="visible" | 114 | android:visibility="visible" |
114 | app:fontFamily="sans-serif-condensed" | 115 | app:fontFamily="sans-serif-condensed" |
115 | app:layout_constraintBottom_toBottomOf="parent" | 116 | app:layout_constraintBottom_toBottomOf="parent" |
116 | app:layout_constraintEnd_toEndOf="parent" | 117 | app:layout_constraintEnd_toEndOf="parent" |
117 | app:layout_constraintStart_toStartOf="parent" | 118 | app:layout_constraintStart_toStartOf="parent" |
118 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" | 119 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" |
119 | app:layout_constraintVertical_bias="0.0" /> | 120 | app:layout_constraintVertical_bias="0.0" /> |
120 | </androidx.constraintlayout.widget.ConstraintLayout> | 121 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/fragment_servidores.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <androidx.constraintlayout.widget.ConstraintLayout | 2 | <androidx.constraintlayout.widget.ConstraintLayout |
3 | xmlns:android="http://schemas.android.com/apk/res/android" | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
4 | xmlns:app="http://schemas.android.com/apk/res-auto" | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
5 | xmlns:tools="http://schemas.android.com/tools" | 5 | xmlns:tools="http://schemas.android.com/tools" |
6 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
7 | android:layout_height="match_parent" | 7 | android:layout_height="match_parent" |
8 | tools:context=".ui.servidores.ServidoresFragment"> | 8 | tools:context=".UI.servidores.ServidoresFragment"> |
9 | 9 | ||
10 | <androidx.appcompat.widget.AppCompatTextView | 10 | <androidx.appcompat.widget.AppCompatTextView |
11 | android:id="@+id/tvTitutloServer" | 11 | android:id="@+id/tvTitutloServer" |
12 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
13 | android:layout_height="90dp" | 13 | android:layout_height="90dp" |
14 | android:layout_marginStart="8dp" | 14 | android:layout_marginStart="8dp" |
15 | android:layout_marginTop="15dp" | 15 | android:layout_marginTop="15dp" |
16 | android:layout_marginEnd="8dp" | 16 | android:layout_marginEnd="8dp" |
17 | android:autoSizeMaxTextSize="100sp" | 17 | android:autoSizeMaxTextSize="100sp" |
18 | android:autoSizeMinTextSize="20sp" | 18 | android:autoSizeMinTextSize="20sp" |
19 | android:autoSizeStepGranularity="5sp" | 19 | android:autoSizeStepGranularity="5sp" |
20 | android:autoSizeTextType="uniform" | 20 | android:autoSizeTextType="uniform" |
21 | android:gravity="center" | 21 | android:gravity="center" |
22 | android:lines="1" | 22 | android:lines="1" |
23 | android:text="@string/tvTitutloServer" | 23 | android:text="@string/tvTitutloServer" |
24 | android:textColor="@color/colorAccent" | 24 | android:textColor="@color/colorAccent" |
25 | app:fontFamily="sans-serif-condensed" | 25 | app:fontFamily="sans-serif-condensed" |
26 | app:layout_constraintEnd_toEndOf="parent" | 26 | app:layout_constraintEnd_toEndOf="parent" |
27 | app:layout_constraintStart_toStartOf="parent" | 27 | app:layout_constraintStart_toStartOf="parent" |
28 | app:layout_constraintTop_toTopOf="parent" /> | 28 | app:layout_constraintTop_toTopOf="parent" /> |
29 | 29 | ||
30 | <TextView | 30 | <TextView |
31 | android:id="@+id/tvDirServer" | 31 | android:id="@+id/tvDirServer" |
32 | android:layout_width="match_parent" | 32 | android:layout_width="match_parent" |
33 | android:layout_height="wrap_content" | 33 | android:layout_height="wrap_content" |
34 | android:layout_margin="10dp" | 34 | android:layout_margin="10dp" |
35 | android:gravity="start" | 35 | android:gravity="start" |
36 | android:lines="1" | 36 | android:lines="1" |
37 | android:text="@string/tvDirServer" | 37 | android:text="@string/tvDirServer" |
38 | android:textColor="@android:color/black" | 38 | android:textColor="@android:color/black" |
39 | android:textSize="@dimen/TitulosMedios" | 39 | android:textSize="@dimen/TitulosMedios" |
40 | android:textStyle="bold|italic" | 40 | android:textStyle="bold|italic" |
41 | app:fontFamily="sans-serif-condensed" | 41 | app:fontFamily="sans-serif-condensed" |
42 | app:layout_constraintBottom_toTopOf="@+id/etDireccionServidor" | 42 | app:layout_constraintBottom_toTopOf="@+id/etDireccionServidor" |
43 | app:layout_constraintEnd_toEndOf="parent" | 43 | app:layout_constraintEnd_toEndOf="parent" |
44 | app:layout_constraintStart_toStartOf="parent" | 44 | app:layout_constraintStart_toStartOf="parent" |
45 | app:layout_constraintTop_toBottomOf="@id/tvTitutloServer" /> | 45 | app:layout_constraintTop_toBottomOf="@id/tvTitutloServer" /> |
46 | 46 | ||
47 | <EditText | 47 | <EditText |
48 | android:id="@+id/etDireccionServidor" | 48 | android:id="@+id/etDireccionServidor" |
49 | android:layout_width="0dp" | 49 | android:layout_width="0dp" |
50 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
51 | android:layout_margin="10dp" | 51 | android:layout_margin="10dp" |
52 | android:clickable="true" | 52 | android:clickable="true" |
53 | android:ems="10" | 53 | android:ems="10" |
54 | android:focusable="true" | 54 | android:focusable="true" |
55 | android:hint="192.168.10.1:9090" | 55 | android:hint="192.168.10.1:9090" |
56 | android:inputType="text" | 56 | android:inputType="text" |
57 | android:lines="1" | 57 | android:lines="1" |
58 | android:textSize="15sp" | 58 | android:textSize="15sp" |
59 | app:layout_constraintEnd_toEndOf="parent" | 59 | app:layout_constraintEnd_toEndOf="parent" |
60 | app:layout_constraintStart_toStartOf="parent" | 60 | app:layout_constraintStart_toStartOf="parent" |
61 | app:layout_constraintTop_toBottomOf="@id/tvDirServer" /> | 61 | app:layout_constraintTop_toBottomOf="@id/tvDirServer" /> |
62 | 62 | ||
63 | <TextView | 63 | <TextView |
64 | android:id="@+id/tvNomServer" | 64 | android:id="@+id/tvNomServer" |
65 | android:layout_width="match_parent" | 65 | android:layout_width="match_parent" |
66 | android:layout_height="wrap_content" | 66 | android:layout_height="wrap_content" |
67 | android:layout_margin="10dp" | 67 | android:layout_margin="10dp" |
68 | android:gravity="start" | 68 | android:gravity="start" |
69 | android:lines="1" | 69 | android:lines="1" |
70 | android:text="@string/tvNomServer" | 70 | android:text="@string/tvNomServer" |
71 | android:textColor="@android:color/black" | 71 | android:textColor="@android:color/black" |
72 | android:textSize="@dimen/TitulosMedios" | 72 | android:textSize="@dimen/TitulosMedios" |
73 | android:textStyle="bold|italic" | 73 | android:textStyle="bold|italic" |
74 | app:fontFamily="sans-serif-condensed" | 74 | app:fontFamily="sans-serif-condensed" |
75 | app:layout_constraintEnd_toEndOf="parent" | 75 | app:layout_constraintEnd_toEndOf="parent" |
76 | app:layout_constraintStart_toStartOf="parent" | 76 | app:layout_constraintStart_toStartOf="parent" |
77 | app:layout_constraintTop_toBottomOf="@id/etDireccionServidor" /> | 77 | app:layout_constraintTop_toBottomOf="@id/etDireccionServidor" /> |
78 | 78 | ||
79 | <EditText | 79 | <EditText |
80 | android:id="@+id/etNombreServidor" | 80 | android:id="@+id/etNombreServidor" |
81 | android:layout_width="match_parent" | 81 | android:layout_width="match_parent" |
82 | android:layout_height="wrap_content" | 82 | android:layout_height="wrap_content" |
83 | android:layout_margin="10dp" | 83 | android:layout_margin="10dp" |
84 | android:autofillHints="" | 84 | android:autofillHints="" |
85 | android:clickable="true" | 85 | android:clickable="true" |
86 | android:ems="10" | 86 | android:ems="10" |
87 | android:focusable="true" | 87 | android:focusable="true" |
88 | android:inputType="text" | 88 | android:inputType="text" |
89 | android:lines="1" | 89 | android:lines="1" |
90 | android:hint="Servidor Local" | 90 | android:hint="Servidor Local" |
91 | android:textSize="15sp" | 91 | android:textSize="15sp" |
92 | app:layout_constraintEnd_toEndOf="parent" | 92 | app:layout_constraintEnd_toEndOf="parent" |
93 | app:layout_constraintStart_toStartOf="parent" | 93 | app:layout_constraintStart_toStartOf="parent" |
94 | app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> | 94 | app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> |
95 | 95 | ||
96 | 96 | ||
97 | <androidx.recyclerview.widget.RecyclerView | 97 | <androidx.recyclerview.widget.RecyclerView |
98 | android:id="@+id/rvServidores" | 98 | android:id="@+id/rvServidores" |
99 | android:layout_width="0dp" | 99 | android:layout_width="match_parent" |
100 | android:layout_height="0dp" | 100 | android:layout_height="0dp" |
101 | android:layout_marginTop="10dp" | 101 | android:layout_marginTop="10dp" |
102 | app:layout_goneMarginEnd="10dp" | 102 | app:layout_goneMarginEnd="10dp" |
103 | android:background="@android:color/darker_gray" | 103 | android:background="@android:color/darker_gray" |
104 | app:layout_constraintBottom_toTopOf="@+id/btnGuardarServidores" | 104 | app:layout_constraintBottom_toTopOf="@+id/btnGuardarServidores" |
105 | app:layout_constraintEnd_toEndOf="parent" | 105 | app:layout_constraintEnd_toEndOf="parent" |
106 | app:layout_constraintStart_toStartOf="parent" | 106 | app:layout_constraintStart_toStartOf="parent" |
107 | app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" | 107 | app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" |
108 | tools:listitem="@layout/item_servidores" /> | 108 | tools:listitem="@layout/item_servidores" /> |
109 | 109 | ||
110 | <Button | 110 | <Button |
111 | android:id="@+id/btnGuardarServidores" | 111 | android:id="@+id/btnGuardarServidores" |
112 | android:layout_width="0dp" | 112 | android:layout_width="0dp" |
113 | android:layout_height="wrap_content" | 113 | android:layout_height="wrap_content" |
114 | android:layout_marginTop="10dp" | 114 | android:layout_marginTop="10dp" |
115 | android:layout_marginEnd="10dp" | 115 | android:layout_marginEnd="10dp" |
116 | android:text="@string/btnGuardarServidores" | 116 | android:text="@string/btnGuardarServidores" |
117 | android:textColor="@android:color/white" | 117 | android:textColor="@android:color/white" |
118 | android:padding="10dp" | 118 | android:padding="10dp" |
119 | android:background="@drawable/boton_borde_redondeado" | 119 | android:background="@drawable/boton_borde_redondeado" |
120 | app:layout_constraintTop_toBottomOf="@+id/rvServidores" | 120 | app:layout_constraintTop_toBottomOf="@+id/rvServidores" |
121 | app:layout_constraintEnd_toEndOf="parent" | 121 | app:layout_constraintEnd_toEndOf="parent" |
122 | app:layout_constraintStart_toStartOf="parent" | 122 | app:layout_constraintStart_toStartOf="parent" |
123 | app:layout_constraintBottom_toBottomOf="parent"/> | 123 | app:layout_constraintBottom_toBottomOf="parent"/> |
124 | 124 | ||
125 | </androidx.constraintlayout.widget.ConstraintLayout> | 125 | </androidx.constraintlayout.widget.ConstraintLayout> |
126 | 126 |
app/src/main/res/layout/ingresar_cantidad.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <androidx.cardview.widget.CardView | 2 | <androidx.cardview.widget.CardView |
3 | xmlns:android="http://schemas.android.com/apk/res/android" | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
4 | xmlns:app="http://schemas.android.com/apk/res-auto" | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
5 | xmlns:tools="http://schemas.android.com/tools" | 5 | xmlns:tools="http://schemas.android.com/tools" |
6 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
7 | android:layout_height="wrap_content" | 7 | android:layout_height="wrap_content" |
8 | app:cardCornerRadius="10dp" | 8 | app:cardCornerRadius="10dp" |
9 | app:cardElevation="5dp" | 9 | app:cardElevation="5dp" |
10 | 10 | ||
11 | tools:ignore="PrivateResource"> | 11 | tools:ignore="PrivateResource"> |
12 | <!-- android:background="@drawable/md_transparent"--> | 12 | <!-- android:background="@drawable/md_transparent"--> |
13 | 13 | ||
14 | <androidx.constraintlayout.widget.ConstraintLayout | 14 | <androidx.constraintlayout.widget.ConstraintLayout |
15 | android:layout_width="match_parent" | 15 | android:layout_width="match_parent" |
16 | android:layout_height="match_parent"> | 16 | android:layout_height="match_parent"> |
17 | 17 | ||
18 | <LinearLayout | 18 | <LinearLayout |
19 | android:id="@+id/barraSuperior" | 19 | android:id="@+id/barraSuperior" |
20 | android:layout_width="0dp" | 20 | android:layout_width="0dp" |
21 | android:layout_height="wrap_content" | 21 | android:layout_height="wrap_content" |
22 | android:background="@color/colorPrimaryDark" | 22 | android:background="@color/colorPrimaryDark" |
23 | android:orientation="horizontal" | 23 | android:orientation="horizontal" |
24 | app:layout_constraintLeft_toLeftOf="parent" | 24 | app:layout_constraintLeft_toLeftOf="parent" |
25 | app:layout_constraintRight_toRightOf="parent" | 25 | app:layout_constraintRight_toRightOf="parent" |
26 | app:layout_constraintTop_toTopOf="parent" | 26 | app:layout_constraintTop_toTopOf="parent" |
27 | app:layout_constraintTop_toBottomOf="@+id/lySegundo"> | 27 | app:layout_constraintTop_toBottomOf="@+id/lySegundo"> |
28 | 28 | ||
29 | <androidx.appcompat.widget.AppCompatTextView | 29 | <androidx.appcompat.widget.AppCompatTextView |
30 | android:id="@+id/tvTitulo" | 30 | android:id="@+id/tvTitulo" |
31 | android:layout_width="0dp" | 31 | android:layout_width="0dp" |
32 | android:layout_height="wrap_content" | 32 | android:layout_height="wrap_content" |
33 | android:layout_margin="10dp" | 33 | android:layout_margin="10dp" |
34 | android:layout_marginStart="5dp" | 34 | android:layout_marginStart="5dp" |
35 | android:layout_marginTop="10dp" | 35 | android:layout_marginTop="10dp" |
36 | android:layout_weight="1" | 36 | android:layout_weight="1" |
37 | android:text="@string/adv" | 37 | android:text="@string/adv" |
38 | android:textAlignment="center" | 38 | android:textAlignment="center" |
39 | android:textColor="@android:color/white" | 39 | android:textColor="@android:color/white" |
40 | android:textSize="25sp" | 40 | android:textSize="25sp" /> |
41 | android:textStyle="bold" /> | ||
42 | </LinearLayout> | 41 | </LinearLayout> |
43 | 42 | ||
44 | 43 | ||
45 | <LinearLayout | 44 | <LinearLayout |
46 | android:id="@+id/lySegundo" | 45 | android:id="@+id/lySegundo" |
47 | android:layout_width="match_parent" | 46 | android:layout_width="match_parent" |
48 | android:layout_height="wrap_content" | 47 | android:layout_height="wrap_content" |
49 | android:orientation="vertical" | 48 | android:orientation="vertical" |
50 | android:padding="12dp" | 49 | android:padding="12dp" |
51 | app:layout_constraintLeft_toLeftOf="parent" | 50 | app:layout_constraintLeft_toLeftOf="parent" |
52 | app:layout_constraintRight_toRightOf="parent" | 51 | app:layout_constraintRight_toRightOf="parent" |
53 | app:layout_constraintTop_toBottomOf="@id/barraSuperior"> | 52 | app:layout_constraintTop_toBottomOf="@id/barraSuperior"> |
54 | 53 | ||
55 | 54 | ||
56 | 55 | ||
57 | <EditText | 56 | <EditText |
58 | android:id="@+id/etCantidad" | 57 | android:id="@+id/etCantidad" |
59 | android:layout_width="match_parent" | 58 | android:layout_width="match_parent" |
60 | android:layout_height="wrap_content" | 59 | android:layout_height="wrap_content" |
61 | android:ems="10" | 60 | android:ems="10" |
62 | android:gravity="center" | 61 | android:gravity="center" |
63 | android:textSize="20sp" | 62 | android:textSize="20sp" |
64 | android:focusable="true" | 63 | android:focusable="true" |
65 | android:clickable="true" | 64 | android:clickable="true" |
66 | android:inputType="numberDecimal" | 65 | android:inputType="numberDecimal" |
67 | android:text="" /> | 66 | android:text="" /> |
68 | 67 | ||
69 | 68 | ||
70 | <androidx.appcompat.widget.AppCompatButton | 69 | <androidx.appcompat.widget.AppCompatButton |
71 | android:id="@+id/btnAceptar" | 70 | android:id="@+id/btnAceptar" |
72 | android:layout_width="match_parent" | 71 | android:layout_width="match_parent" |
73 | android:layout_height="wrap_content" | 72 | android:layout_height="wrap_content" |
74 | android:layout_margin="10dp" | 73 | android:layout_margin="10dp" |
75 | android:layout_marginBottom="20dp" | 74 | android:layout_marginBottom="20dp" |
76 | android:clickable="true" | 75 | android:clickable="true" |
77 | android:focusable="true" | 76 | android:focusable="true" |
78 | android:textColor="@android:color/white" | 77 | android:textColor="@android:color/white" |
79 | android:padding="10dp" | 78 | android:padding="10dp" |
80 | android:background="@drawable/boton_borde_redondeado" | 79 | android:background="@drawable/boton_borde_redondeado" |
81 | android:text="@string/btnConfirmar" | 80 | android:text="@string/btnConfirmar" |
82 | android:textAlignment="center" | 81 | android:textAlignment="center" |
83 | android:textSize="20sp" | 82 | android:textSize="20sp" |
84 | android:textStyle="bold" | 83 | android:textStyle="bold" |
85 | app:cardBackgroundColor="@android:color/darker_gray" | 84 | app:cardBackgroundColor="@android:color/darker_gray" |
86 | app:cardUseCompatPadding="true" /> | 85 | app:cardUseCompatPadding="true" /> |
87 | 86 | ||
88 | 87 | ||
89 | </LinearLayout> | 88 | </LinearLayout> |
90 | 89 | ||
91 | 90 | ||
92 | </androidx.constraintlayout.widget.ConstraintLayout> | 91 | </androidx.constraintlayout.widget.ConstraintLayout> |
93 | </androidx.cardview.widget.CardView> | 92 | </androidx.cardview.widget.CardView> |
app/src/main/res/layout/login_dialog.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
5 | android:layout_height="wrap_content" | 5 | android:layout_height="wrap_content" |
6 | android:orientation="vertical" | 6 | android:orientation="vertical" |
7 | android:padding="10dp"> | 7 | android:padding="10dp"> |
8 | 8 | ||
9 | <TextView | 9 | <TextView |
10 | android:id="@+id/dialogNameEt" | 10 | android:id="@+id/dialogNameEt" |
11 | android:layout_width="wrap_content" | 11 | android:layout_width="wrap_content" |
12 | android:layout_height="wrap_content" | 12 | android:layout_height="wrap_content" |
13 | android:layout_margin="5dp" | 13 | android:layout_margin="5dp" |
14 | android:text="Cantidad actual:" | 14 | android:text="Cantidad actual:" |
15 | android:textSize="20sp" | 15 | android:textSize="20sp" |
16 | app:layout_constraintEnd_toStartOf="@id/tvCantInicial" | 16 | app:layout_constraintEnd_toStartOf="@id/tvCantInicial" |
17 | app:layout_constraintHorizontal_bias="0.0" | 17 | app:layout_constraintHorizontal_bias="0.0" |
18 | app:layout_constraintHorizontal_chainStyle="packed" | 18 | app:layout_constraintHorizontal_chainStyle="packed" |
19 | app:layout_constraintStart_toStartOf="parent" | 19 | app:layout_constraintStart_toStartOf="parent" |
20 | app:layout_constraintTop_toTopOf="parent" /> | 20 | app:layout_constraintTop_toTopOf="parent" /> |
21 | 21 | ||
22 | <TextView | 22 | <TextView |
23 | android:id="@+id/tvCantInicial" | 23 | android:id="@+id/tvCantInicial" |
24 | android:layout_width="wrap_content" | 24 | android:layout_width="wrap_content" |
25 | android:layout_height="wrap_content" | 25 | android:layout_height="wrap_content" |
26 | android:layout_margin="5dp" | 26 | android:layout_margin="5dp" |
27 | android:text="" | 27 | android:text="" |
28 | android:textSize="20sp" | 28 | android:textSize="20sp" |
29 | app:layout_constraintBaseline_toBaselineOf="@+id/dialogNameEt" | 29 | app:layout_constraintBaseline_toBaselineOf="@+id/dialogNameEt" |
30 | app:layout_constraintEnd_toEndOf="parent" | 30 | app:layout_constraintEnd_toEndOf="parent" |
31 | app:layout_constraintHorizontal_chainStyle="packed" | 31 | app:layout_constraintHorizontal_chainStyle="packed" |
32 | app:layout_constraintStart_toEndOf="@id/dialogNameEt" /> | 32 | app:layout_constraintStart_toEndOf="@id/dialogNameEt" /> |
33 | 33 | ||
34 | <TextView | 34 | <TextView |
35 | android:id="@+id/tvgenerico" | 35 | android:id="@+id/tvgenerico" |
36 | android:layout_width="wrap_content" | 36 | android:layout_width="wrap_content" |
37 | android:layout_height="wrap_content" | 37 | android:layout_height="wrap_content" |
38 | android:layout_margin="5dp" | 38 | android:layout_margin="5dp" |
39 | android:text="Nueva cantidad:" | 39 | android:text="Nueva cantidad:" |
40 | android:textSize="20sp" | 40 | android:textSize="20sp" |
41 | app:layout_constraintStart_toStartOf="parent" | 41 | app:layout_constraintStart_toStartOf="parent" |
42 | app:layout_constraintTop_toBottomOf="@+id/tvCantInicial" /> | 42 | app:layout_constraintTop_toBottomOf="@+id/tvCantInicial" /> |
43 | 43 | ||
44 | <EditText | 44 | <EditText |
45 | android:id="@+id/tvNuevaCantidad" | 45 | android:id="@+id/tvNuevaCantidad" |
46 | android:layout_width="0dp" | 46 | android:layout_width="0dp" |
47 | android:layout_height="wrap_content" | 47 | android:layout_height="wrap_content" |
48 | android:autofillHints="" | 48 | android:autofillHints="" |
49 | android:hint="" | 49 | android:hint="" |
50 | android:focusable="true" | ||
51 | android:clickable="true" | ||
50 | android:inputType="numberDecimal" | 52 | android:inputType="numberDecimal" |
51 | app:layout_constraintBaseline_toBaselineOf="@+id/tvgenerico" | 53 | app:layout_constraintBaseline_toBaselineOf="@+id/tvgenerico" |
52 | app:layout_constraintEnd_toEndOf="parent" | 54 | app:layout_constraintEnd_toEndOf="parent" |
53 | app:layout_constraintStart_toEndOf="@id/tvgenerico" /> | 55 | app:layout_constraintStart_toEndOf="@id/tvgenerico" /> |
54 | 56 | ||
55 | <TextView | 57 | <TextView |
56 | android:id="@+id/tvgenerico2" | 58 | android:id="@+id/tvgenerico2" |
57 | android:layout_width="wrap_content" | 59 | android:layout_width="wrap_content" |
58 | android:layout_height="wrap_content" | 60 | android:layout_height="wrap_content" |
59 | android:layout_margin="5dp" | 61 | android:layout_margin="5dp" |
60 | android:gravity="center" | 62 | android:gravity="center" |
61 | android:text="@string/tvSeleccion" | 63 | android:text="@string/tvSeleccion" |
62 | android:textSize="20sp" | 64 | android:textSize="20sp" |
63 | android:visibility="gone" | 65 | android:visibility="gone" |
64 | app:layout_constraintStart_toStartOf="parent" | 66 | app:layout_constraintStart_toStartOf="parent" |
65 | app:layout_constraintTop_toBottomOf="@+id/tvgenerico" /> | 67 | app:layout_constraintTop_toBottomOf="@+id/tvgenerico" /> |
66 | 68 | ||
67 | <RadioGroup | 69 | <RadioGroup |
68 | android:id="@+id/rgFechaHora" | 70 | android:id="@+id/rgFechaHora" |
69 | android:layout_width="wrap_content" | 71 | android:layout_width="wrap_content" |
70 | android:layout_height="wrap_content" | 72 | android:layout_height="wrap_content" |
71 | android:gravity="start" | 73 | android:gravity="start" |
72 | android:orientation="horizontal" | 74 | android:orientation="horizontal" |
73 | app:layout_constraintEnd_toEndOf="parent" | 75 | app:layout_constraintEnd_toEndOf="parent" |
74 | app:layout_constraintHorizontal_bias="0.0" | 76 | app:layout_constraintHorizontal_bias="0.0" |
75 | app:layout_constraintStart_toStartOf="parent" | 77 | app:layout_constraintStart_toStartOf="parent" |
76 | app:layout_constraintTop_toBottomOf="@+id/tvgenerico2"> | 78 | app:layout_constraintTop_toBottomOf="@+id/tvgenerico2"> |
77 | 79 | ||
78 | <RadioButton | 80 | <RadioButton |
79 | android:id="@+id/rbSumar" | 81 | android:id="@+id/rbSumar" |
80 | android:layout_width="wrap_content" | 82 | android:layout_width="wrap_content" |
81 | android:layout_height="wrap_content" | 83 | android:layout_height="wrap_content" |
82 | android:layout_margin="5dp" | 84 | android:layout_margin="5dp" |
83 | android:checked="false" | 85 | android:checked="false" |
84 | 86 | ||
85 | android:text="@string/rbSumar" | 87 | android:text="@string/rbSumar" |
86 | android:textSize="@dimen/text_size2" /> | 88 | android:textSize="@dimen/text_size2" /> |
87 | 89 | ||
88 | <RadioButton | 90 | <RadioButton |
89 | android:id="@+id/rbMdodificar" | 91 | android:id="@+id/rbMdodificar" |
90 | android:layout_width="wrap_content" | 92 | android:layout_width="wrap_content" |
91 | android:layout_height="wrap_content" | 93 | android:layout_height="wrap_content" |
92 | android:layout_margin="5dp" | 94 | android:layout_margin="5dp" |
93 | android:checked="false" | 95 | android:checked="false" |
94 | android:text="@string/rbModificar" | 96 | android:text="@string/rbModificar" |
95 | android:textSize="@dimen/text_size2" /> | 97 | android:textSize="@dimen/text_size2" /> |
96 | 98 | ||
97 | <RadioButton | 99 | <RadioButton |
98 | android:id="@+id/rbRestar" | 100 | android:id="@+id/rbRestar" |
99 | android:layout_width="wrap_content" | 101 | android:layout_width="wrap_content" |
100 | android:layout_height="wrap_content" | 102 | android:layout_height="wrap_content" |
101 | android:layout_margin="5dp" | 103 | android:layout_margin="5dp" |
102 | android:checked="false" | 104 | android:checked="false" |
103 | android:padding="5dp" | 105 | android:padding="5dp" |
104 | android:text="@string/rbRestar" | 106 | android:text="@string/rbRestar" |
105 | android:textSize="@dimen/text_size2" /> | 107 | android:textSize="@dimen/text_size2" /> |
106 | 108 | ||
107 | </RadioGroup> | 109 | </RadioGroup> |
108 | 110 | ||
109 | <TextView | 111 | <TextView |
110 | android:id="@+id/tvgenerico3" | 112 | android:id="@+id/tvgenerico3" |
111 | android:layout_width="wrap_content" | 113 | android:layout_width="wrap_content" |
112 | android:layout_height="wrap_content" | 114 | android:layout_height="wrap_content" |
113 | android:layout_margin="5dp" | 115 | android:layout_margin="5dp" |
114 | android:gravity="center" | 116 | android:gravity="center" |
115 | android:text="@string/tvResultado" | 117 | android:text="@string/tvResultado" |
116 | android:textSize="20sp" | 118 | android:textSize="20sp" |
117 | app:layout_constraintEnd_toEndOf="parent" | 119 | app:layout_constraintEnd_toEndOf="parent" |
118 | app:layout_constraintHorizontal_bias="0.0" | 120 | app:layout_constraintHorizontal_bias="0.0" |
119 | app:layout_constraintStart_toStartOf="parent" | 121 | app:layout_constraintStart_toStartOf="parent" |
120 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> | 122 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> |
121 | 123 | ||
122 | <TextView | 124 | <TextView |
123 | android:id="@+id/tvResultado" | 125 | android:id="@+id/tvResultado" |
124 | android:layout_width="wrap_content" | 126 | android:layout_width="wrap_content" |
125 | android:layout_height="wrap_content" | 127 | android:layout_height="wrap_content" |
126 | android:layout_margin="5dp" | 128 | android:layout_margin="5dp" |
127 | android:gravity="center" | 129 | android:gravity="center" |
128 | android:text="" | 130 | android:text="" |
129 | android:textSize="20sp" | 131 | android:textSize="20sp" |
130 | app:layout_constraintEnd_toEndOf="parent" | 132 | app:layout_constraintEnd_toEndOf="parent" |
131 | app:layout_constraintHorizontal_bias="0.0" | 133 | app:layout_constraintHorizontal_bias="0.0" |
132 | app:layout_constraintStart_toEndOf="@+id/tvgenerico3" | 134 | app:layout_constraintStart_toEndOf="@+id/tvgenerico3" |
133 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> | 135 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> |
134 | 136 | ||
135 | <LinearLayout | 137 | <LinearLayout |
136 | android:layout_width="match_parent" | 138 | android:layout_width="match_parent" |
137 | android:layout_height="wrap_content" | 139 | android:layout_height="wrap_content" |
138 | android:gravity="center" | 140 | android:gravity="center" |
139 | android:orientation="horizontal" | 141 | android:orientation="horizontal" |
140 | app:layout_constraintEnd_toEndOf="parent" | 142 | app:layout_constraintEnd_toEndOf="parent" |
141 | app:layout_constraintStart_toStartOf="parent" | 143 | app:layout_constraintStart_toStartOf="parent" |
142 | app:layout_constraintTop_toBottomOf="@+id/tvResultado"> | 144 | app:layout_constraintTop_toBottomOf="@+id/tvResultado"> |
143 | 145 | ||
144 | <Button | 146 | <Button |
145 | android:id="@+id/btnAceptar" | 147 | android:id="@+id/btnAceptar" |
146 | style="@style/Base.Widget.AppCompat.Button.Colored" | 148 | style="@style/Base.Widget.AppCompat.Button.Colored" |
147 | android:layout_width="wrap_content" | 149 | android:layout_width="wrap_content" |
148 | android:layout_height="wrap_content" | 150 | android:layout_height="wrap_content" |
149 | android:layout_margin="5dp" | 151 | android:layout_margin="5dp" |
150 | android:background="@drawable/boton_borde_redondeado" | 152 | android:background="@drawable/boton_borde_redondeado" |
151 | android:padding="20dp" | 153 | android:padding="20dp" |
152 | android:text="@string/btnOk" | 154 | android:text="@string/btnOk" |
153 | android:textColor="@android:color/white" /> | 155 | android:textColor="@android:color/white" /> |
154 | 156 | ||
155 | <Button | 157 | <Button |
156 | android:id="@+id/dialogCancelBtn" | 158 | android:id="@+id/dialogCancelBtn" |
157 | style="@style/Base.Widget.AppCompat.Button.Colored" | 159 | style="@style/Base.Widget.AppCompat.Button.Colored" |
158 | android:layout_width="wrap_content" | 160 | android:layout_width="wrap_content" |
159 | android:layout_height="wrap_content" | 161 | android:layout_height="wrap_content" |
160 | android:layout_margin="5dp" | 162 | android:layout_margin="5dp" |
161 | android:background="@drawable/boton_borde_redondeado" | 163 | android:background="@drawable/boton_borde_redondeado" |
162 | android:padding="20dp" | 164 | android:padding="20dp" |
163 | android:text="@string/btnCancelar" | 165 | android:text="@string/btnCancelar" |
164 | android:textColor="@android:color/white" /> | 166 | android:textColor="@android:color/white" /> |
165 | </LinearLayout> | 167 | </LinearLayout> |
166 | 168 | ||
167 | </androidx.constraintlayout.widget.ConstraintLayout> | 169 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/navigation/mobile_navigation.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <navigation xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <navigation xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:id="@+id/mobile_navigation" | 5 | android:id="@+id/mobile_navigation" |
6 | app:startDestination="@id/mainFragment2"> | 6 | app:startDestination="@id/mainFragment2"> |
7 | 7 | ||
8 | <activity | 8 | <activity |
9 | android:id="@+id/mainActivity" | 9 | android:id="@+id/mainActivity" |
10 | android:name="com.focasoftware.deboinventariov20.ui.MainActivity" | 10 | android:name="com.focasoftware.deboinventariov20.UI.MainActivity" |
11 | android:label="app_bar_main" | 11 | android:label="app_bar_main" |
12 | tools:layout="@layout/app_bar_main" /> | 12 | tools:layout="@layout/app_bar_main" /> |
13 | |||
13 | <fragment | 14 | <fragment |
14 | android:id="@+id/mainFragment2" | 15 | android:id="@+id/mainFragment2" |
15 | android:name="com.focasoftware.deboinventariov20.ui.main.MainFragment" | 16 | android:name="com.focasoftware.deboinventariov20.UI.main.MainFragment" |
16 | android:label="Principal" | 17 | android:label="Principal" |
17 | tools:layout="@layout/fragment_main" > | 18 | tools:layout="@layout/fragment_main" > |
18 | <action | 19 | <action |
19 | android:id="@+id/action_mainFragment2_to_configuracionFragment" | 20 | android:id="@+id/action_mainFragment2_to_configuracionFragment" |
20 | app:destination="@id/configuracionFragment" | 21 | app:destination="@id/configuracionFragment" |
21 | app:popEnterAnim="@anim/slide_in_left" | 22 | app:popEnterAnim="@anim/slide_in_left" |
22 | app:popExitAnim="@anim/slide_out_right" | 23 | app:popExitAnim="@anim/slide_out_right" |
23 | app:enterAnim="@anim/slide_in_right" | 24 | app:enterAnim="@anim/slide_in_right" |
24 | app:exitAnim="@anim/slide_out_left" /> | 25 | app:exitAnim="@anim/slide_out_left" /> |
25 | <action | 26 | <action |
26 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" | 27 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" |
27 | app:destination="@id/actuaMaestrosFragment" | 28 | app:destination="@id/actuaMaestrosFragment" |
28 | app:popEnterAnim="@anim/slide_in_left" | 29 | app:popEnterAnim="@anim/slide_in_left" |
29 | app:popExitAnim="@anim/slide_out_right" | 30 | app:popExitAnim="@anim/slide_out_right" |
30 | app:enterAnim="@anim/slide_in_right" | 31 | app:enterAnim="@anim/slide_in_right" |
31 | app:exitAnim="@anim/slide_out_left" /> | 32 | app:exitAnim="@anim/slide_out_left" /> |
32 | <action | 33 | <action |
33 | android:id="@+id/action_mainFragment2_to_inventarioFragment" | 34 | android:id="@+id/action_mainFragment2_to_inventarioFragment" |
34 | app:destination="@id/inventarioFragment" | 35 | app:destination="@id/inventarioFragment" |
35 | app:popEnterAnim="@anim/slide_in_left" | 36 | app:popEnterAnim="@anim/slide_in_left" |
36 | app:popExitAnim="@anim/slide_out_right" | 37 | app:popExitAnim="@anim/slide_out_right" |
37 | app:enterAnim="@anim/slide_in_right" | 38 | app:enterAnim="@anim/slide_in_right" |
38 | app:exitAnim="@anim/slide_out_left" /> | 39 | app:exitAnim="@anim/slide_out_left" /> |
39 | </fragment> | 40 | </fragment> |
41 | |||
40 | <fragment | 42 | <fragment |
41 | android:id="@+id/actuaMaestrosFragment" | 43 | android:id="@+id/actuaMaestrosFragment" |
42 | android:name="com.focasoftware.deboinventariov20.ui.actualizacionMaestros.ActuaMaestrosFragment" | 44 | android:name="com.focasoftware.deboinventariov20.UI.actualizacionMaestros.ActuaMaestrosFragment" |
43 | android:label="Importaciones Varias" | 45 | android:label="Importaciones Varias" |
44 | tools:layout="@layout/fragment_actua_maestros" /> | 46 | tools:layout="@layout/fragment_actua_maestros" /> |
45 | 47 | ||
46 | <fragment | ||
47 | android:id="@+id/servidoresFragment" | ||
48 | android:name="com.focasoftware.deboinventariov20.ui.servidores.ServidoresFragment" | ||
49 | android:label="Alta Servidores" | ||
50 | tools:layout="@layout/fragment_servidores"> | ||
51 | <action | ||
52 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" | ||
53 | app:destination="@id/configuracionFragment" | ||
54 | app:popUpTo="@id/servidoresFragment" | ||
55 | app:popUpToInclusive="true" /> | ||
56 | </fragment> | ||
57 | 48 | ||
58 | <fragment | 49 | <fragment |
59 | android:id="@+id/inventarioFragment" | 50 | android:id="@+id/inventarioFragment" |
60 | android:name="com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment" | 51 | android:name="com.focasoftware.deboinventariov20.UI.inventario.InventarioFragment" |
61 | android:label="Inventario Dinamico" | 52 | android:label="Inventario Dinamico" |
62 | tools:layout="@layout/fragment_inventario" > | 53 | tools:layout="@layout/fragment_inventario" > |
63 | <action | 54 | <action |
64 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" | 55 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" |
65 | app:destination="@id/descripcionFragment" | 56 | app:destination="@id/descripcionFragment" |
66 | app:popEnterAnim="@anim/slide_in_left" | 57 | app:popEnterAnim="@anim/slide_in_left" |
67 | app:popExitAnim="@anim/slide_out_right" | 58 | app:popExitAnim="@anim/slide_out_right" |
68 | app:enterAnim="@anim/slide_in_right" | 59 | app:enterAnim="@anim/slide_in_right" |
69 | app:exitAnim="@anim/slide_out_left" | 60 | app:exitAnim="@anim/slide_out_left" |
70 | /> | 61 | /> |
71 | <action | 62 | <action |
72 | android:id="@+id/action_inventarioFragment_to_mainFragment2" | 63 | android:id="@+id/action_inventarioFragment_to_mainFragment2" |
73 | app:destination="@id/mainFragment2" | 64 | app:destination="@id/mainFragment2" |
74 | app:popEnterAnim="@anim/slide_in_left" | 65 | app:popEnterAnim="@anim/slide_in_left" |
75 | app:popExitAnim="@anim/slide_out_right" | 66 | app:popExitAnim="@anim/slide_out_right" |
76 | app:enterAnim="@anim/slide_in_right" | 67 | app:enterAnim="@anim/slide_in_right" |
77 | app:exitAnim="@anim/slide_out_left"/> | 68 | app:exitAnim="@anim/slide_out_left"/> |
78 | <action | 69 | <action |
79 | android:id="@+id/action_inventarioFragment_to_detalleArtFragment" | 70 | android:id="@+id/action_inventarioFragment_to_detalleArtFragment" |
80 | app:destination="@id/detalleArtFragment" /> | 71 | app:destination="@id/detalleArtFragment" /> |
81 | |||
82 | </fragment> | ||
83 | <fragment | ||
84 | android:id="@+id/configuracionFragment" | ||
85 | android:name="com.focasoftware.deboinventariov20.ui.configuracion.ConfiguracionFragment" | ||
86 | android:label="Configuraciones" | ||
87 | tools:layout="@layout/fragment_configuracion" > | ||
88 | <action | ||
89 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" | ||
90 | app:destination="@id/servidoresFragment" | ||
91 | app:popEnterAnim="@anim/slide_in_left" | ||
92 | app:popExitAnim="@anim/slide_out_right" | ||
93 | app:enterAnim="@anim/slide_in_right" | ||
94 | app:exitAnim="@anim/slide_out_left" | ||
95 | app:popUpTo="@id/configuracionFragment" | ||
96 | app:popUpToInclusive="true" /> | ||
97 | <action | ||
98 | android:id="@+id/action_configuracionFragment_to_mainFragment2" | ||
99 | app:destination="@id/mainFragment2" /> | ||
100 | </fragment> | 72 | </fragment> |
73 | |||
101 | <fragment | 74 | <fragment |
102 | android:id="@+id/descripcionFragment" | 75 | android:id="@+id/descripcionFragment" |
103 | android:name="com.focasoftware.deboinventariov20.ui.descripcionFragment.DescripcionFragment" | 76 | android:name="com.focasoftware.deboinventariov20.UI.descripcionFragment.DescripcionFragment" |
104 | android:label="Productos Encontrados"> | 77 | android:label="Productos Encontrados"> |
105 | |||
106 | <action | 78 | <action |
107 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" | 79 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" |
108 | app:destination="@id/inventarioFragment" | 80 | app:destination="@id/inventarioFragment" |
109 | app:popEnterAnim="@anim/slide_in_left" | 81 | app:popEnterAnim="@anim/slide_in_left" |
110 | app:popExitAnim="@anim/slide_out_right" | 82 | app:popExitAnim="@anim/slide_out_right" |
111 | app:enterAnim="@anim/slide_in_right" | 83 | app:enterAnim="@anim/slide_in_right" |
112 | app:exitAnim="@anim/slide_out_left" | 84 | app:exitAnim="@anim/slide_out_left" /> |
113 | /> | ||
114 | </fragment> | 85 | </fragment> |
115 | <dialog | ||
116 | android:id="@+id/dialogNoEncontrado" | ||
117 | android:name="com.focasoftware.deboinventariov20.ui.util.Base.dialogos.DialogNoEncontrado" | ||
118 | android:label="DialogNoEncontrado" /> | ||
119 | <fragment | ||
120 | android:id="@+id/dialogoLogin" | ||
121 | android:name="com.focasoftware.deboinventariov20.ui.util.Base.dialogos.DialogoLogin" | ||
122 | android:label="dialogoLogin" /> | ||
123 | <fragment | ||
124 | android:id="@+id/singleChoiceAlertDialog" | ||
125 | android:name="com.focasoftware.deboinventariov20.ui.util.Base.dialogos.SingleChoiceAlertDialog" | ||
126 | android:label="SingleChoiceAlertDialog" /> | ||
127 | 86 | ||
128 | <fragment | 87 | <fragment |
129 | android:id="@+id/detalleArtFragment" | 88 | android:id="@+id/detalleArtFragment" |
130 | android:name="com.focasoftware.deboinventariov20.ui.detalleProducto.DetalleArtFragment" | 89 | android:name="com.focasoftware.deboinventariov20.UI.detalleProducto.DetalleArtFragment" |
131 | android:label="Detalle Articulo" | 90 | android:label="Detalle Articulo" |
132 | tools:layout="@layout/fragment_detalle_art"> | 91 | tools:layout="@layout/fragment_detalle_art"> |
133 | <action | 92 | <action |
134 | android:id="@+id/action_detalleArtFragment_to_inventarioFragment" | 93 | android:id="@+id/action_detalleArtFragment_to_inventarioFragment" |
build.gradle
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. | 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. |
2 | buildscript { | 2 | buildscript { |
3 | ext.kotlin_version = '1.4.0' | 3 | ext.kotlin_version = '1.4.0' |
4 | repositories { | 4 | repositories { |
5 | google() | 5 | google() |
6 | jcenter() | 6 | jcenter() |
7 | } | 7 | } |
8 | dependencies { | 8 | dependencies { |
9 | classpath "com.android.tools.build:gradle:4.0.1" | 9 | classpath "com.android.tools.build:gradle:4.0.1" |
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
11 | 11 | ||
12 | // NOTE: Do not place your application dependencies here; they belong | 12 | // NOTE: Do not place your application dependencies here; they belong |
13 | // in the individual module build.gradle files | 13 | // in the individual module build.gradle files |
14 | } | 14 | } |
15 | } | 15 | } |
16 | 16 | ||
17 | allprojects { | 17 | allprojects { |
18 | repositories { | 18 | repositories { |
19 | google() | 19 | google() |
20 | jcenter() | 20 | jcenter() |
21 | maven { | ||
22 | url 'http://www.idescout.com/maven/repo/' | ||
23 | name 'IDEScout, Inc.' | ||
24 | } | ||
21 | } | 25 | } |
22 | } | 26 | } |
23 | 27 | ||
24 | task clean(type: Delete) { | 28 | task clean(type: Delete) { |
25 | delete rootProject.buildDir | 29 | delete rootProject.buildDir |
26 | } | 30 | } |