Commit 85d821f7 by onuma

利用規約に同意する。ログイン画面修正と、ダイアログ表示。

parent 4e8470d2
...@@ -63,6 +63,8 @@ public class ABVEnvironment { ...@@ -63,6 +63,8 @@ public class ABVEnvironment {
public int resourcePatternType; public int resourcePatternType;
public boolean operationGroupMasterClearFlg; public boolean operationGroupMasterClearFlg;
// 利用規約に同意するのテキストがあるURL
public String agree_to_terms_of_use_url = "";
////////////////////////////// 定数 ////////////////////////////////// ////////////////////////////// 定数 //////////////////////////////////
......
...@@ -56,6 +56,8 @@ android { ...@@ -56,6 +56,8 @@ android {
resValue("integer", "push_message", "${push_message}") resValue("integer", "push_message", "${push_message}")
resValue("integer", "check_app_update", "${check_app_update}") resValue("integer", "check_app_update", "${check_app_update}")
resValue("integer", "not_delete_all_contents", "${not_delete_all_contents}") resValue("integer", "not_delete_all_contents", "${not_delete_all_contents}")
// 利用規約
resValue("string", "agree_to_terms_of_use_url", "${agree_to_terms_of_use_url}")
} }
sourceSets { sourceSets {
main { main {
......
...@@ -208,6 +208,7 @@ ...@@ -208,6 +208,7 @@
<string name="E128">ライセンス情報の取得に失敗しました。</string> <string name="E128">ライセンス情報の取得に失敗しました。</string>
<string name="E129">パスワード に誤りがあります。</string> <string name="E129">パスワード に誤りがあります。</string>
<string name="E130">リンクは無効です。</string> <string name="E130">リンクは無効です。</string>
<string name="E132">利用規約に同意してください。</string>
<string name="L001">入力された情報に誤りがあります。\nユーザアカウントをご確認の上、再度ログインしてください。(L001)</string> <string name="L001">入力された情報に誤りがあります。\nユーザアカウントをご確認の上、再度ログインしてください。(L001)</string>
<string name="L002">この端末のIDは既に他のユーザアカウントに利用されています。\n管理者へお問い合わせください。(L002)</string> <string name="L002">この端末のIDは既に他のユーザアカウントに利用されています。\n管理者へお問い合わせください。(L002)</string>
...@@ -1508,4 +1509,6 @@ ...@@ -1508,4 +1509,6 @@
<string name="btn_communication">コミュニケーション</string> <string name="btn_communication">コミュニケーション</string>
<string name="btn_setting">設定</string> <string name="btn_setting">設定</string>
<string name="btn_print">PDF</string> <string name="btn_print">PDF</string>
<string name="msg_agree_to_terms_of_use">利用規約に同意する</string>
<string name="clickable_detail_button">(詳細)</string>
</resources> </resources>
...@@ -209,6 +209,7 @@ ...@@ -209,6 +209,7 @@
<string name="E128">라이선스 정보를 표시할 수 없습니다.</string> <string name="E128">라이선스 정보를 표시할 수 없습니다.</string>
<string name="E129">패스워드를 잘못 입력하셨습니다.</string> <string name="E129">패스워드를 잘못 입력하셨습니다.</string>
<string name="E130">링크가 잘못되었습니다.</string> <string name="E130">링크가 잘못되었습니다.</string>
<string name="E132">이용약관에 동의하십시오.</string>
<string name="L001">입력된 정보에 오류가 있습니다.\n로그인 정보를 다시 확인하신 후 로그인해 주십시오.(L001)</string> <string name="L001">입력된 정보에 오류가 있습니다.\n로그인 정보를 다시 확인하신 후 로그인해 주십시오.(L001)</string>
<string name="L002">이 단말기의 ID는 기존의 다른 사용자 계정에 사용되었습니다.\n관리자에게 문의해 주십시오.(L002)</string> <string name="L002">이 단말기의 ID는 기존의 다른 사용자 계정에 사용되었습니다.\n관리자에게 문의해 주십시오.(L002)</string>
...@@ -1513,4 +1514,6 @@ ...@@ -1513,4 +1514,6 @@
<string name="btn_communication">커뮤니케이션</string> <string name="btn_communication">커뮤니케이션</string>
<string name="btn_setting">설정</string> <string name="btn_setting">설정</string>
<string name="btn_print">PDF</string> <string name="btn_print">PDF</string>
<string name="msg_agree_to_terms_of_use">이용약관에 동의함</string>
<string name="clickable_detail_button">(상세)</string>
</resources> </resources>
\ No newline at end of file
...@@ -208,6 +208,7 @@ ...@@ -208,6 +208,7 @@
<string name="E128">Failed to get license info.</string> <string name="E128">Failed to get license info.</string>
<string name="E129">Password is not correct.</string> <string name="E129">Password is not correct.</string>
<string name="E130">Link is invalid.</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="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> <string name="L002">This device ID is already used in other user accounts. \n Please contact the administrator.(L002)</string>
...@@ -1509,4 +1510,6 @@ ...@@ -1509,4 +1510,6 @@
<string name="btn_communication">Communication</string> <string name="btn_communication">Communication</string>
<string name="btn_setting">Setting</string> <string name="btn_setting">Setting</string>
<string name="btn_print">PDF</string> <string name="btn_print">PDF</string>
<string name="msg_agree_to_terms_of_use">I agree to the terms of use</string>
<string name="clickable_detail_button">(detail)</string>
</resources> </resources>
...@@ -14,7 +14,7 @@ dependencies { ...@@ -14,7 +14,7 @@ dependencies {
implementation files('libs/ozrv_android.jar') implementation files('libs/ozrv_android.jar')
api 'com.google.firebase:firebase-core:11.4.0' api 'com.google.firebase:firebase-core:11.4.0'
api 'com.google.firebase:firebase-messaging: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 'commons-codec:commons-codec:1.10'
implementation 'net.lingala.zip4j:zip4j:1.3.2' implementation 'net.lingala.zip4j:zip4j:1.3.2'
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_margin="40dp"
android:layout_marginStart="40dp"
android:layout_marginLeft="40dp"
android:layout_marginBottom="20dp" android:layout_marginBottom="20dp"
android:background="@drawable/logo_login" android:background="@drawable/logo_login"
android:contentDescription="@string/login" android:contentDescription="@string/login"
...@@ -69,16 +72,58 @@ ...@@ -69,16 +72,58 @@
android:hint="@string/title_password" android:hint="@string/title_password"
android:inputType="textPassword" android:inputType="textPassword"
android:maxLines="1" /> 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/textView6"
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 <Button
android:id="@+id/btn_login" android:id="@+id/btn_login_off"
android:layout_width="200dp" android:layout_width="match_parent"
android:layout_height="46dp" android:layout_height="46dp"
android:layout_gravity="center"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:background="@drawable/btn_login" android:background="@drawable/btn_login_off"
android:contentDescription="@string/login" android:contentDescription="@string/login"
android:text="@string/login" android:text="@string/login"
android:textColor="@color/text_color" /> android:textColor="@color/text_color"
android:visibility="visible"/>
<Button
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_on"
android:contentDescription="@string/login"
android:text="@string/login"
android:textColor="@color/text_color"
android:visibility="gone"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
......
...@@ -5,6 +5,7 @@ public interface AppDefType { ...@@ -5,6 +5,7 @@ public interface AppDefType {
interface PrefName { interface PrefName {
String USER_PREFERENCE = "user_info"; String USER_PREFERENCE = "user_info";
String AGREE_STATUS = "agree_status";
} }
interface ViewMode{ interface ViewMode{
......
...@@ -26,7 +26,7 @@ public enum ErrorCode { ...@@ -26,7 +26,7 @@ public enum ErrorCode {
E111(R.string.E111), E111(R.string.E111),
E112(R.string.E112), E112(R.string.E112),
E129(R.string.E129), E129(R.string.E129),
E132(R.string.E132),
L001(R.string.L001), L001(R.string.L001),
L002(R.string.L002), L002(R.string.L002),
L003(R.string.L003), L003(R.string.L003),
......
...@@ -140,6 +140,8 @@ public class Initializer { ...@@ -140,6 +140,8 @@ public class Initializer {
env.aspectType = getAspectType(); env.aspectType = getAspectType();
env.setInitialized(true); env.setInitialized(true);
// 利用規約に同意するの詳細があるURL
env.agree_to_terms_of_use_url = s(R.string.agree_to_terms_of_use_url);
// Helperクラス初期化 // Helperクラス初期化
ActivityHandlingHelper.getInstance().init(context); ActivityHandlingHelper.getInstance().init(context);
......
...@@ -14,11 +14,23 @@ import android.view.animation.Animation; ...@@ -14,11 +14,23 @@ import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener; import android.view.animation.Animation.AnimationListener;
import android.view.animation.TranslateAnimation; import android.view.animation.TranslateAnimation;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.json.adf.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Locale;
import jp.agentec.abook.abv.bl.acms.client.json.CmsUrlJSON; import jp.agentec.abook.abv.bl.acms.client.json.CmsUrlJSON;
import jp.agentec.abook.abv.bl.acms.type.DeleteDataType; import jp.agentec.abook.abv.bl.acms.type.DeleteDataType;
import jp.agentec.abook.abv.bl.acms.type.LoginMode; import jp.agentec.abook.abv.bl.acms.type.LoginMode;
...@@ -53,12 +65,16 @@ import jp.agentec.abook.abv.cl.environment.DeviceInfo; ...@@ -53,12 +65,16 @@ import jp.agentec.abook.abv.cl.environment.DeviceInfo;
import jp.agentec.abook.abv.cl.util.PreferenceUtil; import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVLoginActivity; 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.appinfo.AppDefType.UserPrefKey;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode; import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
import jp.agentec.abook.abv.ui.common.constant.ErrorMessage; import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog; import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.helper.ABVViewUnbindHelper; import jp.agentec.abook.abv.ui.common.helper.ABVViewUnbindHelper;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil; import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.adf.net.http.HttpRequestSender;
import jp.agentec.adf.net.http.HttpResponse;
import jp.agentec.adf.util.NumericUtil;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
/** /**
...@@ -94,6 +110,12 @@ public class LoginActivity extends ABVLoginActivity { ...@@ -94,6 +110,12 @@ public class LoginActivity extends ABVLoginActivity {
private InputMethodManager imm; private InputMethodManager imm;
private Button btnLoginOff;
private Button btnLoginOn;
private CheckBox chexBoxAgree;
private String detail_text = "";
  • 他の変数名と合わせてdetailTextではいかがでしょうか? 利用規約の内容なので、termsOfServiceTextではいかがでしょうか? これってメンバー変数にする必要はあるのでしょうか?

    Edited by Kim Jinsung
  • 了解しました。他の個所がterms of use で統一しているので termsOfUseTextにします。

Please register or sign in to reply
private static String agreementUrl = ABVEnvironment.getInstance().agree_to_terms_of_use_url;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
Logger.i(TAG, "onCreate"); Logger.i(TAG, "onCreate");
...@@ -148,12 +170,40 @@ public class LoginActivity extends ABVLoginActivity { ...@@ -148,12 +170,40 @@ public class LoginActivity extends ABVLoginActivity {
} }
}); });
findViewById(R.id.btn_login).setOnClickListener(new View.OnClickListener() { // ログインボタン(最初はGONEにして見せない)
btnLoginOn = findViewById(R.id.btn_login_on);
btnLoginOn.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
tryLogin(); tryLogin();
} }
}); });
btnLoginOff = findViewById(R.id.btn_login_off);
btnLoginOff.setVisibility(View.VISIBLE);
// チェックボックス
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);
}
}
});
//androidバジョン6以上からMAC idではなくandroid固有numberを取得ため、ダイアログで表示 //androidバジョン6以上からMAC idではなくandroid固有numberを取得ため、ダイアログで表示
if (android.os.Build.VERSION.SDK_INT >= 23) { if (android.os.Build.VERSION.SDK_INT >= 23) {
...@@ -193,6 +243,89 @@ public class LoginActivity extends ABVLoginActivity { ...@@ -193,6 +243,89 @@ public class LoginActivity extends ABVLoginActivity {
ErrorMessage.showErrorMessageDialog(this, R.string.app_name, ErrorCode.L110); ErrorMessage.showErrorMessageDialog(this, R.string.app_name, ErrorCode.L110);
} }
} }
// 詳細ボタン
Button btnDetail = findViewById(R.id.detail);
btnDetail.setOnClickListener(new View.OnClickListener() {
@Override
Please register or sign in to reply
public void onClick(View view) {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
// CMSより文言を取得し、ダイアログで表示する。
detail_text = getAgreementText();
runOnUiThread(new Runnable() {
@Override
public void run() {
final ABookAlertDialog messageDialog = AlertDialogUtil.createAlertDialog(LoginActivity.this, R.string.error);
if (detail_text != null) {
JSONObject detail_json = new JSONObject(detail_text);
Locale locale = Locale.getDefault();
if (locale.getLanguage().equals("ja")) {
messageDialog.setMessage(detail_json.getString("ja"));
} else if (locale.getLanguage().equals("ko")) {
messageDialog.setMessage(detail_json.getString("ko"));
} else {
messageDialog.setMessage(detail_json.getString("en"));
}
} else {
messageDialog.setMessage(R.string.NETWORK);
}
messageDialog.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
messageDialog.show();
}
});
}
});
}
});
}
/**
* 利用規約の詳細文を取得する
* @return 取得した文字列(失敗したらnullが返る)
*/
private String getAgreementText() {
  • 通信処理はActivityではなくLogicに実装してください。 ContractLogicで良いかと思います。

  • 了解しました

Please register or sign in to reply
HttpResponse response = new HttpResponse();
HttpURLConnection conn = null;
try {
java.net.URL url = new URL(agreementUrl);
Logger.d(TAG, "url=" + url);
conn = HttpRequestSender.openConnection("GET", url, "UTF-8", null, null, 5000);
Logger.i(TAG,"responseCode : " + conn.getResponseCode());
response.httpResponseCode = conn.getResponseCode();
if (response.httpResponseCode != 200) {
return null;
}
response.httpResponseMessage = conn.getResponseMessage();
response.contentLength = NumericUtil.parseLong(conn.getHeaderField("Content-Length"), 0);
InputStream inputStream = conn.getInputStream();
BufferedReader bufferReader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
String resultJson = new String();
String str;
while ( null != ( str = bufferReader.readLine() ) ) {
resultJson = resultJson + str;
}
bufferReader.close();
Logger.i(TAG,"response JSON : " + resultJson);
Please register or sign in to reply
return resultJson;
} catch (IOException e) {
Logger.e(e.getMessage());
} catch (NumberFormatException e) {
Logger.e(e.getMessage());
} finally {
if (conn != null) {
conn.disconnect();
}
}
return null;
} }
@Override @Override
...@@ -362,6 +495,10 @@ public class LoginActivity extends ABVLoginActivity { ...@@ -362,6 +495,10 @@ public class LoginActivity extends ABVLoginActivity {
return false; return false;
} }
} }
if (!chexBoxAgree.isChecked()) {
handleErrorMessageToast(ErrorCode.E132);
return false;
}
return true; return true;
} }
......
...@@ -38,8 +38,8 @@ app_versioncode=1 ...@@ -38,8 +38,8 @@ app_versioncode=1
# abvEnvironments.xml # abvEnvironments.xml
#cms server #cms server
acms_address=https://check130.agentec.jp/acms acms_address=https://chatdev2.agentec.jp/acms
download_server_address=https://check130.agentec.jp/acms download_server_address=https://chatdev2.agentec.jp/acms
#syncview server #syncview server
websocket_server_http_url=https://check130.agentec.jp/v1 websocket_server_http_url=https://check130.agentec.jp/v1
...@@ -133,3 +133,6 @@ isStoreProduct=false ...@@ -133,3 +133,6 @@ isStoreProduct=false
#CHECK = 5 #CHECK = 5
#EXFRAME = 6 #EXFRAME = 6
edition_type=5 edition_type=5
// 利用規約に同意するのテキストがあるURL
agree_to_terms_of_use_url = https://chatdev2.agentec.jp/acms/common/getAgreement/
\ No newline at end of file
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