Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

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

Rev 63 Rev 65
Línea 41... Línea 41...
41
import com.cesams.twogetskills.Configuration;
41
import com.cesams.twogetskills.Configuration;
42
import com.cesams.twogetskills.dao.AnswerDao;
42
import com.cesams.twogetskills.dao.AnswerDao;
43
import com.cesams.twogetskills.dao.AppDatabase;
43
import com.cesams.twogetskills.dao.AppDatabase;
44
import com.cesams.twogetskills.dao.CapsuleDao;
44
import com.cesams.twogetskills.dao.CapsuleDao;
45
import com.cesams.twogetskills.dao.CompanyDao;
45
import com.cesams.twogetskills.dao.CompanyDao;
-
 
46
import com.cesams.twogetskills.dao.ConfigDao;
46
import com.cesams.twogetskills.dao.DatabaseHelper;
47
import com.cesams.twogetskills.dao.DatabaseHelper;
47
import com.cesams.twogetskills.dao.NotificationCenterDao;
48
import com.cesams.twogetskills.dao.NotificationCenterDao;
48
import com.cesams.twogetskills.dao.ProgressDao;
49
import com.cesams.twogetskills.dao.ProgressDao;
49
import com.cesams.twogetskills.dao.QuestionDao;
50
import com.cesams.twogetskills.dao.QuestionDao;
50
import com.cesams.twogetskills.dao.QuizDao;
51
import com.cesams.twogetskills.dao.QuizDao;
51
import com.cesams.twogetskills.dao.SlideDao;
52
import com.cesams.twogetskills.dao.SlideDao;
52
import com.cesams.twogetskills.dao.SyncDao;
53
import com.cesams.twogetskills.dao.SyncDao;
53
import com.cesams.twogetskills.dao.TopicDao;
54
import com.cesams.twogetskills.dao.TopicDao;
54
import com.cesams.twogetskills.dao.UserExtendedDao;
55
import com.cesams.twogetskills.dao.UserExtendedDao;
55
import com.cesams.twogetskills.dao.UserLogDao;
56
import com.cesams.twogetskills.dao.UserLogDao;
-
 
57
import com.cesams.twogetskills.entity.Config;
56
import com.cesams.twogetskills.entity.UserExtended;
58
import com.cesams.twogetskills.entity.UserExtended;
57
import com.cesams.twogetskills.fragment.CapsuleDetail;
59
import com.cesams.twogetskills.fragment.CapsuleDetail;
58
import com.cesams.twogetskills.fragment.CapsuleFragment;
60
import com.cesams.twogetskills.fragment.CapsuleFragment;
59
import com.cesams.twogetskills.fragment.CompanyFragment;
61
import com.cesams.twogetskills.fragment.CompanyFragment;
60
import com.cesams.twogetskills.fragment.FinishCapsuleFragment;
62
import com.cesams.twogetskills.fragment.FinishCapsuleFragment;
Línea 179... Línea 181...
179
 
181
 
Línea 180... Línea 182...
180
        Log.d(TAG, "MainActivity onCreate");
182
        Log.d(TAG, "MainActivity onCreate");
Línea -... Línea 183...
-
 
183
 
-
 
184
        mAppDatabase = DatabaseHelper.getInstance(getApplicationContext()).getAppDatabase();
181
 
185
 
Línea 182... Línea 186...
182
        mAppDatabase = DatabaseHelper.getInstance(getApplicationContext()).getAppDatabase();
186
        setNoCapsuleActive();
Línea 183... Línea 187...
183
 
187
 
Línea 362... Línea 366...
362
            inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
366
            inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
363
        } catch (Exception e) {
367
        } catch (Exception e) {
364
            e.printStackTrace();
368
            e.printStackTrace();
365
        }
369
        }
Línea -... Línea 370...
-
 
370
 
-
 
371
    }
-
 
372
 
-
 
373
    public void setNoCapsuleActive()
-
 
