|
|
@@ -4,6 +4,17 @@
|
|
|
|
|
|
package com.ntels.kneet.v3.view.mainmore;
|
|
|
|
|
|
+import com.ntels.kneet.v3.R;
|
|
|
+import com.ntels.kneet.v3.common.AppConfig;
|
|
|
+import com.ntels.kneet.v3.common.Constants;
|
|
|
+import com.ntels.kneet.v3.common.http.RetrofitCallback;
|
|
|
+import com.ntels.kneet.v3.common.http.RetrofitClient;
|
|
|
+import com.ntels.kneet.v3.common.http.RetrofitService;
|
|
|
+import com.ntels.kneet.v3.common.util.Util;
|
|
|
+import com.ntels.kneet.v3.common.widget.CustomActivity;
|
|
|
+import com.ntels.kneet.v3.model.BaseResponse;
|
|
|
+import com.ntels.kneet.v3.view.dialog.CustomDialog;
|
|
|
+
|
|
|
import android.app.Activity;
|
|
|
import android.content.Intent;
|
|
|
import android.content.res.Configuration;
|
|
|
@@ -14,18 +25,10 @@ import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
-import com.ntels.kneet.v3.R;
|
|
|
-import com.ntels.kneet.v3.common.AppConfig;
|
|
|
-import com.ntels.kneet.v3.common.Constants;
|
|
|
-import com.ntels.kneet.v3.common.c_interface.OnDataSendToReslut;
|
|
|
-import com.ntels.kneet.v3.common.http.HttpSend;
|
|
|
-import com.ntels.kneet.v3.common.http.Response;
|
|
|
-import com.ntels.kneet.v3.common.util.Dlog;
|
|
|
-import com.ntels.kneet.v3.common.util.Util;
|
|
|
-import com.ntels.kneet.v3.common.widget.CustomActivity;
|
|
|
-import com.ntels.kneet.v3.view.dialog.CustomDialog;
|
|
|
+import java.io.IOException;
|
|
|
|
|
|
-import org.json.JSONObject;
|
|
|
+import retrofit2.Call;
|
|
|
+import retrofit2.Callback;
|
|
|
|
|
|
/**
|
|
|
* <pre>
|
|
|
@@ -38,213 +41,263 @@ import org.json.JSONObject;
|
|
|
* </pre>
|
|
|
*/
|
|
|
public class SettingPasswordCheck extends CustomActivity implements View.OnClickListener,
|
|
|
- CustomDialog.OnMsgAlterToResult {
|
|
|
+ CustomDialog.OnMsgAlterToResult {
|
|
|
|
|
|
- private static final int MSG_COM_G_MEMBER_MEMBER_ID = 1;
|
|
|
+ private static final int MSG_COM_G_MEMBER_MEMBER_ID = 1;
|
|
|
|
|
|
- /*통신 관련*/
|
|
|
- private int tag = 0;
|
|
|
+ /*통신 관련*/
|
|
|
+ private int tag = 0;
|
|
|
|
|
|
- /*공통*/
|
|
|
- private Activity act;
|
|
|
- private AppConfig appConfig;
|
|
|
- private Intent intent;
|
|
|
- private Util util = new Util();
|
|
|
- private CustomDialog customDialog = new CustomDialog();
|
|
|
- private String callType = "";
|
|
|
- private String oldPassword = "";
|
|
|
+ /*공통*/
|
|
|
+ private Activity act;
|
|
|
+ private AppConfig appConfig;
|
|
|
+ private Intent intent;
|
|
|
+ private Util util = new Util();
|
|
|
+ private CustomDialog customDialog = new CustomDialog();
|
|
|
+ private String callType = "";
|
|
|
+ private String oldPassword = "";
|
|
|
|
|
|
- @Override
|
|
|
- public void onCreate(Bundle savedInstanceState) {
|
|
|
-
|
|
|
- super.onCreate(savedInstanceState);
|
|
|
+ @Override
|
|
|
+ public void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
|
- act = SettingPasswordCheck.this;
|
|
|
- appConfig = (AppConfig) act.getApplicationContext();
|
|
|
- customDialog.setOnMsgAlterToResultEvent(this);
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
|
|
|
- View viewToLoad = LayoutInflater.from(act).inflate(R.layout.setting_password_chk, null);
|
|
|
- this.setContentView(viewToLoad);
|
|
|
+ act = SettingPasswordCheck.this;
|
|
|
+ appConfig = (AppConfig) act.getApplicationContext();
|
|
|
+ customDialog.setOnMsgAlterToResultEvent(this);
|
|
|
|
|
|
- if (null != getIntent()) {
|
|
|
- Intent intent = getIntent();
|
|
|
- callType = intent.getStringExtra(Constants.EXTRA_CALL_TYPE);
|
|
|
- }
|
|
|
+ View viewToLoad = LayoutInflater.from(act).inflate(R.layout.setting_password_chk, null);
|
|
|
+ this.setContentView(viewToLoad);
|
|
|
|
|
|
- util.getView(act, R.id.llBtn1).setOnClickListener(this);
|
|
|
- util.getView(act, R.id.llBtn2).setOnClickListener(this);
|
|
|
+ if (null != getIntent()) {
|
|
|
+ Intent intent = getIntent();
|
|
|
+ callType = intent.getStringExtra(Constants.EXTRA_CALL_TYPE);
|
|
|
+ }
|
|
|
|
|
|
- util.getEditText(act, R.id.edtPassword).setText("");
|
|
|
- }
|
|
|
+ util.getView(act, R.id.llBtn1).setOnClickListener(this);
|
|
|
+ util.getView(act, R.id.llBtn2).setOnClickListener(this);
|
|
|
|
|
|
- @Override
|
|
|
- public void onConfigurationChanged(Configuration newConfig) {
|
|
|
+ util.getEditText(act, R.id.edtPassword).setText("");
|
|
|
+ }
|
|
|
|
|
|
- super.onConfigurationChanged(newConfig);
|
|
|
- }
|
|
|
+ @Override
|
|
|
+ public void onConfigurationChanged(Configuration newConfig) {
|
|
|
|
|
|
- @Override
|
|
|
- public void onClick(View view) {
|
|
|
+ super.onConfigurationChanged(newConfig);
|
|
|
+ }
|
|
|
|
|
|
- switch (view.getId()) {
|
|
|
- case R.id.llBtn1:
|
|
|
- oldPassword = util.getEditTextVal(act, R.id.edtPassword);
|
|
|
- if (oldPassword.equals("")) {
|
|
|
- util.setShowToast(act, util.getString(act, R.string.MSG847), Toast.LENGTH_SHORT);
|
|
|
- return;
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+
|
|
|
+ switch (view.getId()) {
|
|
|
+ case R.id.llBtn1:
|
|
|
+ oldPassword = util.getEditTextVal(act, R.id.edtPassword);
|
|
|
+ if ("".equals(oldPassword)) {
|
|
|
+ util.setShowToast(act, util.getString(act, R.string.MSG847), Toast.LENGTH_SHORT);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ view.setEnabled(false);
|
|
|
+ comHandler.sendMessageDelayed(comHandler.obtainMessage(MSG_COM_G_MEMBER_MEMBER_ID), 10);
|
|
|
+ break;
|
|
|
+ case R.id.llBtn2:
|
|
|
+ onBackPressed();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
-
|
|
|
- view.setEnabled(false);
|
|
|
- comHandler.sendMessageDelayed(comHandler.obtainMessage(MSG_COM_G_MEMBER_MEMBER_ID), 10);
|
|
|
- break;
|
|
|
- case R.id.llBtn2:
|
|
|
- onBackPressed();
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- Handler comHandler = new Handler(new IncomingHandlerCallBack());
|
|
|
+ Handler comHandler = new Handler(new IncomingHandlerCallBack());
|
|
|
|
|
|
- class IncomingHandlerCallBack implements Handler.Callback {
|
|
|
+ class IncomingHandlerCallBack implements Handler.Callback {
|
|
|
|
|
|
- @Override
|
|
|
- public boolean handleMessage(Message msg) {
|
|
|
-
|
|
|
- tag = msg.what;
|
|
|
- switch (msg.what) {
|
|
|
- case MSG_COM_G_MEMBER_MEMBER_ID:
|
|
|
- sendGetMemberPassword();
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- return true;
|
|
|
+ @Override
|
|
|
+ public boolean handleMessage(Message msg) {
|
|
|
+
|
|
|
+ tag = msg.what;
|
|
|
+ switch (msg.what) {
|
|
|
+ case MSG_COM_G_MEMBER_MEMBER_ID:
|
|
|
+ requestCheckPassword();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- /**
|
|
|
- * (기존)비밀번호 확인(비밀번호 정보를 확인한다) 요청.
|
|
|
- */
|
|
|
- private void sendGetMemberPassword() {
|
|
|
-
|
|
|
- try {
|
|
|
- HttpSend httpSend = new HttpSend(act);
|
|
|
- httpSend.setOnDataSendToReslutEvent(new OnDataSendToReslut() {
|
|
|
- @Override
|
|
|
- public void resultResponse(Response result) {
|
|
|
+ /**
|
|
|
+ * (기존)비밀번호 확인(비밀번호 정보를 확인한다) 요청.
|
|
|
+ */
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ private void requestCheckPassword() {
|
|
|
+ Call<Void> checkPasswordCall = RetrofitService.getUserService().checkPassword(oldPassword);
|
|
|
+ checkPasswordCall.enqueue(new RetrofitCallback(act, new Callback<Void>() {
|
|
|
+ @Override
|
|
|
+ public void onResponse(Call<Void> call, retrofit2.Response<Void> response) {
|
|
|
+ if (null != response) {
|
|
|
+ if (response.isSuccessful()) {
|
|
|
+ if ("1".equals(callType)) {
|
|
|
+ intent = new Intent(act, SettingPasswordChange.class);
|
|
|
+ intent.putExtra(Constants.EXTRA_PASSWORD, oldPassword);
|
|
|
+ util.callActivityForResultNoAnim(act, intent, Constants.ACT_SETTING_PASSWORD_CHANGE);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ BaseResponse errorResponse;
|
|
|
+ try {
|
|
|
+ errorResponse = (BaseResponse) RetrofitClient.getClient().responseBodyConverter(BaseResponse.class,
|
|
|
+ BaseResponse.class.getAnnotations()).convert(response.errorBody());
|
|
|
+
|
|
|
+ if ("401".equals(errorResponse.getErrCode())) {
|
|
|
+ customDialog.msgAlert(act, Constants.MSG998, errorResponse.getErrMsg());
|
|
|
+ } else if ("401-106".equals(errorResponse.getErrCode())) {
|
|
|
+ customDialog.msgAlert(act, Constants.MSG997, errorResponse.getErrMsg());
|
|
|
+ } else {
|
|
|
+ customDialog.msgAlert(act, Constants.MSG000, errorResponse.getErrMsg());
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ customDialog.msgAlert(act, Constants.MSG807);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ customDialog.msgAlert(act, Constants.MSG807);
|
|
|
+ }
|
|
|
+ util.getView(act, R.id.llBtn1).setEnabled(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFailure(Call<Void> call, Throwable t) {
|
|
|
+ t.printStackTrace();
|
|
|
+ customDialog.msgAlert(act, Constants.MSG807);
|
|
|
+ util.getView(act, R.id.llBtn1).setEnabled(true);
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ }
|
|
|
|
|
|
- resultGetMemberPassword(result);
|
|
|
+ /**
|
|
|
+ * (기존)비밀번호 확인(비밀번호 정보를 확인한다) 요청.
|
|
|
+ */
|
|
|
+ /*private void sendGetMemberPassword() {
|
|
|
+
|
|
|
+ try {
|
|
|
+ HttpSend httpSend = new HttpSend(act);
|
|
|
+ httpSend.setOnDataSendToReslutEvent(new OnDataSendToReslut() {
|
|
|
+ @Override
|
|
|
+ public void resultResponse(Response result) {
|
|
|
+
|
|
|
+ resultGetMemberPassword(result);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //공통 변수 입력
|
|
|
+ httpSend.G_member_member_id(appConfig.getLogin_Member_Id(), oldPassword);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ /**
|
|
|
+ * {@link #sendGetMemberPassword()} 요청 결과.
|
|
|
+ *
|
|
|
+ * @param response 결과 data
|
|
|
+ */
|
|
|
+ /*private void resultGetMemberPassword(Response response) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ if (response.getStatusCode() == 200) {
|
|
|
+ if (callType.equals("1")) {
|
|
|
+ intent = new Intent(act, SettingPasswordChange.class);
|
|
|
+ intent.putExtra(Constants.EXTRA_PASSWORD, oldPassword);
|
|
|
+ util.callActivityForResultNoAnim(act, intent, Constants.ACT_SETTING_PASSWORD_CHANGE);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ JSONObject joResult = new JSONObject(response.getContent());
|
|
|
+ Dlog.v(joResult.toString());
|
|
|
+ String errorCode = util.null2string(joResult.get(Constants.HTTP_err_code));
|
|
|
+ String errorMsg = util.null2string(joResult.get(Constants.HTTP_err_msg));
|
|
|
+
|
|
|
+ if (errorCode.equals("401")) {
|
|
|
+ customDialog.msgAlert(act, Constants.MSG998, errorMsg);
|
|
|
+ } else if (errorCode.equals("401-106")) {
|
|
|
+ customDialog.msgAlert(act, Constants.MSG997, errorMsg);
|
|
|
+ } else {
|
|
|
+ customDialog.msgAlert(act, Constants.MSG000, errorMsg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ customDialog.msgAlert(act, Constants.MSG807);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ util.getView(act, R.id.llBtn1).setEnabled(true);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
}
|
|
|
- });
|
|
|
+ }*/
|
|
|
|
|
|
- //공통 변수 입력
|
|
|
- httpSend.G_member_member_id(appConfig.getLogin_Member_Id(), oldPassword);
|
|
|
- } catch (Exception ex) {
|
|
|
- ex.printStackTrace();
|
|
|
+ @Override
|
|
|
+ public void onBackPressed() {
|
|
|
+
|
|
|
+ intent = new Intent();
|
|
|
+ act.setResult(RESULT_CANCELED, intent);
|
|
|
+ finish();
|
|
|
+ return;
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * {@link #sendGetMemberPassword()} 요청 결과.
|
|
|
- *
|
|
|
- * @param response 결과 data
|
|
|
- */
|
|
|
- private void resultGetMemberPassword(Response response) {
|
|
|
-
|
|
|
- try {
|
|
|
- if (response.getStatusCode() == 200) {
|
|
|
- if (callType.equals("1")) {
|
|
|
- intent = new Intent(act, SettingPasswordChange.class);
|
|
|
- intent.putExtra(Constants.EXTRA_PASSWORD, oldPassword);
|
|
|
- util.callActivityForResultNoAnim(act, intent, Constants.ACT_SETTING_PASSWORD_CHANGE);
|
|
|
- }
|
|
|
- } else {
|
|
|
- JSONObject joResult = new JSONObject(response.getContent());
|
|
|
- Dlog.v(joResult.toString());
|
|
|
- String errorCode = util.null2string(joResult.get(Constants.HTTP_err_code));
|
|
|
- String errorMsg = util.null2string(joResult.get(Constants.HTTP_err_msg));
|
|
|
-
|
|
|
- if (errorCode.equals("401")) {
|
|
|
- customDialog.msgAlert(act, Constants.MSG998, errorMsg);
|
|
|
- } else if (errorCode.equals("401-106")) {
|
|
|
- customDialog.msgAlert(act, Constants.MSG997, errorMsg);
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
+
|
|
|
+ super.onActivityResult(requestCode, resultCode, data);
|
|
|
+ if (resultCode == RESULT_OK) {
|
|
|
+ switch (requestCode) {
|
|
|
+ case Constants.ACT_SETTING_PASSWORD_CHANGE:
|
|
|
+ intent = new Intent();
|
|
|
+ act.setResult(RESULT_OK, intent);
|
|
|
+ finish();
|
|
|
+ break;
|
|
|
+ case Constants.ACT_SETTING_HOME_DEL:
|
|
|
+ intent = new Intent();
|
|
|
+ act.setResult(RESULT_OK, intent);
|
|
|
+ finish();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
} else {
|
|
|
- customDialog.msgAlert(act, Constants.MSG000, errorMsg);
|
|
|
+ switch (requestCode) {
|
|
|
+ case Constants.ACT_SETTING_ACCOUNT_DEL_CONFIRM:
|
|
|
+ case Constants.ACT_SETTING_PASSWORD_CHANGE:
|
|
|
+ intent = new Intent();
|
|
|
+ act.setResult(RESULT_OK, intent);
|
|
|
+ finish();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- } catch (Exception ex) {
|
|
|
- ex.printStackTrace();
|
|
|
- customDialog.msgAlert(act, Constants.MSG807);
|
|
|
}
|
|
|
- try {
|
|
|
- util.getView(act, R.id.llBtn1).setEnabled(true);
|
|
|
- } catch (Exception ex) {
|
|
|
- ex.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onBackPressed() {
|
|
|
-
|
|
|
- intent = new Intent();
|
|
|
- act.setResult(RESULT_CANCELED, intent);
|
|
|
- finish();
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
-
|
|
|
- super.onActivityResult(requestCode, resultCode, data);
|
|
|
- if (resultCode == RESULT_OK) {
|
|
|
- switch (requestCode) {
|
|
|
- case Constants.ACT_SETTING_PASSWORD_CHANGE:
|
|
|
- intent = new Intent();
|
|
|
- act.setResult(RESULT_OK, intent);
|
|
|
- finish();
|
|
|
- break;
|
|
|
- case Constants.ACT_SETTING_HOME_DEL:
|
|
|
- intent = new Intent();
|
|
|
- act.setResult(RESULT_OK, intent);
|
|
|
- finish();
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- } else {
|
|
|
- switch (requestCode) {
|
|
|
- case Constants.ACT_SETTING_ACCOUNT_DEL_CONFIRM:
|
|
|
- case Constants.ACT_SETTING_PASSWORD_CHANGE:
|
|
|
- intent = new Intent();
|
|
|
- act.setResult(RESULT_OK, intent);
|
|
|
- finish();
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void resultCustomDialogResponse(int msgId, int btnResult) {
|
|
|
-
|
|
|
- switch (msgId) {
|
|
|
-
|
|
|
- case Constants.MSG998:
|
|
|
- util.callApp_Start(act, "LOGOUT");
|
|
|
- break;
|
|
|
- case Constants.MSG997:
|
|
|
- util.callApp_Start(act, "HOME_RELOAD");
|
|
|
- break;
|
|
|
- case Constants.MSG807:
|
|
|
- if (btnResult == 1) {
|
|
|
- comHandler.sendMessageDelayed(comHandler.obtainMessage(tag), 10);
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void resultCustomDialogResponse(int msgId, int btnResult) {
|
|
|
+
|
|
|
+ switch (msgId) {
|
|
|
+
|
|
|
+ case Constants.MSG998:
|
|
|
+ util.callApp_Start(act, "LOGOUT");
|
|
|
+ break;
|
|
|
+ case Constants.MSG997:
|
|
|
+ util.callApp_Start(act, "HOME_RELOAD");
|
|
|
+ break;
|
|
|
+ case Constants.MSG807:
|
|
|
+ if (btnResult == 1) {
|
|
|
+ comHandler.sendMessageDelayed(comHandler.obtainMessage(tag), 10);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
}
|
|
|
- }
|
|
|
}
|