Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d46a80e4 authored by Michael W's avatar Michael W
Browse files

SystemUI: Internet tile: Allow long-pressing on mobile network

* The current WiFi network has a setting toggle and also opens the
  settings on single click where the mobile network only allows
  connecting but not opening settings
* Add a long press listener that goes to the subId's network settings,
  allowing for example to disable roaming or change network

Change-Id: Iacc1c64d318b0240da5397f2b4e4dfb59d4834dd
parent 9a2e33e7
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -288,6 +288,7 @@ public class InternetDialog extends SystemUIDialog implements
        mHandler.removeCallbacks(mHideProgressBarRunnable);
        mHandler.removeCallbacks(mHideSearchingRunnable);
        mMobileNetworkLayout.setOnClickListener(null);
        mMobileNetworkLayout.setOnLongClickListener(null);
        mMobileDataToggle.setOnCheckedChangeListener(null);
        mConnectedWifListLayout.setOnClickListener(null);
        if (mSecondaryMobileNetworkLayout != null) {
@@ -358,6 +359,13 @@ public class InternetDialog extends SystemUIDialog implements
                }
            }
        });
        mMobileNetworkLayout.setOnLongClickListener(v -> {
            if (!mInternetDialogController.isDeviceLocked()) {
                mInternetDialogController.launchMobileNetworkSettings(v, mDefaultDataSubId);
                return true;
            }
            return false;
        });
        mMobileDataToggle.setOnCheckedChangeListener(
                (buttonView, isChecked) -> {
                    if (!isChecked && shouldShowMobileDialog()) {
+4 −0
Original line number Diff line number Diff line
@@ -739,6 +739,10 @@ public class InternetDialogController implements AccessPointController.AccessPoi

    void launchMobileNetworkSettings(View view) {
        final int subId = getActiveAutoSwitchNonDdsSubId();
        launchMobileNetworkSettings(view, subId);
    }

    void launchMobileNetworkSettings(View view, int subId) {
        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
            Log.w(TAG, "launchMobileNetworkSettings fail, invalid subId:" + subId);
            return;