rschilling / websmsdroid

Automatically exported from code.google.com/p/websmsdroid
0 stars 0 forks source link

Show time of received SMS for last 24 hours in SMSdroid #593

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Get a SMS text message at eg. 18:00
2. Wait 19 hours (it's now 13:00 next day)
3. Check list of "threads" in SMSdroid

What is the expected output? What do you see instead?
Expected: Would be useful, if SMSdroid showed the TIME when the message was 
received and not just the date from yesterday. This should be so for the last 
24 hours.

What version of the product are you using? On what operating system?
v0.7.3

Please provide any additional information below.
Attached screenshot shows the "problem" - I "cannot" tell when I received the 
upper 3 text messages.

Original issue reported on code.google.com by a.skwar on 28 Sep 2011 at 9:37

Attachments:

GoogleCodeExporter commented 9 years ago
you can long click the message and view details, but i'll try to add a "custom 
time format" feature.

Original comment by f...@ub0r.de on 9 Oct 2011 at 1:24

GoogleCodeExporter commented 9 years ago
I now finally came around to doing this myself… :)

@@ -601,6 +600,11 @@ public final class ConversationListActivity extends 
FragmentActivity implements
         */
        static String getDate(final Context context, final long time) {
                long t = time;
+
+               // Get time for now - 24 hours
+               Calendar CAL_DAYAGO = Calendar.getInstance();
+               CAL_DAYAGO.add(Calendar.DAY_OF_MONTH, -1);
+
                if (t < MIN_DATE) {
                        t *= MILLIS;
                }
@@ -608,7 +612,7 @@ public final class ConversationListActivity extends 
FragmentActivity implements
                                PreferencesActivity.PREFS_FULL_DATE, false)) {
                        return DateFormat.getTimeFormat(context).format(t) + " "
                                        + DateFormat.getDateFormat(context).format(t);
-               } else if (t < CAL_TODAY.getTimeInMillis()) {
+               } else if (t < CAL_DAYAGO.getTimeInMillis()) {
                        return DateFormat.getDateFormat(context).format(t);
                } else {
                        return DateFormat.getTimeFormat(context).format(t);

This is a patch against 
src/de/ub0r/android/smsdroid/ConversationListActivity.java which does what I 
want:

If a message is "younger" than 24 hours, display the time of the message, else 
display the date of the message.

I'm not too sure, though, if you like the style of the code…

Original comment by a.skwar on 30 Oct 2011 at 12:51

GoogleCodeExporter commented 9 years ago
thanks for your input. i just merged your changes.

Original comment by f...@ub0r.de on 6 Nov 2011 at 2:02

GoogleCodeExporter commented 9 years ago

Original comment by f...@ub0r.de on 6 Nov 2011 at 2:16