Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

Rev 43 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 43 Rev 46
Línea 20... Línea 20...
20
import android.widget.Button;
20
import android.widget.Button;
21
import android.widget.EditText;
21
import android.widget.EditText;
22
import android.widget.ImageView;
22
import android.widget.ImageView;
23
import android.widget.ProgressBar;
23
import android.widget.ProgressBar;
24
import android.widget.TextView;
24
import android.widget.TextView;
-
 
25
import android.widget.Toast;
Línea 25... Línea 26...
25
 
26
 
26
import com.bumptech.glide.Glide;
27
import com.bumptech.glide.Glide;
27
import com.bumptech.glide.load.engine.DiskCacheStrategy;
28
import com.bumptech.glide.load.engine.DiskCacheStrategy;
28
import com.bumptech.glide.load.model.GlideUrl;
29
import com.bumptech.glide.load.model.GlideUrl;
Línea 242... Línea 243...
242
                }
243
                }
Línea 243... Línea 244...
243
 
244
 
244
            }
245
            }
245
        });
246
        });
246
*/
-
 
247
 
247
*/
248
        getActivity().runOnUiThread(() -> {
248
        getActivity().runOnUiThread(() -> {
249
            String message = capsuleList.size() == 1
249
            String message = capsuleList.size() == 1
250
                    ? "Hay 1 cápsula nueva disponible"
250
                    ? "Hay 1 cápsula nueva disponible"
Línea 251... Línea -...
251
                    : "Tiene " + capsuleList.size() + " cápsulas pendientes para ver";
-
 
252
 
-
 
253
 
-
 
254
            Calendar calendar = Calendar.getInstance();
-
 
255
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Constants.FORMAT_DATETIME_SERVICE);
-
 
256
            Date date = calendar.getTime();
-
 
257
 
-
 
258
            String  dateOn = simpleDateFormat.format(date);
-
 
259
 
-
 
260
 
-
 
261
            NotificationCenterDao notificacionDao =  iTwoGetSkills.getDatabase().getNotificationCenterDao();
-
 
262
            com.cesams.twogetskills.entity.NotificationCenter notificacionueva;
-
 
263
 
-
 
264
            notificacionueva = new com.cesams.twogetskills.entity.NotificationCenter();
-
 
265
 
-
 
266
            notificacionueva.setTitle("Nuevo contenido disponible");
-
 
267
            notificacionueva.setDate(dateOn);
-
 
268
            notificacionueva.setDescription(message);
251
                    : "Tiene " + capsuleList.size() + " cápsulas pendientes para ver";
269
           // Log.e("Notificacion","a guardar"+notificacionueva);
-
 
270
 
-
 
271
            List<com.cesams.twogetskills.entity.NotificationCenter> lista;
-
 
272
            lista=notificacionDao.selectAllNotification();
-
 
273
 
-
 
274
 
-
 
275
            if(lista.size()==0)
-
 
276
            {
-
 
277
                notificacionDao.insert(notificacionueva);
-
 
278
 
-
 
279
            }
-
 
280
            else {
-
 
281
                for (com.cesams.twogetskills.entity.NotificationCenter notificacion : lista) {
-
 
282
                    if (notificacion.getDescription().equals(message)) {
-
 
283
                       // Log.e("Notification Center", " omitir, he registrado esta notificacion");
-
 
284
                    } else {
-
 
285
                        notificacionDao.insert(notificacionueva);
-
 
286
                       // Log.e("Notification Center", "guardar");
-
 
287
 
-
 
288
                    }
-
 
Línea 289... Línea 252...
289
                }
252
 
290
            }
253
 
291
            iTwoGetSkills.showMessageSnackBarWithClose(message);
254
            Toast.makeText(getContext(), ""+message, Toast.LENGTH_LONG).show();