X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=android%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fclient%2Fandroid%2Fhistory%2FHistoryManager.java;fp=android%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fclient%2Fandroid%2Fhistory%2FHistoryManager.java;h=e8c448a7c53fdcc326f4c09aa64a94cab1d64117;hb=e9ca8207850d858ab43b1944a9626cd4402aca73;hp=8e861dd6dd7a62f13ffee91f26f93479d128836f;hpb=b0d8630b70b7259710fde94e203175006bdd5cc9;p=zxing.git diff --git a/android/src/com/google/zxing/client/android/history/HistoryManager.java b/android/src/com/google/zxing/client/android/history/HistoryManager.java index 8e861dd6..e8c448a7 100644 --- a/android/src/com/google/zxing/client/android/history/HistoryManager.java +++ b/android/src/com/google/zxing/client/android/history/HistoryManager.java @@ -27,6 +27,8 @@ import android.database.Cursor; import android.net.Uri; import android.os.Message; +import java.text.DateFormat; +import java.util.Date; import java.util.List; import java.util.ArrayList; @@ -46,7 +48,14 @@ public final class HistoryManager { private static final int MAX_ITEMS = 50; private static final String[] TEXT_COL_PROJECTION = { DBHelper.TEXT_COL }; private static final String[] TEXT_FORMAT_COL_PROJECTION = { DBHelper.TEXT_COL, DBHelper.FORMAT_COL }; + private static final String[] EXPORT_COL_PROJECTION = { + DBHelper.TEXT_COL, + DBHelper.DISPLAY_COL, + DBHelper.FORMAT_COL, + DBHelper.TIMESTAMP_COL, + }; private static final String[] ID_COL_PROJECTION = { DBHelper.ID_COL }; + private static final DateFormat EXPORT_DATE_TIME_FORMAT = DateFormat.getDateTimeInstance(); private final CaptureActivity activity; @@ -91,12 +100,12 @@ public final class HistoryManager { if (i == dialogItems.length - 1) { clearHistory(); } else if (i == dialogItems.length - 2) { - String history = buildHistory(); + CharSequence history = buildHistory(); Intent intent = new Intent(Intent.ACTION_SEND, Uri.parse("mailto:")); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.putExtra(Intent.EXTRA_SUBJECT, res.getString(R.string.history_email_title)); intent.putExtra(Intent.EXTRA_TEXT, history); - intent.setType("text/plain"); + intent.setType("text/csv"); activity.startActivity(intent); } else { Result result = items.get(i); @@ -167,18 +176,38 @@ public final class HistoryManager { } } - private String buildHistory() { - StringBuilder historyText = new StringBuilder(); + /** + *
Builds a text representation of the scanning history. Each scan is encoded on one + * line, terminated by a line break (\n). The values in each line are comma-separated, + * and double-quoted. Double-quotes within values are escaped with a sequence of two + * double-quotes. The fields output are:
+ * + *