Would the maintainers be interested in an editable version of Tomdroid?

Asked by NoahY on 2012-07-16

I have modified the source code enough to provide basic editing capabilities:

- ability to add new notes
- ability to edit and save notes and note titles
- ability to delete notes

all of the above are followed by an instant sync with the server, which seems to work.

Check out the code here:

https://code.launchpad.net/~tomdroid-dev/tomdroid/note-editing-and-syncing/

Update: changed the URI to the code

Question information

Language:
English Edit question
Status:
Answered
For:
Tomdroid Edit question
Assignee:
No assignee Edit question
Last query:
2012-07-16
Last reply:
2012-07-20
Stefan Hammer (j-4) said : #1

Can you please upload the code as a branch of tomdroid?
e.g.: bzr push lp:~tomdroid-dev/tomdroid/note-editing-and-sync
And if you are sure that it is finished, please propose the branch for merging into lp:tomdroid!

I will have a look - but it already sounds really awesome!
Thanks a lot.

NoahY (noahy) said : #2

Dear Stefan,

Okay, I'll try. I changed the package name to allow me to install both side by side, but I can change it back.

BTW, I can't sync with Ubuntu One, either on Linux or Android; it looks like a problem with their server, so I've been testing it with Snowy on my own server, which seems to work well.

NoahY (noahy) said : #3

It says I'm not a member of Tomdroid Developers, which makes sense, since I'm not :) I'll push it to my ppa, anyway, packaged as org.tomdroid.

It's not really finished, but it does seem to work; probably the next step is to make the editor a rich text box; right now it uses markup style for *italics* and *bold* and +large+. That was just a quick fudge to get it out the door; hopefully someone will be able to give it a full editor.

Stefan Hammer (j-4) said : #4

Ubuntu one sync is working for me... weird! But they sometimes have problems with their notes service.
You can easily become a Tomdroid Developer by joining the group - there are no restrictions! https://launchpad.net/~tomdroid-dev

I will look at you branch as soon as possible. Hopefully, also Olivier has some time to check it - he knows the code much better than me.

If your code is working with two way sync at the moment, please don't add 1000s of further features like rich text editing, but always create one branch for one feature. Branches can of course depend on each other (eg: you take your code now, duplicate it to a new branch and add features. Your stuff has then to be merged in the same order.=
Please check out the other work-in-progress things, as there is already a rich text editing feature existing.
https://code.launchpad.net/~syslock/tomdroid/note-editing
https://code.launchpad.net/tomdroid

Best would be to also test your stuff, remove unnecessary white-space changes,clean the code up and propose it for merging if you are really sure that you stuff is ready to be used for everyone everyday!

Thanks for your contributions!
Cheers, Stefan

NoahY (noahy) said : #5

Sorry, I meant the notes sync... syncing Tomboy or Tomdroid with Ubuntu One doesn't work for me, gives a 500 Server error.

Here's the new branch:

https://code.launchpad.net/~tomdroid-dev/tomdroid/note-editing-and-syncing

I'll revert the Markdown hack, let it just be raw xml editing. Then maybe look into how they did the WYSIWYG editor. Please do test it and let me know if it works outside of my lab :)

Stefan Hammer (j-4) said : #6

Hi!

I had a short look yesterday with the old branch: I could run it on Android 4, but not below - there it crashed all the time. But this is expected, as you raised the target SDK level to 10, which is not really a good idea. We should at least also support android 2.1 and 2.2. Best would be to also include Android 1.6. I think, that almost nobody out there is still using 1.5, so its ok to exclude it.
Do you think, you can support also older Android versions? Maybe there is a library out there which does exactly the things you need on older SDK versions. This would be great.
Futher, have you also implemented two way sync for the local sdcard sync? If you do so, please use our sdcard.img file as test ressource!

Happy hacking :-)

NoahY (noahy) said : #7

Dear Stefan,

I borrowed the XML Parser from the note-editing branch, and they were using some functions from API 9, so I had to jack up the minSDK. I've found workarounds, I think, and put it back down to 3.

SD Card sync is now working, I've been able to save, delete, and create new notes with the SD Card and with my own Snowy server. Yay :)

I'm still getting a 500 error at https://one.ubuntu.com/notes/api/1.0/user/ - I think that should return a JSON array, but it doesn't...

Stefan Hammer (j-4) said : #8

Hello!

Great! I am very excited about your work!
your link path returns an array for me:
{"user-name": "https://login.launchpad.net/+id/AAAAAAA", "last-name": "Stefan Hammer", "notes-ref": {"href": "https://one.ubuntu.com/notes/", "api-ref": "https://one.ubuntu.com/notes/api/1.0/op/"}, "current-sync-guid": "0", "first-name": "Stefan Hammer", "latest-sync-revision": 128}

