SettingsGeneralFragment.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package eu.kanade.mangafeed.ui.setting;
  2. import android.os.Bundle;
  3. import android.view.LayoutInflater;
  4. import android.view.View;
  5. import android.view.ViewGroup;
  6. import eu.kanade.mangafeed.R;
  7. import eu.kanade.mangafeed.data.preference.PreferencesHelper;
  8. import eu.kanade.mangafeed.data.sync.LibraryUpdateAlarm;
  9. import eu.kanade.mangafeed.widget.preference.IntListPreference;
  10. import eu.kanade.mangafeed.widget.preference.LibraryColumnsDialog;
  11. public class SettingsGeneralFragment extends SettingsNestedFragment {
  12. public static SettingsNestedFragment newInstance(int resourcePreference, int resourceTitle) {
  13. SettingsNestedFragment fragment = new SettingsGeneralFragment();
  14. fragment.setArgs(resourcePreference, resourceTitle);
  15. return fragment;
  16. }
  17. @Override
  18. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
  19. View view = super.onCreateView(inflater, container, savedState);
  20. PreferencesHelper preferences = getSettingsActivity().preferences;
  21. LibraryColumnsDialog columnsDialog = (LibraryColumnsDialog) findPreference(
  22. getString(R.string.pref_library_columns_dialog_key));
  23. columnsDialog.setPreferencesHelper(preferences);
  24. IntListPreference updateInterval = (IntListPreference) findPreference(
  25. getString(R.string.pref_library_update_interval_key));
  26. updateInterval.setOnPreferenceChangeListener((preference, newValue) -> {
  27. LibraryUpdateAlarm.startAlarm(getActivity(), Integer.parseInt((String) newValue));
  28. return true;
  29. });
  30. return view;
  31. }
  32. }