Skip to content

Commit

Permalink
Modification de libellés, du toast du nombre de devices
Browse files Browse the repository at this point in the history
  • Loading branch information
lfallet committed Sep 29, 2012
1 parent 29d1661 commit 3bec5ba
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 18 deletions.
21 changes: 13 additions & 8 deletions res/values-fr/strings.xml
Expand Up @@ -3,17 +3,20 @@

<string name="app_name">CloudConnect Device tracker</string>
<string name="fermer">Fermer</string>
<string name="rafraichir_description">Rafraîchir la localisation des voitures</string>
<string name="rafraichir_description">Rafraîchir la localisation des devices</string>
<string name="progress_dialog">Récupération des informations de la g8teway. Merci de patienter…</string>
<string name="connectionParamsNotSet">Veuillez saisir vos paramètres de connexion</string>
<string name="device">Véhicule</string>
<string name="device">Device</string>

<plurals name="located_devices">
<item quantity="zero">Aucun véhicule localisé</item>
<item quantity="one">1 véhicule localisé</item>
<item quantity="other">%d véhicules localisés</item>
<item quantity="zero">Aucun device localisé</item>
<item quantity="one">1 device localisé</item>
<item quantity="other">%d devices localisés</item>
</plurals>

<string name="today_and_total_located_devices">%1$d aujourd\'hui, %2$d au total</string>
<string name="today_and_not_displayed_located_devices">%1$d aujourd\'hui, %2$d non affichés</string>

<!-- Option Menu -->
<string name="menuRefreshTitle">Rafraîchir</string>
<string name="menuSettingsTitle">Configuration</string>
Expand All @@ -22,16 +25,18 @@
<string name="connectionParam">Paramètres de connexion</string>
<string name="user">Utilisateur</string>
<string name="password">Mot de passe</string>
<string name="client">Client</string>
<string name="url">URL</string>
<string name="userField_summary">Nom d\'utilisateur de la g8teway</string>
<string name="passwordField_summary">Mémorisé uniquement dans votre appareil</string>
<string name="clientField_summary">Nom de client sur la g8teway</string>
<string name="urlField_summary">Adresse de l\'API V2 de la g8teway</string>

<!-- Display parameters -->
<string name="displayParameters">Paramètres d\'affichage</string>
<string name="displayInactiveDevicesTitle">Affichage des devices inactifs</string>
<string name="displayInactiveDevices">Les devices inactifs seront représentés sur la carte</string>
<string name="doNotDisplayInactiveDevices">Les devices inactifs ne seront pas représentés sur la carte</string>
<string name="displayInactiveDevicesTitle">Afficher les devices inactifs</string>
<string name="displayInactiveDevices">Les devices inactifs aujourd\'hui seront représentés sur la carte</string>
<string name="doNotDisplayInactiveDevices">Les devices inactifs aujourd\'hui ne seront pas représentés sur la carte</string>
<string name="definitionOfRecentDevicesInMinutesTitle">Définition des devices récents</string>
<string name="definitionOfRecentDevicesInMinutesSummary">Durée en minutes pendant laquelle une information est considérée comme récente</string>
<string name="definitionOfRecentDevicesInMinutesMessage">Durée en minutes pendant laquelle une information est considérée comme récente</string>
Expand Down
15 changes: 9 additions & 6 deletions res/values/strings.xml
Expand Up @@ -3,7 +3,7 @@

<string name="app_name">CloudConnect Device tracker</string>
<string name="fermer">Close</string>
<string name="rafraichir_description">Refresh cars\' location</string>
<string name="rafraichir_description">Refresh devices\' location</string>
<string name="progress_dialog">Retrieving information from g8teway. Please wait…</string>
<string name="connectionParamsNotSet">Please fill connection parameters first</string>
<string name="device">Device</string>
Expand All @@ -14,6 +14,9 @@
<item quantity="other">%d located devices</item>
</plurals>

<string name="today_and_total_located_devices">%1$d today, %2$d in total</string>
<string name="today_and_not_displayed_located_devices">%1$d today, %2$d not displayed</string>

<!-- Option Menu -->
<string name="menuRefreshTitle">Refresh</string>
<string name="menuSettingsTitle">Settings</string>
Expand All @@ -25,19 +28,19 @@
<string name="client">Client</string>
<string name="url">URL</string>
<string name="userField_summary">Username used to connect to the g8teway</string>
<string name="passwordField_summary">Stored in your device only</string>
<string name="passwordField_summary">Only sent to g8teway, privacy respected</string>
<string name="clientField_summary">Client name used to connect to the g8teway</string>
<string name="urlField_summary">g8teway\'s API V2 address</string>
<string name="default_url">http://g8teway.com/api/v2/</string>

