Commit 1297d06c by nakamura akane

Merge branch 'contract/kagome/1.2.1_leej' into 'contract/kagome/1.2.1'

新着更新時、ログアウトすることによりエラーが発生する問題対応

See merge request !69
parents 96ea7e01 5707d20c
...@@ -171,6 +171,8 @@ public class ContentDownloader { ...@@ -171,6 +171,8 @@ public class ContentDownloader {
Logger.e(TAG, "execKickTask encountered an exception.", e); Logger.e(TAG, "execKickTask encountered an exception.", e);
} catch (NetworkDisconnectedException e) { } catch (NetworkDisconnectedException e) {
Logger.e(TAG, "execKickTask encountered an exception.", e); Logger.e(TAG, "execKickTask encountered an exception.", e);
} catch (NullPointerException e) {
Logger.e(TAG, "execKickTask encountered an exception.", e);
} finally { } finally {
isKickTask = false; isKickTask = false;
} }
...@@ -178,7 +180,7 @@ public class ContentDownloader { ...@@ -178,7 +180,7 @@ public class ContentDownloader {
}); });
} }
private void execKickTask() throws AcmsException, NetworkDisconnectedException { private void execKickTask() throws AcmsException, NetworkDisconnectedException, NullPointerException {
autoPaused = false; autoPaused = false;
if (Logger.isDebugEnabled()) { if (Logger.isDebugEnabled()) {
Logger.d(TAG, "downloaderMap %s", getDownloadMapForDebug()); Logger.d(TAG, "downloaderMap %s", getDownloadMapForDebug());
...@@ -622,7 +624,7 @@ public class ContentDownloader { ...@@ -622,7 +624,7 @@ public class ContentDownloader {
* @throws AcmsException * @throws AcmsException
* @throws NetworkDisconnectedException * @throws NetworkDisconnectedException
*/ */
private void startDownload(ContentDto contentDto) throws AcmsException, NetworkDisconnectedException { private void startDownload(ContentDto contentDto) throws AcmsException, NetworkDisconnectedException, NullPointerException {
contentDto.status = DownloadStatusType.Downloading.type(); contentDto.status = DownloadStatusType.Downloading.type();
contentDto.resourcePath = ABVEnvironment.getInstance().getContentResourcesDirectoryPath(contentDto.contentId, false); contentDto.resourcePath = ABVEnvironment.getInstance().getContentResourcesDirectoryPath(contentDto.contentId, false);
contentDto.downloadStartDate = DateTimeUtil.getCurrentDate(); contentDto.downloadStartDate = DateTimeUtil.getCurrentDate();
...@@ -691,7 +693,7 @@ public class ContentDownloader { ...@@ -691,7 +693,7 @@ public class ContentDownloader {
return downloadUrl; return downloadUrl;
} }
private GetContentParameters getContentParameter(ContentDto contentDto) { private GetContentParameters getContentParameter(ContentDto contentDto) throws NullPointerException {
GetContentParameters param; GetContentParameters param;
param = new GetContentParameters(contentDto.contentId, cache.getMemberInfo().sid, ContentZipType.ContentDownload); param = new GetContentParameters(contentDto.contentId, cache.getMemberInfo().sid, ContentZipType.ContentDownload);
return param; return param;
......
...@@ -499,7 +499,8 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -499,7 +499,8 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
if (!contentRefresher.isRefreshing()) { if (!contentRefresher.isRefreshing()) {
configureKeepScreen(); configureKeepScreen();
} }
if (e != null) { //新着更新時にログアウトすることで、SIDが取得できなく、例外が発生したときにはトースト非表示
if (e != null && ABVDataCache.getInstance().getMemberInfo() != null) {
handleError(e); handleError(e);
} }
} }
......
...@@ -120,39 +120,17 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity { ...@@ -120,39 +120,17 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity {
} }
//更新する場合中止させる。 //更新する場合中止させる。
protected boolean refreshStop() { public boolean refreshStop() {
if (refreshFlag()) { try {
try { contentRefresher.stopRefresh();
contentRefresher.stopRefresh();
} catch (Exception e) {
} catch (Exception e) { Logger.w("stopRefresh failed at refreshStop.", e);
Logger.w("stopRefresh failed at refreshStop.", e);
// 停止ができなかった場合はfalseを返す。
// 停止ができなかった場合はfalseを返す。
return false;
}
}
return true;
}
//更新の場合動作させないメッセージ
protected boolean refreshMessage() {
if (refreshFlag()) {
handleErrorMessageToast(ErrorCode.L113);
return true;
}else{
return false; return false;
} }
} return true;
//更新中の場合true
protected boolean refreshFlag() {
// if (progressRefresh.getVisibility() == View.VISIBLE) {
// return true;
// }else{
// return false;
// }
return false;
} }
@Override @Override
...@@ -442,9 +420,11 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity { ...@@ -442,9 +420,11 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity {
} }
}); });
} }
//ログアウト時にも呼ばれるのでチェック
// 自動ダウンロード対象がある場合、新着更新が完了したあとに開始するように修正(jang) if (ABVDataCache.getInstance().getMemberInfo() != null) {
ContentDownloader.getInstance().autoDownload(); // 自動ダウンロード対象がある場合、新着更新が完了したあとに開始するように修正(jang)
ContentDownloader.getInstance().autoDownload();
}
} }
/** /**
......
...@@ -83,4 +83,11 @@ public class ABookSettingActivity extends PreferenceActivity { ...@@ -83,4 +83,11 @@ public class ABookSettingActivity extends PreferenceActivity {
return (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL; return (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
} }
/**
* 新着更新の中止処理
*/
public void stopRefresher() {
ABVUIActivity activity = ActivityHandlingHelper.getInstance().getPreviousOfSettingActivity();
activity.refreshStop();
}
} }
...@@ -177,6 +177,9 @@ public class ABookSettingFragment extends PreferenceFragment { ...@@ -177,6 +177,9 @@ public class ABookSettingFragment extends PreferenceFragment {
private void logout() { private void logout() {
try { try {
// 新着更新が実行されている場合停止
((ABookSettingActivity)getActivity()).stopRefresher();
// modify by Jang 2013.06.20 // modify by Jang 2013.06.20
UserAuthenticateLogic user = AbstractLogic.getLogic(UserAuthenticateLogic.class); UserAuthenticateLogic user = AbstractLogic.getLogic(UserAuthenticateLogic.class);
// ログイン情報がある場合のみログアウト処理を行う // ログイン情報がある場合のみログアウト処理を行う
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment