예제 #1
0
        public static Note createFirstNote(Activity activity)
        {
            TLog.v(TAG, "Creating first note");

            Note note = new Note();

            note.setTitle(activity.GetString(Resource.String.firstNoteTitle));
            // FIXME as soon as we can create notes, make sure GUID is unique! - we are referencing this UUID elsewhere, don't forget to check!
            note.setGuid("8f837a99-c920-4501-b303-6a39af57a714");
            note.setLastChangeDate("2010-10-09T16:50:12.219-04:00");

            // reconstitute HTML in note content

            string[] contentarray = activity.Resources.GetStringArray(Resource.Array.firstNoteContent);
            string content = TextUtils.Join("\n", contentarray);

            content = content.Replace("(?m)^=(.+)=$", "<size:large>$1</size:large>")
                    .Replace("(?m)^-(.+)$", "<list-item dir=\"ltr\">$1</list-item>")
                    .Replace("/list-item>\n<list-item", "/list-item><list-item")
                    .Replace("(<list-item.+</list-item>)", "<list>$1</list>")
                    .Replace("/list-item><list-item", "/list-item>\n<list-item");

            note.setXmlContent(content);

            return note;
        }
예제 #2
0
        public static Note createNewNote(Context context, string title, string xmlContent)
        {
            TLog.v(TAG, "Creating new note");

            Note note = new Note();
            neverSaved = true;

            note.setTitle(title);

            UUID newid = UUID.RandomUUID();
            note.setGuid(newid.ToString());
            note.setLastChangeDate();
            note.setXmlContent(xmlContent);

            return note;
        }