Hide PN settings if disabled in xml

This commit is contained in:
Sylvain Berfini 2012-11-20 17:15:09 +01:00
parent 3ca83c62ab
commit 4164f05740
2 changed files with 11 additions and 5 deletions

View file

@ -611,11 +611,13 @@ public final class LinphoneManager implements LinphoneCoreListener {
proxycon.setExpires(Integer.parseInt(getPrefString(R.string.pref_expire_key, getString(R.string.pref_expire_default))));
// Add parameters for push notifications
String regId = getPrefString(R.string.push_reg_id_key, null);
String appId = getString(R.string.push_sender_id);
if (regId != null && getPrefBoolean(R.string.pref_push_notification_key, mR.getBoolean(R.bool.pref_push_notification_default))) {
String contactInfos = "app-id=" + appId + ";pn-type=google;pn-tok=" + regId + ";pn-msg-str=IM_MSG;pn-call-str=IC_MSG;pn-call-snd=ring.caf;pn-msg-snd=msg.caf;";
proxycon.setContactParameters(contactInfos);
if (mR.getBoolean(R.bool.enable_push_id)) {
String regId = getPrefString(R.string.push_reg_id_key, null);
String appId = getString(R.string.push_sender_id);
if (regId != null && getPrefBoolean(R.string.pref_push_notification_key, mR.getBoolean(R.bool.pref_push_notification_default))) {
String contactInfos = "app-id=" + appId + ";pn-type=google;pn-tok=" + regId + ";pn-msg-str=IM_MSG;pn-call-str=IC_MSG;pn-call-snd=ring.caf;pn-msg-snd=msg.caf;";
proxycon.setContactParameters(contactInfos);
}
}
mLc.addProxyConfig(proxycon);

View file

@ -111,6 +111,10 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
if (getResources().getBoolean(R.bool.disable_chat)) {
imageSharingServer.setLayoutResource(R.layout.hidden);
}
if (!getResources().getBoolean(R.bool.enable_push_id)) {
findPreference(getString(R.string.pref_push_notification_key)).setLayoutResource(R.layout.hidden);
}
initializeTransportPreferences();