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