Updated feed settings screen
This commit is contained in:
parent
8931d5b795
commit
8f11f8a271
|
@ -1,46 +1,26 @@
|
|||
package de.danoeh.antennapod.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.LightingColorFilter;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
|
||||
import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.core.feed.FeedFilter;
|
||||
import de.danoeh.antennapod.core.feed.FeedPreferences;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.glide.FastBlurTransformation;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import de.danoeh.antennapod.core.storage.DownloadRequestException;
|
||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
||||
import de.danoeh.antennapod.menuhandler.FeedMenuHandler;
|
||||
import de.danoeh.antennapod.fragment.FeedSettingsFragment;
|
||||
import io.reactivex.Maybe;
|
||||
import io.reactivex.MaybeOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
|
@ -51,14 +31,16 @@ import io.reactivex.schedulers.Schedulers;
|
|||
* Displays information about a feed.
|
||||
*/
|
||||
public class FeedSettingsActivity extends AppCompatActivity {
|
||||
|
||||
public static final String EXTRA_FEED_ID = "de.danoeh.antennapod.extra.feedId";
|
||||
private static final String TAG = "FeedSettingsActivity";
|
||||
private boolean autoDeleteChanged = false;
|
||||
private Feed feed;
|
||||
|
||||
private Disposable disposable;
|
||||
private ImageView imgvCover;
|
||||
private TextView txtvTitle;
|
||||
private ImageView imgvBackground;
|
||||
private TextView txtvAuthorHeader;
|
||||
|
||||
/*
|
||||
private EditText etxtUsername;
|
||||
private EditText etxtPassword;
|
||||
private EditText etxtFilterText;
|
||||
|
@ -68,42 +50,7 @@ public class FeedSettingsActivity extends AppCompatActivity {
|
|||
private CheckBox cbxKeepUpdated;
|
||||
private Spinner spnAutoDelete;
|
||||
private boolean filterInclude = true;
|
||||
|
||||
private Disposable disposable;
|
||||
|
||||
private boolean authInfoChanged = false;
|
||||
|
||||
private final TextWatcher authTextWatcher = new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
authInfoChanged = true;
|
||||
}
|
||||
};
|
||||
|
||||
private boolean filterTextChanged = false;
|
||||
|
||||
private final TextWatcher filterTextWatcher = new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
filterTextChanged = true;
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -115,16 +62,14 @@ public class FeedSettingsActivity extends AppCompatActivity {
|
|||
|
||||
imgvCover = findViewById(R.id.imgvCover);
|
||||
txtvTitle = findViewById(R.id.txtvTitle);
|
||||
TextView txtvAuthorHeader = findViewById(R.id.txtvAuthor);
|
||||
ImageView imgvBackground = findViewById(R.id.imgvBackground);
|
||||
txtvAuthorHeader = findViewById(R.id.txtvAuthor);
|
||||
imgvBackground = findViewById(R.id.imgvBackground);
|
||||
findViewById(R.id.butShowInfo).setVisibility(View.INVISIBLE);
|
||||
findViewById(R.id.butShowSettings).setVisibility(View.INVISIBLE);
|
||||
// https://github.com/bumptech/glide/issues/529
|
||||
imgvBackground.setColorFilter(new LightingColorFilter(0xff828282, 0x000000));
|
||||
|
||||
cbxAutoDownload = findViewById(R.id.cbxAutoDownload);
|
||||
cbxKeepUpdated = findViewById(R.id.cbxKeepUpdated);
|
||||
spnAutoDelete = findViewById(R.id.spnAutoDelete);
|
||||
/*
|
||||
etxtUsername = findViewById(R.id.etxtUsername);
|
||||
etxtPassword = findViewById(R.id.etxtPassword);
|
||||
etxtFilterText = findViewById(R.id.etxtEpisodeFilterText);
|
||||
|
@ -138,115 +83,22 @@ public class FeedSettingsActivity extends AppCompatActivity {
|
|||
filterInclude = false;
|
||||
filterTextChanged = true;
|
||||
});
|
||||
*/
|
||||
|
||||
disposable = Maybe.create((MaybeOnSubscribe<Feed>) emitter -> {
|
||||
Feed feed = DBReader.getFeed(feedId);
|
||||
if (feed != null) {
|
||||
emitter.onSuccess(feed);
|
||||
} else {
|
||||
emitter.onComplete();
|
||||
}
|
||||
})
|
||||
Feed feed = DBReader.getFeed(feedId);
|
||||
if (feed != null) {
|
||||
emitter.onSuccess(feed);
|
||||
} else {
|
||||
emitter.onComplete();
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
feed = result;
|
||||
FeedPreferences prefs = feed.getPreferences();
|
||||
Glide.with(FeedSettingsActivity.this)
|
||||
.load(feed.getImageLocation())
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate())
|
||||
.into(imgvCover);
|
||||
Glide.with(FeedSettingsActivity.this)
|
||||
.load(feed.getImageLocation())
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.image_readability_tint)
|
||||
.error(R.color.image_readability_tint)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.transform(new FastBlurTransformation())
|
||||
.dontAnimate())
|
||||
.into(imgvBackground);
|
||||
|
||||
txtvTitle.setText(feed.getTitle());
|
||||
|
||||
if (!TextUtils.isEmpty(feed.getAuthor())) {
|
||||
txtvAuthorHeader.setText(feed.getAuthor());
|
||||
}
|
||||
|
||||
cbxAutoDownload.setEnabled(UserPreferences.isEnableAutodownload());
|
||||
cbxAutoDownload.setChecked(prefs.getAutoDownload());
|
||||
cbxAutoDownload.setOnCheckedChangeListener((compoundButton, checked) -> {
|
||||
feed.getPreferences().setAutoDownload(checked);
|
||||
feed.savePreferences();
|
||||
updateAutoDownloadSettings();
|
||||
ApplyToEpisodesDialog dialog = new ApplyToEpisodesDialog(FeedSettingsActivity.this,
|
||||
feed, checked);
|
||||
dialog.createNewDialog().show();
|
||||
});
|
||||
cbxKeepUpdated.setChecked(prefs.getKeepUpdated());
|
||||
cbxKeepUpdated.setOnCheckedChangeListener((compoundButton, checked) -> {
|
||||
feed.getPreferences().setKeepUpdated(checked);
|
||||
feed.savePreferences();
|
||||
});
|
||||
spnAutoDelete.setOnItemSelectedListener(new OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
|
||||
FeedPreferences.AutoDeleteAction auto_delete_action;
|
||||
switch (parent.getSelectedItemPosition()) {
|
||||
case 0:
|
||||
auto_delete_action = FeedPreferences.AutoDeleteAction.GLOBAL;
|
||||
break;
|
||||
case 1:
|
||||
auto_delete_action = FeedPreferences.AutoDeleteAction.YES;
|
||||
break;
|
||||
case 2:
|
||||
auto_delete_action = FeedPreferences.AutoDeleteAction.NO;
|
||||
break;
|
||||
default: // TODO - add exceptions here
|
||||
return;
|
||||
}
|
||||
feed.getPreferences().setAutoDeleteAction(auto_delete_action);// p
|
||||
autoDeleteChanged = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
// Another interface callback
|
||||
}
|
||||
});
|
||||
spnAutoDelete.setSelection(prefs.getAutoDeleteAction().ordinal());
|
||||
|
||||
etxtUsername.setText(prefs.getUsername());
|
||||
etxtPassword.setText(prefs.getPassword());
|
||||
|
||||
etxtUsername.addTextChangedListener(authTextWatcher);
|
||||
etxtPassword.addTextChangedListener(authTextWatcher);
|
||||
|
||||
FeedFilter filter = prefs.getFilter();
|
||||
if (filter.includeOnly()) {
|
||||
etxtFilterText.setText(filter.getIncludeFilter());
|
||||
rdoFilterInclude.setChecked(true);
|
||||
rdoFilterExclude.setChecked(false);
|
||||
filterInclude = true;
|
||||
} else if (filter.excludeOnly()) {
|
||||
etxtFilterText.setText(filter.getExcludeFilter());
|
||||
rdoFilterInclude.setChecked(false);
|
||||
rdoFilterExclude.setChecked(true);
|
||||
filterInclude = false;
|
||||
} else {
|
||||
Log.d(TAG, "No filter set");
|
||||
rdoFilterInclude.setChecked(false);
|
||||
rdoFilterExclude.setChecked(false);
|
||||
etxtFilterText.setText("");
|
||||
}
|
||||
etxtFilterText.addTextChangedListener(filterTextWatcher);
|
||||
|
||||
supportInvalidateOptionsMenu();
|
||||
updateAutoDownloadSettings();
|
||||
showFragment();
|
||||
showHeader();
|
||||
}, error -> {
|
||||
Log.d(TAG, Log.getStackTraceString(error));
|
||||
finish();
|
||||
|
@ -256,6 +108,79 @@ public class FeedSettingsActivity extends AppCompatActivity {
|
|||
});
|
||||
}
|
||||
|
||||
private void showFragment() {
|
||||
FeedSettingsFragment fragment = new FeedSettingsFragment();
|
||||
fragment.setArguments(getIntent().getExtras());
|
||||
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
FragmentTransaction fragmentTransaction =
|
||||
fragmentManager.beginTransaction();
|
||||
fragmentTransaction.replace(R.id.settings_fragment_container, fragment);
|
||||
fragmentTransaction.commit();
|
||||
}
|
||||
|
||||
public Feed getFeed() {
|
||||
return feed;
|
||||
}
|
||||
|
||||
private void showHeader() {
|
||||
txtvTitle.setText(feed.getTitle());
|
||||
|
||||
if (!TextUtils.isEmpty(feed.getAuthor())) {
|
||||
txtvAuthorHeader.setText(feed.getAuthor());
|
||||
}
|
||||
|
||||
Glide.with(FeedSettingsActivity.this)
|
||||
.load(feed.getImageLocation())
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate())
|
||||
.into(imgvCover);
|
||||
Glide.with(FeedSettingsActivity.this)
|
||||
.load(feed.getImageLocation())
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.image_readability_tint)
|
||||
.error(R.color.image_readability_tint)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.transform(new FastBlurTransformation())
|
||||
.dontAnimate())
|
||||
.into(imgvBackground);
|
||||
}
|
||||
|
||||
/*
|
||||
private void setupPrefs(Feed feed) {
|
||||
FeedPreferences prefs = feed.getPreferences();
|
||||
|
||||
etxtUsername.setText(prefs.getUsername());
|
||||
etxtPassword.setText(prefs.getPassword());
|
||||
|
||||
etxtUsername.addTextChangedListener(authTextWatcher);
|
||||
etxtPassword.addTextChangedListener(authTextWatcher);
|
||||
|
||||
FeedFilter filter = prefs.getFilter();
|
||||
if (filter.includeOnly()) {
|
||||
etxtFilterText.setText(filter.getIncludeFilter());
|
||||
rdoFilterInclude.setChecked(true);
|
||||
rdoFilterExclude.setChecked(false);
|
||||
filterInclude = true;
|
||||
} else if (filter.excludeOnly()) {
|
||||
etxtFilterText.setText(filter.getExcludeFilter());
|
||||
rdoFilterInclude.setChecked(false);
|
||||
rdoFilterExclude.setChecked(true);
|
||||
filterInclude = false;
|
||||
} else {
|
||||
Log.d(TAG, "No filter set");
|
||||
rdoFilterInclude.setChecked(false);
|
||||
rdoFilterExclude.setChecked(false);
|
||||
etxtFilterText.setText("");
|
||||
}
|
||||
etxtFilterText.addTextChangedListener(filterTextWatcher);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
@ -286,6 +211,7 @@ public class FeedSettingsActivity extends AppCompatActivity {
|
|||
filterTextChanged = false;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
@ -295,25 +221,6 @@ public class FeedSettingsActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.feedinfo, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
menu.findItem(R.id.support_item).setVisible(
|
||||
feed != null && feed.getPaymentLink() != null);
|
||||
menu.findItem(R.id.share_link_item).setVisible(feed != null && feed.getLink() != null);
|
||||
menu.findItem(R.id.visit_website_item).setVisible(feed != null && feed.getLink() != null &&
|
||||
IntentUtils.isCallable(this, new Intent(Intent.ACTION_VIEW, Uri.parse(feed.getLink()))));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
@ -321,44 +228,7 @@ public class FeedSettingsActivity extends AppCompatActivity {
|
|||
finish();
|
||||
return true;
|
||||
default:
|
||||
try {
|
||||
return FeedMenuHandler.onOptionsItemClicked(this, item, feed);
|
||||
} catch (DownloadRequestException e) {
|
||||
e.printStackTrace();
|
||||
DownloadRequestErrorDialogCreator.newRequestErrorDialog(this,
|
||||
e.getMessage());
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAutoDownloadSettings() {
|
||||
if (feed != null && feed.getPreferences() != null) {
|
||||
boolean enabled = feed.getPreferences().getAutoDownload() && UserPreferences.isEnableAutodownload();
|
||||
rdoFilterInclude.setEnabled(enabled);
|
||||
rdoFilterExclude.setEnabled(enabled);
|
||||
etxtFilterText.setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ApplyToEpisodesDialog extends ConfirmationDialog {
|
||||
|
||||
private final Feed feed;
|
||||
private final boolean autoDownload;
|
||||
|
||||
ApplyToEpisodesDialog(Context context, Feed feed, boolean autoDownload) {
|
||||
super(context, R.string.auto_download_apply_to_items_title,
|
||||
R.string.auto_download_apply_to_items_message);
|
||||
this.feed = feed;
|
||||
this.autoDownload = autoDownload;
|
||||
setPositiveText(R.string.yes);
|
||||
setNegativeText(R.string.no);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmButtonPressed(DialogInterface dialog) {
|
||||
DBWriter.setFeedsItemsAutoDownload(feed, autoDownload);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
package de.danoeh.antennapod.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v7.preference.ListPreference;
|
||||
import android.support.v7.preference.PreferenceFragmentCompat;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.FeedSettingsActivity;
|
||||
import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.core.feed.FeedPreferences;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
|
||||
public class FeedSettingsFragment extends PreferenceFragmentCompat {
|
||||
private Feed feed;
|
||||
private FeedPreferences feedPreferences;
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
addPreferencesFromResource(R.xml.feed_settings);
|
||||
|
||||
feed = ((FeedSettingsActivity) getActivity()).getFeed();
|
||||
feedPreferences = feed.getPreferences();
|
||||
|
||||
setupAutoDownloadPreference();
|
||||
setupKeepUpdatedPreference();
|
||||
setupAutoDeletePreference();
|
||||
|
||||
updateAutoDeleteSummary();
|
||||
updateAutoDownloadEnabled();
|
||||
}
|
||||
|
||||
private void setupAutoDeletePreference() {
|
||||
ListPreference autoDeletePreference = (ListPreference) findPreference("autoDelete");
|
||||
autoDeletePreference.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
switch ((String) newValue) {
|
||||
case "global":
|
||||
feedPreferences.setAutoDeleteAction(FeedPreferences.AutoDeleteAction.GLOBAL);
|
||||
break;
|
||||
case "always":
|
||||
feedPreferences.setAutoDeleteAction(FeedPreferences.AutoDeleteAction.YES);
|
||||
break;
|
||||
case "never":
|
||||
feedPreferences.setAutoDeleteAction(FeedPreferences.AutoDeleteAction.NO);
|
||||
break;
|
||||
}
|
||||
feed.savePreferences();
|
||||
updateAutoDeleteSummary();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
private void updateAutoDeleteSummary() {
|
||||
ListPreference autoDeletePreference = (ListPreference) findPreference("autoDelete");
|
||||
|
||||
switch (feedPreferences.getAutoDeleteAction()) {
|
||||
case GLOBAL:
|
||||
autoDeletePreference.setSummary(R.string.feed_auto_download_global);
|
||||
autoDeletePreference.setValue("global");
|
||||
break;
|
||||
case YES:
|
||||
autoDeletePreference.setSummary(R.string.feed_auto_download_always);
|
||||
autoDeletePreference.setValue("always");
|
||||
break;
|
||||
case NO:
|
||||
autoDeletePreference.setSummary(R.string.feed_auto_download_never);
|
||||
autoDeletePreference.setValue("never");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void setupKeepUpdatedPreference() {
|
||||
SwitchPreference pref = (SwitchPreference) findPreference("keepUpdated");
|
||||
|
||||
pref.setChecked(feedPreferences.getKeepUpdated());
|
||||
pref.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
boolean checked = newValue == Boolean.TRUE;
|
||||
feedPreferences.setKeepUpdated(checked);
|
||||
feed.savePreferences();
|
||||
pref.setChecked(checked);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
private void setupAutoDownloadPreference() {
|
||||
SwitchPreference pref = (SwitchPreference) findPreference("autoDownload");
|
||||
|
||||
pref.setEnabled(UserPreferences.isEnableAutodownload());
|
||||
pref.setChecked(feedPreferences.getAutoDownload());
|
||||
pref.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
boolean checked = newValue == Boolean.TRUE;
|
||||
|
||||
feedPreferences.setAutoDownload(checked);
|
||||
feed.savePreferences();
|
||||
updateAutoDownloadEnabled();
|
||||
ApplyToEpisodesDialog dialog = new ApplyToEpisodesDialog(getActivity(), checked);
|
||||
dialog.createNewDialog().show();
|
||||
pref.setChecked(checked);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
private void updateAutoDownloadEnabled() {
|
||||
if (feed != null && feed.getPreferences() != null) {
|
||||
boolean enabled = feed.getPreferences().getAutoDownload() && UserPreferences.isEnableAutodownload();
|
||||
findPreference("filters").setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
private class ApplyToEpisodesDialog extends ConfirmationDialog {
|
||||
private final boolean autoDownload;
|
||||
|
||||
ApplyToEpisodesDialog(Context context, boolean autoDownload) {
|
||||
super(context, R.string.auto_download_apply_to_items_title,
|
||||
R.string.auto_download_apply_to_items_message);
|
||||
this.autoDownload = autoDownload;
|
||||
setPositiveText(R.string.yes);
|
||||
setNegativeText(R.string.no);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmButtonPressed(DialogInterface dialog) {
|
||||
DBWriter.setFeedsItemsAutoDownload(feed, autoDownload);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,6 +8,13 @@
|
|||
|
||||
<include layout="@layout/feeditemlist_header" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/settings_fragment_container" />
|
||||
|
||||
<!--
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -24,48 +31,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.GridLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
app:columnCount="2"
|
||||
app:rowCount="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvFeedAutoDelete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/auto_delete_label"
|
||||
app:layout_row="0"
|
||||
app:layout_column="0"
|
||||
app:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginEnd="10dp" />
|
||||
|
||||
<Spinner
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/spnAutoDelete"
|
||||
android:entries="@array/spnAutoDeleteItems"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_row="0"
|
||||
app:layout_column="1"
|
||||
android:spinnerMode="dropdown"
|
||||
app:layout_gravity="center"
|
||||
android:dropDownWidth="wrap_content"
|
||||
android:clickable="true" />
|
||||
</android.support.v7.widget.GridLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbxKeepUpdated"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/keep_updated"
|
||||
android:enabled="true"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
tools:background="@android:color/holo_red_light"
|
||||
android:checked="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvAuthentication"
|
||||
|
@ -214,5 +180,5 @@
|
|||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
-->
|
||||
</LinearLayout>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<SwitchPreference
|
||||
android:key="keepUpdated"
|
||||
android:title="@string/keep_updated"
|
||||
android:summary="@string/keep_updated_summary"/>
|
||||
|
||||
<Preference
|
||||
android:key="authentication"
|
||||
android:title="@string/authentication_label"
|
||||
android:summary="@string/authentication_descr"/>
|
||||
|
||||
<ListPreference
|
||||
android:entries="@array/spnAutoDeleteItems"
|
||||
android:entryValues="@array/spnAutoDeleteValues"
|
||||
android:title="@string/auto_delete_label"
|
||||
android:key="autoDelete"/>
|
||||
|
||||
<PreferenceCategory android:title="@string/auto_download_settings_label">
|
||||
<SwitchPreference
|
||||
android:key="autoDownload"
|
||||
android:title="@string/auto_download_label"/>
|
||||
<Preference
|
||||
android:key="filters"
|
||||
android:title="@string/episode_filters_label"
|
||||
android:summary="@string/episode_filters_description"/>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
|
@ -7,6 +7,12 @@
|
|||
<item>@string/feed_auto_download_never</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="spnAutoDeleteValues">
|
||||
<item>global</item>
|
||||
<item>always</item>
|
||||
<item>never</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="smart_mark_as_played_values">
|
||||
<item>0</item>
|
||||
<item>15</item>
|
||||
|
|
|
@ -693,6 +693,7 @@
|
|||
<string name="episode_filters_exclude">Exclude</string>
|
||||
<string name="episode_filters_hint">Single words \n\"Multiple Words\"</string>
|
||||
<string name="keep_updated">Keep Updated</string>
|
||||
<string name="keep_updated_summary">Include this feed when (auto-)refreshing all feeds</string>
|
||||
|
||||
<!-- Progress information -->
|
||||
<string name="progress_upgrading_database">Upgrading the database</string>
|
||||
|
|
Loading…
Reference in New Issue