Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

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

Rev 2 Rev 3
Línea 80... Línea 80...
80
import com.cesams.twogetskills.entity.UserLog;
80
import com.cesams.twogetskills.entity.UserLog;
81
import com.cesams.twogetskills.preference.Preference;
81
import com.cesams.twogetskills.preference.Preference;
82
import com.cesams.twogetskills.receiver.ConnectivityReceiver;
82
import com.cesams.twogetskills.receiver.ConnectivityReceiver;
83
import com.cesams.twogetskills.receiver.InternalReceiver;
83
import com.cesams.twogetskills.receiver.InternalReceiver;
84
import com.cesams.twogetskills.room.ResultCount;
84
import com.cesams.twogetskills.room.ResultCount;
-
 
85
import com.cesams.twogetskills.viewdata.SlideRefreshUIViewData;
-
 
86
import com.cesams.twogetskills.viewmodel.SlideRefreshUIViewModel;
85
import com.google.android.material.snackbar.Snackbar;
87
import com.google.android.material.snackbar.Snackbar;
86
import com.google.android.material.navigation.NavigationView;
88
import com.google.android.material.navigation.NavigationView;
Línea 87... Línea 89...
87
 
89
 
88
import androidx.drawerlayout.widget.DrawerLayout;
90
import androidx.drawerlayout.widget.DrawerLayout;
-
 
91
import androidx.appcompat.widget.Toolbar;
89
import androidx.appcompat.widget.Toolbar;
92
import androidx.lifecycle.ViewModelProvider;
Línea 90... Línea 93...
90
import androidx.room.Database;
93
import androidx.room.Database;
91
 
94
 
Línea 103... Línea 106...
103
import java.io.IOException;
106
import java.io.IOException;
104
import java.text.SimpleDateFormat;
107
import java.text.SimpleDateFormat;
105
import java.util.Calendar;
108
import java.util.Calendar;
106
import java.util.Date;
109
import java.util.Date;
107
import java.util.HashMap;
110
import java.util.HashMap;
-
 
111
import java.util.Iterator;
108
import java.util.List;
112
import java.util.List;
-
 
113
import java.util.Map;
109
import java.util.Random;
114
import java.util.Random;
110
import java.util.TimeZone;
115
import java.util.TimeZone;
Línea 111... Línea 116...
111
 
116
 
