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

Commit bf1fa0c2 authored by Raff Tsai's avatar Raff Tsai
Browse files

Fix Settings crash

Doesn't unregister contentprovider so that when data changed,
the fragment is destroyed.

Fixes: 127726564
Test: Connect to wifi. Go to Settings -> connected devices ->
      connection preference -> printing -> hp print service -> press
      back. Repeat several times.

Change-Id: I79d1522ce9d91a6bf6b1f982b7687eab1f7896bb
parent 476b9050
Loading
Loading
Loading
Loading
+3 −12
Original line number Diff line number Diff line
@@ -143,6 +143,8 @@ public class PrintServiceSettingsFragment extends SettingsPreferenceFragment
    @Override
    public void onStart() {
        super.onStart();
        initComponents();
        updateUiForArguments();
        updateEmptyView();
        updateUiForServiceState();
    }
@@ -158,20 +160,9 @@ public class PrintServiceSettingsFragment extends SettingsPreferenceFragment
    @Override
    public void onStop() {
        super.onStop();
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        initComponents();
        updateUiForArguments();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        mSwitchBar.removeOnSwitchChangeListener(this);
        mSwitchBar.hide();
        mPrintersAdapter.unregisterAdapterDataObserver(mDataObserver);
    }

    private void onPreferenceToggled(String preferenceKey, boolean enabled) {