Merge pull request #211 from kruks23/development

Rounded minutes ago and last seen moe exactly
This commit is contained in:
Daniel Gultsch 2014-06-15 20:12:40 +02:00
commit e6b5713c12
3 changed files with 30 additions and 15 deletions

View file

@ -22,7 +22,8 @@
<string name="title_activity_conversations">Conversations</string>
<string name="title_activity_sharewith">Compartir con Conversación</string>
<string name="just_now">ahora</string>
<string name="minutes_ago">%d min</string>
<string name="minute_ago">1 minuto</string>
<string name="minutes_ago">%d minutos</string>
<string name="unread_conversations">conversaciones por leer</string>
<string name="sending">enviando&#8230;</string>
<string name="announce_pgp">Renovar anuncio PGP</string>
@ -97,9 +98,6 @@
<string name="error_loading_image">Error cargando imagen (Archivo no encontrado)</string>
<string name="image_offered_for_download"><i>Archivo de imagen ofrecido para descarga</i></string>
<string name="not_connected">No conectado</string>
<string name="you_are_offline">Debes estar conectado para enviar %s pero tu cuenta asociada a esta conversación está desconectada.</string>
<string name="you_are_offline_blank">No puedes ejecutar esta acción estando desconectado</string>
<string name="files">archivos</string>
<string name="otr_messages">Mensajes encriptados con OTR</string>
<string name="manage_account">Gestionar cuenta</string>
<string name="contact_offline">El contacto está desconectado</string>
@ -112,6 +110,7 @@
<string name="restart">Reiniciar</string>
<string name="install">Instalar</string>
<string name="offering">ofreciendo&#8230;</string>
<string name="waiting">esperando&#8230;</string>
<string name="no_pgp_key">Clave OpenPGP no encontrada</string>
<string name="contact_has_no_pgp_key">Conversations no ha podido encriptar tus mensajes porque el contacto no está anunciando su clave publica.\n\n<small>Por favor, pide a tu contacto que configure OpenPGP.</small></string>
<string name="no_pgp_keys">Claves OpenPGP no encontradas</string>
@ -236,9 +235,13 @@
<string name="hours">horas</string>
<string name="mins">mins</string>
<string name="missing_public_keys">Se han perdido las claves de anuncio públicas</string>
<string name="last_seen_now">última vez ahora</string>
<string name="last_seen_mins">última vez hace %d min.</string>
<string name="last_seen_hours">última vez hace %d horas</string>
<string name="last_seen_days">última vez hace %d días</string>
<string name="never_seen">nunca visto</string>
<string name="last_seen_now">Visto última vez ahora</string>
<string name="last_seen_min">Visto última vez hace 1 minuto</string>
<string name="last_seen_mins">Visto última vez hace %d minutos</string>
<string name="last_seen_hour">Visto última vez hace 1 hora</string>
<string name="last_seen_hours">Visto última vez hace %d horas</string>
<string name="last_seen_day">Visto última vez hace 1 día</string>
<string name="last_seen_days">Visto última vez hace %d días</string>
<string name="never_seen">Nunca visto</string>
<string name="install_openkeychain">Mensaje encriptado. Por favor instala OpenKeychain para desencriptar.</string>
</resources>

View file

@ -22,6 +22,7 @@
<string name="title_activity_conversations">Conversations</string>
<string name="title_activity_sharewith">Share with Conversation</string>
<string name="just_now">just now</string>
<string name="minute_ago">1 min ago</string>
<string name="minutes_ago">%d mins ago</string>
<string name="unread_conversations">unread Conversations</string>
<string name="sending">sending&#8230;</string>
@ -235,8 +236,11 @@
<string name="mins">mins</string>
<string name="missing_public_keys">Missing public key announcements</string>
<string name="last_seen_now">last seen just now</string>
<string name="last_seen_min">last seen 1 minute ago</string>
<string name="last_seen_mins">last seen %d minutes ago</string>
<string name="last_seen_hour">last seen 1 hour ago</string>
<string name="last_seen_hours">last seen %d hours ago</string>
<string name="last_seen_day">last seen 1 day ago</string>
<string name="last_seen_days">last seen %d days ago</string>
<string name="never_seen">never seen</string>
<string name="install_openkeychain">Encrypted message. Please install OpenKeychain to decrypt.</string>

View file

@ -61,8 +61,10 @@ public class UIHelper {
}
Date date = new Date(time);
long difference = (System.currentTimeMillis() - time) / 1000;
if (difference < 90) {
if (difference < 60) {
return context.getString(R.string.just_now);
} else if (difference < 60 * 2) {
return context.getString(R.string.minute_ago);
} else if (difference < 60 * 15) {
return context.getString(R.string.minutes_ago,Math.round(difference/60.0));
} else if (today(date)) {
@ -87,12 +89,18 @@ public class UIHelper {
return context.getString(R.string.never_seen);
}
long difference = (System.currentTimeMillis() - time) / 1000;
if (difference < 90) {
if (difference < 60) {
return context.getString(R.string.last_seen_now);
} else if (difference < 60 * 90) {
return context.getString(R.string.last_seen_mins,Math.round(difference/60.0));
} else if (difference < 60 * 60 * 36) {
return context.getString(R.string.last_seen_hours,Math.round(difference/(60.0*60.0)));
} else if (difference < 60 * 2) {
return context.getString(R.string.last_seen_min);
} else if (difference < 60 * 60) {
return context.getString(R.string.last_seen_mins,Math.round(difference/60.0));
} else if (difference < 60 * 60 * 2) {
return context.getString(R.string.last_seen_hour);
} else if (difference < 60 * 60 * 24) {
return context.getString(R.string.last_seen_hours,Math.round(difference/(60.0*60.0)));
} else if (difference < 60 * 60 * 48) {
return context.getString(R.string.last_seen_day);
} else {
return context.getString(R.string.last_seen_days,Math.round(difference/(60.0*60.0*24.0)));
}