# HG changeset patch # User Nikita Kozlov # Date 1268505128 -3600 # Node ID bc47c8518bfde1b3ffee805658d8714871f426a3 # Parent 8cd09cb7b00bbd65373be96acd143d07a99d5257 some notification preferences diff -r 8cd09cb7b00b -r bc47c8518bfd res/layout/preferences.xml --- a/res/layout/preferences.xml Sun Mar 07 21:33:13 2010 +0100 +++ b/res/layout/preferences.xml Sat Mar 13 19:32:08 2010 +0100 @@ -13,35 +13,37 @@ - + + + + + + android:key="settings_key_account_username" android:hint="@string/login_username_info_default" /> - - + + - @@ -61,8 +63,7 @@ + android:key="settings_key_proxy_port" android:hint="@string/comments_proxy_port" /> + android:key="settings_key_xmpp_server" android:hint="@string/comments_xmpp_server" /> + android:defaultValue="5222" android:key="settings_key_xmpp_port" + android:hint="@string/comments_xmpp_port" /> diff -r 8cd09cb7b00b -r bc47c8518bfd res/values-fr/strings.xml --- a/res/values-fr/strings.xml Sun Mar 07 21:33:13 2010 +0100 +++ b/res/values-fr/strings.xml Sat Mar 13 19:32:08 2010 +0100 @@ -138,6 +138,11 @@ Message d\'asbence Votre Message d\'absence Je suis absent car mon ecran est éteind + Paramètres des notifications + Vibreur + Désactiver le vibreur pour les messages entrants + Sonnerie des messages + Configurer la sonnerie par défaut pour les messages entrants Inscription acceptée diff -r 8cd09cb7b00b -r bc47c8518bfd res/values/strings.xml --- a/res/values/strings.xml Sun Mar 07 21:33:13 2010 +0100 +++ b/res/values/strings.xml Sat Mar 13 19:32:08 2010 +0100 @@ -138,6 +138,12 @@ Away message The away message that will be displayed I\'m away, my cellphone screen is off + Notification preferences + Vibrate + Vibrate phone for incoming messages + Message ringtone + Set your default incoming message ringtone + Subscription accepted diff -r 8cd09cb7b00b -r bc47c8518bfd src/com/beem/project/beem/service/BeemChatManager.java --- a/src/com/beem/project/beem/service/BeemChatManager.java Sun Mar 07 21:33:13 2010 +0100 +++ b/src/com/beem/project/beem/service/BeemChatManager.java Sat Mar 13 19:32:08 2010 +0100 @@ -40,7 +40,7 @@ Flavien Astraud, November 26, 2009 Head of the EIP Laboratory. -*/ + */ package com.beem.project.beem.service; import java.util.ArrayList; @@ -56,8 +56,11 @@ import android.app.Notification; 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; import android.util.Log; import com.beem.project.beem.BeemService; @@ -123,7 +126,7 @@ Log.e(TAG, e.getMessage()); } PendingIntent contentIntent = PendingIntent.getActivity(mService, 0, chatIntent, - PendingIntent.FLAG_UPDATE_CURRENT); + PendingIntent.FLAG_UPDATE_CURRENT); return contentIntent; } @@ -132,15 +135,19 @@ * @param chat The chat to access by the notification */ private void notifyNewChat(IChat chat) { + SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(mService); try { CharSequence tickerText = mService.getBind().getRoster().getContact(chat.getParticipant().getJID()) - .getName(); + .getName(); Notification notification = new Notification(android.R.drawable.stat_notify_chat, tickerText, System - .currentTimeMillis()); - notification.defaults = Notification.DEFAULT_ALL; + .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)); + .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());