private void rescheduleAlarm(List<ItemGridModel> agenda) { for (ItemGridModel item : agenda) { Utils.removeAlarm(getActivity(), item); Utils.setAlarm(getActivity(), item); try { List<ItemGridModel> items = mDatabaseHelper.getItemGridByProposta(item.getPid()); for (ItemGridModel itemGridModel : items) { itemGridModel.setAssistir(Boolean.TRUE); mDatabaseHelper.getItemGridDao().update(itemGridModel); } } catch (Exception e) { } } }
private void criarItemGradeFake(int dia, int minutos) { String titulo = "Evento de Teste do Lembrete - "; // Teste de AlarmManager Calendar inicio = Calendar.getInstance(); // inicio.set(Calendar.HOUR_OF_DAY, 16); // inicio.set(Calendar.DAY_OF_MONTH, dia); inicio.add(Calendar.MINUTE, 2 + minutos); inicio.set(Calendar.SECOND, 0); Calendar fim = Calendar.getInstance(); fim.setTimeInMillis(inicio.getTimeInMillis()); fim.add(Calendar.HOUR_OF_DAY, 1); ItemGridModel itemGrade = new ItemGridModel(); itemGrade.setInicio(new Date(inicio.getTimeInMillis())); itemGrade.setFim(new Date(fim.getTimeInMillis())); itemGrade.setAssistir(true); itemGrade.setPid(140); itemGrade.setTime(1); itemGrade.setDate(1); itemGrade.setPlace(1); itemGrade.setTitle(titulo + minutos); itemGrade.setType(1); AuthorModel author = new AuthorModel(); author.setCurriculum("Biografia"); author.setId(900); author.setName("Clovis Lemes Ferreira Junior"); itemGrade.setAuthor(author); List<ItemGridModel> t = mDatabaseHelper.getItemGridDao().queryForEq("title", titulo + minutos); if (t == null || t.isEmpty()) { mDatabaseHelper.createItemGrid(itemGrade); } }