Proyectos de Subversion Android Microlearning

Rev

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

Rev 25 Rev 26
Línea 177... Línea 177...
177
 
177
 
178
        /**** CANAL DE NOTIFICACIONES **/
178
        /**** CANAL DE NOTIFICACIONES **/
Línea 179... Línea 179...
179
        createNotificationChannel();
179
        createNotificationChannel();
180
 
180
 
Línea 181... Línea 181...
181
        /*** CUENTAS DE SINCRONIZACION **/
181
        /*** CUENTAS DE SINCRONIZACION **/
182
        mAccount =  CreateSyncAccount(this);
182
        mAccount =  CreateSyncAccount(getApplicationContext());
Línea 183... Línea 183...
183
 
183
 
Línea 184... Línea 184...
184
 
184
 
Línea 185... Línea 185...
185
        // Get the content resolver for your app
185
        // Get the content resolver for your app
186
        //mResolver = getContentResolver();
186
        //mResolver = getContentResolver();
187
 
187
 
188
        mAppDatabase = DatabaseHelper.getInstance(this).getAppDatabase();
188
        mAppDatabase = DatabaseHelper.getInstance(this).getAppDatabase();
Línea 189... Línea 189...
189
 
189
 
190
        preference = new Preference(this);
190
        preference = new Preference(getApplicationContext());
Línea 191... Línea 191...
191
 
191
 
Línea 261... Línea 261...
261
    protected void onResume() {
261
    protected void onResume() {
262
        super.onResume();
262
        super.onResume();
263
        isForeground = true;
263
        isForeground = true;
Línea 264... Línea 264...
264
 
264
 
265
        if(preference == null) {
265
        if(preference == null) {
266
            preference = new Preference(this);
266
            preference = new Preference(getApplicationContext());
267
        } else {
267
        } else {
268
            preference.load(this);
268
            preference.load(getApplicationContext());
269
        }
269
        }
Línea 270... Línea 270...
270
        reloadNavHeader();
270
        reloadNavHeader();
Línea 294... Línea 294...
294
    @Override
294
    @Override
295
    protected void onPause() {
295
    protected void onPause() {
296
        super.onPause();
296
        super.onPause();
Línea 297... Línea 297...
297
 
297
 
298
        isForeground = false;
298
        isForeground = false;
299
        preference.save(this);
299
        preference.save(getApplicationContext());
Línea 300... Línea 300...
300
    }
300
    }
301
 
301
 
302
    @Override
302
    @Override
Línea 303... Línea 303...
303
    protected void onRestart() {
303
    protected void onRestart() {
304
        super.onRestart();
304
        super.onRestart();
305
 
305
 
306
        if(preference == null) {
306
        if(preference == null) {
307
            preference = new Preference(this);
307
            preference = new Preference(getApplicationContext());
Línea 308... Línea 308...
308
        } else {
308
        } else {
Línea 309... Línea 309...
309
            preference.load(this);
309
            preference.load(getApplicationContext());
Línea 331... Línea 331...
331
    }
331
    }
Línea 332... Línea 332...
332
 
332
 
333
    @Override
333
    @Override
334
    protected void onStop() {
334
    protected void onStop() {
335
        super.onStop();
335
        super.onStop();
Línea 336... Línea 336...
336
        preference.save(this);
336
        preference.save(getApplicationContext());
Línea 337... Línea 337...
337
 
337
 
338
    }
338
    }
Línea 432... Línea 432...
432
        if(new_capsules > 0) {
432
        if(new_capsules > 0) {
433
            builder.setBadgeIconType(NotificationCompat.BADGE_ICON_LARGE);
433
            builder.setBadgeIconType(NotificationCompat.BADGE_ICON_LARGE);
434
            builder.setNumber(new_capsules);
434
            builder.setNumber(new_capsules);
435
        }
435
        }
Línea 436... Línea 436...
436
 
436
 
437
        Intent notificationIntent = new Intent(this, MainActivity.class);
437
        Intent notificationIntent = new Intent(getApplicationContext(), MainActivity.class);
438
        notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
438
        notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
439
        //notification message will get at NotificationView
439
        //notification message will get at NotificationView
Línea 440... Línea 440...
440
        notificationIntent.putExtra(title, body);
440
        notificationIntent.putExtra(title, body);
441
 
441
 
442
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent,
442
        PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, notificationIntent,
Línea 443... Línea 443...
443
                PendingIntent.FLAG_IMMUTABLE);
443
                PendingIntent.FLAG_IMMUTABLE);
444
        builder.setContentIntent(pendingIntent);
444
        builder.setContentIntent(pendingIntent);
Línea 483... Línea 483...
483
        preference.setCompanyCount(0);
483
        preference.setCompanyCount(0);
484
        preference.setCompanyUuidActive("");
484
        preference.setCompanyUuidActive("");
485
        preference.setTopicUuidActive("");
485
        preference.setTopicUuidActive("");
486
        preference.setCapsuleUuidActive("");
486
        preference.setCapsuleUuidActive("");
487
        preference.setSlideUuidActive("");
487
        preference.setSlideUuidActive("");
488
        preference.save(this);
488
        preference.save(getApplicationContext());
Línea 489... Línea 489...
489
 
489
 
490
        invokeFragment(Constants.IDX_FRAGMENT_INTRO);
490
        invokeFragment(Constants.IDX_FRAGMENT_INTRO);
Línea 491... Línea 491...
491
    }
491
    }
Línea 518... Línea 518...
518
            case Constants.IDX_FRAGMENT_FINISH_TOPIC :
518
            case Constants.IDX_FRAGMENT_FINISH_TOPIC :
Línea 519... Línea 519...
519
 
519
 
520
                preference.setTopicUuidActive("");
520
                preference.setTopicUuidActive("");
521
                preference.setCapsuleUuidActive("");
521
                preference.setCapsuleUuidActive("");
522
                preference.setSlideUuidActive("");
522
                preference.setSlideUuidActive("");
Línea 523... Línea 523...
523
                preference.save(this);
523
                preference.save(getApplicationContext());
524
 
524
 
Línea 525... Línea 525...
525
                invokeFragment(Constants.IDX_FRAGMENT_TOPICS);
525
                invokeFragment(Constants.IDX_FRAGMENT_TOPICS);
Línea 534... Línea 534...
534
                return;
534
                return;
Línea 535... Línea 535...
535
 
535
 
536
            case Constants.IDX_FRAGMENT_FINISH_CAPSULE :
536
            case Constants.IDX_FRAGMENT_FINISH_CAPSULE :
537
                preference.setCapsuleUuidActive("");
537
                preference.setCapsuleUuidActive("");
538
                preference.setSlideUuidActive("");
538
                preference.setSlideUuidActive("");
Línea 539... Línea 539...
539
                preference.save(this);
539
                preference.save(getApplicationContext());
540
 
540
 
Línea 541... Línea 541...
541
                invokeFragment(Constants.IDX_FRAGMENT_CAPSULES);
541
                invokeFragment(Constants.IDX_FRAGMENT_CAPSULES);
Línea 652... Línea 652...
652
    @Override
652
    @Override
653
    public void createSyncRecordNewToken(String token)
653
    public void createSyncRecordNewToken(String token)
