Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

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

Rev 33 Rev 34
Línea 701... Línea 701...
701
        String  dateOn = simpleDateFormat.format(date);
701
        String  dateOn = simpleDateFormat.format(date);
Línea 702... Línea 702...
702
 
702
 
703
        NotificationCenterDao notificacionDao =  mAppDatabase.getNotificationCenterDao();
703
        NotificationCenterDao notificacionDao =  mAppDatabase.getNotificationCenterDao();
Línea -... Línea 704...
-
 
704
        com.cesams.twogetskills.entity.NotificationCenter notificacionueva;
Línea -... Línea 705...
-
 
705
 
-
 
706
        notificacionueva = new com.cesams.twogetskills.entity.NotificationCenter();
Línea 704... Línea 707...
704
        com.cesams.twogetskills.entity.NotificationCenter notificacionueva;
707
 
Línea 705... Línea 708...
705
 
708
        notificacionueva.setTitle("Nuevo contenido disponible");
706
 
709
        notificacionueva.setDate(dateOn);
707
 
710
 
Línea 708... Línea 711...
708
        if(new_capsules > 0) {
711
        if(new_capsules > 0) {
-
 
712
 
Línea 709... Línea -...
709
 
-
 
710
            String message = new_capsules == 1
713
            String message = new_capsules == 1
711
                    ? "Hay 1 cápsula nueva disponible"
714
                    ? "Hay 1 cápsula nueva disponible"
-
 
715
                    : "Hay " + new_capsules + " cápsulas disponible";
-
 
716
 
-
 
717
            List<com.cesams.twogetskills.entity.NotificationCenter> lista;
-
 
718
            lista=notificacionDao.selectAllNotification();
-
 
719
 
-
 
720
            boolean registrada=false;
712
                    : "Hay " + new_capsules + " cápsulas disponible";
721
            notificacionueva.setDescription(message);
-
 
722
 
-
 
723
            for(com.cesams.twogetskills.entity.NotificationCenter notificacion: lista)
-
 
724
            {
-
 
725
                if(notificacion.getDescription().equals(notificacionueva.getDescription()))
713
 
726
                {
-
 
727
                    registrada=true;
Línea 714... Línea 728...
714
            notificacionueva = new com.cesams.twogetskills.entity.NotificationCenter();
728
                    Log.e("Ya registrada"," ignoro esta notificacion");
715
 
729
                }
716
            notificacionueva.setTitle("Nuevo contenido disponible");
-
 
Línea -... Línea 730...
-
 
730
            }
717
            notificacionueva.setDate(dateOn);
731
            if(!registrada)
-
 
732
            {
718
            notificacionueva.setDescription(message);
733
                notificacionDao.insert(notificacionueva);
719
           // Log.e("Notificacion","a guardar"+notificacionueva);
734
            }
-
 
735
 
-
 
736
            showMessageSnackBarWithClose(message);
-
 
737
        } else {
-
 
738
 
-
 
739
            List<com.cesams.twogetskills.entity.NotificationCenter> lista;
-
 
740
            lista=notificacionDao.selectAllNotification();
720
            notificacionDao.insert(notificacionueva);
741
 
-
 
742
            boolean registrada=false;
-
 
743
            notificacionueva.setDescription(body);
-
 
744
 
-
 
745
            for(com.cesams.twogetskills.entity.NotificationCenter notificacion: lista)
721
 
746
            {
-
 
747
                if(notificacion.getDescription().equals(notificacionueva.getDescription()))
Línea 722... Línea 748...
722
            showMessageSnackBarWithClose(message);
748
                {
723
        } else {
749
                    registrada=true;
Línea 2603... Línea 2629...
2603
                    notificacionueva = new com.cesams.twogetskills.entity.NotificationCenter();
2629
                    notificacionueva = new com.cesams.twogetskills.entity.NotificationCenter();
Línea 2604... Línea 2630...
2604
 
2630
 
2605
                    notificacionueva.setTitle("Nuevo contenido disponible");
2631
                    notificacionueva.setTitle("Nuevo contenido disponible");
2606
                    notificacionueva.setDate(dateOn);
2632
                    notificacionueva.setDate(dateOn);
-
 
2633
                    notificacionueva.setDescription(message);
-
 
2634
 
2607
                    notificacionueva.setDescription(message);
2635
                    List<com.cesams.twogetskills.entity.NotificationCenter> lista;
-
 
2636
                    lista=notificacionDao.selectAllNotification();
-
 
2637
 
-
 
2638
                    for(com.cesams.twogetskills.entity.NotificationCenter notificacion: lista)
-
 
2639
                    {
-
 
2640
                        if(!notificacion.getDescription().equals(notificacionueva.getDescription()))
2608
                   // Log.e("Notificacion","a guardar"+notificacionueva);
2641
                        {
-
 
2642
                            notificacionDao.insert(notificacionueva);
-
 
2643
                            Log.e("Ya registrada"," ignoro esta notificacion");
-
 
2644
                        }
2609
                    notificacionDao.insert(notificacionueva);
2645
                    }
2610
                }
2646
                }
2611
            }
2647
            }
2612
        } catch (JSONException e) {
2648
        } catch (JSONException e) {
2613
            Log.d(TAG, e.getMessage());
2649
            Log.d(TAG, e.getMessage());