Add an option to update the library automatically after a specified time and an option to update only non completed mangas. Other minor changes.

This commit is contained in:
inorichi
2016-01-10 17:47:43 +01:00
parent 6eb321bb06
commit fcb5bf4dd4
13 changed files with 209 additions and 46 deletions
@@ -105,10 +105,7 @@ public class LibraryFragment extends BaseRxFragment<LibraryPresenter>
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_refresh:
if (!LibraryUpdateService.isRunning(getActivity())) {
Intent intent = LibraryUpdateService.getStartIntent(getActivity());
getActivity().startService(intent);
}
LibraryUpdateService.start(getActivity());
return true;
case R.id.action_edit_categories:
onEditCategories();
@@ -7,12 +7,12 @@ import android.view.ViewGroup;
import eu.kanade.mangafeed.R;
import eu.kanade.mangafeed.data.preference.PreferencesHelper;
import eu.kanade.mangafeed.data.sync.LibraryUpdateAlarm;
import eu.kanade.mangafeed.ui.setting.preference.IntListPreference;
import eu.kanade.mangafeed.ui.setting.preference.LibraryColumnsDialog;
public class SettingsGeneralFragment extends SettingsNestedFragment {
private LibraryColumnsDialog columnsDialog;
public static SettingsNestedFragment newInstance(int resourcePreference, int resourceTitle) {
SettingsNestedFragment fragment = new SettingsGeneralFragment();
fragment.setArgs(resourcePreference, resourceTitle);
@@ -25,11 +25,19 @@ public class SettingsGeneralFragment extends SettingsNestedFragment {
PreferencesHelper preferences = getSettingsActivity().preferences;
columnsDialog = (LibraryColumnsDialog) findPreference(
LibraryColumnsDialog columnsDialog = (LibraryColumnsDialog) findPreference(
getString(R.string.pref_library_columns_dialog_key));
columnsDialog.setPreferencesHelper(preferences);
IntListPreference updateInterval = (IntListPreference) findPreference(
getString(R.string.pref_library_update_interval_key));
updateInterval.setOnPreferenceChangeListener((preference, newValue) -> {
LibraryUpdateAlarm.startAlarm(getActivity(), Integer.parseInt((String) newValue));
return true;
});
return view;
}