Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

Rev 12 | Rev 21 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 12 Rev 19
Línea 87... Línea 87...
87
 
87
 
88
    @Override
88
    @Override
89
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
89
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
90
        super.onViewCreated(view, savedInstanceState);
90
        super.onViewCreated(view, savedInstanceState);
91
        iTwoGetSkills = (ITwoGetSkills) getActivity();
91
        iTwoGetSkills = (ITwoGetSkills) getActivity();
92
        mProgressBar =  getView().findViewById(R.id.signin_progress_bar);
92
        mProgressBar = (ProgressBar) getView().findViewById(R.id.signin_progress_bar);
93
        mEditTextEmail =  getView().findViewById(R.id.signin_edittext_email);
93
        mEditTextEmail = (EditText) getView().findViewById(R.id.signin_edittext_email);
94
        //mEditTextEmail.setText("santiago.olivera@leaderslinked.com");
94
        //mEditTextEmail.setText("santiago.olivera@leaderslinked.com");
95
        //mEditTextEmail.setText("efrain.yanez@leaderslinked.com");
95
        //mEditTextEmail.setText("efrain.yanez@leaderslinked.com");
96
        //mEditTextEmail.setText("snof@adinet.com.uy");
96
        //mEditTextEmail.setText("snof@adinet.com.uy");
97
        //mEditTextEmail.setText("mmarrugo@coosalud.com");
-
 
98
 
-
 
99
        Log.e("Oculto", "signin");
97
        //mEditTextEmail.setText("mmarrugo@coosalud.com");
Línea 100... Línea 98...
100
        iTwoGetSkills.hideNavigationAndtoolbar();
98
        //mEditTextEmail.setText("daniela.lara@mdsmexico.com");
101
 
99
 
102
 
100
 
Línea 224... Línea 222...
224
 
222
 
Línea 225... Línea 223...
225
            String aes = iTwoGetSkills.getPreference().getAes();
223
            String aes = iTwoGetSkills.getPreference().getAes();
226
 
224
 
227
            mEditTextEmail.setEnabled(false);
-
 
-
 
225
            mEditTextEmail.setEnabled(false);
228
            mEditTextPassword.setEnabled(false);
226
            mEditTextPassword.setEnabled(false);
229
 
-
 
230
            mButtonSignIn.setEnabled(false);
-
 
231
            mProgressBar.setVisibility(View.VISIBLE);
-
 
232
 
227
            mButtonSignUp.setEnabled(false);
233
            inProgress = false;
-
 
234
            mEditTextEmail.setEnabled(true);
-
 
235
            mEditTextPassword.setEnabled(true);
-
 
236
 
-
 
Línea 237... Línea 228...
237
            mButtonSignIn.setEnabled(true);
228
            mButtonSignIn.setEnabled(false);
Línea 238... Línea 229...
238
            mProgressBar.setVisibility(View.INVISIBLE);
229
            iTwoGetSkills.showProgressBar();
Línea 277... Línea 268...
277
                        .url(Configuration.URL_SIGNIN)
268
                        .url(Configuration.URL_SIGNIN)
278
                        .post(formBody)
269
                        .post(formBody)
279
                        .build();
270
                        .build();
Línea 280... Línea 271...
280
 
271
 
281
                Call call = client.newCall(request);
-
 
282
          /*  try {
-
 
283
                mProgressBar.setVisibility(View.VISIBLE);
-
 
284
 
-
 
Línea 285... Línea -...
285
                Response response = call.execute();
-
 
286
 
-
 
287
                processResponseServer(response.body().string());
-
 
288
 
-
 
289
            } catch(IOException e) {
-
 
290
                Log.d(TAG, e.getMessage());
-
 
291
            }*/
272
                Call call = client.newCall(request);
292
                iTwoGetSkills.showProgressBar();
273
 
