Hide 'sip account' heading if there are no sip accounts.
Right now on the SIP settings menu, this is alway shown, even if
there's nothing listed below. Was a little visually confusing to me.
Now it will only show if there's at least one account listed.
There's still always an "add account" button at the top.
Bug: 17179743
Change-Id: Icd64f5c1f135d7341405ae4285a7697563331cdb
diff --git a/sip/res/xml/sip_setting.xml b/sip/res/xml/sip_setting.xml
index c754404..f66e5e4 100644
--- a/sip/res/xml/sip_setting.xml
+++ b/sip/res/xml/sip_setting.xml
@@ -23,4 +23,5 @@
android:persistent="true"/>
<PreferenceCategory android:key="sip_account_list" android:title="@string/sip_account_list"/>
+
</PreferenceScreen>
diff --git a/sip/src/com/android/services/telephony/sip/SipSettings.java b/sip/src/com/android/services/telephony/sip/SipSettings.java
index e4fca2b..f799f75 100644
--- a/sip/src/com/android/services/telephony/sip/SipSettings.java
+++ b/sip/src/com/android/services/telephony/sip/SipSettings.java
@@ -293,8 +293,13 @@
}
});
mSipListContainer.removeAll();
- for (SipProfile p : mSipProfileList) {
- addPreferenceFor(p);
+ if (mSipProfileList.isEmpty()) {
+ getPreferenceScreen().removePreference(mSipListContainer);
+ } else {
+ getPreferenceScreen().addPreference(mSipListContainer);
+ for (SipProfile p : mSipProfileList) {
+ addPreferenceFor(p);
+ }
}
if (!mSipSharedPreferences.isReceivingCallsEnabled()) return;