diff options
| author | Anushek Prasal <anushekprasal@gmail.com> | 2021-08-01 14:49:17 +0530 |
|---|---|---|
| committer | Anushek Prasal <anushekprasal@gmail.com> | 2021-08-01 15:57:08 +0530 |
| commit | f018267cc47f76b09d64d44589372c5566c78b30 (patch) | |
| tree | 3b087571c04dde0a10bf3c4f62d2aa728e90d00f | |
| parent | fbfdffd051aac783c90dac4f239b8671c2feafc7 (diff) | |
SoftAPManager: Hide empty categories
Signed-off-by: Anushek Prasal <anushekprasal@gmail.com>
| -rw-r--r-- | java/com/android/softap/ClientListActivity.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/java/com/android/softap/ClientListActivity.java b/java/com/android/softap/ClientListActivity.java index ae1c2d7..5411601 100644 --- a/java/com/android/softap/ClientListActivity.java +++ b/java/com/android/softap/ClientListActivity.java @@ -101,6 +101,7 @@ public class ClientListActivity extends FragmentActivity implements SoftApManage setPreferencesFromResource(R.xml.client_list_prefs, rootKey); mConnectedClients = findPreference("connected_clients"); mBlockedClients = findPreference("blocked_clients"); + updateCategory(); } @Override @@ -140,6 +141,7 @@ public class ClientListActivity extends FragmentActivity implements SoftApManage for (String key : removeConnectedPrefList) { mConnectedClients.removePreferenceRecursively(key); } + updateCategory(); } private void addPrefToList(ArrayList<String> list, PreferenceCategory preferenceCategory) { @@ -157,6 +159,24 @@ public class ClientListActivity extends FragmentActivity implements SoftApManage preference.setOnPreferenceClickListener(this); return preference; } + + private void updateCategory() { + if (mConnectedClients != null) { + if (mConnectedClients.getPreferenceCount() == 0) { + mConnectedClients.setVisible(false); + } else { + mConnectedClients.setVisible(true); + } + } + + if (mBlockedClients != null) { + if (mBlockedClients.getPreferenceCount() == 0) { + mBlockedClients.setVisible(false); + } else { + mBlockedClients.setVisible(true); + } + } + } } private class SoftApManageConn implements ServiceConnection { |
