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
|
@Override
|
||||||
protected Integer doInBackground(FeedList... params) {
|
protected Integer doInBackground(FeedList... params) {
|
||||||
|
|
||||||
|
FeedList localList = new FeedList();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
localList.addAll(params[0]);
|
||||||
|
|
||||||
File storage = m_activity.getExternalCacheDir();
|
File storage = m_activity.getExternalCacheDir();
|
||||||
final File iconPath = new File(storage.getAbsolutePath() + ICON_PATH);
|
final File iconPath = new File(storage.getAbsolutePath() + ICON_PATH);
|
||||||
if (!iconPath.exists()) iconPath.mkdirs();
|
if (!iconPath.exists()) iconPath.mkdirs();
|
||||||
|
|
||||||
if (iconPath.exists()) {
|
if (iconPath.exists()) {
|
||||||
for (Feed feed : params[0]) {
|
for (Feed feed : localList) {
|
||||||
if (feed.id > 0 && feed.has_icon && !feed.is_cat) {
|
if (feed.id > 0 && feed.has_icon && !feed.is_cat) {
|
||||||
File outputFile = new File(iconPath.getAbsolutePath() + "/" + feed.id + ".ico");
|
File outputFile = new File(iconPath.getAbsolutePath() + "/" + feed.id + ".ico");
|
||||||
String fetchUrl = m_baseUrl + "/" + feed.id + ".ico";
|
String fetchUrl = m_baseUrl + "/" + feed.id + ".ico";
|
||||||
@ -631,6 +635,11 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
|||||||
try {
|
try {
|
||||||
URL url = new URL(fetchUrl);
|
URL url = new URL(fetchUrl);
|
||||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||||
|
|
||||||
|
conn.setConnectTimeout(1000);
|
||||||
|
conn.setReadTimeout(5000);
|
||||||
|
|
||||||
|
Log.d(TAG, "[downloadFile] " + url);
|
||||||
|
|
||||||
String httpLogin = m_prefs.getString("http_login", "");
|
String httpLogin = m_prefs.getString("http_login", "");
|
||||||
String httpPassword = m_prefs.getString("http_password", "");
|
String httpPassword = m_prefs.getString("http_password", "");
|
||||||
|
Loading…
Reference in New Issue
Block a user