Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

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

Rev 23 Rev 25
Línea 601... Línea 601...
601
        // Add as notification
601
        // Add as notification
602
        NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
602
        NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
603
        manager.notify(0, builder.build());
603
        manager.notify(0, builder.build());
Línea -... Línea 604...
-
 
604
 
-
 
605
 
-
 
606
        Calendar calendar = Calendar.getInstance();
-
 
607
        Date date = calendar.getTime();
-
 
608
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Constants.FORMAT_DATETIME_SERVICE);
-
 
609
        String  dateOn = simpleDateFormat.format(date);
-
 
610
 
-
 
611
        NotificationCenterDao notificacionDao =  mAppDatabase.getNotificationCenterDao();
-
 
612
        com.cesams.twogetskills.entity.NotificationCenter notificacionueva;
Línea 604... Línea 613...
604
 
613
 
Línea 605... Línea 614...
605
 
614
 
606
 
615
 
607
        if(new_capsules > 0) {
616
        if(new_capsules > 0) {
Línea -... Línea 617...
-
 
617
 
-
 
618
            String message = new_capsules == 1
-
 
619
                    ? "Hay 1 cápsula nueva disponible"
-
 
620
                    : "Hay " + new_capsules + " cápsulas disponible";
-
 
621
 
-
 
622
            notificacionueva = new com.cesams.twogetskills.entity.NotificationCenter();
-
 
623
 
-
 
624
            notificacionueva.setTitle("Nuevo contenido disponible");
608
 
625
            notificacionueva.setDate(dateOn);
609
            String message = new_capsules == 1
626
            notificacionueva.setDescription(message);
-
 
627
            Log.e("Notificacion","a guardar"+notificacionueva);
-
 
628
            notificacionDao.insert(notificacionueva);
-
 
629
 
-
 
630
            showMessageSnackBarWithClose(message);
-
 
631
        } else {
-
 
632
            notificacionueva = new com.cesams.twogetskills.entity.NotificationCenter();
-
 
633
 
-
 
634
            notificacionueva.setTitle("Nuevo contenido disponible");
610
                    ? "Hay 1 cápsula nueva disponible"
635
            notificacionueva.setDate(dateOn);
611
                    : "Hay " + new_capsules + " cápsulas disponible";
636
            notificacionueva.setDescription(body);
Línea 612... Línea 637...
612
 
637
            Log.e("Notificacion","a guardar"+notificacionueva);
Línea 916... Línea 941...
916
 
941
 
917
 
942
 
Línea 918... Línea -...
918
    @Override
-
 
919
    public void showMessageSnackBarWithClose(String message) {
-
 
920
 
-
 
921
    //    Log.e("Mensaje","Notificacion"+message);
-
 
922
 
-
 
923
        //Crear notificacion local
-
 
924
 
-
 
925
        Calendar calendar = Calendar.getInstance();
-
 
926
        Date date = calendar.getTime();
-
 
927
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Constants.FORMAT_DATETIME_SERVICE);
-
 
928
        String  dateOn = simpleDateFormat.format(date);
-
 
929
 
-
 
930
        NotificationCenterDao notificacionDao =  mAppDatabase.getNotificationCenterDao();
-
 
931
        com.cesams.twogetskills.entity.NotificationCenter notificacionueva;
-
 
932
 
-
 
933
        notificacionueva = new com.cesams.twogetskills.entity.NotificationCenter();
-
 
934
 
-
 
935
        notificacionueva.setTitle("Nuevo contenido disponible");
-
 
936
        notificacionueva.setDate(dateOn);
-
 
937
        notificacionueva.setDescription(message);
-
 
938
        Log.e("Notificacion","a guardar"+notificacionueva);
943
    @Override
Línea 939... Línea 944...
939
        notificacionDao.insert(notificacionueva);
944
    public void showMessageSnackBarWithClose(String message) {
940
 
945
 
941
        final Snackbar snackBar = Snackbar.make(this.findViewById(R.id.fragment_container), message, Snackbar.LENGTH_INDEFINITE);
946
        final Snackbar snackBar = Snackbar.make(this.findViewById(R.id.fragment_container), message, Snackbar.LENGTH_INDEFINITE);
Línea 2426... Línea 2431...
2426
                }
2431
                }
Línea 2427... Línea 2432...
2427
 
2432
 
2428
                if(processChanges && !max_date_changes.isEmpty()) {
2433
                if(processChanges && !max_date_changes.isEmpty()) {
2429
                    int new_capsules = data.getInt("new_capsules");
2434
                    int new_capsules = data.getInt("new_capsules");
2430
                    String message = new_capsules == 1
2435
                    String message = new_capsules == 1
2431
                            ? "Hay 1 cápsula nueva disponible"
2436
                            ? "Hay 1 cápsula disponible"
Línea 2432... Línea -...
2432
                            : "Hay " + new_capsules + " cápsulas disponible";
-
 
Línea -... Línea 2437...
-
 
2437
                            : "Hay " + new_capsules + " cápsulas disponible";
-
 
2438
 
Línea 2433... Línea 2439...
2433
 
2439
 
Línea 2434... Línea 2440...
2434
 
2440
 
2435
                    showMessageSnackBarWithClose(message);
2441
 
2436
 
2442
                    showMessageSnackBarWithClose(message);
2437
 
2443
 
2438
 
2444
 
2439
                    preference.setMaxDateChanges(max_date_changes);
2445
                    preference.setMaxDateChanges(max_date_changes);
Línea 2440... Línea 2446...
2440
 
2446
 
Línea 2489... Línea 2495...
2489
                                preference.save(this);
2495
                                preference.save(this);
2490
                            }
2496
                            }
Línea 2491... Línea 2497...
2491
 
2497
 
2492
                        }
2498
                        }
-
 
2499
                    }*/
-
 
2500
 
-
 
2501
                    Date date = calendar.getTime();
-
 
2502
 
-
 
2503
                    String  dateOn = simpleDateFormat.format(date);
-
 
2504
 
-
 
2505
 
-
 
2506
                    NotificationCenterDao notificacionDao =  mAppDatabase.getNotificationCenterDao();
-
 
2507
                    com.cesams.twogetskills.entity.NotificationCenter notificacionueva;
-
 
2508
 
-
 
2509
                    notificacionueva = new com.cesams.twogetskills.entity.NotificationCenter();
-
 
2510
 
-
 
2511
                    notificacionueva.setTitle("Nuevo contenido disponible");
-
 
2512
                    notificacionueva.setDate(dateOn);
-
 
2513
                    notificacionueva.setDescription(message);
-
 
2514
                    Log.e("Notificacion","a guardar"+notificacionueva);
2493
                    }*/
2515
                    notificacionDao.insert(notificacionueva);
2494
                }
2516
                }
2495
            }
2517
            }
2496
        } catch (JSONException e) {
2518
        } catch (JSONException e) {
2497
            Log.d(TAG, e.getMessage());
2519
            Log.d(TAG, e.getMessage());