[GCI] [Notepad] Sorting encrypted notes, issue 187

33 views
Skip to first unread message

Shuhao Wu

unread,
Nov 25, 2011, 3:16:53 PM11/25/11
to openi...@googlegroups.com
Here's the link to GCI: http://www.google-melange.com/gci/task/view/google/gci2011/7116278

I've been studying through the code for adding the notes view. The way I understand it is that this is the workflow:
  1. The SQLite database gets queried, and it's queried with a certain order gotten from PreferenceActivity
  2. The notes stored in the SQLite database is encrypted, hence the ordering of alphabetical or reverse alphabetical wouldn't work as they're encrypted strings.
  3. The NoteListCursorAdapter takes the cursor, iterates through and sets each item in the list. It iterates through according to the order that's first queried.
So the main problem I'm having is that since everything is in the cursor, and I can't change the ordering of the cursor (?), it'll be difficult to change this.

Am I missing something? 

Shuhao

Peli

unread,
Nov 26, 2011, 9:39:09 AM11/26/11
to OpenIntents
Answered by Randy on your task page:
http://www.google-melange.com/gci/task/view/google/gci2011/7116278

I think the tactics would be to store the plain text titles in some
kind of cache that is created once all strings are decrypted, and then
sort the list according to that cache. That gets invalidated as soon
as the user logs out of OI Safe.

Peli

On Nov 25, 9:16 pm, Shuhao Wu <ad...@thekks.net> wrote:
> Here's the link to GCI:http://www.google-melange.com/gci/task/view/google/gci2011/7116278
>
> I've been studying through the code for adding the notes view. The way I
> understand it is that this is the workflow:
>

>    1. The SQLite database gets queried, and it's queried with a certain
>    order gotten from PreferenceActivity
>    2. The notes stored in the SQLite database is encrypted, hence the


>    ordering of alphabetical or reverse alphabetical wouldn't work as they're
>    encrypted strings.

>    3. The NoteListCursorAdapter takes the cursor, iterates through and sets

Shuhao

unread,
Nov 26, 2011, 4:38:11 PM11/26/11
to openi...@googlegroups.com
The problem is that the list is constructed via a CursorAdapter. So the construction of the UI is done via the ordering of the Cursor.

Does this mean I have to rewrite a significant portion of the interface?

Peli

unread,
Nov 27, 2011, 6:08:17 PM11/27/11
to OpenIntents
Probably this means you have to write a custom cursor. However, maybe
it is possible to replace just the cursor by a custom cursor
(MatrixCursor?), without the need to modify too much of the rest of
the code...

Let us know if you think the task is too involved or should be split
into smaller parts.

Peli

Shuhao

unread,
Nov 27, 2011, 6:29:40 PM11/27/11
to openi...@googlegroups.com
It might be a bit involved, in the sense that I need to understand how several parts of the code works. So I think I'll need some help with that.

Shuhao

unread,
Nov 30, 2011, 7:23:03 PM11/30/11
to openi...@googlegroups.com
Yeah, after some further investigation, i don't think the task can be done without rewriting a lot, because currently we're getting the rows from OpenMatrixCursor's data rows and then using a mEncryptedStringHashMap to map the encrypted to the decrypted string.

This might take a while to do and I don't have the time right now to do such a complicated task (even though the feature is quite trivia).

Peli

unread,
Dec 1, 2011, 2:03:23 AM12/1/11
to OpenIntents
Ok, so unclaim this task and pick some other task. You may comment
directly on the issue page of 187 what you just wrote here.

Peli

Shuhao

unread,
Dec 1, 2011, 3:57:42 PM12/1/11
to openi...@googlegroups.com
Yeah, Is it okay if I create an issue (something I want to work on) and claim it?

aap

unread,
Dec 1, 2011, 10:16:14 PM12/1/11
to openi...@googlegroups.com
Shuhao,

It would be easier to answer this question if you give us some idea what you have in mind.  If we like it, we might even create the issue for you.

-- Aaron
Reply all
Reply to author
Forward
0 new messages