Make message details reflect 24-hour system preference.

Fixes #2150
Closes #2163
This commit is contained in:
Aaron M Brown 2014-11-30 21:02:35 -08:00 committed by Moxie Marlinspike
parent 426c56c77d
commit bbea017d5a

View File

@ -16,6 +16,7 @@ import android.support.v4.widget.CursorAdapter;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.view.ActionMode;
import android.text.ClipboardManager;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@ -203,8 +204,16 @@ public class ConversationFragment extends ListFragment
else if (message.isMms()) transport = getString(R.string.ConversationFragment_mms);
else transport = getString(R.string.ConversationFragment_sms);
SimpleDateFormat dateFormatter = new SimpleDateFormat("EEE MMM d, yyyy 'at' hh:mm:ss a zzz");
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
String dateFormatPattern;
if (DateFormat.is24HourFormat(getActivity().getApplicationContext())) {
dateFormatPattern = "EEE MMM d, yyyy 'at' HH:mm:ss zzz";
} else {
dateFormatPattern = "EEE MMM d, yyyy 'at' hh:mm:ss a zzz";
}
SimpleDateFormat dateFormatter = new SimpleDateFormat(dateFormatPattern);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.ConversationFragment_message_details);
builder.setIcon(Dialogs.resolveIcon(getActivity(), R.attr.dialog_info_icon));
builder.setCancelable(true);