112
//import de.hdodenhof.circleimageview.CircleImageView;
117
//import de.hdodenhof.circleimageview.CircleImageView;
Línea 120... Línea 125...
120
public class MainActivity extends  AppCompatActivity implements ITwoGetSkills,NavigationView.OnNavigationItemSelectedListener {
125
public class MainActivity extends  AppCompatActivity implements ITwoGetSkills,NavigationView.OnNavigationItemSelectedListener {
121
    private boolean isSyncDevice = false;
126
    private boolean isSyncDevice = false;
122
    private boolean isSyncToken = false;
127
    private boolean isSyncToken = false;
123
    private boolean isSyncBatch = false;
128
    private boolean isSyncBatch = false;
124
    private boolean isForeground = false;
129
    private boolean isForeground = false;
125
    private boolean issmartlockloginrun = false;
130
    private boolean isSmartLockLoginRun = false;
Línea 126... Línea 131...
126
 
131
 
127
    private final static String PREFIX_FRAG = "FRAG";
132
    private final static String PREFIX_FRAG = "FRAG";
Línea 128... Línea 133...
128
    private final static String TAG = "C2GS - MainActivity";
133
    private final static String TAG = "C2GS - MainActivity";
Línea 147... Línea 152...
147
    private ProgressBar mProgressBar;
152
    private ProgressBar mProgressBar;
Línea 148... Línea 153...
148
 
153
 
149
    private Account mAccount;
154
    private Account mAccount;
Línea -... Línea 155...
-
 
155
    private AppDatabase mAppDatabase;
-
 
156
 
Línea 150... Línea 157...
150
    private AppDatabase mAppDatabase;
157
    private SlideRefreshUIViewModel mSlideRefreshUIViewModel;
151
 
158
 
152
 
159
 
Línea 178... Línea 185...
178
 
185
 
179
        /**** CANAL DE NOTIFICACIONES **/
186
        /**** CANAL DE NOTIFICACIONES **/
Línea 180... Línea 187...
180
        createNotificationChannel();
187
        createNotificationChannel();
181
 
188
 
Línea 182... Línea 189...
182
        /*** CUENTAS DE SINCRONIZACION **/
189
        /*** CUENTAS DE SINCRONIZACION **/
183
        mAccount =  CreateSyncAccount(this);
190
        mAccount =  CreateSyncAccount(getApplicationContext());
Línea 184... Línea 191...
184
 
191
 
Línea -... Línea 192...
-
 
192
 
185
 
193
        // Get the content resolver for your app
Línea 186... Línea 194...
186
        // Get the content resolver for your app
194
        //mResolver = getContentResolver();
187
        //mResolver = getContentResolver();
195
 
188
 
196
        mAppDatabase = DatabaseHelper.getInstance(getApplicationContext()).getAppDatabase();
189
        mAppDatabase = DatabaseHelper.getInstance(this).getAppDatabase();
197
 
Línea 190... Línea 198...
190
 
198
        preference = Preference.getInstance(getApplicationContext());
191
        preference = new Preference(this);
199
        preference.load();
Línea 192... Línea 200...
192
 
200
 
Línea 229... Línea 237...
229
        navHeaderUserName = header.findViewById(R.id.nav_header_user_name);
237
        navHeaderUserName = header.findViewById(R.id.nav_header_user_name);
230
        navHeaderUserEmail =  header.findViewById(R.id.nav_header_user_email);
238
        navHeaderUserEmail =  header.findViewById(R.id.nav_header_user_email);
Línea 231... Línea 239...
231
 
239
 
Línea -... Línea 240...
-
 
240
        textViewMessageNotConnection = findViewById(R.id.main_activity_text_view_message_not_connection);
-
 
241
 
-
 
242
        mSlideRefreshUIViewModel = new ViewModelProvider(this).get(SlideRefreshUIViewModel.class);
232
        textViewMessageNotConnection = findViewById(R.id.main_activity_text_view_message_not_connection);
243
 
233
 
244
 
Línea 234... Línea 245...
234
        mConnectivityReceiver = new ConnectivityReceiver();
245
        mConnectivityReceiver = new ConnectivityReceiver();
235
        registerReceiver(mConnectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
246
        registerReceiver(mConnectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
Línea 261... Línea 272...
261
    @Override
272
    @Override
262
    protected void onResume() {
273
    protected void onResume() {
263
        super.onResume();
274
        super.onResume();
264
        isForeground = true;
275
        isForeground = true;
Línea 265... Línea 276...
265
 
276
 
266
        if(preference == null) {
277
        preference = Preference.getInstance(getApplicationContext());
267
            preference = new Preference(this);
-
 
268
        }
278
        preference.load();
269
 
279
        
Línea 270... Línea 280...
270
        reloadNavHeader();
280
        reloadNavHeader();
Línea 271... Línea 281...
271
 
281
 
Línea 272... Línea 282...
272
        Log.e("Se ejecuta", "On resumen");
282
        Log.e("Se ejecuta", "On resumen");
273
 
283
 
274
        if(TextUtils.isEmpty(preference.getUserUuid())) {
284
        if(TextUtils.isEmpty(preference.getUserUuid())) {
275
 
285
 
276
            //Verifico que el teclado no vaya a relanzar el fragment de intro al usar Google Smartlock para traer
286
            //Verifico que el teclado no vaya a relanzar el fragment de intro al usar Google Smartlock para traer
277
            //Informacion de inicio de sesion almacenada en su cuenta personal de Google
287
            //Informacion de inicio de sesion almacenada en su cuenta personal de Google
Línea 278... Línea 288...
278
            if (!issmartlockloginrun) {
288
            if (!isSmartLockLoginRun) {
279
                invokeFragment(Constants.IDX_FRAGMENT_INTRO);
289
                invokeFragment(Constants.IDX_FRAGMENT_INTRO);
Línea 294... Línea 304...
294
    @Override
304
    @Override
295
    protected void onPause() {
305
    protected void onPause() {
296
        super.onPause();
306
        super.onPause();
Línea 297... Línea 307...
297
 
307
 
298
        isForeground = false;
308
        isForeground = false;
-
 
309
        preference.save();
-
 
310
    }
-
 
311
 
-
 
312
    /*
-
 
313
    @Override
-
 
314
    protected void onRestart() {
-
 
315
        super.onRestart();
-
 
316
        preference = Preference.getInstance(getApplicationContext());
-
 
317
        preference.load();
-
 
318
 
-
 
319
        if(TextUtils.isEmpty(preference.getUserUuid())) {
-
 
320
 
-
 
321
            //Verifico que el teclado no vaya a relanzar el fragment de intro al usar Google Smartlock para traer
-
 
322
            //Informacion de inicio de sesion almacenada en su cuenta personal de Google
-
 
323
            if (!isSmartLockLoginRun) {
-
 
324
                invokeFragment(Constants.IDX_FRAGMENT_INTRO);
-
 
325
                isSmartLockLoginRun= true;
-
 
326
            }
-
 
327
 
-
 
328
 
-
 
329
        } else {
-
 
330
            if(preference.getFragmentIdxActive() == 0) {
-
 
331
                invokeFragment(Constants.IDX_FRAGMENT_TOPICS);
-
 
332
            } else {
-
 
333
                invokeFragment(preference.getFragmentIdxActive());
-
 
334
            }
-
 
335
        }
-
 
336
 
299
        preference.save(this);
337
 
-
 
338
    }
-
 
339
    */
-
 
340
 
-
 
341
    /*
-
 
342
    @Override
-
 
343
    protected void onStop() {
-
 
344
        super.onStop();
-
 
345
        preference.save();
-
 
346
 
-
 
347
    }
Línea 300... Línea 348...
300
    }
348
    */
301
 
349
 
302
    @Override
350
    @Override
303
    public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
351
    public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
Línea 394... Línea 442...
394
        if(new_capsules > 0) {
442
        if(new_capsules > 0) {
395
            builder.setBadgeIconType(NotificationCompat.BADGE_ICON_LARGE);
443
            builder.setBadgeIconType(NotificationCompat.BADGE_ICON_LARGE);
396
            builder.setNumber(new_capsules);
444
            builder.setNumber(new_capsules);
397
        }
445
        }
Línea 398... Línea 446...
398
 
446
 
399
        Intent notificationIntent = new Intent(this, MainActivity.class);
447
        Intent notificationIntent = new Intent(getApplicationContext(), MainActivity.class);
400
        notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
448
        notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
401
        //notification message will get at NotificationView
449
        //notification message will get at NotificationView
Línea 402... Línea 450...
402
        notificationIntent.putExtra(title, body);
450
        notificationIntent.putExtra(title, body);
403
 
451
 
404
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent,
452
        PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, notificationIntent,
Línea 405... Línea 453...
405
                PendingIntent.FLAG_IMMUTABLE);
453
                PendingIntent.FLAG_IMMUTABLE);
406
        builder.setContentIntent(pendingIntent);
454
        builder.setContentIntent(pendingIntent);
Línea 414... Línea 462...
414
 
462
 
415
            String message = new_capsules == 1
463
            String message = new_capsules == 1
416
                    ? "Hay 1 cápsula nueva disponible"
464
                    ? "Hay 1 cápsula nueva disponible"
Línea 417... Línea 465...
417
                    : "Hay " + new_capsules + " cápsulas disponible";
465
                    : "Hay " + new_capsules + " cápsulas disponible";
418
 
466
 
419
           // showMessageSnackBarWithClose(message);
467
            showMessageSnackBarWithClose(message);
420
        } else {
468
        } else {
Línea 421... Línea 469...
421
           // showMessageSnackBarWithClose(body);
469
            showMessageSnackBarWithClose(body);
Línea 445... Línea 493...
445
        preference.setCompanyCount(0);
493
        preference.setCompanyCount(0);
446
        preference.setCompanyUuidActive("");
494
        preference.setCompanyUuidActive("");
447
        preference.setTopicUuidActive("");
495
        preference.setTopicUuidActive("");
448
        preference.setCapsuleUuidActive("");
496
        preference.setCapsuleUuidActive("");
449
        preference.setSlideUuidActive("");
497
        preference.setSlideUuidActive("");
450
        preference.save(this);
498
        preference.save();
Línea 451... Línea 499...
451
 
499
 
452
        invokeFragment(Constants.IDX_FRAGMENT_INTRO);
500
        invokeFragment(Constants.IDX_FRAGMENT_INTRO);
Línea 453... Línea 501...
453
    }
501
    }
Línea 480... Línea 528...
480
            case Constants.IDX_FRAGMENT_FINISH_TOPIC :
528
            case Constants.IDX_FRAGMENT_FINISH_TOPIC :
Línea 481... Línea 529...
481
 
529
 
482
                preference.setTopicUuidActive("");
530
                preference.setTopicUuidActive("");
483
                preference.setCapsuleUuidActive("");
531
                preference.setCapsuleUuidActive("");
484
                preference.setSlideUuidActive("");
532
                preference.setSlideUuidActive("");
Línea 485... Línea 533...
485
                preference.save(this);
533
                preference.save();
486
 
534
 
Línea 487... Línea 535...
487
                invokeFragment(Constants.IDX_FRAGMENT_TOPICS);
535
                invokeFragment(Constants.IDX_FRAGMENT_TOPICS);
Línea 496... Línea 544...
496
                return;
544
                return;
Línea 497... Línea 545...
497
 
545
 
498
            case Constants.IDX_FRAGMENT_FINISH_CAPSULE :
546
            case Constants.IDX_FRAGMENT_FINISH_CAPSULE :
499
                preference.setCapsuleUuidActive("");
547
                preference.setCapsuleUuidActive("");
500
                preference.setSlideUuidActive("");
548
                preference.setSlideUuidActive("");
Línea 501... Línea 549...
501
                preference.save(this);
549
                preference.save();
502
 
550
 
Línea 503... Línea 551...
503
                invokeFragment(Constants.IDX_FRAGMENT_CAPSULES);
551
                invokeFragment(Constants.IDX_FRAGMENT_CAPSULES);
Línea 614... Línea 662...
614
    @Override
662
    @Override
615
    public void createSyncRecordNewToken(String token)
663
    public void createSyncRecordNewToken(String token)
616
    {
664
    {
Línea 617... Línea 665...
617
 
665
 
618
        preference.setDeviceToken (token);
666
        preference.setDeviceToken (token);
Línea 619... Línea 667...
619
        preference.save(this);
667
        preference.save();
620
 
668
 
621
        if(!TextUtils.isEmpty(preference.getDeviceUuid())) {
669
        if(!TextUtils.isEmpty(preference.getDeviceUuid())) {
622
            Sync sync = new Sync(Constants.SYNC_ADAPTER_TYPE_FCM, token);
670
            Sync sync = new Sync(Constants.SYNC_ADAPTER_TYPE_FCM, token);
Línea 683... Línea 731...
683
    public void invokeFragment(int fragmentIdxActiveNuevo)
731
    public void invokeFragment(int fragmentIdxActiveNuevo)
684
    {
732
    {
685
        String fragmentKeyActual    = PREFIX_FRAG + preference.getFragmentIdxActive();
733
        String fragmentKeyActual    = PREFIX_FRAG + preference.getFragmentIdxActive();
686
        String fragmentKeyNuevo 	= PREFIX_FRAG + fragmentIdxActiveNuevo;
734
        String fragmentKeyNuevo 	= PREFIX_FRAG + fragmentIdxActiveNuevo;
687
        preference.setFragmentIdxActive(fragmentIdxActiveNuevo);
735
        preference.setFragmentIdxActive(fragmentIdxActiveNuevo);
688
        preference.save(this);
736
        preference.save();
Línea 689... Línea 737...
689
 
737
 
690
        Fragment fragment;
738
        Fragment fragment;
691
        if(!fragmentKeyActual.equalsIgnoreCase(fragmentKeyNuevo)) {
739
        if(!fragmentKeyActual.equalsIgnoreCase(fragmentKeyNuevo)) {
692
            if(fragmentHashMap.containsKey(fragmentKeyActual)) {
740
            if(fragmentHashMap.containsKey(fragmentKeyActual)) {
693
                fragment = fragmentHashMap.get(fragmentKeyActual);
741
                fragment = fragmentHashMap.get(fragmentKeyActual);
694
                if(fragment != null) {
742
                if(fragment != null) {
695
                    FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
743
                    FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
696
                    fragmentTransaction.hide(fragment);
744
                    fragmentTransaction.hide(fragment);
697
                    fragmentTransaction.commit();
745
                    fragmentTransaction.commitAllowingStateLoss();
698
                }
746
                }
699
            }
747
            }
Línea 700... Línea 748...
700
        }
748
        }
Línea 714... Línea 762...
714
                     add = true;
762
                     add = true;
715
                     fragment = new SigninFragment();
763
                     fragment = new SigninFragment();
716
                 }
764
                 }
717
                break;
765
                break;
Línea 718... Línea -...
718
 
-
 
719
            case Constants.IDX_WELCOME_APP :
-
 
720
                getSupportActionBar().hide();
-
 
721
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
-
 
722
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
-
 
723
                } else {
-
 
724
                    add = true;
-
 
725
                    fragment = new WelcomeFragment();
-
 
726
                }
-
 
727
                break;
-
 
728
 
766
 
Línea 729... Línea 767...
729
            case Constants.IDX_FRAGMENT_TOPICS :
767
            case Constants.IDX_FRAGMENT_TOPICS :
730
 
768
 
Línea 854... Línea 892...
854
        if(add) {
892
        if(add) {
855
            fragmentHashMap.put(fragmentKeyNuevo, fragment);
893
            fragmentHashMap.put(fragmentKeyNuevo, fragment);
Línea 856... Línea 894...
856
 
894
 
857
            FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
895
            FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
858
            fragmentTransaction.add(R.id.fragment_container, fragment, fragmentKeyNuevo);
896
            fragmentTransaction.add(R.id.fragment_container, fragment, fragmentKeyNuevo);
859
            fragmentTransaction.commit();
897
            fragmentTransaction.commitAllowingStateLoss();
Línea 860... Línea 898...
860
        }
898
        }
861
 
899
 
862
 
900
 
863
        if(fragment != null) {
901
        if(fragment != null) {
864
            FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
902
            FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
Línea 865... Línea 903...
865
            fragmentTransaction.show(fragment);
903
            fragmentTransaction.show(fragment);
Línea 866... Línea 904...
866
            fragmentTransaction.commit();
904
            fragmentTransaction.commitAllowingStateLoss();
867
        }
905
        }
868
 
906
 
869
    }
907
    }
870
 
908
 
Línea 871... Línea 909...
871
    @Override
909
    @Override
872
    public void changeTopicActive(String topicUuid)
910
    public void changeTopicActive(String topicUuid)
873
    {
911
    {
874
        Log.d(TAG, "changeTopicActive : " + topicUuid);
912
        Log.d(TAG, "changeTopicActive : " + topicUuid);
Línea 875... Línea 913...
875
        Log.e("Guardo", "Topico en Main");
913
       // Log.e("Guardo", "Topico en Main");
876
 
914
 
Línea 877... Línea 915...
877
        preference.setTopicUuidActive(topicUuid);
915
        preference.setTopicUuidActive(topicUuid);
Línea 889... Línea 927...
889
 
927
 
890
 
928
 
891
 
-
 
892
        preference.setCapsuleUuidActive(capsuleUuid);
-
 
893
        preference.setSlideUuidActive("");
929
 
Línea 894... Línea 930...
894
 
930
        preference.setCapsuleUuidActive(capsuleUuid);
895
 
931
        preference.setSlideUuidActive("");
Línea 896... Línea 932...
896
        preference.save(this);
932
        preference.save();
897
 
933
 
898
        invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
934
        invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
899
    }
935
    }
Línea 900... Línea 936...
900
 
936
 
901
    @Override
937
    @Override
902
    public void changeCompanyActive(String companyUuid)
938
    public void changeCompanyActive(String companyUuid)
Línea 903... Línea 939...
903
    {
939
    {
904
        Log.d(TAG, "changeCompanyActive : " + companyUuid);
940
        Log.d(TAG, "changeCompanyActive : " + companyUuid);
905
 
941
 
Línea 916... Línea 952...
916
        if(!preference.getSlideUuidActive().equals(slideUuid) && type.equals(Constants.SLIDE_TYPE_IMAGE)) {
952
        if(!preference.getSlideUuidActive().equals(slideUuid) && type.equals(Constants.SLIDE_TYPE_IMAGE)) {
917
            Log.d(TAG, "registerOnPageChangeCallback - createProgressAndSyncRecord");
953
            Log.d(TAG, "registerOnPageChangeCallback - createProgressAndSyncRecord");
Línea 918... Línea 954...
918
 
954
 
919
            createProgressAndSyncRecord(slideUuid, true, false, false);
955
            createProgressAndSyncRecord(slideUuid, true, false, false);
920
        }
-
 
921
 
-
 
922
 
-
 
923
 
956
        }
924
        preference.setSlideUuidActive(slideUuid);
957
        preference.setSlideUuidActive(slideUuid);
Línea 925... Línea 958...
925
        preference.save(this);
958
        preference.save();
926
 
959
 
927
 
960
 
-
 
961
        if(showGallery) {
-
 
962
            invokeFragment(Constants.IDX_FRAGMENT_GALLERY);
-
 
963
            Log.e("Aqui","Es donde cambio el capsule");
-
 
964
 
-
 
965
            SlideRefreshUIViewData slideRefreshUIViewData = mSlideRefreshUIViewModel.getSlideRefreshUIViewData();
928
        if(showGallery) {
966
            slideRefreshUIViewData.setCambioSlide(true);
929
            invokeFragment(Constants.IDX_FRAGMENT_GALLERY);
967
            mSlideRefreshUIViewModel.getSlideRefreshUIMutableLiveData().setValue(slideRefreshUIViewData);
930
            Log.e("Aqui","Es donde cambio el capsule");
968
 
Línea 931... Línea 969...
931
            DatabaseHelper.CambioSlide="SI";
969
            //DatabaseHelper.CambioSlide="SI";
932
        }
970
        }
Línea 1031... Línea 1069...
1031
            progressSlide.setUpdatedOn(dateOn);
1069
            progressSlide.setUpdatedOn(dateOn);
1032
            progressDao.update(progressSlide);
1070
            progressDao.update(progressSlide);
1033
        }
1071
        }
Línea -... Línea 1072...
-
 
1072
 
1034
 
1073
 
Línea 1035... Línea 1074...
1035
 
1074
 
Línea 1159... Línea 1198...
1159
                    Log.d(TAG, "Capsule NEW returningAfterCompleted = " + returningAfterCompleted);
1198
                    Log.d(TAG, "Capsule NEW returningAfterCompleted = " + returningAfterCompleted);
1160
                    progressCapsule.setReturningAfterCompleted(returningAfterCompleted);
1199
                    progressCapsule.setReturningAfterCompleted(returningAfterCompleted);
1161
                }
1200
                }
Línea 1162... Línea 1201...
1162
 
1201
 
1163
                preference.setLastCapsuleUuidActive(capsule.getUuid());
1202
                preference.setLastCapsuleUuidActive(capsule.getUuid());
Línea 1164... Línea 1203...
1164
                preference.save(this);
1203
                preference.save();
1165
 
1204
 
Línea 1166... Línea 1205...
1166
                Log.d(TAG, "Progress Capsule : setLastCapsuleActive : " + preference.getLastCapsuleUuidActive());
1205
                Log.d(TAG, "Progress Capsule : setLastCapsuleActive : " + preference.getLastCapsuleUuidActive());
Línea 1307... Línea 1346...
1307
 
1346
 
1308
    @Override
1347
    @Override
1309
    public void launchVideoViewer(String videoAudioUrl)
1348
    public void launchVideoViewer(String videoAudioUrl)
Línea 1310... Línea 1349...
1310
    {
1349
    {
1311
 
1350
 
1312
        Intent intent = new Intent(this, VideoAudioActivity.class);
1351
        Intent intent = new Intent(getApplicationContext(), VideoAudioActivity.class);
1313
        intent.putExtra("videoAudioUrl",videoAudioUrl);
1352
        intent.putExtra("videoAudioUrl",videoAudioUrl);
1314
        intent.putExtra("deviceId", preference.getDeviceUuid());
1353
        intent.putExtra("deviceId", preference.getDeviceUuid());
Línea 1321... Línea 1360...
1321
 
1360
 
1322
    @Override
1361
    @Override
1323
    public void launchAudioViewer(String videoAudioUrl)
1362
    public void launchAudioViewer(String videoAudioUrl)
Línea 1324... Línea 1363...
1324
    {
1363
    {
1325
 
1364
 
1326
        Intent intent = new Intent(this, VideoAudioActivity.class);
1365
        Intent intent = new Intent(getApplicationContext(), VideoAudioActivity.class);
1327
        intent.putExtra("videoAudioUrl",videoAudioUrl);
1366
        intent.putExtra("videoAudioUrl",videoAudioUrl);
1328
        intent.putExtra("deviceId", preference.getDeviceUuid());
1367
        intent.putExtra("deviceId", preference.getDeviceUuid());
Línea 1334... Línea 1373...
1334
    }
1373
    }
Línea 1335... Línea 1374...
1335
 
1374
 
1336
    @Override
1375
    @Override
1337
    public void launchTextViewer(String description)
1376
    public void launchTextViewer(String description)
1338
    {
1377
    {
1339
        Intent intent = new Intent(this,TextActivity.class);
1378
        Intent intent = new Intent(getApplicationContext(),TextActivity.class);
Línea 1340... Línea 1379...
1340
        intent.putExtra("description",description);
1379
        intent.putExtra("description",description);
Línea 1341... Línea 1380...
1341
 
1380
 
Línea 1347... Línea 1386...
1347
 
1386
 
1348
    @Override
1387
    @Override
1349
    public void launchDocumentViewer(String file)
1388
    public void launchDocumentViewer(String file)
Línea 1350... Línea 1389...
1350
    {
1389
    {
1351
 
1390
 
1352
        Intent intent = new Intent(this,PdfActivity.class);
1391
        Intent intent = new Intent(getApplicationContext(),PdfActivity.class);
1353
        intent.putExtra("documentUrl",file);
1392
        intent.putExtra("documentUrl",file);
Línea 1354... Línea 1393...
1354
        intent.putExtra("deviceId", preference.getDeviceUuid());
1393
        intent.putExtra("deviceId", preference.getDeviceUuid());
Línea 1410... Línea 1449...
1410
 
1449
 
1411
 
1450
 
Línea 1412... Línea 1451...
1412
            List<Answer> answers;
1451
            List<Answer> answers;
1413
            AnswerDao answerDao = mAppDatabase.getAnswerDao();
1452
            AnswerDao answerDao = mAppDatabase.getAnswerDao();
1414
 
1453
 
1415
            Intent intent = new Intent(this, QuizActivity.class);
1454
            Intent intent = new Intent(getApplicationContext(), QuizActivity.class);
1416
           // intent.putExtra("companyUuid", topic.getCompanyUuid());
1455
           // intent.putExtra("companyUuid", topic.getCompanyUuid());
1417
           // intent.putExtra("topicUuid", topic.getUuid());
1456
           // intent.putExtra("topicUuid", topic.getUuid());
Línea 1471... Línea 1510...
1471
    public Preference getPreference() {
1510
    public Preference getPreference() {
1472
        return preference;
1511
        return preference;
1473
    }
1512
    }
Línea 1474... Línea 1513...
1474
 
1513
 
1475
    @Override
-
 
1476
    public Preference reloadPreference()
-
 
1477
    {
-
 
1478
        preference = new Preference(this);
-
 
1479
        return preference;
-
 
1480
    }
-
 
1481
 
-
 
1482
    @Override
1514
    @Override
1483
    public void reloadNavHeader() {
1515
    public void reloadNavHeader() {
1484
        Log.d(TAG, "User Image = " + preference.getImage());
1516
        Log.d(TAG, "User Image = " + preference.getImage());
1485
        navHeaderUserName.setText((preference.getFirstName() + " " + preference.getLastName()).trim());
1517
        navHeaderUserName.setText((preference.getFirstName() + " " + preference.getLastName()).trim());
Línea 1517... Línea 1549...
1517
                    .build());
1549
                    .build());
Línea 1518... Línea 1550...
1518
 
1550
 
1519
            RequestOptions options = new RequestOptions()
1551
            RequestOptions options = new RequestOptions()
Línea 1520... Línea 1552...
1520
                    .diskCacheStrategy(DiskCacheStrategy.ALL);
1552
                    .diskCacheStrategy(DiskCacheStrategy.ALL);
1521
 
1553
 
1522
            Glide.with(this).load(url)
1554
            Glide.with(getApplicationContext()).load(url)
1523
                    .thumbnail()
1555
                    .thumbnail()
1524
                    .apply(options)
1556
                    .apply(options)
1525
                    .into(navHeaderUserImage);
1557
                    .into(navHeaderUserImage);
Línea 1928... Línea 1960...
1928
 
1960
 
Línea 1929... Línea 1961...
1929
            }
1961
            }
1930
 
1962
 
1931
            preference.setLastDataRefresh(addedOn);
1963
            preference.setLastDataRefresh(addedOn);
Línea 1932... Línea 1964...
1932
            preference.setCompanyCount(companySize);
1964
            preference.setCompanyCount(companySize);
1933
            preference.save(this);
1965
            preference.save();
1934
 
1966
 
1935
        } catch (JSONException e) {
1967
        } catch (JSONException e) {
Línea 1962... Línea 1994...
1962
 
1994
 
1963
            if(success) {
1995
            if(success) {
1964
                Calendar calendar = Calendar.getInstance();
1996
                Calendar calendar = Calendar.getInstance();
1965
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Constants.FORMAT_DATETIME_SERVICE);
1997
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Constants.FORMAT_DATETIME_SERVICE);
1966
                preference.setLastDataRefresh(simpleDateFormat.format(calendar.getTime()));
1998
                preference.setLastDataRefresh(simpleDateFormat.format(calendar.getTime()));
Línea 1967... Línea 1999...
1967
                preference.save(this);
1999
                preference.save();
1968
 
2000
 
Línea 1969... Línea 2001...
1969
                String max_date_changes = "";
2001
                String max_date_changes = "";