Example #1
0
  @Override
  public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {

    if (key.equals(SettingActivity.ENABLE_FETCH_MSG)) {
      boolean value = sharedPreferences.getBoolean(key, false);
      if (value) {
        AppNewMsgAlarm.startAlarm(getActivity(), false);
      } else {
        AppNewMsgAlarm.stopAlarm(getActivity(), true);
      }
    }

    if (key.equals(SettingActivity.FREQUENCY)) {

      AppNewMsgAlarm.startAlarm(getActivity(), false);
      buildSummary();
    }

    if (key.equals(SettingActivity.FONT_SIZE)) {
      String value = sharedPreferences.getString(key, "15");
      GlobalContext.getInstance().setFontSize(Integer.valueOf(value));
    }

    if (key.equals(SettingActivity.SOUND)) {
      boolean value = sharedPreferences.getBoolean(key, true);
      GlobalContext.getInstance().setEnableSound(value);
    }

    if (key.equals(SettingActivity.AUTO_REFRESH)) {
      boolean value = sharedPreferences.getBoolean(key, false);
      GlobalContext.getInstance().setEnableAutoRefresh(value);
    }
  }
Example #2
0
  private void cancelAlarm() {

    AppNewMsgAlarm.stopAlarm(getActivity(), true);
  }