package com.naholyr.android.horairessncf.ws;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import android.util.SparseArray;
public interface IBrowser {
public static interface ProgressListener {
/**
* Met jour le message de progression
*
* @param message
*/
public void updateMessage(String message);
}
/**
* Attache un "progress listener" Renvoie son identifiant numrique interne
*
* Note : l'absence de doublons dpendra de l'implmentation...
*
* @param listener
*/
public int addProgressListener(ProgressListener listener);
/**
* Dtache un "progress listener" par son id numrique interne
*
* @param listener
*/
public void removeProgressListener(int index);
/**
* Dtache un "progress listener"
*
* @param listener
*/
public void removeProgressListener(ProgressListener listener);
/**
* Rcuprer la liste des trains, sans forcment redemander la liste au
* serveur
*
* @param nbItems
* @return
* @throws IOException
*/
public List<ProchainTrain.Depart> getItems(int nbItems) throws IOException;
/**
* Rcuprer la liste des trains, en forant une requte au serveur
*
* @param nbItems
* @param refresh
* @return
* @throws IOException
*/
public List<ProchainTrain.Depart> getItems(int nbItems, boolean refresh) throws IOException;
/**
* Confirmer la gare exacte par son ID
*
* @param id
*/
public void confirmGare(int id);
/**
* Retourne la liste des gares correspondant au nom recherch.
*
* @param nom
* @param nbItems
* Nombre de trains qui sera demand (Conseil : si le serveur le
* permet, mettre en cache la liste des dparts directement)
* @return
* @throws IOException
*/
public SparseArray<String> searchGares(String nom, int nbItems) throws IOException;
/**
* Informations sur un train particulier
*
* @param numero
* @return
* @throws IOException
*/
public ProchainTrain.Depart getItem(String numero) throws IOException;
/**
* Liste des arrts d'un train
*
* @param numeroTrain
* @return
* @throws IOException
*/
public List<Map<String, Object>> getArrets(String numeroTrain) throws IOException;
}
|