Example usage for android.content SharedPreferences unregisterOnSharedPreferenceChangeListener

List of usage examples for android.content SharedPreferences unregisterOnSharedPreferenceChangeListener

Introduction

In this page you can find the example usage for android.content SharedPreferences unregisterOnSharedPreferenceChangeListener.

Prototype

void unregisterOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener listener);

Source Link

Document

Unregisters a previous callback.

Usage

From source file:com.audiokernel.euphonyrmt.fragments.NowPlayingFragment.java

@Override
public void onDestroy() {
    final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mActivity);
    settings.unregisterOnSharedPreferenceChangeListener(this);
    super.onDestroy();
}

From source file:com.xandy.calendar.AllInOneActivity.java

@Override
protected void onDestroy() {
    super.onDestroy();

    SharedPreferences prefs = GeneralPreferences.getSharedPreferences(this);
    prefs.unregisterOnSharedPreferenceChangeListener(this);

    mController.deregisterAllEventHandlers();

    CalendarController.removeInstance(this);
}

From source file:com.xandy.calendar.AllInOneActivity.java

@Override
protected void onPause() {
    super.onPause();

    mController.deregisterEventHandler(HANDLER_KEY);
    mPaused = true;//from www. ja  v  a  2  s  . c  o m
    mHomeTime.removeCallbacks(mHomeTimeUpdater);
    if (mActionBarMenuSpinnerAdapter != null) {
        mActionBarMenuSpinnerAdapter.onPause();
    }
    mContentResolver.unregisterContentObserver(mObserver);
    if (isFinishing()) {
        // Stop listening for changes that would require this to be refreshed
        SharedPreferences prefs = GeneralPreferences.getSharedPreferences(this);
        prefs.unregisterOnSharedPreferenceChangeListener(this);
    }
    // FRAG_TODO save highlighted days of the week;
    if (mController.getViewType() != ViewType.EDIT) {
        Utils.setDefaultView(this, mController.getViewType());
    }
    Utils.resetMidnightUpdater(mHandler, mTimeChangesUpdater);
    Utils.clearTimeChangesReceiver(this, mCalIntentReceiver);
}

From source file:eu.faircode.netguard.ActivitySettings.java

@Override
protected void onPause() {
    super.onPause();

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    prefs.unregisterOnSharedPreferenceChangeListener(this);

    unregisterReceiver(interactiveStateReceiver);
    unregisterReceiver(connectivityChangedReceiver);
}

From source file:com.android.calendar.AllInOneActivity.java

@Override
protected void onDestroy() {
    super.onDestroy();

    SharedPreferences prefs = GeneralPreferences.getSharedPreferences(this);
    prefs.unregisterOnSharedPreferenceChangeListener(this);

    mController.deregisterAllEventHandlers();

    CalendarController.removeInstance(this);

    // Clean up cached ics and vcs files
    cleanupCachedEventFiles();//from w w w.jav  a  2  s . co m
}

From source file:com.android.calendar.AllInOneActivity.java

@Override
protected void onPause() {
    super.onPause();

    mController.deregisterEventHandler(HANDLER_KEY);
    mPaused = true;//from w  w w .j a v  a 2  s .c  o m
    mHomeTime.removeCallbacks(mHomeTimeUpdater);

    mContentResolver.unregisterContentObserver(mObserver);
    if (isFinishing()) {
        // Stop listening for changes that would require this to be refreshed
        SharedPreferences prefs = GeneralPreferences.getSharedPreferences(this);
        prefs.unregisterOnSharedPreferenceChangeListener(this);
    }
    // FRAG_TODO save highlighted days of the week;
    if (mController.getViewType() != ViewType.EDIT) {
        Utils.setDefaultView(this, mController.getViewType());
    }
    Utils.resetMidnightUpdater(mHandler, mTimeChangesUpdater);
    Utils.clearTimeChangesReceiver(this, mCalIntentReceiver);
}

From source file:eu.faircode.netguard.ActivitySettings.java

private void xmlImport(InputStream in) throws IOException, SAXException, ParserConfigurationException {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    prefs.unregisterOnSharedPreferenceChangeListener(this);
    prefs.edit().putBoolean("enabled", false).apply();
    ServiceSinkhole.stop("import", this, false);

    XMLReader reader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
    XmlImportHandler handler = new XmlImportHandler(this);
    reader.setContentHandler(handler);// w w  w . j a  va 2 s .  com
    reader.parse(new InputSource(in));

    xmlImport(handler.application, prefs);
    xmlImport(handler.wifi, getSharedPreferences("wifi", Context.MODE_PRIVATE));
    xmlImport(handler.mobile, getSharedPreferences("other", Context.MODE_PRIVATE));
    xmlImport(handler.screen_wifi, getSharedPreferences("screen_wifi", Context.MODE_PRIVATE));
    xmlImport(handler.screen_other, getSharedPreferences("screen_other", Context.MODE_PRIVATE));
    xmlImport(handler.roaming, getSharedPreferences("roaming", Context.MODE_PRIVATE));
    xmlImport(handler.lockdown, getSharedPreferences("lockdown", Context.MODE_PRIVATE));
    xmlImport(handler.apply, getSharedPreferences("apply", Context.MODE_PRIVATE));
    xmlImport(handler.notify, getSharedPreferences("notify", Context.MODE_PRIVATE));

    // Upgrade imported settings
    ReceiverAutostart.upgrade(true, this);

    DatabaseHelper.clearCache();

    // Refresh UI
    prefs.edit().putBoolean("imported", true).apply();
    prefs.registerOnSharedPreferenceChangeListener(this);
}

From source file:xyz.template.material.menu.ui.BaseActivity.java

@Override
protected void onDestroy() {
    super.onDestroy();

    if (mGCMRegisterTask != null) {
        LOGD(TAG, "Cancelling GCM registration task.");
        mGCMRegisterTask.cancel(true);/*w  ww  . j  a va  2 s.  c  om*/
    }

    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
    sp.unregisterOnSharedPreferenceChangeListener(this);
}

From source file:android_network.hetnet.vpn_service.ActivitySettings.java

@Override
protected void onPause() {
    super.onPause();

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    prefs.unregisterOnSharedPreferenceChangeListener(this);

    unregisterReceiver(interactiveStateReceiver);
    unregisterReceiver(connectivityChangedReceiver);

    if (phone_state) {
        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        tm.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE);
        phone_state = false;/*from w  ww  .  jav  a 2  s  . co  m*/
    }
}

From source file:com.mobicage.rogerthat.MainService.java

private void teardownConfiguration() {
    T.UI();/*www  .j  a  v a  2  s . co m*/
    final SharedPreferences options = PreferenceManager.getDefaultSharedPreferences(this);
    options.unregisterOnSharedPreferenceChangeListener(mPreferencesListener);
    if (mConfigProvider != null) {
        mConfigProvider.close();
        mConfigProvider = null;
    }
}