Skip to content

Commit

Permalink
6.4: Added German translation (thx @repetti); Added Russian translation
Browse files Browse the repository at this point in the history
(thx @repetti); Removed iterator in AsyncTask, introduced in v6.1,
delayed list sorting (can cause items to be added) until after cycling
through shows for stats refresh in order to avoid (hopefully)
ConcurrentModificationException as described in issue #4.
  • Loading branch information
ltGuillaume authored and ltGuillaume committed Dec 13, 2015
1 parent 4198a3e commit df73388
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="nl.asymmetrics.droidshows"
android:versionCode="63" android:versionName="6.3">
android:versionCode="64" android:versionName="6.4">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="11"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Expand Down
20 changes: 10 additions & 10 deletions src/nl/asymmetrics/droidshows/DroidShows.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.io.FileUtils;
import nl.asymmetrics.droidshows.R;
Expand Down Expand Up @@ -84,8 +83,8 @@ public class DroidShows extends ListActivity
private static final int EXIT_MENU_ITEM = OPTIONS_MENU_ITEM + 1;
/* Context Menus */
private static final int MARK_NEXT_EPISODE_AS_SEEN_CONTEXT = Menu.FIRST;
private static final int TOGGLE_ARCHIVED = MARK_NEXT_EPISODE_AS_SEEN_CONTEXT + 1;
private static final int VIEW_SERIEDETAILS_CONTEXT = TOGGLE_ARCHIVED + 1;
private static final int TOGGLE_ARCHIVED_CONTEXT = MARK_NEXT_EPISODE_AS_SEEN_CONTEXT + 1;
private static final int VIEW_SERIEDETAILS_CONTEXT = TOGGLE_ARCHIVED_CONTEXT + 1;
private static final int VIEW_IMDB_CONTEXT = VIEW_SERIEDETAILS_CONTEXT + 1;
private static final int VIEW_EP_IMDB_CONTEXT = VIEW_IMDB_CONTEXT + 1;
private static final int UPDATE_CONTEXT = VIEW_EP_IMDB_CONTEXT + 1;
Expand Down Expand Up @@ -489,13 +488,13 @@ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuIn
menu.add(0, VIEW_IMDB_CONTEXT, 0, getString(R.string.menu_context_view_imdb));
menu.add(0, VIEW_EP_IMDB_CONTEXT, 0, getString(R.string.menu_context_view_ep_imdb));
menu.add(0, UPDATE_CONTEXT, 0, getString(R.string.menu_context_update));
menu.add(0, TOGGLE_ARCHIVED, 0, getString(R.string.menu_archive));
menu.add(0, TOGGLE_ARCHIVED_CONTEXT, 0, getString(R.string.menu_archive));
menu.add(0, DELETE_CONTEXT, 0, getString(R.string.menu_context_delete));
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
if (seriesAdapter.getItem(info.position).getUnwatchedAired() == 0)
menu.findItem(MARK_NEXT_EPISODE_AS_SEEN_CONTEXT).setVisible(false);
if (seriesAdapter.getItem(info.position).getPassiveStatus())
menu.findItem(TOGGLE_ARCHIVED).setTitle(R.string.menu_unarchive);
menu.findItem(TOGGLE_ARCHIVED_CONTEXT).setTitle(R.string.menu_unarchive);
}

public boolean onContextItemSelected(MenuItem item) {
Expand All @@ -516,7 +515,7 @@ public boolean onContextItemSelected(MenuItem item) {
case UPDATE_CONTEXT :
updateSerie(seriesAdapter.getItem(info.position).getSerieId(), info.position);
return true;
case TOGGLE_ARCHIVED :
case TOGGLE_ARCHIVED_CONTEXT :
asyncInfo.cancel(true);
String serieId = seriesAdapter.getItem(info.position).getSerieId();
db.updateSerieStatus(serieId, showArchive ^ 1);
Expand Down Expand Up @@ -1009,22 +1008,23 @@ private class AsyncInfo extends AsyncTask<Void, Void, Void> {
protected Void doInBackground(Void... params) {
String newAsync = dateFormat.format(new Date());
if (!lastStatsUpdate.equals(newAsync)) {
Iterator<TVShowItem> it = series.iterator();
while(it.hasNext()) {
for (TVShowItem serie : series) {
if (isCancelled()) return null;
TVShowItem serie = it.next();
String serieId = serie.getSerieId();
int unwatched = db.getEPUnwatched(serieId);
int unwatchedAired = db.getEPUnwatchedAired(serieId);
if (unwatched != serie.getUnwatched() || unwatchedAired != serie.getUnwatchedAired()) {
if (isCancelled()) return null;
serie.setUnwatched(unwatched);
serie.setUnwatchedAired(unwatchedAired);
listView.post(updateListView);
runOnUiThread(new Runnable() {
public void run() {seriesAdapter.notifyDataSetChanged();}
});
if (isCancelled()) return null;
db.execQuery("UPDATE series SET unwatched="+ unwatched +", unwatchedAired="+ unwatchedAired +" WHERE id="+ serieId);
}
}
listView.post(updateListView);
lastStatsUpdate = newAsync;
// Log.d(SQLiteStore.TAG, "Updated show stats on "+ newAsync);
}
Expand Down
2 changes: 1 addition & 1 deletion src/nl/asymmetrics/droidshows/utils/SQLiteStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public List<String> getSeries(int showArchive) {
String showArchiveString = "";
if (showArchive < 2)
showArchiveString = " WHERE passiveStatus"
+(showArchive == 0 ? "=0 OR passiveStatus IS NULL" : ">="+ showArchive); // Solves issue with former bug when adding show directly after restoring backup
+(showArchive == 0 ? "=0 OR passiveStatus IS NULL" : ">=1"); // Solves issue with former bug when adding show directly after restoring backup
Cursor cseries = Query("SELECT id FROM series"+ showArchiveString);
try {
cseries.moveToFirst();
Expand Down

0 comments on commit df73388

Please sign in to comment.