Maybe you are not authenticated? we will figure it out somehow.
As I already mentioned, if you have tested your code and you think this can be merged, please klick the propose for merging link!

Stefan Hammer (j-4) said : #9

Hello!

I just tested your latest work - I am fascinated. Creating a note and editing worked with simple text. This is great!
I of course got several force closes, eg when trying to write bold text. There are small ui things, like in the NoteView, there is the gray Titlebar, which should be hidden - but this are peanuts.
Further, when creating a new note, android is asking which application to choose when taping into the note body field. There are two Tomdroid entries... klicking on them does strange things :-D
You might also want to test the code in different SDK versions, just to make sure it works everywhere.

As soon as your code works perfectly, I thought of migrating our App to the new ActionBar Framework for a consistent look and feel in Android 4 - and also below it looks much better and does exactly what we need! So you don't have to concentrate on ui tweaks of the ActionBar!

NoahY (noahy) said : #10

Dear Stefan,

Thanks for testing :)

Your force closes are probably a bug in the xml parser for nested tags. Adding a second formatting to text caused the tags to get jumbled somehow, like:

<bold><italic>text</bold></italic>

This is fixed in the latest code.

I've now integrated the actionbar - on earlier SDKs this puts everything in the menu popup, which I guess is expected. The titlebar now changes to reflect the current activity.

The bug asking for an application is because of two things: first, I had extra code in the manifest, which caused links to be opened by either VewNote or EditNote - now they should only open via ViewNote; and second, the original code wasn't checking for empty titles, and so it was linking empty text - when you clicked on the note body, it thought this was a link to the new note itself. All fixed now.

Please test again and let me know.

NoahY (noahy) said : #11

Oh, and I found out what was wrong with Ubuntu One... I guess I had corrupted my notes; deleting them from the server allowed me to sync again... can confirm it is working! Yay - now I have a real note-taking app that syncs with my Ubuntu notes :)

Do you think Olivier will respond to this?

Stefan Hammer (j-4) said : #12

Hi!

Sorry - I can't test at work, but i will have a look in the evening.
Thanks for fixing all the bugs... you even implemented the Actionbar already? wow!

Is there an actionbar also in Android 2.3 and below now, or is there only the titlebar?
I read somewhere, that it is also possible to implement the actionbar in these versions - even with most used buttons and an home icon. see the links here: https://blueprints.launchpad.net/tomdroid/+spec/actionbar-redesign

I have one question: you are uploading the edited note directly, are you? What if there is no internet connection? will it remember to sync the note later?
Maybe it is better to just save the note and upload/download it in one go. Mobile Internet connections are not always really great and if you then can't upload it properly, you have to retry and so on.

If you are bored until i find new bugs in the evening ;-) you can create a new branch on top of this one and try to get a sync service working. this would be a big improvement together with two way sync. Best would be to have some settings, how often to sync and to turn on/off the automatic sync service (just look how other apps are doing it). Or you can do it like the google apps... I think they sync whenever a connection comes up and then in a regulary manner.
more here: https://blueprints.launchpad.net/tomdroid/+spec/synchronisation-service

And if this is too much work, you can also try to get a "tablet ui" working. If the actionbar is implemented, this should be no problem, as you only have to define screen fragments. there is even an example with a listfragment and a viewnote fragment in the links here: https://blueprints.launchpad.net/tomdroid/+spec/tablet-ui

But as i already mentioned - please make new branches therefore. it is easier to review then!

Olivier will for sure respond! At least when he sees your merging request with the attatched diff file.

NoahY (noahy) said : #13

Okay, I made it only push changes on sync. Now what it does is:

- on new note, it creates a local note
- on save note, it updates the local note
- on delete note, it adds a tag "system:deleted"

Then, on sync, it does the following:

- checks if there are local changes newer than last sync
- asks if you want to push local changes
- if you are pushing local changes, pushes all local notes that aren't on the remote
- if you are not pushing, deletes all local notes that aren't on remote
- compares local and remote note dates:
    - if a local note is newer, and you are pushing local changes, and the local has the "system:deleted" tag, it deletes both remote and local versions
    - if a local note is newer, and you are pushing local changes, rejects the remote note, pushing the local version instead
    - if local is newer but you aren't pushing, or local is older overwrites the local with the remote
    - if local date = remote date, skips the note

Whew. That's enough for me. I looked at the Sync Service, not into it, really. Also, some sort of action bar compat, but also not into it. Enough, until you, or someone, finds some bugs :)

Stefan Hammer (j-4) said : #14

I like your changes very much!

But unfortunately I can't build the branch as it is! It looks like the icons/drawable are missing: highlight, xml, ic_menu_sync

