Perform string content comparison in SmackableImp::getName

This may have worked by accident if the invoked methods returned the
same static string objects, but better replace this with a proper check.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Drop stray android:enabled from chat action bar layout

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Avoid deprecation warning for text.ClipboardManager

The more modern content.ClipboardManager requires API level 11.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Log presence in presenceChanged

Helps debugging.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Use PreferenceConstants consistently

No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Refactor boolean ChatConstants.FROM_ME to integer DIRECTION

The name reflects the meaning better, and the type maps cleaner on the
database representation. No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Refactor RosterConstants and GroupsConstants usage

Import RosterConstants and GroupsConstants directly and use them
consistently. No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Let database count unread messages

Instead of generating a list of unread messages, let the database count
them and return this number. Slightly more efficient.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Replace updateOrInsertRosterEntryToDB on status updates with updateRosterEntryInDB

There is no obvious reason that we need special DB updates to store a
new presence code. The DB must already contain the corresponding roster
entry, so just call updateRosterEntryInDB and drop the now unused
updateOrInsertRosterEntryToDB.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Move addRosterEntryToDB

Just to have {add,delete,update}RosterEntryToDB close to each other. No
functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Enhance updateRosterEntryInDB to add new entries on demand

Call addRosterEntryToDB from updateRosterEntryInDB if the entry does not
exist yet. This allows to start using it from setRosterEntries, in
preparation of preserving the roster table across connections.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Preserve roster table across connections

Instead of dropping all entries from the roster table on reconnect,
update existing ones or add new entries based on the server DB, and drop
those entries that were removed from the server. This will allow to
maintain additional data in the roster entries.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Drop groups table

These days we only use the groups table to identify is some group was
added or removed. But this approach is not perfect either as it doesn't
allow us to find out if a group became virtually empty (no more online
members).

This commit just raises a change notification for the group URI along
with any content change. No relevant impact on the visualization of the
roster could be found so far. Instead, the code becomes much simpler.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Hide groups without available members

Reactivate the disabled code in RosterExpListAdapter.requery. It works
now as we report any content change also as group URI change.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>