Commit 2cb30549 by Kazuyuki Hida

Merge branch 'features/1.4.500_dev' into 'features/1.4.500'

開発テストで見つかった不具合を修正

See merge request !317
parents 7917561a 6bc8d530
......@@ -71,7 +71,7 @@ public class ABVDataCache {
* @return サービスオプション情報です。指定したserviceOptionIdがサービスオプションリストに存在しない場合はnullを返します。
* @since 1.0.0
*/
public ServiceOptionDto getServiceOption(int serviceOptionId) {
public synchronized ServiceOptionDto getServiceOption(int serviceOptionId) {
if (serviceOptionDtoList != null) {
for (ServiceOptionDto serviceOptionDto : Collections.unmodifiableCollection(serviceOptionDtoList)) {
if (serviceOptionDto.serviceOptionId == serviceOptionId) {
......
package jp.agentec.abook.abv.ui.common.activity;
import android.app.AlertDialog;
import android.app.DownloadManager;
import android.app.DownloadManager.Request;
import android.content.Context;
......@@ -36,6 +37,7 @@ import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
import jp.agentec.abook.abv.cl.environment.NetworkAdapter;
import jp.agentec.abook.abv.cl.push.FcmManager;
......@@ -77,6 +79,12 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
protected void onStop() {
super.onStop();
ABVViewUnbindHelper.unbindReferences(getContentViewId());
AlertDialog dialog = AgreementToTermsHelper.getCurrentDialog();
if (dialog != null && dialog.isShowing()) {
dialog.dismiss();
LogoutHelper.logout(this, false);
}
}
protected abstract View getContentViewId();
......@@ -126,7 +134,10 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
logoutAlert(R.string.failed_to_get_terms_of_service);
}
private void logoutAlert(int messageRes) {
private void logoutAlert(final int messageRes) {
runOnUiThread(new Runnable() {
@Override
public void run() {
AlertDialogUtil.showAlertDialog(ABVNoAuthenticatedActivity.this, R.string.app_name, messageRes, true, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
......@@ -134,6 +145,8 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
}
});
}
});
}
};
AgreementToTermsHelper.confirmAgreement(this, isNormalSize(), listener);
}
......@@ -273,6 +286,8 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
private void showMain() {
try {
ContractLogic contractLogic = AbstractLogic.getLogic(ContractLogic.class);
contractLogic.initializeContractServiceOption();
try {
final ABVDataCache dataCache = ABVDataCache.getInstance();
dataCache.refreshServiceOptions();
......
......@@ -48,6 +48,17 @@ public class AgreementToTermsHelper {
void onError(Exception e);
}
private static AlertDialog currentDialog = null;
private static synchronized void setCurrentDialog(AlertDialog dialog) {
currentDialog = dialog;
}
public static synchronized AlertDialog getCurrentDialog() {
return currentDialog;
}
/**
* 同意規約情報を読み込んで、バージョンが異なっていたら、ダイアログを表示
* バージョンが同じだったら何もしない
......@@ -122,6 +133,13 @@ public class AgreementToTermsHelper {
params.width = disp.getWidth() * 4 / 5;
}
dialog.getWindow().setAttributes(params);
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
setCurrentDialog(null);
}
});
setCurrentDialog(dialog);
} catch (Exception e) {
listener.onError(e);
}
......
......@@ -27,6 +27,16 @@ public class LogoutHelper {
* @param activity 呼び出し元アクティビティ
*/
public static void logout(Activity activity) {
logout(activity, true);
}
/**
* ログアウトして、ログイン画面に遷移する
*
* @param activity 呼び出し元アクティビティ
* @param launchLogin trueならLoginActivityをstart
*/
public static void logout(Activity activity, boolean launchLogin) {
try {
// modify by Jang 2013.06.20
UserAuthenticateLogic user = AbstractLogic.getLogic(UserAuthenticateLogic.class);
......@@ -50,10 +60,11 @@ public class LogoutHelper {
SharedPreferences sharedPreferences = activity.getSharedPreferences(AppDefType.PrefName.USER_PREFERENCE, Context.MODE_PRIVATE);
sharedPreferences.edit().remove(AppDefType.UserPrefKey.GUEST_LOGIN).apply();
if (launchLogin) {
Intent intent = new Intent(activity, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
activity.startActivity(intent);
activity.finish();
}
}
}
......@@ -86,7 +86,6 @@ public class LoginPasswordChangeActivity extends ABVNoAuthenticatedActivity {
if (mType == 1 || mType == 2) {
// 催促
showMainActivity(mLoginId);
finish();
} else {
finishActivity();
}
......@@ -177,7 +176,6 @@ public class LoginPasswordChangeActivity extends ABVNoAuthenticatedActivity {
ABVToastUtil.showMakeText(LoginPasswordChangeActivity.this, getString(R.string.change_password_ok), Toast.LENGTH_LONG);
showMainActivity(mLoginId);
finish();
} catch (NetworkDisconnectedException e) {
Logger.e("NetworkDisconnectedException", e);
handleErrorMessageToast(ErrorCode.NETWORK);
......
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