374
    {
-
 
375
 
-
 
376
        ConfigDao configuracion =  mAppDatabase.getConfigDao();
-
 
377
 
-
 
378
        if(configuracion.selectConfigByTitle("act_capsule") == null)
-
 
379
        {
-
 
380
            Log.e("La capsula activa"," es nula");
-
 
381
            com.cesams.twogetskills.entity.Config confignueva;
-
 
382
 
-
 
383
            confignueva = new com.cesams.twogetskills.entity.Config();
-
 
384
            confignueva.setTitle("act_capsule");
-
 
385
            confignueva.setNow("");
-
 
386
 
-
 
387
            configuracion.insert(confignueva);
-
 
388
        }
-
 
389
        else{
-
 
390
            Log.e("La capsula activa"," es vacia o tiene algo");
-
 
391
 
-
 
392
            com.cesams.twogetskills.entity.Config confignueva;
-
 
393
 
-
 
394
            confignueva = new com.cesams.twogetskills.entity.Config();
-
 
395
            confignueva.setTitle("act_capsule");
-
 
396
            confignueva.setNow("");
-
 
397
 
-
 
398
            configuracion.update(confignueva);
-
 
399
        }
Línea 366... Línea 400...
366
 
400
 
Línea 367... Línea 401...
367
 
401
 
Línea 623... Línea 657...
623
        preference.setImage("");
657
        preference.setImage("");
624
        preference.setMaxDateChanges("");
658
        preference.setMaxDateChanges("");
625
        preference.setCompanyCount(0);
659
        preference.setCompanyCount(0);
626
        preference.setCompanyUuidActive("");
660
        preference.setCompanyUuidActive("");
627
        preference.setTopicUuidActive("");
661
        preference.setTopicUuidActive("");
628
        preference.setCapsuleUuidActive("");
662
      //  preference.setCapsuleUuidActive("");
-
 
663
        setNoCapsuleActive();
629
        preference.setSlideUuidActive("");
664
        preference.setSlideUuidActive("");
630
        preference.save();
665
        preference.save();
Línea 631... Línea 666...
631
 
666
 
Línea 676... Línea 711...
676
 
711
 
677
                break;
712
                break;
Línea 678... Línea 713...
678
            case Constants.IDX_FRAGMENT_FINISH_TOPIC :
713
            case Constants.IDX_FRAGMENT_FINISH_TOPIC :
679
 
714
 
-
 
715
                preference.setTopicUuidActive("");
680
                preference.setTopicUuidActive("");
716
               // preference.setCapsuleUuidActive("");
681
                preference.setCapsuleUuidActive("");
717
                setNoCapsuleActive();
Línea 682... Línea 718...
682
                preference.setSlideUuidActive("");
718
                preference.setSlideUuidActive("");
683
                preference.save();
719
                preference.save();
Línea 715... Línea 751...
715
                    invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
751
                    invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
716
                }
752
                }
717
                return;
753
                return;
Línea 718... Línea 754...
718
 
754
 
719
            case Constants.IDX_FRAGMENT_FINISH_CAPSULE :
755
            case Constants.IDX_FRAGMENT_FINISH_CAPSULE :
-
 
756
              //  preference.setCapsuleUuidActive("");
720
                preference.setCapsuleUuidActive("");
757
                setNoCapsuleActive();
721
                preference.setSlideUuidActive("");
758
                preference.setSlideUuidActive("");
Línea 722... Línea 759...
722
                preference.save();
759
                preference.save();
723
 
760
 
Línea 1250... Línea 1287...
1250
    {
1287
    {
1251
        Log.d(TAG, "changeTopicActive : " + topicUuid);
1288
        Log.d(TAG, "changeTopicActive : " + topicUuid);
1252
       // Log.e("Guardo", "Topico en Main");
1289
       // Log.e("Guardo", "Topico en Main");
Línea 1253... Línea 1290...
1253
 
1290
 
1254
        preference.setTopicUuidActive(topicUuid);
1291
        preference.setTopicUuidActive(topicUuid);
-
 
1292
       // preference.setCapsuleUuidActive("");
1255
        preference.setCapsuleUuidActive("");
1293
        setNoCapsuleActive();
1256
        preference.setSlideUuidActive("");
1294
        preference.setSlideUuidActive("");
Línea 1257... Línea 1295...
1257
        preference.save();
1295
        preference.save();
1258
 
1296
 
Línea 1263... Línea 1301...
1263
    public void changeCapsuleActive(String capsuleUuid)
1301
    public void changeCapsuleActive(String capsuleUuid)
1264
    {
1302
    {
1265
        Log.d(TAG, "changeCapsuleActive : " + capsuleUuid);
1303
        Log.d(TAG, "changeCapsuleActive : " + capsuleUuid);
Línea 1266... Línea -...
1266
 
-
 
1267
 
1304
 
-
 
1305
 
1268
 
1306
     //   preference.setCapsuleUuidActive(capsuleUuid);
1269
        preference.setCapsuleUuidActive(capsuleUuid);
1307
        setCapsulaActiva(capsuleUuid);
Línea 1270... Línea 1308...
1270
        preference.setSlideUuidActive("");
1308
        preference.setSlideUuidActive("");
1271
        preference.save();
1309
        preference.save();
Línea 1285... Línea 1323...
1285
            invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
1323
            invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
Línea 1286... Línea 1324...
1286
 
1324
 
1287
        }
1325
        }
Línea -... Línea 1326...
-
 
1326
    }
-
 
1327
 
-
 
1328
    public void setCapsulaActiva(String capsuleUuid) {
-
 
1329
 
-
 
1330
        ConfigDao configuracion =  mAppDatabase.getConfigDao();
-
 
1331
 
-
 
1332
        Config actual = configuracion.selectConfigByTitle("act_capsule");
-
 
1333
        com.cesams.twogetskills.entity.Config confignueva;
-
 
1334
 
-
 
1335
        confignueva = new com.cesams.twogetskills.entity.Config();
-
 
1336
        confignueva.setId(actual.getId());
-
 
1337
        confignueva.setTitle("act_capsule");
-
 
1338
        confignueva.setNow(capsuleUuid);
-
 
1339
 
-
 
1340
        configuracion.update(confignueva);
1288
    }
1341
    }
