Hide identity in notifications if no %s in message.
This commit is contained in:
parent
73b3782f13
commit
4271398147
3 changed files with 15 additions and 21 deletions
|
@ -15,7 +15,8 @@
|
|||
<bool name="use_video_activity">false</bool>
|
||||
|
||||
<string name="notification_title">Linphone</string>
|
||||
<bool name="allow_edit_in_dialer">true</bool>
|
||||
|
||||
<bool name="allow_edit_in_dialer">true</bool>
|
||||
<string name="notification_registered">registered to %s </string>
|
||||
<string name="notification_register_failure">fails to register to %s</string>
|
||||
</resources>
|
||||
|
|
@ -93,9 +93,8 @@
|
|||
<string name="menu_clear_history">Clear</string>
|
||||
<string name="error_cannot_get_call_parameters">Cannot get call parameters</string>
|
||||
<string name="error_cannot_create_default_parameters">Cannot create default call parameters</string>
|
||||
<string name="error_cannot_invite_address">Cannot invite destination address [%s]</string>
|
||||
<string name="notification_registered">registered to %s </string>
|
||||
<string name="notification_register_failure">fails to register to %s</string>
|
||||
<string name="error_cannot_invite_address">Cannot invite destination address [%s]</string>
|
||||
|
||||
<string name="notification_started">started</string>
|
||||
<string name="pref_echo_cancellation_summary">Removes the echo heard by other end</string>
|
||||
<string name="pref_stun_server">Stun server</string>
|
||||
|
|
|
@ -119,22 +119,16 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
private void sendNotification(int level, int text) {
|
||||
private void sendNotification(int level, int textId) {
|
||||
mNotif.iconLevel = level;
|
||||
mNotif.when=System.currentTimeMillis();
|
||||
mNotif.setLatestEventInfo(this, notificationTitle,getString(text), mNotifContentIntent);
|
||||
mNotificationMgr.notify(NOTIF_ID, mNotif);
|
||||
}
|
||||
|
||||
private void sendNotificationWithId(int level, int text) {
|
||||
mNotif.iconLevel = level;
|
||||
mNotif.when=System.currentTimeMillis();
|
||||
String id = LinphoneManager.getLc().getDefaultProxyConfig().getIdentity();
|
||||
mNotif.setLatestEventInfo(this, notificationTitle,
|
||||
String.format(getString(text), id),
|
||||
mNotifContentIntent);
|
||||
String text = getString(textId);
|
||||
if (text.contains("%s")) {
|
||||
String id = LinphoneManager.getLc().getDefaultProxyConfig().getIdentity();
|
||||
text = String.format(text, id);
|
||||
}
|
||||
|
||||
mNotif.setLatestEventInfo(this, notificationTitle, text, mNotifContentIntent);
|
||||
mNotificationMgr.notify(NOTIF_ID, mNotif);
|
||||
}
|
||||
|
||||
|
@ -191,11 +185,11 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
|
|||
public void onRegistrationStateChanged(final RegistrationState state,
|
||||
final String message) {
|
||||
if (state == RegistrationState.RegistrationOk && LinphoneManager.getLc().getDefaultProxyConfig().isRegistered()) {
|
||||
sendNotificationWithId(IC_LEVEL_ORANGE, R.string.notification_registered);
|
||||
sendNotification(IC_LEVEL_ORANGE, R.string.notification_registered);
|
||||
}
|
||||
|
||||
if (state == RegistrationState.RegistrationFailed) {
|
||||
sendNotificationWithId(IC_LEVEL_OFFLINE, R.string.notification_register_failure);
|
||||
sendNotification(IC_LEVEL_OFFLINE, R.string.notification_register_failure);
|
||||
}
|
||||
|
||||
if (state == RegistrationState.RegistrationOk || state == RegistrationState.RegistrationFailed) {
|
||||
|
|
Loading…
Reference in a new issue