<!-- Display parameters -->
<string name="displayParameters">Display parameters</string>
<string name="displayInactiveDevicesTitle">Display of inactive devices</string>
<string name="displayInactiveDevices">Inactive devices will be shown on the map</string>
<string name="doNotDisplayInactiveDevices">Inactive devices will not be shown on the map</string>
<string name="displayInactiveDevicesTitle">Display not active devices</string>
<string name="displayInactiveDevices">Devices not active today will be shown on the map</string>
<string name="doNotDisplayInactiveDevices">Devices not active today will not be shown on the map</string>
<string name="definitionOfRecentDevicesInMinutesTitle">Definition of recent devices</string>
<string name="definitionOfRecentDevicesInMinutesSummary">If a device sent information during the last minutes defined here, it will be considered as recent.</string>
<string name="definitionOfRecentDevicesInMinutesMessage">Maximum lenght in minutes to consider a device\'s information as recent</string>
<string name="definitionOfRecentDevicesInMinutesMessage">Maximum length in minutes to consider a device\'s information as recent</string>

<!-- device dialog menu -->
<string name="unitid">unitid: </string>
Expand Down
24 changes: 20 additions & 4 deletions src/name/fallet/cloudconnect/GoogleMapsActivity.java
Expand Up @@ -63,6 +63,8 @@ public class GoogleMapsActivity extends MapActivity implements OnDoubleTapListen

private Collection<LocatedDevice> locatedDevices;

private int nbDevicesInactifs;

// approximativement le centre de Paris
private static final GeoPoint initGeoPoint = new GeoPoint(48863850, 2338170);
private static final int ZOOM_PAR_DEFAUT = 12;
Expand Down Expand Up @@ -251,6 +253,7 @@ private void processEveryDevice(final Collection<LocatedDevice> locatedDevices,
notActiveDevicesOverlay.clear();
todayActiveDevicesOverlay.clear();
recentlyActiveDevicesOverlay.clear();
nbDevicesInactifs = 0;

for (LocatedDevice locatedDevice : locatedDevices) {
// Log.d(TAG, vehiculeLocalise.getLat() + "," +
Expand Down Expand Up @@ -285,7 +288,7 @@ private void processEveryDevice(final Collection<LocatedDevice> locatedDevices,
final Calendar calInfoDevice = GregorianCalendar.getInstance();
calInfoDevice.setTime(locatedDevice.getDateInformations());
Log.d(TAG, calInfoDevice.toString() + " / timezone par défaut : " + calInfoDevice.getTimeZone().toString());

// selon la fraîcheur de l'info
boolean deviceDisplayed = false;
if (dateInfoDevice.after(dateRecentEnMinutesAuparavant)) {
Expand All @@ -299,6 +302,7 @@ private void processEveryDevice(final Collection<LocatedDevice> locatedDevices,
notActiveDevicesOverlay.addOverlay(overlayItem);
deviceDisplayed = true;
}
nbDevicesInactifs++;
}

if (deviceDisplayed)
Expand Down Expand Up @@ -477,9 +481,21 @@ protected void onPostExecute(Collection<LocatedDevice> result) {
progressDialog.dismiss();

// attention un toast doit être lancé dans le Thread UI, pas un autre ; piste d'amélioration : utiliser un handler
final int nbVehiculesLocalises = recentlyActiveDevicesOverlay.size();
String texte = getResources().getQuantityString(R.plurals.located_devices, nbVehiculesLocalises, nbVehiculesLocalises);
Toast toast = Toast.makeText(getApplicationContext(), texte, Toast.LENGTH_SHORT);
final int nbDevicesActifsLocalises = recentlyActiveDevicesOverlay.size();
final int nbDevicesActifsAujourdhuiLocalises = nbDevicesActifsLocalises + todayActiveDevicesOverlay.size();
final int nbDevicesTotalLocalises = nbDevicesActifsAujourdhuiLocalises + notActiveDevicesOverlay.size();
final StringBuilder texteToast = new StringBuilder(40);
texteToast.append(getResources().getQuantityString(R.plurals.located_devices, nbDevicesActifsLocalises,
nbDevicesActifsLocalises));
texteToast.append("\n");
if (viewParameters.displayInactiveDevices) {
texteToast.append(getResources().getString(R.string.today_and_total_located_devices, nbDevicesActifsAujourdhuiLocalises,
nbDevicesTotalLocalises));
} else {
texteToast.append(getResources().getString(R.string.today_and_not_displayed_located_devices,
nbDevicesActifsAujourdhuiLocalises, nbDevicesInactifs));
}
Toast toast = Toast.makeText(getApplicationContext(), texteToast, Toast.LENGTH_SHORT);
toast.show();
}
}
Expand Down

0 comments on commit 3bec5ba

Please sign in to comment.