1289
 
1342
 
1290
    @Override
1343
    @Override
1291
    public void changeCompanyActive(String companyUuid)
1344
    public void changeCompanyActive(String companyUuid)
Línea 1324... Línea 1377...
1324
    }
1377
    }
Línea 1325... Línea 1378...
1325
 
1378
 
1326
    @Override
1379
    @Override
1327
    public String getCapsuleUuidActive()
1380
    public String getCapsuleUuidActive()
1328
    {
1381
    {
-
 
1382
       // return preference.getCapsuleUuidActive();
-
 
1383
 
-
 
1384
        ConfigDao configuracion =  mAppDatabase.getConfigDao();
-
 
1385
        Config config = configuracion.selectConfigByTitle("act_capsule");
-
 
1386
        Log.e("algo","aqui"+config.getNow());
1329
        return preference.getCapsuleUuidActive();
1387
        return config.getNow();
Línea 1330... Línea 1388...
1330
    }
1388
    }
1331
 
1389
 
1332
    @Override
1390
    @Override
Línea 1529... Línea 1587...
1529
            progressCapsule.setViewSlides(viewSlides);
1587
            progressCapsule.setViewSlides(viewSlides);
1530
            progressCapsule.setTotalSlides(totalSlides);
1588
            progressCapsule.setTotalSlides(totalSlides);
1531
            progressCapsule.setProgress(percentaje);
1589
            progressCapsule.setProgress(percentaje);
Línea 1532... Línea 1590...
1532
 
1590
 
1533
            Log.d(TAG, "Progress Capsule : getLastCapsuleActive : " + preference.getLastCapsuleUuidActive());
1591
            Log.d(TAG, "Progress Capsule : getLastCapsuleActive : " + preference.getLastCapsuleUuidActive());
Línea 1534... Línea 1592...
1534
            Log.d(TAG, "Progress Capsule : CapsuleActive : " + preference.getCapsuleUuidActive());
1592
           // Log.d(TAG, "Progress Capsule : CapsuleActive : " + preference.getCapsuleUuidActive());
Línea 1535... Línea 1593...
1535
 
1593
 
1536
            if (!preference.getLastCapsuleUuidActive().equals(preference.getCapsuleUuidActive())) {
1594
            if (!preference.getLastCapsuleUuidActive().equals(getCapsuleUuidActive())) {
1537
 
1595
 
1538
                Log.d(TAG, "Capsule Progress : " + progressCapsule.getProgress());
1596
               // Log.d(TAG, "Capsule Progress : " + progressCapsule.getProgress());
Línea 1539... Línea 1597...
1539
                Log.d(TAG, "Capsule Completed : " + progressCapsule.getCompleted());
1597
               // Log.d(TAG, "Capsule Completed : " + progressCapsule.getCompleted());
1540
                Log.d(TAG, "Capsule Total slides : " + progressCapsule.getTotalSlides());
1598
               // Log.d(TAG, "Capsule Total slides : " + progressCapsule.getTotalSlides());
Línea 1541... Línea 1599...
1541
                Log.d(TAG, "Capsule View slides : " + progressCapsule.getViewSlides());
1599
               // Log.d(TAG, "Capsule View slides : " + progressCapsule.getViewSlides());
Línea 1787... Línea 1845...
1787
 
1845
 
1788
            TopicDao topicDao = mAppDatabase.getTopicDao();
1846
            TopicDao topicDao = mAppDatabase.getTopicDao();
Línea 1789... Línea 1847...
1789
            Topic topic = topicDao.selectByUuid(preference.getTopicUuidActive());
1847
            Topic topic = topicDao.selectByUuid(preference.getTopicUuidActive());
1790
 
1848
 
Línea 1791... Línea 1849...
1791
            CapsuleDao capsuleDao = mAppDatabase.getCapsuleDao();
1849
            CapsuleDao capsuleDao = mAppDatabase.getCapsuleDao();
1792
            Capsule capsule = capsuleDao.selectByUuid(preference.getCapsuleUuidActive());
1850
            Capsule capsule = capsuleDao.selectByUuid(getCapsuleUuidActive());
Línea 1793... Línea 1851...
1793
 
1851