use of ca.etsmtl.applets.etsmobile.model.MonETSNotification in project ETSMobile-Android2 by ApplETS.
the class NotificationsAdapter method getView.
@Override
public View getView(int position, View view, ViewGroup parent) {
ViewHolder holder;
if (view != null) {
holder = (ViewHolder) view.getTag();
} else {
holder = new ViewHolder();
view = inflater.inflate(R.layout.row_notification, parent, false);
holder.tvNomApplication = (TextView) view.findViewById(R.id.tv_notif_application_name);
holder.tvTexteNotification = (TextView) view.findViewById(R.id.tv_notif_text);
holder.linearLayoutNotification = (LinearLayout) view.findViewById(R.id.linearLayout_notif);
view.setTag(holder);
}
MonETSNotification item = getItem(position);
String nomApplication = item.getNotificationApplicationNom();
int colour = Utility.stringToColour(nomApplication, 60);
holder.tvNomApplication.setText(nomApplication);
holder.tvTexteNotification.setText(item.getNotificationTexte());
holder.linearLayoutNotification.setBackgroundColor(colour);
return view;
}
use of ca.etsmtl.applets.etsmobile.model.MonETSNotification in project ETSMobile-Android2 by ApplETS.
the class ETSFcmListenerService method getMonETSNotificationFromMap.
public MonETSNotification getMonETSNotificationFromMap(Map<String, String> data) {
int id = Integer.valueOf(data.get("Id"));
String notificationTexte = data.get("NotificationTexte");
String notificationApplicationNom = data.get("NotificationApplicationNom");
// String notificationSigleCours = data.getString("NotificationSigleCours");
String url = data.get("Url");
return new MonETSNotification(id, 0, notificationTexte, null, notificationApplicationNom, url);
}
use of ca.etsmtl.applets.etsmobile.model.MonETSNotification in project ETSMobile-Android2 by ApplETS.
the class NotificationManager method updateDatabase.
/**
* Updates the database with a given list of notifications
*
* @param notifications the list of notifications that have been fetched from MonÉTS's API
*/
private void updateDatabase(List<MonETSNotification> notifications) {
DatabaseHelper databaseHelper = new DatabaseHelper(context);
try {
Dao<MonETSNotification, ?> dao = databaseHelper.getDao(MonETSNotification.class);
for (MonETSNotification monETSNotification : notifications) {
dao.createOrUpdate(monETSNotification);
}
listener.onRequestSuccess(notifications);
} catch (SQLException e) {
e.printStackTrace();
}
}
Aggregations