134
135
public void onCreate(Bundle savedInstanceState) {
135
136
super.onCreate(savedInstanceState);
136
137
Preferences.init(this, CLEAR_PREFERENCES);
138
139
main = View.inflate(this, R.layout.main, null);
140
if (Preferences.getString(Preferences.Key.THEME_CHOICE).equals("dark"))
141
super.setTheme( R.style.DarkTheme);
143
141
setContentView(main);
171
169
listEmptyView = (TextView) findViewById(R.id.list_empty);
172
170
getListView().setEmptyView(listEmptyView);
174
// FIXME: why is this necessary?
175
if (Preferences.getString(Preferences.Key.THEME_CHOICE).equals("dark"))
176
getListView().setBackgroundColor(0xFF000000);
178
172
registerForContextMenu(findViewById(android.R.id.list));
180
174
// add note to pane for tablet
961
958
if(rightPane != null)
962
959
showNoteInPane(lastIndex);
962
// dev function, used for testing out the note conflict resolution
963
public void compareTestNotes() {
965
Cursor item = (Cursor) adapter.getItem(position);
966
if (item == null || item.getCount() == 0) {
967
TLog.d(TAG, "Index {0} not found in list", position);
972
long noteId = item.getInt(item.getColumnIndexOrThrow(Note.ID));
973
uri = Uri.parse(CONTENT_URI + "/" + noteId);
975
TLog.d(TAG, "Getting note {0}", position);
977
Note localNote = NoteManager.getNote(this, uri);
978
Note remoteNote = new Note();
980
remoteNote.setGuid(localNote.getGuid());
981
remoteNote.setTitle(localNote.getTitle()+" Remote");
982
Time time= new Time();
983
remoteNote.setLastChangeDate(time.format3339(false));
984
remoteNote.setXmlContent(localNote.getXmlContent()+"\nLorem ipsum dolor sit amet, \nconsetetur sadipscing elitr, \nsed diam nonumyeirmod tempor invidunt ut la");
986
int compareBoth = Time.compare(localNote.getLastChangeDate(), remoteNote.getLastChangeDate());
988
TLog.v(TAG, "note conflict... showing resolution dialog TITLE:{0} GUID:{1}", localNote.getTitle(), localNote.getGuid());
990
// send everything to Tomdroid so it can show Sync Dialog
992
Bundle bundle = new Bundle();
993
bundle.putString("title",remoteNote.getTitle());
994
bundle.putString("file",remoteNote.getFileName());
995
bundle.putString("guid",remoteNote.getGuid());
996
bundle.putString("date",remoteNote.getLastChangeDate().format3339(false));
997
bundle.putString("content", remoteNote.getXmlContent());
998
bundle.putString("tags", remoteNote.getTags());
999
bundle.putInt("datediff", compareBoth);
1001
// put local guid if conflicting titles
1003
if(!remoteNote.getGuid().equals(localNote.getGuid()))
1004
bundle.putString("localGUID", localNote.getGuid());
1006
Intent intent = new Intent(this, CompareNotes.class);
1007
intent.putExtras(bundle);
1009
startActivity(intent);