copy actual feedlist when downloading feed icons to prevent concurrent
modification problem
This commit is contained in:
parent
77243ef497
commit
db81d3e462
@ -595,13 +595,17 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
||||
@Override
|
||||
protected Integer doInBackground(FeedList... params) {
|
||||
|
||||
FeedList localList = new FeedList();
|
||||
|
||||
try {
|
||||
localList.addAll(params[0]);
|
||||
|
||||
File storage = m_activity.getExternalCacheDir();
|
||||
final File iconPath = new File(storage.getAbsolutePath() + ICON_PATH);
|
||||
if (!iconPath.exists()) iconPath.mkdirs();
|
||||
|
||||
if (iconPath.exists()) {
|
||||
for (Feed feed : params[0]) {
|
||||
for (Feed feed : localList) {
|
||||
if (feed.id > 0 && feed.has_icon && !feed.is_cat) {
|
||||
File outputFile = new File(iconPath.getAbsolutePath() + "/" + feed.id + ".ico");
|
||||
String fetchUrl = m_baseUrl + "/" + feed.id + ".ico";
|
||||
@ -631,6 +635,11 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
||||
try {
|
||||
URL url = new URL(fetchUrl);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
|
||||
conn.setConnectTimeout(1000);
|
||||
conn.setReadTimeout(5000);
|
||||
|
||||
Log.d(TAG, "[downloadFile] " + url);
|
||||
|
||||
String httpLogin = m_prefs.getString("http_login", "");
|
||||
String httpPassword = m_prefs.getString("http_password", "");
|
||||
|
Loading…
Reference in New Issue
Block a user