Fix NPE when getting text from clipboard.

The clipboard may return null if the clipboard contains something other
than text. This is documented in the API but that case was not
considered by the code.
don't save note if no changes made (#705)  (dae/anki c44cf32)
Cleanup of Note.java. Update up to libanki 2.0.16

- Reorganized code to better match note.py for easier comparison.
- Use objects instead of native types in some parameters/return values. This allows us to use null as a counterpart to python's None instead of using 0s.
- Added asserts.
- Fixed tag deletion.
- Tag duplicate checking is correct on the libanki side, but it leaves CardEditor's dupe checking broken. This will be fixed in a future commit.
Don't disable saving on dupes, only highlight (issue 1787).
Remove dead/commented out code.
Cleanup of Card.java

- Mostly formatting changes.
- Added some asserts and renamed some methods to match libanki.
- Use separate methods for fetching simple interface content instead of modifying  libanki methods.
- Removed suspicious flag from flush() that skipped some values. This was used by our custom undo code which needs to be revisited in the future.
Move all constants into a new Consts.java file to match consts.py
Cleanup for Tags.java

- Includes commit: canonify tags when saving, and strip quotes (#794) (dae/anki da66844 )
- Query fix in registerNotes
Cleanup of Finder.java to match libanki 2.0.16.

- Moved add function into existing SearchState convenience class. Avoids passing itself as a parameter and is now contained in the only place it's used.
- Added missing search commands (_findCids, _findDupes).
- Moved AnkiDroid-specific code into own functions at bottom of file.
- Overload _order instead of unreliable check for "true" string.
- _findDeck() checks if did is already contained in wildcard search (python uses set)

Contains these commits from dae/anki:
- failure to find a field should not break entire query (b571a4c)
- fix duplicate search in browser (#855) (3f6266a)
- escape + in deck names (26a3c30)
- support cid:<card id> search (013f879)
- fix find dupes when fieldname case differs (5db00d5 )
- strip html in duplicate check (#906) (4d42282)
Tests for Media.java