--- a/AndroidManifest.xml Wed May 26 20:37:24 2010 +0200
+++ b/AndroidManifest.xml Mon May 31 00:21:41 2010 +0200
@@ -6,7 +6,7 @@
android:icon="@drawable/beem_launcher_icon_silver" android:theme="@style/Theme.BEEM.Default"
android:debuggable="true" android:name=".BeemApplication">
<activity android:name=".ui.Login" android:label="@string/app_name"
- android:screenOrientation="portrait" android:launchMode="standard">
+ android:launchMode="standard">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
--- a/doc/asmack-beem/beem-build-process.patch Wed May 26 20:37:24 2010 +0200
+++ b/doc/asmack-beem/beem-build-process.patch Mon May 31 00:21:41 2010 +0200
@@ -1,5 +1,5 @@
---- asmack-org/build.bash 2010-03-05 02:42:58.978546820 +0100
-+++ asmack/build.bash 2010-03-05 02:35:43.689307349 +0100
+--- asmack-git/build.bash 2010-05-07 22:08:18.000000000 +0200
++++ asmack/build.bash 2010-05-07 22:06:53.000000000 +0200
@@ -15,11 +15,11 @@
if ! [ -f "${2}/.svn/entries" ]; then
mkdir "${2}"
@@ -20,83 +20,14 @@
fetchall() {
- gitfetch "git://github.com/rtreffer/smack.git" "smack"
- fetch "http://svn.apache.org/repos/asf/qpid/trunk/qpid/java/management/common/src/main/" "qpid"
-- fetch "http://svn.apache.org/repos/asf/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/" "harmony"
+- fetch "http://svn.apache.org/repos/asf/harmony/enhanced/java/trunk/classlib/modules/auth/src/main/java/common/" "harmony"
- fetch "https://dnsjava.svn.sourceforge.net/svnroot/dnsjava/trunk" "dnsjava"
- fetch "https://kenai.com/svn/jbosh~main/trunk/jbosh/src/main/java" "jbosh"
+ fetch "http://svn.igniterealtime.org/svn/repos/smack/trunk" "smack" "11644"
+ fetch "http://svn.apache.org/repos/asf/qpid/trunk/qpid/java/management/common/src/main/" "qpid" "HEAD"
-+ fetch "http://svn.apache.org/repos/asf/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/" "harmony" "HEAD"
++ fetch "http://svn.apache.org/repos/asf/harmony/enhanced/java/trunk/classlib/modules/auth/src/main/java/common/" "harmony" "HEAD"
+ fetch "https://dnsjava.svn.sourceforge.net/svnroot/dnsjava/trunk" "dnsjava" "HEAD"
+ fetch "https://kenai.com/svn/jbosh~main/trunk/jbosh/src/main/java" "jbosh" "HEAD"
}
copyfolder() {
-@@ -95,7 +95,7 @@
- buildsrc
- patchsrc "patch"
- patchsrc "${dir}"
-- ant -Djar.suffix=`echo ${dir}|sed 's:patch/:-:'`
-+ ant -Dbuild.all=true -Djar.suffix=`echo ${dir}|sed 's:patch/:-:'`
- done
- }
-
---- asmack3/build.xml 2010-02-24 16:09:39.000000000 +0100
-+++ asmack-org/build.xml 2010-02-24 00:18:40.000000000 +0100
-@@ -36,6 +36,13 @@
- </and>
- </condition>
-
-+<condition property="build-2.1">
-+ <and>
-+ <istrue value="${build.all}" />
-+ <available file="${sdk-location}/platforms/android-2.1/android.jar" />
-+ </and>
-+</condition>
-+
- <target name="compile-jse" description="Compile for java se">
- <delete dir="build/classes" failonerror="false" />
- <mkdir dir="build/classes" />
-@@ -65,6 +72,34 @@
- />
- </target>
-
-+<target name="compile-a21" description="Compile for android 2.1" if="build-2.1">
-+ <delete dir="build/classes" failonerror="false" />
-+ <mkdir dir="build/classes" />
-+ <mkdir dir="build/classes/trunk" />
-+ <javac
-+ target="1.5"
-+ srcdir="build/src/trunk"
-+ destdir="build/classes/trunk"
-+ classpath="lib/xmlpull_1_1_3_4c.jar"
-+ bootclasspath="${sdk-location}/platforms/android-2.1/android.jar"
-+ debug="true"
-+ debuglevel="source,lines"
-+ />
-+ <copy todir="build/classes/trunk"><fileset dir="build/src/trunk" includes="META-INF/**" /></copy>
-+ <jar
-+ basedir="build/classes/trunk"
-+ destfile="build/asmack-android-2.1${jar.suffix}.jar"
-+ filesonly="true"
-+ level="9"
-+ />
-+ <zip
-+ basedir="build/src/trunk"
-+ destfile="build/asmack-android-2.1-source${jar.suffix}.zip"
-+ filesonly="true"
-+ level="9"
-+ />
-+</target>
-+
- <target name="compile-a201" description="Compile for android 2.0.1" if="build-2.0.1">
- <delete dir="build/classes" failonerror="false" />
- <mkdir dir="build/classes" />
-@@ -208,7 +243,7 @@
- <target
- name="compile"
- description="Compile for all targets"
-- depends="compile-jse,compile-a201,compile-a20,compile-a16,compile-a15,compile-a11"
-+ depends="compile-jse,compile-a21,compile-a201,compile-a20,compile-a16,compile-a15,compile-a11"
- />
-
- </project>
Binary file res/drawable-hdpi/beem_icon_launcher_color.png has changed
Binary file res/drawable-ldpi/beem_icon_launcher_color.png has changed
Binary file res/drawable-mdpi/beem_icon_launcher_color.png has changed
Binary file res/drawable/beem_icon_launcher_color106.png has changed
Binary file res/drawable/beem_icon_launcher_color160.png has changed
Binary file res/drawable/beem_icon_launcher_color80.png has changed
--- a/res/layout-large-land/login_anim.xml Wed May 26 20:37:24 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="fill_parent" android:layout_width="fill_parent"
- android:orientation="vertical">
- <ImageView android:id="@+id/loginanim_logo_anim" android:src="@drawable/beem_icon_launcher_color160"
- android:layout_height="wrap_content" android:layout_width="wrap_content"
- android:layout_gravity="center_vertical|center_horizontal|center"
- android:layout_weight="1" />
- <TextView android:id="@+id/loginanim_status_text"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:textSize="20sp" android:gravity="center" android:textColor="@color/vert_manu"/>
- <Button android:id="@+id/loginanim_cancel_button"
- android:layout_height="wrap_content" android:layout_width="fill_parent"
- android:layout_gravity="bottom" android:text="@string/CancelButton" />
-</LinearLayout>
-
--- a/res/layout-large/login_anim.xml Wed May 26 20:37:24 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="fill_parent" android:layout_width="fill_parent"
- android:orientation="vertical">
- <ImageView android:id="@+id/loginanim_logo_anim" android:src="@drawable/beem_icon_launcher_color160"
- android:layout_height="wrap_content" android:layout_width="wrap_content"
- android:layout_gravity="center_vertical|center_horizontal|center"
- android:layout_weight="1" />
- <TextView android:id="@+id/loginanim_status_text"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:textSize="20sp" android:gravity="center" android:textColor="@color/vert_manu"/>
- <Button android:id="@+id/loginanim_cancel_button"
- android:layout_height="wrap_content" android:layout_width="fill_parent"
- android:layout_gravity="bottom" android:text="@string/CancelButton" />
-</LinearLayout>
-
--- a/res/layout-small/login_anim.xml Wed May 26 20:37:24 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="fill_parent" android:layout_width="fill_parent"
- android:orientation="vertical">
- <ImageView android:id="@+id/loginanim_logo_anim" android:src="@drawable/beem_icon_launcher_color80"
- android:layout_height="wrap_content" android:layout_width="wrap_content"
- android:layout_gravity="center_vertical|center_horizontal|center"
- android:layout_weight="1" />
- <TextView android:id="@+id/loginanim_status_text"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:textSize="20sp" android:gravity="center" android:textColor="@color/vert_manu"/>
- <Button android:id="@+id/loginanim_cancel_button"
- android:layout_height="wrap_content" android:layout_width="fill_parent"
- android:layout_gravity="bottom" android:text="@string/CancelButton" />
-</LinearLayout>
-
--- a/res/layout/contactlist_groupstub.xml Wed May 26 20:37:24 2010 +0200
+++ b/res/layout/contactlist_groupstub.xml Mon May 31 00:21:41 2010 +0200
@@ -4,7 +4,7 @@
android:layout_height="wrap_content">
<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contactlist_banner" android:layout_width="fill_parent"
- android:layout_height="42px" android:spacing="42px"
+ android:layout_height="40dp" android:spacing="25dp"
android:unselectedAlpha="0.4" android:background="#222222" />
<View android:layout_width="fill_parent" android:layout_height="2dp"
android:fadingEdge="horizontal" android:background="#555555" />
--- a/res/layout/login_anim.xml Wed May 26 20:37:24 2010 +0200
+++ b/res/layout/login_anim.xml Mon May 31 00:21:41 2010 +0200
@@ -3,7 +3,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:orientation="vertical">
- <ImageView android:id="@+id/loginanim_logo_anim" android:src="@drawable/beem_icon_launcher_color106"
+ <ImageView android:id="@+id/loginanim_logo_anim" android:src="@drawable/beem_icon_launcher_color"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:layout_weight="1" />
--- a/res/layout/preferences.xml Wed May 26 20:37:24 2010 +0200
+++ b/res/layout/preferences.xml Mon May 31 00:21:41 2010 +0200
@@ -25,11 +25,11 @@
android:hint="@string/away_message_hint" />
</PreferenceScreen>
<PreferenceScreen android:title="@string/notification_preferences">
- <CheckBoxPreference android:title="@string/notification_disable_vibrate_title"
- android:defaultValue="false" android:summary="@string/notification_disable_vibrate_sum"
- android:key="settings_notification_disable_vibrate" />
+ <CheckBoxPreference android:title="@string/notification_enable_vibrate_title"
+ android:defaultValue="false" android:summary="@string/notification_enable_vibrate_sum"
+ android:key="notification_vibrate" />
<RingtonePreference
- android:title="@string/notification_snd_title" android:key="settings_notification_snd"
+ android:title="@string/notification_snd_title" android:key="notification_sound"
android:summary="@string/notification_snd_sum" android:ringtoneType="notification"
android:showDefault="true" />
</PreferenceScreen>
@@ -56,31 +56,31 @@
android:summary="@string/settings_proxy_sum">
<CheckBoxPreference android:title="@string/SettingsProxyProxy"
android:defaultValue="false" android:summary="@string/SettingsProxySummary"
- android:key="settings_key_proxy_use" />
+ android:key="proxy_use" />
<PreferenceCategory android:title="@string/proxy_proxy_settings">
- <ListPreference android:dependency="settings_key_proxy_use"
+ <ListPreference android:dependency="proxy_use"
android:title="@string/SettingsProxyType" android:entries="@array/proxy_types"
android:summary="@string/SettingsProxyTypeSummary"
android:defaultValue="HTTP" android:entryValues="@array/proxy_types"
- android:key="settings_key_proxy_type" />
+ android:key="proxy_type" />
<EditTextPreference android:singleLine="true"
- android:dependency="settings_key_proxy_use" android:name="serveur"
+ android:dependency="proxy_use" android:name="serveur"
android:summary="@string/SettingsProxyServer" android:title="@string/settings_proxy_server"
- android:key="settings_key_proxy_server" />
+ android:key="proxy_server" />
<EditTextPreference android:singleLine="true"
- android:dependency="settings_key_proxy_use" android:name="port"
+ android:dependency="proxy_use" android:name="port"
android:summary="@string/SettingsProxyPort" android:title="@string/settings_proxy_port"
- android:key="settings_key_proxy_port" android:numeric="signed" android:hint="@string/comments_proxy_port" />
+ android:key="proxy_port" android:numeric="signed" android:hint="@string/comments_proxy_port" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/proxy_user_settings">
<EditTextPreference android:singleLine="true"
- android:dependency="settings_key_proxy_use" android:name="Utilisateur"
+ android:dependency="proxy_use" android:name="Utilisateur"
android:summary="@string/SettingsProxyUser" android:title="@string/settings_proxy_username"
- android:key="settings_key_proxy_username" />
+ android:key="proxy_username" />
<EditTextPreference android:singleLine="true"
- android:dependency="settings_key_proxy_use" android:name="pass_user"
+ android:dependency="proxy_use" android:name="pass_user"
android:password="true" android:summary="@string/SettingsProxyPassword"
- android:title="@string/settings_proxy_password" android:key="settings_key_proxy_password" />
+ android:title="@string/settings_proxy_password" android:key="proxy_password" />
</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen android:key="advanced"
--- a/res/values-de/strings.xml Wed May 26 20:37:24 2010 +0200
+++ b/res/values-de/strings.xml Mon May 31 00:21:41 2010 +0200
@@ -21,11 +21,6 @@
<string name="BeemServiceCreated">Beem Service erstellt</string>
<string name="BeemServiceDestroyed">Beem Service verworfen</string>
- <!-- Preferences informations -->
- <string name="PreferenceStatus">Status</string>
- <string name="PreferenceStatusText">status_text</string>
- <string name="PreferenceIsConfigured">preference_is_configured </string>
-
<!-- ContactListSettings class -->
<string name="CLSServerConnection">Server Verbindung</string>
<string name="CLSUserid">Benutzer id:</string>
@@ -122,8 +117,8 @@
<string name="away_message_sum">Angezeigte Abwesendheitsnachricht</string>
<string name="away_message_hint">Ich bin abwesend, mein Telefonbildschirm ist aus</string>
<string name="notification_preferences">Benachrichtigungseinstellungen</string>
- <string name="notification_disable_vibrate_title">Vibrieren</string>
- <string name="notification_disable_vibrate_sum">Deaktivieren Sie vibriert bei eingehenden Nachrichten</string>
+ <string name="notification_enable_vibrate_title">Vibrieren</string>
+ <string name="notification_enable_vibrate_sum">Aktivieren Sie vibriert bei eingehenden Nachrichten</string>
<string name="notification_snd_title">Nachrichtensignalton</string>
<string name="notification_snd_sum">Lege den Signalton für eingehende Nachrichten fest</string>
--- a/res/values-fr/strings.xml Wed May 26 20:37:24 2010 +0200
+++ b/res/values-fr/strings.xml Mon May 31 00:21:41 2010 +0200
@@ -119,8 +119,8 @@
<string name="away_message_sum">Votre Message d\'absence</string>
<string name="away_message_hint">Je suis absent car mon ecran est éteind</string>
<string name="notification_preferences">Paramètres des notifications</string>
- <string name="notification_disable_vibrate_title">Vibreur</string>
- <string name="notification_disable_vibrate_sum">Désactiver le vibreur pour les messages entrants</string>
+ <string name="notification_enable_vibrate_title">Activer le vibreur</string>
+ <string name="notification_enable_vibrate_sum">Activer le vibreur pour les messages entrants</string>
<string name="notification_snd_title">Sonnerie des messages</string>
<string name="notification_snd_sum">Configurer la sonnerie des messages entrants</string>
--- a/res/values-ru/strings.xml Wed May 26 20:37:24 2010 +0200
+++ b/res/values-ru/strings.xml Mon May 31 00:21:41 2010 +0200
@@ -21,12 +21,6 @@
<string name="BeemServiceCreated"></string>
<string name="BeemServiceDestroyed"></string>
-<!-- Preferences informations -->
-<string name="PreferenceStatus">Статус</string>
-<string name="PreferenceStatusText"></string>
-<string name="PreferenceIsConfigured">preference_is_configured
-</string>
-
<!-- ContactListSettings class -->
<string name="CLSServerConnection">Соединение</string>
<string name="CLSUserid">Имя пользователя:</string>
@@ -125,8 +119,8 @@
<string name="away_message_sum"></string>
<string name="away_message_hint"></string>
<string name="notification_preferences">Настройка оповещений</string>
-<string name="notification_disable_vibrate_title">Вибрация</string>
-<string name="notification_disable_vibrate_sum">Отключить вибрировать на входящие сообщения</string>
+<string name="notification_enable_vibrate_title">Вибрация</string>
+<string name="notification_enable_vibrate_sum">Активировать вибрировать на входящие сообщения</string>
<string name="notification_snd_title">Сигнал сообщений</string>
<string name="notification_snd_sum"></string>
--- a/res/values/strings.xml Wed May 26 20:37:24 2010 +0200
+++ b/res/values/strings.xml Mon May 31 00:21:41 2010 +0200
@@ -119,8 +119,8 @@
<string name="away_message_sum">The away message that will be displayed</string>
<string name="away_message_hint">I\'m away, my cellphone screen is off</string>
<string name="notification_preferences">Notification settings</string>
- <string name="notification_disable_vibrate_title">Vibrate</string>
- <string name="notification_disable_vibrate_sum">Disable vibrate on incoming messages</string>
+ <string name="notification_enable_vibrate_title">Enable vibrate</string>
+ <string name="notification_enable_vibrate_sum">Enable vibrate on incoming messages</string>
<string name="notification_snd_title">Message ringtone</string>
<string name="notification_snd_sum">Set your incoming message ringtone</string>
--- a/src/com/beem/project/beem/BeemApplication.java Wed May 26 20:37:24 2010 +0200
+++ b/src/com/beem/project/beem/BeemApplication.java Mon May 31 00:21:41 2010 +0200
@@ -67,6 +67,23 @@
public static final String STATUS_KEY = "status";
/** Preference key for status message. */
public static final String STATUS_TEXT_KEY = "status_text";
+ /** Preference key for the use of a proxy. */
+ public static final String PROXY_USE_KEY = "proxy_use";
+ /** Preference key for the type of proxy. */
+ public static final String PROXY_TYPE_KEY = "proxy_type";
+ /** Preference key for the proxy server. */
+ public static final String PROXY_SERVER_KEY = "proxy_server";
+ /** Preference key for the proxy port. */
+ public static final String PROXY_PORT_KEY = "proxy_port";
+ /** Preference key for the proxy username. */
+ public static final String PROXY_USERNAME_KEY = "proxy_username";
+ /** Preference key for the proxy password. */
+ public static final String PROXY_PASSWORD_KEY = "proxy_password";
+ /** Preference key for vibrate on notification. */
+ public static final String NOTIFICATION_VIBRATE_KEY = "notification_vibrate";
+ /** Preference key for notification sound. */
+ public static final String NOTIFICATION_SOUND_KEY = "notification_sound";
+
//TODO add the other one
private boolean mIsConnected;
--- a/src/com/beem/project/beem/BeemService.java Wed May 26 20:37:24 2010 +0200
+++ b/src/com/beem/project/beem/BeemService.java Mon May 31 00:21:41 2010 +0200
@@ -64,6 +64,7 @@
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.net.ConnectivityManager;
+import android.net.Uri;
import android.os.IBinder;
import android.os.RemoteException;
import android.preference.PreferenceManager;
@@ -77,7 +78,9 @@
import com.beem.project.beem.utils.Status;
/**
- * This class is for the Beem service. The connection to the xmpp server will be made asynchronously when the service
+ * This class is for the Beem service.
+ * It must contains every global informations needed to maintain the background service.
+ * The connection to the xmpp server will be made asynchronously when the service
* will start.
* @author darisk
*/
@@ -119,13 +122,13 @@
* Initialize the connection.
*/
private void initConnectionConfig() {
- mUseProxy = mSettings.getBoolean("settings_key_proxy_use", false);
+ mUseProxy = mSettings.getBoolean(BeemApplication.PROXY_USE_KEY, false);
if (mUseProxy) {
- String stype = mSettings.getString("settings_key_proxy_type", "HTTP");
- String phost = mSettings.getString("settings_key_proxy_server", "");
- String puser = mSettings.getString("settings_key_proxy_username", "");
- String ppass = mSettings.getString("settings_key_proxy_password", "");
- int pport = Integer.parseInt(mSettings.getString("settings_key_proxy_port", "1080"));
+ String stype = mSettings.getString(BeemApplication.PROXY_TYPE_KEY, "HTTP");
+ String phost = mSettings.getString(BeemApplication.PROXY_SERVER_KEY, "");
+ String puser = mSettings.getString(BeemApplication.PROXY_USERNAME_KEY, "");
+ String ppass = mSettings.getString(BeemApplication.PROXY_PASSWORD_KEY, "");
+ int pport = Integer.parseInt(mSettings.getString(BeemApplication.PROXY_PORT_KEY, "1080"));
ProxyInfo.ProxyType type = ProxyType.valueOf(stype);
mProxyInfo = new ProxyInfo(type, phost, pport, puser, ppass);
} else {
@@ -156,21 +159,16 @@
return mBind;
}
- /* (non-Javadoc)
- * @see android.app.Service#onUnbind(android.content.Intent)
- */
@Override
public boolean onUnbind(Intent intent) {
Log.d(TAG, "ONUNBIND()");
if (!mConnection.getAdaptee().isConnected()) {
- Log.d(TAG, "DESTROYED");
this.stopSelf();
}
return true;
}
-
/**
* {@inheritDoc}
*/
@@ -220,7 +218,6 @@
@Override
public void onDestroy() {
super.onDestroy();
- Log.d("Service", "onDestroy");
resetStatus();
mNotificationManager.cancelAll();
unregisterReceiver(mReceiver);
@@ -247,11 +244,16 @@
}
/**
- * Show a notification.
+ * Show a notification using the preference of the user.
* @param id the id of the notification.
* @param notif the notification to show
*/
public void sendNotification(int id, Notification notif) {
+ if (mSettings.getBoolean(BeemApplication.NOTIFICATION_VIBRATE_KEY, true))
+ notif.defaults |= Notification.DEFAULT_VIBRATE;
+ notif.defaults |= Notification.DEFAULT_LIGHTS;
+ String ringtoneStr = mSettings.getString(BeemApplication.NOTIFICATION_SOUND_KEY, "");
+ notif.sound = Uri.parse(ringtoneStr);
mNotificationManager.notify(id, notif);
}
@@ -397,9 +399,6 @@
public BeemServicePreferenceListener() {
}
- /**
- * {@inheritDoc}
- */
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if ("settings_away_chk".equals(key)) {
@@ -424,14 +423,11 @@
private int mOldMode;
/**
- * ctor.
+ * Constructor.
*/
public BeemServiceBroadcastReceiver() {
}
- /**
- * {@inheritDoc}
- */
@Override
public void onReceive(final Context context, final Intent intent) {
String intentAction = intent.getAction();
--- a/src/com/beem/project/beem/service/BeemChatManager.java Wed May 26 20:37:24 2010 +0200
+++ b/src/com/beem/project/beem/service/BeemChatManager.java Mon May 31 00:21:41 2010 +0200
@@ -56,7 +56,6 @@
import android.app.PendingIntent;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.net.Uri;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.preference.PreferenceManager;
@@ -75,8 +74,8 @@
* @author darisk
*/
public class BeemChatManager extends IChatManager.Stub {
- /** Tag to use with log methods. */
- public static final String TAG = "BeemChatManager";
+
+ private static final String TAG = "BeemChatManager";
private final ChatManager mAdaptee;
private final Map<String, ChatAdapter> mChats = new HashMap<String, ChatAdapter>();
private final ChatListener mChatListener = new ChatListener();
@@ -95,9 +94,6 @@
mAdaptee.addChatListener(mChatListener);
}
- /**
- * {@inheritDoc}
- */
@Override
public void addChatCreationListener(IChatManagerListener listener) throws RemoteException {
if (listener != null)
@@ -258,7 +254,8 @@
*/
private PendingIntent makeChatIntent(IChat chat) {
Intent chatIntent = new Intent(mService, com.beem.project.beem.ui.Chat.class);
- chatIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP);
+ chatIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP
+ | Intent.FLAG_ACTIVITY_NEW_TASK);
try {
chatIntent.setData(chat.getParticipant().toUri());
} catch (RemoteException e) {
@@ -280,13 +277,9 @@
.getName();
Notification notification = new Notification(android.R.drawable.stat_notify_chat, tickerText, System
.currentTimeMillis());
- if (!pref.getBoolean("settings_notification_disable_vibrate", true))
- notification.defaults -= Notification.DEFAULT_VIBRATE;
notification.flags = Notification.FLAG_AUTO_CANCEL;
notification.setLatestEventInfo(mService, tickerText, mService
.getString(R.string.BeemChatManagerNewMessage), makeChatIntent(chat));
- String ringtoneStr = pref.getString("settings_notification_snd", "");
- notification.sound = Uri.parse(ringtoneStr);
mService.sendNotification(chat.getParticipant().getJID().hashCode(), notification);
} catch (RemoteException e) {
Log.e(TAG, e.getMessage());
--- a/src/com/beem/project/beem/service/RosterAdapter.java Wed May 26 20:37:24 2010 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java Mon May 31 00:21:41 2010 +0200
@@ -112,20 +112,6 @@
Log.e(TAG, "Error while adding new contact", e);
return null;
}
- if (groups != null) {
- for (String groupStr : groups) {
- RosterGroup group = mAdaptee.getGroup(groupStr);
- if (group == null) {
- group = mAdaptee.createGroup(groupStr);
- }
- try {
- group.addEntry(contact);
- } catch (XMPPException e) {
- e.printStackTrace();
- return null;
- }
- }
- }
return getContactFromRosterEntry(contact);
}
@@ -147,11 +133,8 @@
*/
@Override
public void createGroup(String groupname) throws RemoteException {
- try {
+ if (mAdaptee.getGroup(groupname) == null)
mAdaptee.createGroup(groupname);
- } catch (IllegalArgumentException e) {
- Log.v(TAG, "Error while creating group", e);
- }
}
/**
@@ -170,17 +153,10 @@
@Override
public List<Contact> getContactList() throws RemoteException {
boolean add = true;
- List<Contact> coList = new ArrayList<Contact>(mAdaptee.getEntries().size());
- for (RosterEntry entry : mAdaptee.getEntries()) {
- for (Contact c : coList) {
- if (c.getJID().equals(entry.getUser())) {
- add = false;
- break;
- }
- }
- // Because getEntries return duplicated user.
- if (add)
- coList.add(getContactFromRosterEntry(entry));
+ Collection<RosterEntry> list = mAdaptee.getEntries();
+ List<Contact> coList = new ArrayList<Contact>(list.size());
+ for (RosterEntry entry : list) {
+ coList.add(getContactFromRosterEntry(entry));
}
return coList;
}
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java Wed May 26 20:37:24 2010 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java Mon May 31 00:21:41 2010 +0200
@@ -61,10 +61,8 @@
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.net.Uri;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
-import android.preference.PreferenceManager;
import android.util.Log;
import com.beem.project.beem.BeemService;
@@ -571,10 +569,10 @@
String from = packet.getFrom();
Notification notif = new Notification(android.R.drawable.stat_notify_more, mService.getString(
R.string.AcceptContactRequest, from), System.currentTimeMillis());
- notif.defaults = Notification.DEFAULT_ALL;
notif.flags = Notification.FLAG_AUTO_CANCEL;
Intent intent = new Intent(mService, Subscription.class);
- intent.putExtra("from", from);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ .putExtra("from", from);
notif.setLatestEventInfo(mService, from, mService
.getString(R.string.AcceptContactRequestFrom, from), PendingIntent.getActivity(mService, 0,
intent, PendingIntent.FLAG_ONE_SHOT));
@@ -620,16 +618,11 @@
if (p.getType() != Presence.Type.subscribe)
return;
String from = p.getFrom();
- SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(mService);
Notification notification = new Notification(android.R.drawable.stat_notify_more, mService.getString(
R.string.AcceptContactRequest, from), System.currentTimeMillis());
- if (!pref.getBoolean("settings_notification_disable_vibrate", true))
- notification.defaults -= Notification.DEFAULT_VIBRATE;
notification.flags = Notification.FLAG_AUTO_CANCEL;
Intent intent = new Intent(mService, Subscription.class);
intent.putExtra("from", from);
- String ringtoneStr = pref.getString("settings_notification_snd", "");
- notification.sound = Uri.parse(ringtoneStr);
notification.setLatestEventInfo(mService, from, mService
.getString(R.string.AcceptContactRequestFrom, from), PendingIntent.getActivity(mService, 0,
intent, PendingIntent.FLAG_ONE_SHOT));
--- a/src/com/beem/project/beem/ui/Chat.java Wed May 26 20:37:24 2010 +0200
+++ b/src/com/beem/project/beem/ui/Chat.java Mon May 31 00:21:41 2010 +0200
@@ -133,6 +133,7 @@
private final BeemBroadcastReceiver mBroadcastReceiver = new BeemBroadcastReceiver();
private final BeemRosterListener mBeemRosterListener = new BeemRosterListener();
private IXmppFacade mXmppFacade;
+ private boolean mBinded;
/**
* Constructor.
@@ -174,8 +175,10 @@
protected void onResume() {
super.onResume();
mContact = new Contact(getIntent().getData());
- if (mXmppFacade == null)
+ if (!mBinded) {
bindService(SERVICE_INTENT, mConn, BIND_AUTO_CREATE);
+ mBinded = true;
+ }
}
/**
@@ -205,8 +208,10 @@
} catch (RemoteException e) {
Log.e(TAG, e.getMessage());
}
- if (mXmppFacade != null)
+ if (mBinded) {
unbindService(mConn);
+ mBinded = false;
+ }
mXmppFacade = null;
mRoster = null;
mChat = null;
--- a/src/com/beem/project/beem/ui/ContactList.java Wed May 26 20:37:24 2010 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Mon May 31 00:21:41 2010 +0200
@@ -126,6 +126,7 @@
private IXmppFacade mXmppFacade;
private SharedPreferences mSettings;
private LayoutInflater mInflater;
+ private boolean mBinded;
/**
* Constructor.
@@ -157,8 +158,8 @@
startActivity(new Intent(ContactList.this, AddContact.class));
return true;
case R.id.menu_disconnect:
- stopService(SERVICE_INTENT);
- finish();
+ stopService(SERVICE_INTENT);
+ finish();
return true;
default:
return false;
@@ -272,9 +273,10 @@
@Override
protected void onResume() {
super.onResume();
- if (mXmppFacade == null)
- bindService(SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
- else {
+ if (!mBinded) {
+ mBinded = bindService(SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
+ Log.d(TAG, "on resume bind = " + mBinded);
+ } else {
if (!mSettings.getBoolean("settings_key_hide_groups", false))
buildBanner();
else
@@ -297,7 +299,10 @@
} catch (RemoteException e) {
Log.d("ContactList", "Remote exception", e);
}
- unbindService(mServConn);
+ if (mBinded) {
+ unbindService(mServConn);
+ mBinded = false;
+ }
mXmppFacade = null;
}
--- a/src/com/beem/project/beem/ui/CreateAccount.java Wed May 26 20:37:24 2010 +0200
+++ b/src/com/beem/project/beem/ui/CreateAccount.java Mon May 31 00:21:41 2010 +0200
@@ -172,7 +172,7 @@
* @return Registered proxy password
*/
private String getRegisteredProxyPassword() {
- return mSettings.getString("settings_key_proxy_password", DEFAULT_STRING_VALUE);
+ return mSettings.getString(BeemApplication.PROXY_PASSWORD_KEY, DEFAULT_STRING_VALUE);
}
/**
@@ -180,7 +180,7 @@
* @return Registered proxy port
*/
private int getRegisteredProxyPort() {
- return Integer.parseInt(mSettings.getString("settings_key_proxy_port", DEFAULT_STRING_VALUE));
+ return Integer.parseInt(mSettings.getString(BeemApplication.PROXY_PORT_KEY, DEFAULT_STRING_VALUE));
}
/**
@@ -188,7 +188,7 @@
* @return Registered proxy server
*/
private String getRegisteredProxyServer() {
- return mSettings.getString("settings_key_proxy_server", DEFAULT_STRING_VALUE);
+ return mSettings.getString(BeemApplication.PROXY_SERVER_KEY, DEFAULT_STRING_VALUE);
}
/**
@@ -197,8 +197,8 @@
*/
private ProxyInfo.ProxyType getRegisteredProxyType() {
ProxyInfo.ProxyType result = ProxyInfo.ProxyType.NONE;
- if (mSettings.getBoolean("settings_key_proxy_use", false)) {
- String type = mSettings.getString("settings_key_proxy_type", "none");
+ if (mSettings.getBoolean(BeemApplication.PROXY_USE_KEY, false)) {
+ String type = mSettings.getString(BeemApplication.PROXY_TYPE_KEY, "none");
if ("HTTP".equals(type))
result = ProxyInfo.ProxyType.HTTP;
else if ("SOCKS4".equals(type))
@@ -216,7 +216,7 @@
* @return Registered proxy use
*/
private boolean getRegisteredProxyUse() {
- return mSettings.getBoolean("settings_key_proxy_use", DEFAULT_BOOLEAN_VALUE);
+ return mSettings.getBoolean(BeemApplication.PROXY_USE_KEY, DEFAULT_BOOLEAN_VALUE);
}
/**
@@ -224,7 +224,7 @@
* @return Registered proxy username
*/
private String getRegisteredProxyUsername() {
- return mSettings.getString("settings_key_proxy_username", DEFAULT_STRING_VALUE);
+ return mSettings.getString(BeemApplication.PROXY_USERNAME_KEY, DEFAULT_STRING_VALUE);
}
/**