Global Refresh -> Keep Updated
This commit is contained in:
parent
193fc7adee
commit
7dfe4d5ed3
@ -66,7 +66,7 @@ public class FeedInfoActivity extends ActionBarActivity {
|
|||||||
private RadioButton rdoFilterInclude;
|
private RadioButton rdoFilterInclude;
|
||||||
private RadioButton rdoFilterExclude;
|
private RadioButton rdoFilterExclude;
|
||||||
private CheckBox cbxAutoDownload;
|
private CheckBox cbxAutoDownload;
|
||||||
private CheckBox cbxGlobalRefresh;
|
private CheckBox cbxKeepUpdated;
|
||||||
private Spinner spnAutoDelete;
|
private Spinner spnAutoDelete;
|
||||||
private boolean filterInclude = true;
|
private boolean filterInclude = true;
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ public class FeedInfoActivity extends ActionBarActivity {
|
|||||||
txtvAuthor = (TextView) findViewById(R.id.txtvAuthor);
|
txtvAuthor = (TextView) findViewById(R.id.txtvAuthor);
|
||||||
txtvUrl = (TextView) findViewById(R.id.txtvUrl);
|
txtvUrl = (TextView) findViewById(R.id.txtvUrl);
|
||||||
cbxAutoDownload = (CheckBox) findViewById(R.id.cbxAutoDownload);
|
cbxAutoDownload = (CheckBox) findViewById(R.id.cbxAutoDownload);
|
||||||
cbxGlobalRefresh = (CheckBox) findViewById(R.id.cbxGlobalRefresh);
|
cbxKeepUpdated = (CheckBox) findViewById(R.id.cbxKeepUpdated);
|
||||||
spnAutoDelete = (Spinner) findViewById(R.id.spnAutoDelete);
|
spnAutoDelete = (Spinner) findViewById(R.id.spnAutoDelete);
|
||||||
etxtUsername = (EditText) findViewById(R.id.etxtUsername);
|
etxtUsername = (EditText) findViewById(R.id.etxtUsername);
|
||||||
etxtPassword = (EditText) findViewById(R.id.etxtPassword);
|
etxtPassword = (EditText) findViewById(R.id.etxtPassword);
|
||||||
@ -177,9 +177,9 @@ public class FeedInfoActivity extends ActionBarActivity {
|
|||||||
feed, checked);
|
feed, checked);
|
||||||
dialog.createNewDialog().show();
|
dialog.createNewDialog().show();
|
||||||
});
|
});
|
||||||
cbxGlobalRefresh.setChecked(prefs.getGlobalRefresh());
|
cbxKeepUpdated.setChecked(prefs.getKeepUpdated());
|
||||||
cbxGlobalRefresh.setOnCheckedChangeListener((compoundButton, checked) -> {
|
cbxKeepUpdated.setOnCheckedChangeListener((compoundButton, checked) -> {
|
||||||
feed.getPreferences().setGlobalRefresh(checked);
|
feed.getPreferences().setKeepUpdated(checked);
|
||||||
feed.savePreferences(FeedInfoActivity.this);
|
feed.savePreferences(FeedInfoActivity.this);
|
||||||
});
|
});
|
||||||
spnAutoDelete.setOnItemSelectedListener(new OnItemSelectedListener() {
|
spnAutoDelete.setOnItemSelectedListener(new OnItemSelectedListener() {
|
||||||
|
@ -182,11 +182,11 @@
|
|||||||
</android.support.v7.widget.GridLayout>
|
</android.support.v7.widget.GridLayout>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/cbxGlobalRefresh"
|
android:id="@+id/cbxKeepUpdated"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="@string/global_refresh"
|
android:text="@string/keep_updated"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
tools:background="@android:color/holo_red_light"
|
tools:background="@android:color/holo_red_light"
|
||||||
|
@ -18,7 +18,7 @@ public class FeedPreferences {
|
|||||||
private FeedFilter filter;
|
private FeedFilter filter;
|
||||||
private long feedID;
|
private long feedID;
|
||||||
private boolean autoDownload;
|
private boolean autoDownload;
|
||||||
private boolean globalRefresh;
|
private boolean keepUpdated;
|
||||||
|
|
||||||
public enum AutoDeleteAction {
|
public enum AutoDeleteAction {
|
||||||
GLOBAL,
|
GLOBAL,
|
||||||
@ -33,10 +33,10 @@ public class FeedPreferences {
|
|||||||
this(feedID, autoDownload, true, auto_delete_action, username, password, new FeedFilter());
|
this(feedID, autoDownload, true, auto_delete_action, username, password, new FeedFilter());
|
||||||
}
|
}
|
||||||
|
|
||||||
public FeedPreferences(long feedID, boolean autoDownload, boolean globalRefresh, AutoDeleteAction auto_delete_action, String username, String password, @NonNull FeedFilter filter) {
|
public FeedPreferences(long feedID, boolean autoDownload, boolean keepUpdated, AutoDeleteAction auto_delete_action, String username, String password, @NonNull FeedFilter filter) {
|
||||||
this.feedID = feedID;
|
this.feedID = feedID;
|
||||||
this.autoDownload = autoDownload;
|
this.autoDownload = autoDownload;
|
||||||
this.globalRefresh = globalRefresh;
|
this.keepUpdated = keepUpdated;
|
||||||
this.auto_delete_action = auto_delete_action;
|
this.auto_delete_action = auto_delete_action;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
@ -46,7 +46,7 @@ public class FeedPreferences {
|
|||||||
public static FeedPreferences fromCursor(Cursor cursor) {
|
public static FeedPreferences fromCursor(Cursor cursor) {
|
||||||
int indexId = cursor.getColumnIndex(PodDBAdapter.KEY_ID);
|
int indexId = cursor.getColumnIndex(PodDBAdapter.KEY_ID);
|
||||||
int indexAutoDownload = cursor.getColumnIndex(PodDBAdapter.KEY_AUTO_DOWNLOAD);
|
int indexAutoDownload = cursor.getColumnIndex(PodDBAdapter.KEY_AUTO_DOWNLOAD);
|
||||||
int indexAutoRefresh = cursor.getColumnIndex(PodDBAdapter.KEY_GLOBAL_REFRESH);
|
int indexAutoRefresh = cursor.getColumnIndex(PodDBAdapter.KEY_KEEP_UPDATED);
|
||||||
int indexAutoDeleteAction = cursor.getColumnIndex(PodDBAdapter.KEY_AUTO_DELETE_ACTION);
|
int indexAutoDeleteAction = cursor.getColumnIndex(PodDBAdapter.KEY_AUTO_DELETE_ACTION);
|
||||||
int indexUsername = cursor.getColumnIndex(PodDBAdapter.KEY_USERNAME);
|
int indexUsername = cursor.getColumnIndex(PodDBAdapter.KEY_USERNAME);
|
||||||
int indexPassword = cursor.getColumnIndex(PodDBAdapter.KEY_PASSWORD);
|
int indexPassword = cursor.getColumnIndex(PodDBAdapter.KEY_PASSWORD);
|
||||||
@ -80,12 +80,12 @@ public class FeedPreferences {
|
|||||||
* @return true if this feed should be refreshed when everything else is being refreshed
|
* @return true if this feed should be refreshed when everything else is being refreshed
|
||||||
* if false the feed should only be refreshed if requested directly.
|
* if false the feed should only be refreshed if requested directly.
|
||||||
*/
|
*/
|
||||||
public boolean getGlobalRefresh() {
|
public boolean getKeepUpdated() {
|
||||||
return globalRefresh;
|
return keepUpdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGlobalRefresh(boolean globalRefresh) {
|
public void setKeepUpdated(boolean keepUpdated) {
|
||||||
this.globalRefresh = globalRefresh;
|
this.keepUpdated = keepUpdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -371,7 +371,7 @@ public final class DBReader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a list of FeedItems that are considered new.
|
* Loads a list of FeedItems that are considered new.
|
||||||
* Excludes items from feeds that do not have global refresh enabled.
|
* Excludes items from feeds that do not have keep updated enabled.
|
||||||
* @return A list of FeedItems that are considered new.
|
* @return A list of FeedItems that are considered new.
|
||||||
*/
|
*/
|
||||||
public static List<FeedItem> getNewItemsList() {
|
public static List<FeedItem> getNewItemsList() {
|
||||||
|
@ -196,9 +196,9 @@ public final class DBTasks {
|
|||||||
|
|
||||||
for (Feed feed : feedList) {
|
for (Feed feed : feedList) {
|
||||||
FeedPreferences prefs = feed.getPreferences();
|
FeedPreferences prefs = feed.getPreferences();
|
||||||
// feeds with !getGlobalRefresh can only be refreshed
|
// feeds with !getKeepUpdated can only be refreshed
|
||||||
// directly from the FeedActivity
|
// directly from the FeedActivity
|
||||||
if (prefs.getGlobalRefresh()) {
|
if (prefs.getKeepUpdated()) {
|
||||||
try {
|
try {
|
||||||
refreshFeed(context, feed);
|
refreshFeed(context, feed);
|
||||||
} catch (DownloadRequestException e) {
|
} catch (DownloadRequestException e) {
|
||||||
|
@ -92,7 +92,7 @@ public class PodDBAdapter {
|
|||||||
public static final String KEY_CHAPTER_TYPE = "type";
|
public static final String KEY_CHAPTER_TYPE = "type";
|
||||||
public static final String KEY_PLAYBACK_COMPLETION_DATE = "playback_completion_date";
|
public static final String KEY_PLAYBACK_COMPLETION_DATE = "playback_completion_date";
|
||||||
public static final String KEY_AUTO_DOWNLOAD = "auto_download";
|
public static final String KEY_AUTO_DOWNLOAD = "auto_download";
|
||||||
public static final String KEY_GLOBAL_REFRESH = "global_refresh";
|
public static final String KEY_KEEP_UPDATED = "keep_updated";
|
||||||
public static final String KEY_AUTO_DELETE_ACTION = "auto_delete_action";
|
public static final String KEY_AUTO_DELETE_ACTION = "auto_delete_action";
|
||||||
public static final String KEY_PLAYED_DURATION = "played_duration";
|
public static final String KEY_PLAYED_DURATION = "played_duration";
|
||||||
public static final String KEY_USERNAME = "username";
|
public static final String KEY_USERNAME = "username";
|
||||||
@ -133,7 +133,7 @@ public class PodDBAdapter {
|
|||||||
+ KEY_PASSWORD + " TEXT,"
|
+ KEY_PASSWORD + " TEXT,"
|
||||||
+ KEY_INCLUDE_FILTER + " TEXT DEFAULT '',"
|
+ KEY_INCLUDE_FILTER + " TEXT DEFAULT '',"
|
||||||
+ KEY_EXCLUDE_FILTER + " TEXT DEFAULT '',"
|
+ KEY_EXCLUDE_FILTER + " TEXT DEFAULT '',"
|
||||||
+ KEY_GLOBAL_REFRESH + " INTEGER DEFAULT 1,"
|
+ KEY_KEEP_UPDATED + " INTEGER DEFAULT 1,"
|
||||||
+ KEY_IS_PAGED + " INTEGER DEFAULT 0,"
|
+ KEY_IS_PAGED + " INTEGER DEFAULT 0,"
|
||||||
+ KEY_NEXT_PAGE_LINK + " TEXT,"
|
+ KEY_NEXT_PAGE_LINK + " TEXT,"
|
||||||
+ KEY_HIDE + " TEXT,"
|
+ KEY_HIDE + " TEXT,"
|
||||||
@ -236,7 +236,7 @@ public class PodDBAdapter {
|
|||||||
TABLE_NAME_FEEDS + "." + KEY_TYPE,
|
TABLE_NAME_FEEDS + "." + KEY_TYPE,
|
||||||
TABLE_NAME_FEEDS + "." + KEY_FEED_IDENTIFIER,
|
TABLE_NAME_FEEDS + "." + KEY_FEED_IDENTIFIER,
|
||||||
TABLE_NAME_FEEDS + "." + KEY_AUTO_DOWNLOAD,
|
TABLE_NAME_FEEDS + "." + KEY_AUTO_DOWNLOAD,
|
||||||
TABLE_NAME_FEEDS + "." + KEY_GLOBAL_REFRESH,
|
TABLE_NAME_FEEDS + "." + KEY_KEEP_UPDATED,
|
||||||
TABLE_NAME_FEEDS + "." + KEY_FLATTR_STATUS,
|
TABLE_NAME_FEEDS + "." + KEY_FLATTR_STATUS,
|
||||||
TABLE_NAME_FEEDS + "." + KEY_IS_PAGED,
|
TABLE_NAME_FEEDS + "." + KEY_IS_PAGED,
|
||||||
TABLE_NAME_FEEDS + "." + KEY_NEXT_PAGE_LINK,
|
TABLE_NAME_FEEDS + "." + KEY_NEXT_PAGE_LINK,
|
||||||
@ -401,7 +401,7 @@ public class PodDBAdapter {
|
|||||||
}
|
}
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(KEY_AUTO_DOWNLOAD, prefs.getAutoDownload());
|
values.put(KEY_AUTO_DOWNLOAD, prefs.getAutoDownload());
|
||||||
values.put(KEY_GLOBAL_REFRESH, prefs.getGlobalRefresh());
|
values.put(KEY_KEEP_UPDATED, prefs.getKeepUpdated());
|
||||||
values.put(KEY_AUTO_DELETE_ACTION,prefs.getAutoDeleteAction().ordinal());
|
values.put(KEY_AUTO_DELETE_ACTION,prefs.getAutoDeleteAction().ordinal());
|
||||||
values.put(KEY_USERNAME, prefs.getUsername());
|
values.put(KEY_USERNAME, prefs.getUsername());
|
||||||
values.put(KEY_PASSWORD, prefs.getPassword());
|
values.put(KEY_PASSWORD, prefs.getPassword());
|
||||||
@ -1147,7 +1147,7 @@ public class PodDBAdapter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a cursor which contains all feed items that are considered new.
|
* Returns a cursor which contains all feed items that are considered new.
|
||||||
* Excludes those feeds that do not have 'global_refresh' enabled.
|
* Excludes those feeds that do not have 'Keep Updated' enabled.
|
||||||
* The returned cursor uses the FEEDITEM_SEL_FI_SMALL selection.
|
* The returned cursor uses the FEEDITEM_SEL_FI_SMALL selection.
|
||||||
*/
|
*/
|
||||||
public final Cursor getNewItemsCursor() {
|
public final Cursor getNewItemsCursor() {
|
||||||
@ -1156,7 +1156,7 @@ public class PodDBAdapter {
|
|||||||
TABLE_NAME_FEED_ITEMS,
|
TABLE_NAME_FEED_ITEMS,
|
||||||
TABLE_NAME_FEEDS,
|
TABLE_NAME_FEEDS,
|
||||||
TABLE_NAME_FEED_ITEMS + "." + KEY_FEED + "=" + TABLE_NAME_FEEDS + "." + KEY_ID,
|
TABLE_NAME_FEED_ITEMS + "." + KEY_FEED + "=" + TABLE_NAME_FEEDS + "." + KEY_ID,
|
||||||
TABLE_NAME_FEED_ITEMS + "." + KEY_READ + "=" + FeedItem.NEW + " AND " + TABLE_NAME_FEEDS + "." + KEY_GLOBAL_REFRESH + " > 0",
|
TABLE_NAME_FEED_ITEMS + "." + KEY_READ + "=" + FeedItem.NEW + " AND " + TABLE_NAME_FEEDS + "." + KEY_KEEP_UPDATED + " > 0",
|
||||||
KEY_PUBDATE + " DESC"
|
KEY_PUBDATE + " DESC"
|
||||||
};
|
};
|
||||||
final String query = String.format("SELECT %s FROM %s INNER JOIN %s ON %s WHERE %s ORDER BY %s", args);
|
final String query = String.format("SELECT %s FROM %s INNER JOIN %s ON %s WHERE %s ORDER BY %s", args);
|
||||||
@ -1802,7 +1802,7 @@ public class PodDBAdapter {
|
|||||||
|
|
||||||
// and now auto refresh
|
// and now auto refresh
|
||||||
db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS
|
db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS
|
||||||
+ " ADD COLUMN " + PodDBAdapter.KEY_GLOBAL_REFRESH + " INTEGER DEFAULT 1");
|
+ " ADD COLUMN " + PodDBAdapter.KEY_KEEP_UPDATED + " INTEGER DEFAULT 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
EventBus.getDefault().post(ProgressEvent.end());
|
EventBus.getDefault().post(ProgressEvent.end());
|
||||||
|
@ -536,7 +536,7 @@
|
|||||||
<string name="episode_filters_include">Include</string>
|
<string name="episode_filters_include">Include</string>
|
||||||
<string name="episode_filters_exclude">Exclude</string>
|
<string name="episode_filters_exclude">Exclude</string>
|
||||||
<string name="episode_filters_hint">Single words \n\"Multiple Words\"</string>
|
<string name="episode_filters_hint">Single words \n\"Multiple Words\"</string>
|
||||||
<string name="global_refresh">Global Refresh</string>
|
<string name="keep_updated">Keep Updated</string>
|
||||||
|
|
||||||
<!-- Progress information -->
|
<!-- Progress information -->
|
||||||
<string name="progress_upgrading_database">Upgrading the database</string>
|
<string name="progress_upgrading_database">Upgrading the database</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user