make short vibrate in open chat configurable and respect phone silent mode
This commit is contained in:
parent
037cd4e95b
commit
dd627f76bf
5 changed files with 18 additions and 4 deletions
|
@ -316,11 +316,14 @@ public class NotificationService {
|
|||
|
||||
private void pushNow(final Message message) {
|
||||
mXmppConnectionService.updateUnreadCountBadge();
|
||||
final boolean isScreenOn = mXmppConnectionService.isInteractive();
|
||||
if (!notify(message)) {
|
||||
if (this.mIsInForeground && isScreenOn && this.mOpenConversation == message.getConversation()) {
|
||||
mXmppConnectionService.vibrate();
|
||||
}
|
||||
Log.d(Config.LOGTAG, message.getConversation().getAccount().getJid().asBareJid() + ": suppressing notification because turned off");
|
||||
return;
|
||||
}
|
||||
final boolean isScreenOn = mXmppConnectionService.isInteractive();
|
||||
if (this.mIsInForeground && isScreenOn && this.mOpenConversation == message.getConversation()) {
|
||||
mXmppConnectionService.vibrate();
|
||||
Log.d(Config.LOGTAG, message.getConversation().getAccount().getJid().asBareJid() + ": suppressing notification because conversation is open");
|
||||
|
|
|
@ -4172,9 +4172,12 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
|
||||
public void vibrate() {
|
||||
Log.d(Config.LOGTAG, "Notification: short vibrate");
|
||||
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
|
||||
vibrator.vibrate(100);
|
||||
final boolean vibrateInChat = getBooleanPreference("vibrate_in_chat", R.bool.vibrate_in_chat);
|
||||
if (!isPhoneSilenced() && vibrateInChat) {
|
||||
Log.d(Config.LOGTAG, "Notification: short vibrate");
|
||||
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
|
||||
vibrator.vibrate(100);
|
||||
}
|
||||
}
|
||||
|
||||
private <T> List<T> threadSafeList(Set<T> set) {
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
<bool name="show_maps_inside">true</bool>
|
||||
<bool name="use_internal_updater">true</bool>
|
||||
<bool name="show_own_accounts">true</bool>
|
||||
<bool name="vibrate_in_chat">true</bool>
|
||||
|
||||
<string-array name="domains">
|
||||
<item>pix-art.de</item>
|
||||
|
|
|
@ -925,4 +925,6 @@
|
|||
<string name="share_backup_files">Share backup files</string>
|
||||
<string name="conversations_backup">Conversations backup</string>
|
||||
<string name="event">Event</string>
|
||||
<string name="pref_vibrate_in_chat_summary">Vibrate when a new message arrives in an open chat</string>
|
||||
<string name="pref_vibrate_in_chat">Vibrate in open chat</string>
|
||||
</resources>
|
||||
|
|
|
@ -140,6 +140,11 @@
|
|||
android:key="vibrate_on_notification"
|
||||
android:summary="@string/pref_vibrate_summary"
|
||||
android:title="@string/pref_vibrate" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="@bool/vibrate_in_chat"
|
||||
android:key="vibrate_in_chat"
|
||||
android:summary="@string/pref_vibrate_in_chat_summary"
|
||||
android:title="@string/pref_vibrate_in_chat" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="@bool/led"
|
||||
android:key="led"
|
||||
|
|
Reference in a new issue