654
    {
654
    {
Línea 655... Línea 655...
655
 
655
 
656
        preference.setDeviceToken (token);
656
        preference.setDeviceToken (token);
Línea 657... Línea 657...
657
        preference.save(this);
657
        preference.save(getApplicationContext());
658
 
658
 
659
        if(!TextUtils.isEmpty(preference.getDeviceUuid())) {
659
        if(!TextUtils.isEmpty(preference.getDeviceUuid())) {
660
            Sync sync = new Sync(Constants.SYNC_ADAPTER_TYPE_FCM, token);
660
            Sync sync = new Sync(Constants.SYNC_ADAPTER_TYPE_FCM, token);
Línea 721... Línea 721...
721
    public void invokeFragment(int fragmentIdxActiveNuevo)
721
    public void invokeFragment(int fragmentIdxActiveNuevo)
722
    {
722
    {
723
        String fragmentKeyActual    = PREFIX_FRAG + preference.getFragmentIdxActive();
723
        String fragmentKeyActual    = PREFIX_FRAG + preference.getFragmentIdxActive();
724
        String fragmentKeyNuevo 	= PREFIX_FRAG + fragmentIdxActiveNuevo;
724
        String fragmentKeyNuevo 	= PREFIX_FRAG + fragmentIdxActiveNuevo;
725
        preference.setFragmentIdxActive(fragmentIdxActiveNuevo);
725
        preference.setFragmentIdxActive(fragmentIdxActiveNuevo);
726
        preference.save(this);
726
        preference.save(getApplicationContext());
Línea 727... Línea 727...
727
 
727
 
728
        Fragment fragment;
728
        Fragment fragment;
729
        if(!fragmentKeyActual.equalsIgnoreCase(fragmentKeyNuevo)) {
729
        if(!fragmentKeyActual.equalsIgnoreCase(fragmentKeyNuevo)) {
730
            if(fragmentHashMap.containsKey(fragmentKeyActual)) {
730
            if(fragmentHashMap.containsKey(fragmentKeyActual)) {
Línea 903... Línea 903...
903
       // Log.e("Guardo", "Topico en Main");
903
       // Log.e("Guardo", "Topico en Main");
Línea 904... Línea 904...
904
 
904
 
905
        preference.setTopicUuidActive(topicUuid);
905
        preference.setTopicUuidActive(topicUuid);
906
        preference.setCapsuleUuidActive("");
906
        preference.setCapsuleUuidActive("");
907
        preference.setSlideUuidActive("");
907
        preference.setSlideUuidActive("");
Línea 908... Línea 908...
908
        preference.save(this);
908
        preference.save(getApplicationContext());
909
 
909
 
Línea 910... Línea 910...
910
        invokeFragment(Constants.IDX_FRAGMENT_CAPSULES);
910
        invokeFragment(Constants.IDX_FRAGMENT_CAPSULES);
Línea 919... Línea 919...
919
 
919
 
920
        preference.setCapsuleUuidActive(capsuleUuid);
920
        preference.setCapsuleUuidActive(capsuleUuid);
Línea 921... Línea 921...
921
        preference.setSlideUuidActive("");
921
        preference.setSlideUuidActive("");
Línea 922... Línea 922...
922
 
922
 
923
 
923
 
Línea 924... Línea 924...
924
        preference.save(this);
924
        preference.save(getApplicationContext());
925
 
925
 
926
        invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
926
        invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
927
    }
927
    }
Línea 928... Línea 928...
928
 
928
 
929
    @Override
929
    @Override
930
    public void changeCompanyActive(String companyUuid)
930
    public void changeCompanyActive(String companyUuid)
Línea 931... Línea 931...
931
    {
931
    {
932
        Log.d(TAG, "changeCompanyActive : " + companyUuid);
932
        Log.d(TAG, "changeCompanyActive : " + companyUuid);
933
 
933
 
Línea 948... Línea 948...
948
        }
948
        }
Línea 949... Línea 949...
949
 
949
 
950
 
950
 
Línea 951... Línea 951...
951
 
951
 
952
        preference.setSlideUuidActive(slideUuid);
952
        preference.setSlideUuidActive(slideUuid);
953
        preference.save(this);
953
        preference.save(getApplicationContext());
Línea 1187... Línea 1187...
1187
                    Log.d(TAG, "Capsule NEW returningAfterCompleted = " + returningAfterCompleted);
1187
                    Log.d(TAG, "Capsule NEW returningAfterCompleted = " + returningAfterCompleted);
1188
                    progressCapsule.setReturningAfterCompleted(returningAfterCompleted);
1188
                    progressCapsule.setReturningAfterCompleted(returningAfterCompleted);
1189
                }
1189
                }
Línea 1190... Línea 1190...
1190
 
1190
 
1191
                preference.setLastCapsuleUuidActive(capsule.getUuid());
1191
                preference.setLastCapsuleUuidActive(capsule.getUuid());
Línea 1192... Línea 1192...
1192
                preference.save(this);
1192
                preference.save(getApplicationContext());
1193
 
1193
 
Línea 1194... Línea 1194...
1194
                Log.d(TAG, "Progress Capsule : setLastCapsuleActive : " + preference.getLastCapsuleUuidActive());
1194
                Log.d(TAG, "Progress Capsule : setLastCapsuleActive : " + preference.getLastCapsuleUuidActive());
Línea 1335... Línea 1335...
1335
 
1335
 
1336
    @Override
1336
    @Override
1337
    public void launchVideoViewer(String videoAudioUrl)
1337
    public void launchVideoViewer(String videoAudioUrl)
Línea 1338... Línea 1338...
1338
    {
1338
    {
1339
 
1339
 
1340
        Intent intent = new Intent(this, VideoAudioActivity.class);
1340
        Intent intent = new Intent(getApplicationContext(), VideoAudioActivity.class);
1341
        intent.putExtra("videoAudioUrl",videoAudioUrl);
1341
        intent.putExtra("videoAudioUrl",videoAudioUrl);
1342
        intent.putExtra("deviceId", preference.getDeviceUuid());
1342
        intent.putExtra("deviceId", preference.getDeviceUuid());
Línea 1349... Línea 1349...
1349
 
1349
 
1350
    @Override
1350
    @Override
1351
    public void launchAudioViewer(String videoAudioUrl)
1351
    public void launchAudioViewer(String videoAudioUrl)
Línea 1352... Línea 1352...
1352
    {
1352
    {
1353
 
1353
 
1354
        Intent intent = new Intent(this, VideoAudioActivity.class);
1354
        Intent intent = new Intent(getApplicationContext(), VideoAudioActivity.class);
1355
        intent.putExtra("videoAudioUrl",videoAudioUrl);
1355
        intent.putExtra("videoAudioUrl",videoAudioUrl);
1356
        intent.putExtra("deviceId", preference.getDeviceUuid());
1356
        intent.putExtra("deviceId", preference.getDeviceUuid());
Línea 1362... Línea 1362...
1362
    }
1362
    }
Línea 1363... Línea 1363...
1363
 
1363
 
1364
    @Override
1364
    @Override
1365
    public void launchTextViewer(String description)
1365
    public void launchTextViewer(String description)
1366
    {
1366
    {
1367
        Intent intent = new Intent(this,TextActivity.class);
1367
        Intent intent = new Intent(getApplicationContext(),TextActivity.class);
Línea 1368... Línea 1368...
1368
        intent.putExtra("description",description);
1368
        intent.putExtra("description",description);
Línea 1369... Línea 1369...
1369
 
1369
 
Línea 1375... Línea 1375...
1375
 
1375
 
1376
    @Override
1376
    @Override
1377
    public void launchDocumentViewer(String file)
1377
    public void launchDocumentViewer(String file)
Línea 1378... Línea 1378...
1378
    {
1378
    {
1379
 
1379
 
1380
        Intent intent = new Intent(this,PdfActivity.class);
1380
        Intent intent = new Intent(getApplicationContext(),PdfActivity.class);
1381
        intent.putExtra("documentUrl",file);
1381
        intent.putExtra("documentUrl",file);
Línea 1382... Línea 1382...
1382
        intent.putExtra("deviceId", preference.getDeviceUuid());
1382
        intent.putExtra("deviceId", preference.getDeviceUuid());
Línea 1438... Línea 1438...
1438
 
1438
 
1439
 
1439
 
Línea 1440... Línea 1440...
1440
            List<Answer> answers;
1440
            List<Answer> answers;
1441
            AnswerDao answerDao = mAppDatabase.getAnswerDao();
1441
            AnswerDao answerDao = mAppDatabase.getAnswerDao();
1442
 
1442
 
1443
            Intent intent = new Intent(this, QuizActivity.class);
1443
            Intent intent = new Intent(getApplicationContext(), QuizActivity.class);
1444
           // intent.putExtra("companyUuid", topic.getCompanyUuid());
1444
           // intent.putExtra("companyUuid", topic.getCompanyUuid());
1445
           // intent.putExtra("topicUuid", topic.getUuid());
1445
           // intent.putExtra("topicUuid", topic.getUuid());
Línea 1501... Línea 1501...
1501
    }
1501
    }
Línea 1502... Línea 1502...
1502
 
1502
 
1503
    @Override
1503
    @Override
1504
    public Preference reloadPreference()
1504
    public Preference reloadPreference()
1505
    {
1505
    {
1506
        preference = new Preference(this);
1506
        preference = new Preference(getApplicationContext());
1507
        return preference;
1507
        return preference;
Línea 1508... Línea 1508...
1508
    }
1508
    }
1509
 
1509
 
Línea 1545... Línea 1545...
1545
                    .build());
1545
                    .build());
Línea 1546... Línea 1546...
1546
 
1546
 
1547
            RequestOptions options = new RequestOptions()
1547
            RequestOptions options = new RequestOptions()
Línea 1548... Línea 1548...
1548
                    .diskCacheStrategy(DiskCacheStrategy.ALL);
1548
                    .diskCacheStrategy(DiskCacheStrategy.ALL);
1549
 
1549
 
1550
            Glide.with(this).load(url)
1550
            Glide.with(getApplicationContext()).load(url)
1551
                    .thumbnail()
1551
                    .thumbnail()
1552
                    .apply(options)
1552
                    .apply(options)
1553
                    .into(navHeaderUserImage);
1553
                    .into(navHeaderUserImage);
Línea 1956... Línea 1956...
1956
 
1956
 
Línea 1957... Línea 1957...
1957
            }
1957
            }
1958
 
1958
 
1959
            preference.setLastDataRefresh(addedOn);
1959
            preference.setLastDataRefresh(addedOn);
Línea 1960... Línea 1960...
1960
            preference.setCompanyCount(companySize);
1960
            preference.setCompanyCount(companySize);
1961
            preference.save(this);
1961
            preference.save(getApplicationContext());
1962
 
1962
 
1963
        } catch (JSONException e) {
1963
        } catch (JSONException e) {
Línea 1990... Línea 1990...
1990
 
1990
 
1991
            if(success) {
1991
            if(success) {
1992
                Calendar calendar = Calendar.getInstance();
1992
                Calendar calendar = Calendar.getInstance();
1993
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Constants.FORMAT_DATETIME_SERVICE);
1993
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Constants.FORMAT_DATETIME_SERVICE);
1994
                preference.setLastDataRefresh(simpleDateFormat.format(calendar.getTime()));
1994
                preference.setLastDataRefresh(simpleDateFormat.format(calendar.getTime()));
Línea 1995... Línea 1995...
1995
                preference.save(this);
1995
                preference.save(getApplicationContext());
1996
 
1996
 
Línea 1997... Línea 1997...
1997
                String max_date_changes = "";
1997
                String max_date_changes = "";