public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { Notification notification = (Notification) adapterView.getItemAtPosition(i); Intent intent = new Intent(ListNotif.this, DetailArret.class); Ligne ligne = Ligne.getLigne(notification.getLigneId()); Arret arret = Arret.getArret(notification.getArretId()); intent.putExtra("ligne", ligne); intent.putExtra("idArret", notification.getArretId()); intent.putExtra("nomArret", arret.nom); intent.putExtra("direction", notification.getDirection()); startActivity(intent); } });
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { Notification notification = (Notification) adapterView.getItemAtPosition(i); Intent intent = new Intent(ListNotif.this, DetailArret.class); Ligne ligne = Ligne.getLigne(notification.getLigneId()); Arret arret = Arret.getArret(notification.getArretId()); intent.putExtra("ligne", ligne); intent.putExtra("idArret", notification.getArretId()); intent.putExtra("nomArret", arret.nom); intent.putExtra("direction", notification.getDirection()); intent.putExtra("macroDirection", notification.getMacroDirection()); startActivity(intent); } });
public View getView(final int position, View convertView, ViewGroup parent) { View convertView1 = convertView; NotifAdapter.ViewHolder holder; if (convertView1 == null) { convertView1 = mInflater.inflate(R.layout.notif, null); holder = new NotifAdapter.ViewHolder(); holder.iconeLigne = (ImageView) convertView1.findViewById(R.id.iconeLigne); holder.arret = (TextView) convertView1.findViewById(R.id.nomArret); holder.tempsRestant = (TextView) convertView1.findViewById(R.id.tempsRestant); holder.directionArret = (TextView) convertView1.findViewById(R.id.directionArret); convertView1.setTag(holder); } else { holder = (NotifAdapter.ViewHolder) convertView1.getTag(); } holder.arret.setTextColor(TransportsRennesApplication.getTextColor(myContext)); holder.tempsRestant.setTextColor(TransportsRennesApplication.getTextColor(myContext)); holder.directionArret.setTextColor(TransportsRennesApplication.getTextColor(myContext)); final Notification notification = notifications.get(position); holder.arret.setText(Arret.getArret(notification.getArretId()).nom); holder.iconeLigne.setImageResource(IconeLigne.getIconeResource(Ligne.getLigne(notification.getLigneId()).nomCourt)); holder.tempsRestant.setText(formatterCalendar(notification.getHeure(), now)); holder.directionArret.setText(notification.getDirection()); return convertView1; }
public View getView(final int position, View convertView, ViewGroup parent) { View convertView1 = convertView; NotifAdapter.ViewHolder holder; if (convertView1 == null) { convertView1 = mInflater.inflate(R.layout.notif, null); holder = new NotifAdapter.ViewHolder(); holder.iconeLigne = (ImageView) convertView1.findViewById(R.id.iconeLigne); holder.arret = (TextView) convertView1.findViewById(R.id.nomArret); holder.tempsRestant = (TextView) convertView1.findViewById(R.id.tempsRestant); holder.directionArret = (TextView) convertView1.findViewById(R.id.directionArret); convertView1.setTag(holder); } else { holder = (NotifAdapter.ViewHolder) convertView1.getTag(); } holder.arret.setTextColor(AbstractTransportsApplication.getTextColor(myContext)); holder.tempsRestant.setTextColor(AbstractTransportsApplication.getTextColor(myContext)); holder.directionArret.setTextColor(AbstractTransportsApplication.getTextColor(myContext)); final Notification notification = notifications.get(position); holder.arret.setText(Arret.getArret(notification.getArretId()).nom); holder.iconeLigne.setImageResource(IconeLigne.getIconeResource(Ligne.getLigne(notification.getLigneId()).nomCourt)); holder.tempsRestant.setText(formatterCalendar(notification.getHeure(), now)); holder.directionArret.setText(notification.getDirection()); return convertView1; }
private void createNotification(Notification notification) { LOG_YBO.debug("Création d'une notif pour la ligne " + notification.getLigneId()); Ligne ligne = Ligne.getLigne(notification.getLigneId()); Arret arret = Arret.getArret(notification.getArretId()); int icon = IconeLigne.getIconeResource(ligne.nomCourt); String texte = getResources().getString(R.string.notifText, ligne.nomCourt, arret.nom, notification.getTempsAttente()); String shortText = getResources().getString(R.string.notifShortText, ligne.nomCourt, arret.nom); String descriptionText = getResources().getString(R.string.notifDescriptionText, notification.getTempsAttente()); Intent notificationIntent = new Intent(this, DetailArret.class); notificationIntent.putExtra("ligne", ligne); notificationIntent.putExtra("idArret", notification.getArretId()); notificationIntent.putExtra("nomArret", arret.nom); notificationIntent.putExtra("direction", notification.getDirection()); notificationIntent.putExtra("macroDirection", notification.getMacroDirection()); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); android.app.Notification notif = new android.app.Notification(icon, texte, System.currentTimeMillis()); notif.setLatestEventInfo(this, shortText, descriptionText, contentIntent); notif.defaults |= android.app.Notification.DEFAULT_ALL; notif.flags |= android.app.Notification.FLAG_AUTO_CANCEL; NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(notification.getHeure(), notif); TransportsRennesApplication.getDataBaseHelper().delete(notification); }
private void createNotification(Notification notification) { LOG_YBO.debug("Création d'une notif pour la ligne " + notification.getLigneId()); Ligne ligne = Ligne.getLigne(notification.getLigneId()); Arret arret = Arret.getArret(notification.getArretId()); int icon = IconeLigne.getIconeResource(ligne.nomCourt); String texte = getResources().getString(R.string.notifText, ligne.nomCourt, arret.nom, notification.getTempsAttente()); String shortText = getResources().getString(R.string.notifShortText, ligne.nomCourt, arret.nom); String descriptionText = getResources() .getString(R.string.notifDescriptionText, notification.getTempsAttente()); Intent notificationIntent = new Intent(this, DetailArret.class); notificationIntent.putExtra("ligne", ligne); notificationIntent.putExtra("idArret", notification.getArretId()); notificationIntent.putExtra("nomArret", arret.nom); notificationIntent.putExtra("direction", notification.getDirection()); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); android.app.Notification notif = new android.app.Notification(icon, texte, System.currentTimeMillis()); notif.setLatestEventInfo(this, shortText, descriptionText, contentIntent); notif.defaults |= android.app.Notification.DEFAULT_ALL; notif.flags |= android.app.Notification.FLAG_AUTO_CANCEL; NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(notification.getHeure(), notif); TransportsBordeauxApplication.getDataBaseHelper().delete(notification); }