293
                call.enqueue(new Callback() {
274
                call.enqueue(new Callback() {
Línea 294... Línea -...
294
                    public void onResponse(Call call, Response response)
-
 
295
                            throws IOException {
275
                    public void onResponse(Call call, Response response)
-
 
276
                            throws IOException {
-
 
277
 
-
 
278
                        processResponseServer(response.body().string());
-
 
279
                        iTwoGetSkills.hideProgressBar();
-
 
280
                        getActivity().runOnUiThread(new Runnable() {
-
 
281
 
-
 
282
                            @Override
-
 
283
                            public void run() {
-
 
284
                                mButtonSignIn.setEnabled(true);
-
 
285
                                mButtonSignUp.setEnabled(true);
-
 
286
                                mEditTextEmail.setEnabled(true);
Línea -... Línea 287...
-
 
287
                                mEditTextPassword.setEnabled(true);
Línea 296... Línea 288...
296
 
288
                                inProgress = false;
Línea 297... Línea 289...
297
                        iTwoGetSkills.hideProgressBar();
289
                            }
298
                        processResponseServer(response.body().string());
290
 
299
 
291
                        });
-
 
292
 
-
 
293
                    }
-
 
294
 
-
 
295
                    public void onFailure(Call call, IOException e) {
-
 
296
                        Log.d(TAG, "Error :  " +  e.getMessage());
-
 
297
                        iTwoGetSkills.hideProgressBar();
-
 
298
                        getActivity().runOnUiThread(new Runnable() {
-
 
299
 
-
 
300
                            @Override
-
 
301
                            public void run() {
-
 
302
                                mButtonSignIn.setEnabled(true);
-
 
303
                                mButtonSignUp.setEnabled(true);
-
 
304
                                mEditTextEmail.setEnabled(true);
-
 
305
                                mEditTextPassword.setEnabled(true);
-
 
306
                                inProgress = false;
300
 
307
                            }
301
                    }
308
                        });
Línea 302... Línea 309...
302
 
309
 
303
                    public void onFailure(Call call, IOException e) {
310
 
Línea 347... Línea 354...
347
                Date date = calendar.getTime();
354
                Date date = calendar.getTime();
348
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Constants.FORMAT_DATETIME_SERVICE);
355
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Constants.FORMAT_DATETIME_SERVICE);
349
                String  addedOn = simpleDateFormat.format(date);
356
                String  addedOn = simpleDateFormat.format(date);
Línea 350... Línea 357...
350
 
357
 
-
 
358
                //Elimino antes de guardar.
-
 
359
                JSONObject objUser = data.getJSONObject("user");
-
 
360
                String userUuid = objUser.getString("uuid");
351
                //Elimino antes de guardar.
361
 
352
                iTwoGetSkills.getDatabase().getAnswerDao().removeAll();
362
                iTwoGetSkills.getDatabase().getAnswerDao().removeAll();
353
                iTwoGetSkills.getDatabase().getQuestionDao().removeAll();
363
                iTwoGetSkills.getDatabase().getQuestionDao().removeAll();
354
                iTwoGetSkills.getDatabase().getQuizDao().removeAll();
364
                iTwoGetSkills.getDatabase().getQuizDao().removeAll();
355
                iTwoGetSkills.getDatabase().getSlideDao().removeAll();
365
                iTwoGetSkills.getDatabase().getSlideDao().removeAll();
356
                iTwoGetSkills.getDatabase().getCapsuleDao().removeAll();
366
                iTwoGetSkills.getDatabase().getCapsuleDao().removeAll();
357
                iTwoGetSkills.getDatabase().getTopicDao().removeAll();
367
                iTwoGetSkills.getDatabase().getTopicDao().removeAll();
358
                iTwoGetSkills.getDatabase().getUserExtendedDao().removeAll();
368
                iTwoGetSkills.getDatabase().getUserExtendedDao().removeAll();
-
 
369
                iTwoGetSkills.getDatabase().getProgressDao().removeAllUserUuidNotEqual(userUuid);
359
                iTwoGetSkills.getDatabase().getNotificationCenterDao().removeAllnotifications();
370
                iTwoGetSkills.getDatabase().getUserLogDao().removeAllUserUuidNotEqual(userUuid);
Línea 360... Línea 371...
360
                iTwoGetSkills.syncFromServer(data);
371
                iTwoGetSkills.syncFromServer(data);
361
 
-
 
362
 
372
 
363
                Preference preference = iTwoGetSkills.getPreference();
373
 
364
                JSONObject objUser = data.getJSONObject("user");
374
                Preference preference = iTwoGetSkills.getPreference();
365
                preference.setUserUuid(objUser.getString("uuid"));
375
                preference.setUserUuid(userUuid);
366
                preference.setFirstName(objUser.getString("first_name"));
376
                preference.setFirstName(objUser.getString("first_name"));
367
                preference.setLastName(objUser.getString("last_name"));
377
                preference.setLastName(objUser.getString("last_name"));
Línea 726... Línea 736...
726
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
736
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
727
                             Bundle savedInstanceState) {
737
                             Bundle savedInstanceState) {
728
        // Inflate the layout for this fragment
738
        // Inflate the layout for this fragment
729
        return inflater.inflate(R.layout.fragment_signin, container, false);
739
        return inflater.inflate(R.layout.fragment_signin, container, false);
730
    }
740
    }
731
}
-
 
732
741
}
-
 
742