[2012-07-19 20:09:58 - note-editing-and-syncing] /home/jango/Android-dev/note-editing-and-syncing/res/layout/note_edit.xml:75: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/highlight').
[2012-07-19 20:09:58 - note-editing-and-syncing] /home/jango/Android-dev/note-editing-and-syncing/res/menu/edit_note.xml:35: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/xml').
[2012-07-19 20:09:58 - note-editing-and-syncing] /home/jango/Android-dev/note-editing-and-syncing/res/menu/main.xml:31: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/ic_menu_sync').

Description Resource Path Location Type
text cannot be resolved or is not a field EditNote.java /note-editing-and-syncing/src/org/tomdroid/ui line 284 Java Problem
Description Resource Path Location Type
xml cannot be resolved or is not a field EditNote.java /note-editing-and-syncing/src/org/tomdroid/ui line 298 Java Problem

Thanks!

Stefan Hammer (j-4) said : #15

Have you tried running this on Android 1.6? I always get a force close when trying to view a note synced from our sdcard image.

NoahY (noahy) said : #16

Sorry, I've added the missing resources.

I will try running it on 1.5 (our minSDK)... didn't have the SDK downloaded before. I've been testing on 2.2 and 4.0 so far.

NoahY (noahy) said : #17

Okay, it seems to be running on 1.5 with revision 301, except Toast messages don't show properly on the SDK. Seems to be a bug in the emulator, or maybe have to use a custom Toast.

Stefan Hammer (j-4) said : #18

Awesome! I can compile now and it works great on Android 4.1
however, I still cant view notes on 1.6: http://pastebin.com/C3LCqiUY

And on Android 2.3 all TextViews are singleline only... the about-box is a single line, viewnote content ist just a slingle line and editnote content ist also just a single line. i had a look, but couldn't find out why this is the case. Also the editnote content is not displayed on top, but centered.
The icons are also displayed right now!

Sync works perfectly - which is just great!

To get an ActionBar also on <11 there are two possibilities: either write some abstract classes like shown in the ActionBar Combat Sample of the SDK, or include the ActionBarSherlock library. I think the latter sounds much easier.
But I personally also like it without actionbar... the important thing is that it syncs two way!

Stefan Hammer (j-4) said : #19

I fixed the SingleLine problem with using the light theme on api<11.
Further I aadded android:gravity="top" to the editnote content field made the text appear on top!

This change in the theme also fixed my crash on Android 1.6!

So everything is working atm. Great!

Oh... While testing, I realised one little thing, which can be annoying: In EditView you can not scroll down with tapping and swiping. therefore there is no way to scroll here. This is not good!

Great work, though!

NoahY (noahy) said : #20

Dear Stefan,

I think I also fixed the single line problem, but by adding android:height to the xml file. Seems it needs a height declaration to fill the textview.

Also added gravity="top" before, not sure how it disappeared :)

I think I also fixed the scroll problem - it was the MovementMethod... let me know if the latest code is any better - it is scrolling on swipe here.

Oh, and I'm sorry for this, but I added a tablet layout to this branch; it seemed too complicated to have to create a new branch with all the changes I've already made, and the split layout only seems to make sense if we have an edit activity as well, so there you have it. Hope it isn't too much work to review, it wasn't that difficult to implement. How it works is if the width of the tablet is greater than 600px and it is in landscape mode, it shows the split screen, and a combined actionbar menu Here's a screenshot:

http://static.inky.ws/image/2441/image.jpg

Also, modified the SD Card sync to preserve various tags on the sdcard that we don't use in Tomdroid.

And merged your changes, though I'm not sure if the theme specification is necessary with my first change mentioned above.

Hey NoahY,

Thanks for this awesome work. I'm just now joining this thread. I've tested your changes on a Moto DroidX running 2.3.4 and a Nexus 7 with 4.1. After your most recent update (changing targetSdkVersion to 10), it looks fantastic on the Nexus.

2.3.4 on the DroidX, however, has some issues. See this screenshot: http://lucasoman.com/images/noahY234.png

As you can see, the TextView is only a single line high, but I'm able to scroll it if I can get my fat finger on it. The EditView in note_edit is the same.

NoahY (noahy) said : #22

Hey Lucas,

Thanks for testing... glad to hear it works okay on 4.1 :)

Sorry about 2.3, I had fixed it, but I guess I reverted a change. This bug is a strange one... Stefan tried to fix it, but I think there was one thing missing (or maybe I just reverted a change of his by mistake)... after creating the layout-v11 folder and file, in AndroidManifest.xml, have to change the theme to styles/MyTheme. The underlying problem seems to be that 2.3 doesn't recognize Theme.Holo - for some reason it does recognize (or else doesn't and therefore reverts to default) Theme.Holo.Light. I've now set it to Theme for SDK < 11 and Theme.Holo for SDK 11+ Seems to work on the 2.3 emulator. Please let me know.

Olivier Bilodeau (plaxx) said : #23

Alright better late than sorry.

Can you help with this problem?

Provide an answer of your own, or ask NoahY for more information if necessary.

To post a message you must log in.