1 | /* |
2 | * Tomdroid |
3 | * Tomboy on Android |
4 | * http://www.launchpad.net/tomdroid |
5 | * |
6 | * Copyright 2010 Olivier Bilodeau <olivier@bottomlesspit.org> |
7 | * |
8 | * This file is part of Tomdroid. |
9 | * |
10 | * Tomdroid is free software: you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by |
12 | * the Free Software Foundation, either version 3 of the License, or |
13 | * (at your option) any later version. |
14 | * |
15 | * Tomdroid is distributed in the hope that it will be useful, |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | * GNU General Public License for more details. |
19 | * |
20 | * You should have received a copy of the GNU General Public License |
21 | * along with Tomdroid. If not, see <http://www.gnu.org/licenses/>. |
22 | */ |
23 | package org.tomdroid.util; |
24 | |
25 | import java.util.MissingResourceException; |
26 | import java.util.ResourceBundle; |
27 | |
28 | import org.tomdroid.Note; |
29 | |
30 | import android.util.Log; |
31 | |
32 | /** |
33 | * Creates an introductory note object |
34 | * @author Olivier Bilodeau <olivier@bottomlesspit.org> |
35 | * |
36 | */ |
37 | public class FirstNote { |
38 | |
39 | // Logging info |
40 | private static final String TAG = "FirstNote"; |
41 | |
42 | public static Note createFirstNote() { |
43 | Log.v(TAG, "Creating first note"); |
44 | |
45 | Note note = new Note(); |
46 | |
47 | note.setTitle("Tomdroid's first note"); |
48 | // FIXME as soon as we can create notes, make sure GUID is unique! |
49 | note.setGuid("8f837a99-c920-4501-b303-6a39af57a714"); |
50 | note.setLastChangeDate("2010-10-09T16:50:12.219-04:00"); |
51 | note.setXmlContent(getString("FirstNote.Content")); |
52 | |
53 | return note; |
54 | } |
55 | |
56 | // I bundled the note's content to avoid the hassle of Java strings (escaping quotes and the lack of multi-line support) |
57 | private static final String BUNDLE_NAME = "org.tomdroid.util.FirstNote"; |
58 | private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); |
59 | |
60 | private static String getString(String key) { |
61 | try { |
62 | return RESOURCE_BUNDLE.getString(key); |
63 | } catch (MissingResourceException e) { |
64 | return '!' + key + '!'; |
65 | } |
66 | } |
67 | |
68 | } |