Prevent animating feed settings rows

This commit is contained in:
ByteHamster 2019-12-23 23:38:25 +01:00
parent 19890afc66
commit 7e2fc2c4a2
2 changed files with 13 additions and 0 deletions

View File

@ -52,6 +52,8 @@ public class FeedSettingsFragment extends PreferenceFragmentCompat {
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.feed_settings); addPreferencesFromResource(R.xml.feed_settings);
setupAutoDownloadGlobalPreference(); // To prevent transition animation because of summary update
postponeEnterTransition(); postponeEnterTransition();
long feedId = getArguments().getLong(EXTRA_FEED_ID); long feedId = getArguments().getLong(EXTRA_FEED_ID);
disposable = Maybe.create((MaybeOnSubscribe<Feed>) emitter -> { disposable = Maybe.create((MaybeOnSubscribe<Feed>) emitter -> {
@ -219,6 +221,16 @@ public class FeedSettingsFragment extends PreferenceFragmentCompat {
}); });
} }
private void setupAutoDownloadGlobalPreference() {
if (!UserPreferences.isEnableAutodownload()) {
SwitchPreference autodl = findPreference("autoDownload");
autodl.setChecked(false);
autodl.setEnabled(false);
autodl.setSummary(R.string.auto_download_disabled_globally);
findPreference(PREF_EPISODE_FILTER).setEnabled(false);
}
}
private void setupAutoDownloadPreference() { private void setupAutoDownloadPreference() {
SwitchPreference pref = (SwitchPreference) findPreference("autoDownload"); SwitchPreference pref = (SwitchPreference) findPreference("autoDownload");

View File

@ -25,6 +25,7 @@
android:entryValues="@array/spnAutoDeleteValues" android:entryValues="@array/spnAutoDeleteValues"
android:icon="?attr/content_discard" android:icon="?attr/content_discard"
android:title="@string/auto_delete_label" android:title="@string/auto_delete_label"
android:summary="@string/feed_auto_download_global"
android:key="autoDelete"/> android:key="autoDelete"/>
<PreferenceCategory android:title="@string/auto_download_settings_label"> <PreferenceCategory android:title="@string/auto_download_settings_label">