Loading src/com/android/settings/network/telephony/AbstractMobileNetworkSettings.java +50 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,11 @@ package com.android.settings.network.telephony; import android.text.TextUtils; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import com.android.settings.dashboard.RestrictedDashboardFragment; import com.android.settingslib.core.AbstractPreferenceController; Loading @@ -27,6 +32,9 @@ abstract class AbstractMobileNetworkSettings extends RestrictedDashboardFragment private static final String LOG_TAG = "AbsNetworkSettings"; private List<AbstractPreferenceController> mHiddenControllerList = new ArrayList<AbstractPreferenceController>(); /** * @param restrictionKey The restriction key to check before pin protecting * this settings page. Pass in {@link RESTRICT_IF_OVERRIDABLE} if it should Loading @@ -50,4 +58,46 @@ abstract class AbstractMobileNetworkSettings extends RestrictedDashboardFragment .build(); } @Override public void onExpandButtonClick() { final PreferenceScreen screen = getPreferenceScreen(); mHiddenControllerList.stream() .filter(controller -> controller.isAvailable()) .forEach(controller -> { final String key = controller.getPreferenceKey(); final Preference preference = screen.findPreference(key); controller.updateState(preference); }); super.onExpandButtonClick(); } /* * Replace design within {@link DashboardFragment#updatePreferenceStates()} */ @Override protected void updatePreferenceStates() { mHiddenControllerList.clear(); final PreferenceScreen screen = getPreferenceScreen(); getPreferenceControllersAsList().forEach(controller -> { final String key = controller.getPreferenceKey(); if (TextUtils.isEmpty(key)) { return; } final Preference preference = screen.findPreference(key); if (preference == null) { return; } if (!isPreferenceExpanded(preference)) { mHiddenControllerList.add(controller); return; } if (!controller.isAvailable()) { return; } controller.updateState(preference); }); } } src/com/android/settings/network/telephony/MobileNetworkSettings.java +0 −48 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.view.MenuItem; import androidx.annotation.VisibleForTesting; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import com.android.internal.telephony.TelephonyIntents; import com.android.settings.R; Loading @@ -56,7 +55,6 @@ import com.android.settingslib.utils.ThreadUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; Loading Loading @@ -86,8 +84,6 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings { private UserManager mUserManager; private String mClickedPrefKey; private List<AbstractPreferenceController> mHiddenControllerList; public MobileNetworkSettings() { super(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS); } Loading Loading @@ -210,50 +206,6 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings { onRestoreInstance(icicle); } @Override public void onExpandButtonClick() { final PreferenceScreen screen = getPreferenceScreen(); mHiddenControllerList.stream() .filter(controller -> controller.isAvailable()) .forEach(controller -> { final String key = controller.getPreferenceKey(); final Preference preference = screen.findPreference(key); controller.updateState(preference); }); super.onExpandButtonClick(); } /* * Replace design within {@link DashboardFragment#updatePreferenceStates()} */ @Override protected void updatePreferenceStates() { mHiddenControllerList = new ArrayList<AbstractPreferenceController>(); final PreferenceScreen screen = getPreferenceScreen(); final Collection<List<AbstractPreferenceController>> controllerLists = getPreferenceControllers(); controllerLists.stream().flatMap(Collection::stream) .forEach(controller -> { final String key = controller.getPreferenceKey(); if (TextUtils.isEmpty(key)) { return; } final Preference preference = screen.findPreference(key); if (preference == null) { return; } if (!isPreferenceExpanded(preference)) { mHiddenControllerList.add(controller); return; } if (!controller.isAvailable()) { return; } controller.updateState(preference); }); } @VisibleForTesting void onRestoreInstance(Bundle icicle) { if (icicle != null) { Loading Loading
src/com/android/settings/network/telephony/AbstractMobileNetworkSettings.java +50 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,11 @@ package com.android.settings.network.telephony; import android.text.TextUtils; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import com.android.settings.dashboard.RestrictedDashboardFragment; import com.android.settingslib.core.AbstractPreferenceController; Loading @@ -27,6 +32,9 @@ abstract class AbstractMobileNetworkSettings extends RestrictedDashboardFragment private static final String LOG_TAG = "AbsNetworkSettings"; private List<AbstractPreferenceController> mHiddenControllerList = new ArrayList<AbstractPreferenceController>(); /** * @param restrictionKey The restriction key to check before pin protecting * this settings page. Pass in {@link RESTRICT_IF_OVERRIDABLE} if it should Loading @@ -50,4 +58,46 @@ abstract class AbstractMobileNetworkSettings extends RestrictedDashboardFragment .build(); } @Override public void onExpandButtonClick() { final PreferenceScreen screen = getPreferenceScreen(); mHiddenControllerList.stream() .filter(controller -> controller.isAvailable()) .forEach(controller -> { final String key = controller.getPreferenceKey(); final Preference preference = screen.findPreference(key); controller.updateState(preference); }); super.onExpandButtonClick(); } /* * Replace design within {@link DashboardFragment#updatePreferenceStates()} */ @Override protected void updatePreferenceStates() { mHiddenControllerList.clear(); final PreferenceScreen screen = getPreferenceScreen(); getPreferenceControllersAsList().forEach(controller -> { final String key = controller.getPreferenceKey(); if (TextUtils.isEmpty(key)) { return; } final Preference preference = screen.findPreference(key); if (preference == null) { return; } if (!isPreferenceExpanded(preference)) { mHiddenControllerList.add(controller); return; } if (!controller.isAvailable()) { return; } controller.updateState(preference); }); } }
src/com/android/settings/network/telephony/MobileNetworkSettings.java +0 −48 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.view.MenuItem; import androidx.annotation.VisibleForTesting; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import com.android.internal.telephony.TelephonyIntents; import com.android.settings.R; Loading @@ -56,7 +55,6 @@ import com.android.settingslib.utils.ThreadUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; Loading Loading @@ -86,8 +84,6 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings { private UserManager mUserManager; private String mClickedPrefKey; private List<AbstractPreferenceController> mHiddenControllerList; public MobileNetworkSettings() { super(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS); } Loading Loading @@ -210,50 +206,6 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings { onRestoreInstance(icicle); } @Override public void onExpandButtonClick() { final PreferenceScreen screen = getPreferenceScreen(); mHiddenControllerList.stream() .filter(controller -> controller.isAvailable()) .forEach(controller -> { final String key = controller.getPreferenceKey(); final Preference preference = screen.findPreference(key); controller.updateState(preference); }); super.onExpandButtonClick(); } /* * Replace design within {@link DashboardFragment#updatePreferenceStates()} */ @Override protected void updatePreferenceStates() { mHiddenControllerList = new ArrayList<AbstractPreferenceController>(); final PreferenceScreen screen = getPreferenceScreen(); final Collection<List<AbstractPreferenceController>> controllerLists = getPreferenceControllers(); controllerLists.stream().flatMap(Collection::stream) .forEach(controller -> { final String key = controller.getPreferenceKey(); if (TextUtils.isEmpty(key)) { return; } final Preference preference = screen.findPreference(key); if (preference == null) { return; } if (!isPreferenceExpanded(preference)) { mHiddenControllerList.add(controller); return; } if (!controller.isAvailable()) { return; } controller.updateState(preference); }); } @VisibleForTesting void onRestoreInstance(Bundle icicle) { if (icicle != null) { Loading