[jitsi-dev] [PATCH] Jitsi-Android SIP and Jabber Account Settings


Hi all,

The patch adds account properties editing functionality for SIP and Jabber

I used Preferences to edit most of the settings(
http://developer.android.com/guide/topics/ui/settings.html). First I loaded
all properties from AccountID into the registration
objects(JabberAccountRegistration, SIPAccountRegistration). Then there are
defined PreferenceScreens for SIP and Jabber protocols in files
res/xml/jabber_preferences.xml and sip_preferences.xml. In activites for
the screens I load values from the registration objects and updated them
when user makes any changes. When the PreferenceScreens are closed I store
the properties back to the AccountID.

There are few common parts for both protocols: encoding properties(audio
and video) and partially security settings. Because of that I had to add
common interface for registration objects and I called it
AccountRegistration. It resides next to the
net.java.sip.communicator.util.wizard.EncodingsRegistration and
SecurityAccountRegistration. The interface returns protocol name and
optionally encoding and/or secuirty registration objects in case they are
supported. Common parts are handled in AccountPreferencesActivity.

Below are breifly explained changes made to few particular files. The rest
I tried to describe in javadoc.

org.jitsi.android.gui.account.settings.EncodingActivity.java - the activity
used to edit audio or video encoding settings. It receives
EncodingsRegistration and MediaType through Intent's extra. In the result
Intent it returns the registration object and boolean flag indicating if
any changes have been made and require commit.

org.jitsi.android.gui.account.settings.SecurityActivity.java - activity
takes care of security properties


net.java.sip.communicator.util.wizard.EncodingsRegistration.java - my
intention was to make it Serializable so that I can pass it's instance as
Intent's extra.

- added implementation of AccountRegistration interface and few getters to
make it serializable

net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration - the
same as above but for SIP

net.java.sip.communicator.plugin.jabberaccregwizz.AccountRegistrationImpl -
added modification option, implemented loadAccount() method that loads
properties from AccountID into the registration object

org.jitsi.gui.widgets.TouchInterceptor.java - the list widget that allows
user to drag and drop it's items to change order, it exposes DropListener
and DragListener interfaces to handle the events. It's used in audio/video
encodings settings and security protocols settings(ZRTP, SDES). The code is
modified source of Android music app.

res/values/attrs.xml - contains definition of TouchInterceptor's
atrributes, see javadoc for more details on each item

res/values/array.xml - file contains string arrays definitions for
droplists used in few parts of settings

Every Preference requires some key so that it can be identified later.
These are declared in string.xml file.

Known issues:

The Preferences values are stored by SharedPreferences objects and
automatically persisted by Android. Because they are saved when user
changes any value on the screen there is some garbage stored inspite the
fact that we store them in AccountID properties. There is now way to bind
specified SharedPreferences set to the account or I haven't found an easy
way of doing this. I could try to get rid of the garbage by deleting the
SharedPreferences used by the PreferenceScreen on exit, but would have to
take a look on that.


accountSettings.patch (233 KB)