Commit 10e2ba20 by onuma

Merge branch 'features/1.4.210_46980' into features/1.4.210

# Conflicts:
#	ABVJE_Res_Default_Android/build.gradle
#	ABVJE_Res_Default_Android/res/values-ja/strings.xml
#	ABVJE_Res_Default_Android/res/values-ko/strings.xml
#	ABVJE_Res_Default_Android/res/values/strings.xml
#	gradle.properties
parents 194afe70 aeda04ff
......@@ -9,6 +9,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Observer;
import jp.agentec.abook.abv.bl.acms.client.json.AcmsBooleanResultJSON;
......@@ -45,6 +46,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.SceneEntryJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServerTimeZoneJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServiceOptionsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.TermsOfUseJson;
import jp.agentec.abook.abv.bl.acms.client.json.UnreadCountJSON;
import jp.agentec.abook.abv.bl.acms.client.json.UserInviteResultJSON;
import jp.agentec.abook.abv.bl.acms.client.json.WorkerGroupJSON;
......@@ -1097,6 +1099,19 @@ public class AcmsClient implements AcmsClientResponseListener {
HttpResponse response = send(AcmsApis.ApiDeleteProcess, params);
validateHttpResponse(response, AcmsApis.ApiGetPushMessages);
}
/**
* 利用規約に同意するかの文言を取得します
* @param url 取得するためのURL
* @return 文言を格納したJSON
*/
public TermsOfUseJson getTermsOfServiceText(String url) throws NetworkDisconnectedException, AcmsException {
String requestUrl = url + "?language=" + Locale.getDefault().getLanguage();
HttpResponse response = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).send(requestUrl, "", null);
return new TermsOfUseJson(response.httpResponseBody);
}
/**********************************************************************************************/
/** 以下、共用メソッド---------------------------------------------------------------------- **/
/**********************************************************************************************/
......
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONException;
import org.json.adf.JSONObject;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
/**
* 利用規約に同意するで取得するテキストを格納するJSON
*/
public class TermsOfUseJson extends AcmsCommonJSON {
public String message;
public TermsOfUseJson(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException, JSONException {
super.parse(json);
message = getString(json, "message", null);
}
}
......@@ -63,6 +63,8 @@ public class ABVEnvironment {
public int resourcePatternType;
public boolean operationGroupMasterClearFlg;
// 利用規約に同意するのテキストがあるURL
public String agree_to_terms_of_use_url = "";
// プライバシーポリシーURL
public String privacyPolicyUrl;
......
......@@ -3,6 +3,7 @@ package jp.agentec.abook.abv.bl.logic;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.TermsOfUseJson;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
import jp.agentec.abook.abv.bl.acms.type.SecurityPolicyType;
import jp.agentec.abook.abv.bl.acms.type.ServiceOption.ServiceOptionId;
......@@ -354,4 +355,19 @@ public class ContractLogic extends AbstractLogic {
public static boolean getBooleanValue(String value) {
return True.equals(value);
}
/**
* 利用規約の詳細文を取得する
* @param url 取得しに行くURL
* @return 取得した文字列(失敗したらnullが返る)
*/
public String getTermsOfServiceText(String url) {
try {
TermsOfUseJson response = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getTermsOfServiceText(url);
return response.message;
} catch (Exception e) {
Logger.e(TAG,"" + e);
}
return null;
}
}
......@@ -59,6 +59,8 @@ android {
// privacy policy
resValue("string", "privacy_policy_url", "${privacy_policy_url}")
// 利用規約
resValue("string", "agree_to_terms_of_use_url", "${agree_to_terms_of_use_url}")
}
sourceSets {
main {
......
......@@ -208,6 +208,7 @@
<string name="E128">ライセンス情報の取得に失敗しました。</string>
<string name="E129">パスワード に誤りがあります。</string>
<string name="E130">リンクは無効です。</string>
<string name="E132">利用規約に同意してください。</string>
<string name="L001">入力された情報に誤りがあります。\nユーザアカウントをご確認の上、再度ログインしてください。(L001)</string>
<string name="L002">この端末のIDは既に他のユーザアカウントに利用されています。\n管理者へお問い合わせください。(L002)</string>
......@@ -1510,4 +1511,7 @@
<string name="btn_print">PDF</string>
<string name="msg_oz_report_cancel">キャンセルした場合入力内容は破棄されます。よろしいですか?</string>
<string name="privacy_policy">プライバシーポリシー</string>
<string name="msg_agree_to_terms_of_use">利用規約に同意する</string>
<string name="clickable_detail_button">(詳細)</string>
<string name="err_gert_term_of_use_text">利用規約の取得に失敗しました。ネットワークの接続状態を確認してください。</string>
</resources>
......@@ -209,6 +209,7 @@
<string name="E128">라이선스 정보를 표시할 수 없습니다.</string>
<string name="E129">패스워드를 잘못 입력하셨습니다.</string>
<string name="E130">링크가 잘못되었습니다.</string>
<string name="E132">이용약관에 동의하십시오.</string>
<string name="L001">입력된 정보에 오류가 있습니다.\n로그인 정보를 다시 확인하신 후 로그인해 주십시오.(L001)</string>
<string name="L002">이 단말기의 ID는 기존의 다른 사용자 계정에 사용되었습니다.\n관리자에게 문의해 주십시오.(L002)</string>
......@@ -1515,4 +1516,7 @@
<string name="btn_print">PDF</string>
<string name="msg_oz_report_cancel">취소할 경우 입력내용은 파기됩니다. 괜찮으시겠습니까?</string>
<string name="privacy_policy">개인정보취급방침</string>
<string name="msg_agree_to_terms_of_use">이용약관에 동의함</string>
<string name="clickable_detail_button">(상세)</string>
<string name="err_gert_term_of_use_text">이용약관을 얻지 못했습니다. 네트워크 연결 상태를 확인해주세요.</string>
</resources>
\ No newline at end of file
......@@ -208,6 +208,7 @@
<string name="E128">Failed to get license info.</string>
<string name="E129">Password is not correct.</string>
<string name="E130">Link is invalid.</string>
<string name="E132">Please agree to the terms of use.</string>
<string name="L001">Incorrect information entered. \n Please check the user account, please login again.(L001)</string>
<string name="L002">This device ID is already used in other user accounts. \n Please contact the administrator.(L002)</string>
......@@ -1511,4 +1512,7 @@
<string name="btn_print">PDF</string>
<string name="msg_oz_report_cancel">If you cancel, your input will be discarded. Is it OK?</string>
<string name="privacy_policy">Privacy Policy</string>
<string name="msg_agree_to_terms_of_use">I agree to the terms of use</string>
<string name="clickable_detail_button">(detail)</string>
<string name="err_gert_term_of_use_text">Failed to get the terms of use. Check the network connection status.</string>
</resources>
......@@ -14,7 +14,7 @@ dependencies {
implementation files('libs/ozrv_android.jar')
api 'com.google.firebase:firebase-core:11.4.0'
api 'com.google.firebase:firebase-messaging:11.4.0'
api 'com.android.support:appcompat-v7:21.0.+'
api 'com.android.support:appcompat-v7:25.0.0'
implementation 'commons-codec:commons-codec:1.10'
implementation 'net.lingala.zip4j:zip4j:1.3.2'
......
......@@ -19,6 +19,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="40dp"
android:layout_marginStart="40dp"
android:layout_marginLeft="40dp"
android:layout_marginBottom="20dp"
android:background="@drawable/logo_login"
android:contentDescription="@string/login"
......@@ -69,16 +72,58 @@
android:hint="@string/title_password"
android:inputType="textPassword"
android:maxLines="1" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<CheckBox
android:id="@+id/check_box_agree"
android:layout_width="match_parent"
android:layout_height="46dp"
android:layout_gravity="center" />
<TextView
android:id="@+id/terms_of_use_text"
android:layout_width="match_parent"
android:layout_height="46dp"
android:layout_gravity="left"
android:gravity="center"
android:text="@string/msg_agree_to_terms_of_use"
android:textColor="@color/text_color" />
<Button
android:id="@+id/detail"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
android:layout_height="46dp"
android:freezesText="false"
android:text="@string/clickable_detail_button"
android:textColor="@color/text_color" />
</LinearLayout>
<Button
android:id="@+id/btn_login_off"
android:layout_width="match_parent"
android:layout_height="46dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:background="@drawable/btn_login_off"
android:contentDescription="@string/login"
android:text="@string/login"
android:textColor="@color/text_color"
android:visibility="visible"/>
<Button
android:id="@+id/btn_login"
android:layout_width="200dp"
android:id="@+id/btn_login_on"
android:layout_width="match_parent"
android:layout_height="46dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:background="@drawable/btn_login"
android:background="@drawable/btn_login_on"
android:contentDescription="@string/login"
android:text="@string/login"
android:textColor="@color/text_color" />
android:textColor="@color/text_color"
android:visibility="gone"/>
</LinearLayout>
</LinearLayout>
......
......@@ -5,6 +5,7 @@ public interface AppDefType {
interface PrefName {
String USER_PREFERENCE = "user_info";
String AGREE_STATUS = "agree_status";
}
interface ViewMode{
......
......@@ -26,7 +26,7 @@ public enum ErrorCode {
E111(R.string.E111),
E112(R.string.E112),
E129(R.string.E129),
E132(R.string.E132),
L001(R.string.L001),
L002(R.string.L002),
L003(R.string.L003),
......
......@@ -143,6 +143,8 @@ public class Initializer {
env.privacyPolicyUrl = s(R.string.privacy_policy_url);
env.setInitialized(true);
// 利用規約に同意するの詳細があるURL
env.agree_to_terms_of_use_url = s(R.string.agree_to_terms_of_use_url);
// Helperクラス初期化
ActivityHandlingHelper.getInstance().init(context);
......
......@@ -14,6 +14,8 @@ import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.TranslateAnimation;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
......@@ -53,6 +55,7 @@ import jp.agentec.abook.abv.cl.environment.DeviceInfo;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVLoginActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.UserPrefKey;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
......@@ -94,6 +97,12 @@ public class LoginActivity extends ABVLoginActivity {
private InputMethodManager imm;
private Button btnLoginOff;
private Button btnLoginOn;
private Button btnDetail;
private CheckBox chexBoxAgree;
private static String termsOfUseUrl = ABVEnvironment.getInstance().agree_to_terms_of_use_url;
@Override
public void onCreate(Bundle savedInstanceState) {
Logger.i(TAG, "onCreate");
......@@ -148,13 +157,58 @@ public class LoginActivity extends ABVLoginActivity {
}
});
findViewById(R.id.btn_login).setOnClickListener(new View.OnClickListener() {
// 活性化したログインボタン。
btnLoginOn = findViewById(R.id.btn_login_on);
btnLoginOn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
public void onClick(View v) {
tryLogin();
}
});
// 非活性化したログインボタン
btnLoginOff = findViewById(R.id.btn_login_off);
btnLoginOff.setVisibility(View.VISIBLE);
btnLoginOff.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tryLogin();
}
});
// チェックボックス
chexBoxAgree = findViewById(R.id.check_box_agree);
// 初期化(状態は保存しておく。ログアウトした後に使う)
boolean agree = PreferenceUtil.getUserPref(LoginActivity.this, AppDefType.PrefName.AGREE_STATUS, false);
if (agree) {
btnLoginOn.setVisibility(View.VISIBLE);
btnLoginOff.setVisibility(View.GONE);
chexBoxAgree.setChecked(true);
}
chexBoxAgree.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (chexBoxAgree.isChecked()) {
btnLoginOn.setVisibility(View.VISIBLE);
btnLoginOff.setVisibility(View.GONE);
PreferenceUtil.putUserPref(LoginActivity.this, AppDefType.PrefName.AGREE_STATUS, true);
} else {
btnLoginOn.setVisibility(View.GONE);
btnLoginOff.setVisibility(View.VISIBLE);
PreferenceUtil.putUserPref(LoginActivity.this, AppDefType.PrefName.AGREE_STATUS, false);
}
}
});
// agreementUrl が 空の場合は、チェックボックスなどを消す
if (StringUtil.isNullOrEmpty(termsOfUseUrl)) {
chexBoxAgree.setVisibility(View.GONE);
findViewById(R.id.terms_of_use_text).setVisibility(View.GONE);
findViewById(R.id.detail).setVisibility(View.GONE);
// ログインボタン
btnLoginOff.setVisibility(View.GONE);
btnLoginOn.setVisibility(View.VISIBLE);
}
//androidバジョン6以上からMAC idではなくandroid固有numberを取得ため、ダイアログで表示
if (android.os.Build.VERSION.SDK_INT >= 23) {
mBtnDeviceInfo.setVisibility(View.VISIBLE);
......@@ -193,6 +247,51 @@ public class LoginActivity extends ABVLoginActivity {
ErrorMessage.showErrorMessageDialog(this, R.string.app_name, ErrorCode.L110);
}
}
// 詳細ボタン
btnDetail = findViewById(R.id.detail);
btnDetail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
btnDetail.setEnabled(false); // 非活性化(連打防止)
// ネットワーク接続チェック
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
AlertDialogUtil.showAlertDialog(LoginActivity.this, getString(R.string.error), getString(R.string.err_gert_term_of_use_text), true, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
btnDetail.setEnabled(true); // 活性化
}
});
return;
}
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
// CMSより文言を取得し、ダイアログで表示する。
final String termsOfUseText = contractLogic.getTermsOfServiceText(termsOfUseUrl);
runOnUiThread(new Runnable() {
@Override
public void run() {
String title = getString(R.string.error);
String messageText = getString(R.string.err_gert_term_of_use_text);
if (termsOfUseText != null) {
title = getString(R.string.app_name);
messageText = termsOfUseText;
}
AlertDialogUtil.showAlertDialog(LoginActivity.this, title, messageText, true, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
btnDetail.setEnabled(true); // 活性化
}
});
}
});
}
});
}
});
}
@Override
......@@ -362,6 +461,13 @@ public class LoginActivity extends ABVLoginActivity {
return false;
}
}
if (!StringUtil.isNullOrEmpty(termsOfUseUrl)) {
if (!chexBoxAgree.isChecked()) {
handleErrorMessageToast(ErrorCode.E132);
return false;
}
}
return true;
}
......
......@@ -135,4 +135,7 @@ isStoreProduct=false
edition_type=5
#プライバシーポリシーURL
privacy_policy_url=https://www.agentec.jp/privacy/
\ No newline at end of file
privacy_policy_url=https://www.agentec.jp/privacy/
#利用規約に同意するのテキストがあるURL
agree_to_terms_of_use_url=https://chatdev2.agentec.jp/acms/common/getAgreement/
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