|
|
@@ -5,6 +5,7 @@
|
|
|
package com.ntels.onecable.view.homemember;
|
|
|
|
|
|
import com.ntels.onecable.R;
|
|
|
+import com.ntels.onecable.common.AppConfig;
|
|
|
import com.ntels.onecable.common.Constants;
|
|
|
import com.ntels.onecable.common.c_interface.OnDataSendToReslut;
|
|
|
import com.ntels.onecable.common.http.HttpSend;
|
|
|
@@ -14,13 +15,11 @@ import com.ntels.onecable.common.util.Util;
|
|
|
import com.ntels.onecable.common.widget.CustomActivity;
|
|
|
import com.ntels.onecable.common.widget.CustomScrollView;
|
|
|
import com.ntels.onecable.view.dialog.CustomDialog;
|
|
|
-import com.ntels.onecable.view.dialog.DialogDate;
|
|
|
|
|
|
-import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
import android.app.Activity;
|
|
|
-import android.app.Dialog;
|
|
|
+import android.app.DatePickerDialog;
|
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
|
@@ -28,23 +27,27 @@ import android.os.Message;
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
import android.support.v7.widget.Toolbar;
|
|
|
+import android.text.Editable;
|
|
|
+import android.text.TextWatcher;
|
|
|
import android.view.KeyEvent;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.animation.Animation;
|
|
|
import android.view.animation.AnimationUtils;
|
|
|
import android.view.inputmethod.EditorInfo;
|
|
|
+import android.widget.DatePicker;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.ScrollView;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
-import java.lang.reflect.Type;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
+import java.util.Calendar;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.GregorianCalendar;
|
|
|
import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
import butterknife.ButterKnife;
|
|
|
@@ -63,38 +66,48 @@ import butterknife.OnClick;
|
|
|
public class HomeMemberAdd extends CustomActivity implements View.OnClickListener,
|
|
|
CustomDialog.OnMsgAlterToResult {
|
|
|
|
|
|
+ // 서버 API 요청 구분 코드
|
|
|
private static final int MSG_COM_P_HOMEGRP_MEMBERS = 1;
|
|
|
private static final int MSG_COM_P_HOMEGRP_MEMBERS_VALIDATION = 2;
|
|
|
private static final int MSG_COM_G_HOMEGRP_MEMBERS_QUIZ_LIST = 3;
|
|
|
|
|
|
+ private static final String QUIZ_STATUS_CODE_MANUAL = "1";
|
|
|
+ private static final String QUIZ_STATUS_CODE_SELECT = "2";
|
|
|
+
|
|
|
Handler comHandler = new Handler(new IncomingHandlerCallBack());
|
|
|
private Util util = new Util();
|
|
|
private CustomDialog customDialog = new CustomDialog();
|
|
|
- private Activity act;
|
|
|
+ private Activity mAct;
|
|
|
private boolean isReloadFinish = false;
|
|
|
private int type = 0;
|
|
|
private ArrayList<HashMap<String, Object>> totalList = new ArrayList<>();
|
|
|
private String authorizationQuestion = "";
|
|
|
- private String authorizationReply = "";
|
|
|
+ private String mQuizAnswer = "";
|
|
|
+ private LinearLayoutManager mLinearLayoutManager;
|
|
|
+ private HomeMemberAddMenuAdapter mHomeMemberAddMenuAdapter;
|
|
|
+ private ArrayList<HashMap<String, Object>> mQuizData = new ArrayList<HashMap<String, Object>>();
|
|
|
+ private HashMap<String, Object> mSelectedQuiz = new HashMap<>();
|
|
|
+ private boolean mIsQuizManualInput = false;
|
|
|
+ private AppConfig mAppConfig;
|
|
|
+
|
|
|
@BindView(R.id.tvQuestion) TextView mQuestion;
|
|
|
@BindView(R.id.llSlidingMenu) LinearLayout mSlidingMenu;
|
|
|
@BindView(R.id.rcvList) RecyclerView mQuizList;
|
|
|
- private LinearLayoutManager mLinearLayoutManager;
|
|
|
- private HomeMemberAddMenuAdapter mHomeMemberAddMenuAdapter;
|
|
|
@BindView(R.id.llQuiz) LinearLayout mQuizLayout;
|
|
|
@BindView(R.id.edtQuiz) EditText mQuizEditText;
|
|
|
@BindView(R.id.svBody) CustomScrollView mCustomScrollView;
|
|
|
- private List<String> mQuizData = new ArrayList<>();
|
|
|
+ @BindView(R.id.llBtn1) LinearLayout mOkBtn;
|
|
|
|
|
|
@Override
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
- act = HomeMemberAdd.this;
|
|
|
+ mAct = HomeMemberAdd.this;
|
|
|
+ mAppConfig = (AppConfig) mAct.getApplicationContext();
|
|
|
customDialog.setOnMsgAlterToResultEvent(this);
|
|
|
|
|
|
- View viewToLoad = LayoutInflater.from(act).inflate(R.layout.homemember_add, null);
|
|
|
+ View viewToLoad = LayoutInflater.from(mAct).inflate(R.layout.homemember_add, null);
|
|
|
this.setContentView(viewToLoad);
|
|
|
|
|
|
// annotation 사용을 위해 bind.
|
|
|
@@ -110,8 +123,8 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
*/
|
|
|
private void setToolbar() {
|
|
|
|
|
|
- Toolbar toolbar = (Toolbar) act.findViewById(R.id.toolbar);
|
|
|
- util.setKeyboardHide(act, toolbar);
|
|
|
+ Toolbar toolbar = (Toolbar) mAct.findViewById(R.id.toolbar);
|
|
|
+ util.setKeyboardHide(mAct, toolbar);
|
|
|
util.getTextView(toolbar, R.id.tvToolbarTitle1).setVisibility(View.VISIBLE);
|
|
|
util.getTextView(toolbar, R.id.tvToolbarTitle2).setVisibility(View.GONE);
|
|
|
util.getTextView(toolbar, R.id.tvToolbarTitleDivider).setVisibility(View.GONE);
|
|
|
@@ -122,7 +135,7 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
util.getTextView(toolbar, R.id.btnToolbarMore).setVisibility(View.GONE);
|
|
|
|
|
|
util.getTextView(toolbar, R.id.tvToolbarTitle1)
|
|
|
- .setText(util.getString(act, R.string.layout_homemember_add_01));
|
|
|
+ .setText(util.getString(mAct, R.string.layout_homemember_add_01));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -130,21 +143,22 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
*/
|
|
|
private void displayListView() {
|
|
|
|
|
|
- util.getView(act, R.id.llBtn1).setOnClickListener(this);
|
|
|
- util.getView(act, R.id.llBtn2).setOnClickListener(this);
|
|
|
- util.getView(act, R.id.btnAdd).setOnClickListener(this);
|
|
|
- util.getView(act, R.id.rlQuestion).setOnClickListener(this);
|
|
|
- util.getView(act, R.id.tvValueDate).setOnClickListener(this);
|
|
|
+ util.getView(mAct, R.id.llBtn1).setOnClickListener(this);
|
|
|
+ util.getView(mAct, R.id.llBtn1).setEnabled(false);
|
|
|
+ util.getView(mAct, R.id.llBtn2).setOnClickListener(this);
|
|
|
+ util.getView(mAct, R.id.btnAdd).setOnClickListener(this);
|
|
|
+ util.getView(mAct, R.id.rlQuestion).setOnClickListener(this);
|
|
|
+ util.getView(mAct, R.id.tvValueDate).setOnClickListener(this);
|
|
|
|
|
|
- util.setKeyboardHide(act, util.getLinearLayout(act, R.id.llSvbody));
|
|
|
- util.getEditText(act, R.id.edtCellphone)
|
|
|
+ util.setKeyboardHide(mAct, util.getLinearLayout(mAct, R.id.llSvbody));
|
|
|
+ util.getEditText(mAct, R.id.edtCellphone)
|
|
|
.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
|
@Override
|
|
|
public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
|
|
|
|
|
|
switch (actionId) {
|
|
|
case EditorInfo.IME_ACTION_DONE:
|
|
|
- util.getView(act, R.id.btnAdd).performClick();
|
|
|
+ util.getView(mAct, R.id.btnAdd).performClick();
|
|
|
break;
|
|
|
default:
|
|
|
return false;
|
|
|
@@ -152,6 +166,22 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
+ mQuizEditText.addTextChangedListener(new TextWatcher() {
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable editable) {
|
|
|
+ enableOkBtn();
|
|
|
+ }
|
|
|
+ });
|
|
|
mLinearLayoutManager = new LinearLayoutManager(this);
|
|
|
mQuizList.setLayoutManager(mLinearLayoutManager);
|
|
|
mHomeMemberAddMenuAdapter = new HomeMemberAddMenuAdapter(this, mQuizData, mQuizOnClickListener);
|
|
|
@@ -163,8 +193,11 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
mQuestion.setText(((TextView) view).getText());
|
|
|
- // TODO: 2017-04-05 하드코딩 변경 필요
|
|
|
- if (((TextView) view).getText().equals("퀴즈 직접 입력하기")) {
|
|
|
+ int position = util.null2int(view.getTag());
|
|
|
+ mSelectedQuiz = mQuizData.get(position);
|
|
|
+
|
|
|
+ if (QUIZ_STATUS_CODE_MANUAL.equals(mSelectedQuiz.get(Constants.KEY_STATUS_CODE))) {
|
|
|
+ // 퀴즈 직접 입력 선택 시
|
|
|
mQuizLayout.setVisibility(View.VISIBLE);
|
|
|
mCustomScrollView.post(new Runnable() {
|
|
|
@Override
|
|
|
@@ -172,14 +205,68 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
mCustomScrollView.fullScroll(ScrollView.FOCUS_DOWN);
|
|
|
}
|
|
|
});
|
|
|
+ mIsQuizManualInput = true;
|
|
|
|
|
|
} else {
|
|
|
+ // 기존 정의되어 있는 퀴즈 선택 시
|
|
|
mQuizLayout.setVisibility(View.GONE);
|
|
|
+ mQuizEditText.setText("");
|
|
|
+ mIsQuizManualInput = false;
|
|
|
}
|
|
|
showSlidingMenu();
|
|
|
+ enableOkBtn();
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ /**
|
|
|
+ * 정답날짜 입력 시 날짜선택 다이얼로그 노출.
|
|
|
+ */
|
|
|
+ private void showDatePicker() {
|
|
|
+ GregorianCalendar calendar = new GregorianCalendar();
|
|
|
+ int year = calendar.get(Calendar.YEAR);
|
|
|
+ int month = calendar.get(Calendar.MONTH);
|
|
|
+ int day = calendar.get(Calendar.DAY_OF_MONTH);
|
|
|
+// int hour = calendar.get(Calendar.HOUR_OF_DAY);
|
|
|
+// int minute = calendar.get(Calendar.MINUTE);
|
|
|
+
|
|
|
+ new DatePickerDialog(mAct, new DatePickerDialog.OnDateSetListener() {
|
|
|
+ @Override
|
|
|
+ public void onDateSet(DatePicker datePicker, int year, int month, int day) {
|
|
|
+
|
|
|
+ String date = String.format("%d / %d / %d", year, month + 1, day);
|
|
|
+ util.getTextView(mAct, R.id.tvValueDate).setText(date);
|
|
|
+ Dlog.i("pick date = " + date);
|
|
|
+
|
|
|
+ Calendar calendar1 = Calendar.getInstance();
|
|
|
+ calendar1.set(year, month, day);
|
|
|
+ SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyyMMdd");
|
|
|
+ mQuizAnswer = dateFormatter.format(calendar1.getTime());
|
|
|
+ Dlog.i("mQuizAnswer = " + mQuizAnswer);
|
|
|
+
|
|
|
+ enableOkBtn();
|
|
|
+ }
|
|
|
+ }, year, month, day).show();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 필수입력 조건을 모두 만족해야 확인 버튼 활성화.
|
|
|
+ */
|
|
|
+ private void enableOkBtn() {
|
|
|
+ boolean isEnable = true;
|
|
|
+
|
|
|
+ isEnable &= totalList.size() > 0;
|
|
|
+ isEnable &= !util.getTextViewVal(mAct, R.id.tvQuestion).isEmpty();
|
|
|
+ isEnable &= !util.getTextViewVal(mAct, R.id.tvValueDate).isEmpty();
|
|
|
+ if (mIsQuizManualInput) {
|
|
|
+ isEnable &= !util.getEditTextVal(mAct, R.id.edtQuiz).isEmpty();
|
|
|
+ }
|
|
|
+
|
|
|
+ mOkBtn.setEnabled(isEnable);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 하단에서 슬라이딩으로 올라오는 퀴즈 선택 메뉴 노출/숨김.
|
|
|
+ */
|
|
|
private void showSlidingMenu() {
|
|
|
if (mSlidingMenu.getVisibility() == View.GONE) {
|
|
|
|
|
|
@@ -206,60 +293,61 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
|
|
|
-// util.getView(act, R.id.rlQuestion).clearFocus();
|
|
|
+// util.getView(mAct, R.id.rlQuestion).clearFocus();
|
|
|
switch (view.getId()) {
|
|
|
case R.id.llBtn1:
|
|
|
view.setEnabled(false);
|
|
|
- authorizationQuestion = util.getEditTextVal(act, R.id.tvQuestion);
|
|
|
- authorizationReply = util.getTextViewVal(act, R.id.tvValueDate);
|
|
|
+// authorizationQuestion = util.getTextViewVal(mAct, R.id.tvQuestion);
|
|
|
+// mQuizAnswer = util.delSpecialChar(util.getTextViewVal(mAct, R.id.tvValueDate));
|
|
|
|
|
|
- if (totalList.size() == 0) {
|
|
|
- util.setShowToast(act, util.getString(act, R.string.MSG812), Toast.LENGTH_SHORT);
|
|
|
+ /*if (totalList.size() == 0) {
|
|
|
+ util.setShowToast(mAct, util.getString(mAct, R.string.MSG812), Toast.LENGTH_SHORT);
|
|
|
view.setEnabled(true);
|
|
|
return;
|
|
|
}
|
|
|
if ("".equals(authorizationQuestion)) {
|
|
|
- util.setShowToast(act, util.getString(act, R.string.MSG886), Toast.LENGTH_SHORT);
|
|
|
+ util.setShowToast(mAct, util.getString(mAct, R.string.MSG886), Toast.LENGTH_SHORT);
|
|
|
view.setEnabled(true);
|
|
|
return;
|
|
|
}
|
|
|
- if ("".equals(authorizationReply)) {
|
|
|
- util.setShowToast(act, util.getString(act, R.string.MSG813), Toast.LENGTH_SHORT);
|
|
|
+ if ("".equals(mQuizAnswer)) {
|
|
|
+ util.setShowToast(mAct, util.getString(mAct, R.string.MSG813), Toast.LENGTH_SHORT);
|
|
|
view.setEnabled(true);
|
|
|
return;
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
- comHandler.sendMessageDelayed(comHandler.obtainMessage(MSG_COM_P_HOMEGRP_MEMBERS), 10);
|
|
|
+ comHandler.sendMessageDelayed(comHandler.obtainMessage(MSG_COM_P_HOMEGRP_MEMBERS), Constants.HANDLER_DELAY_MILLIS);
|
|
|
break;
|
|
|
case R.id.llBtn2:
|
|
|
onBackPressed();
|
|
|
break;
|
|
|
case R.id.btnAdd:
|
|
|
if (totalList.size() >= 10) {
|
|
|
- util.setShowToast(act, util.getString(act, R.string.MSG811), Toast.LENGTH_SHORT);
|
|
|
+ util.setShowToast(mAct, util.getString(mAct, R.string.MSG811), Toast.LENGTH_SHORT);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- String targetCellphone = util.getEditTextVal(act, R.id.edtCellphone);
|
|
|
+ String targetCellphone = util.getEditTextVal(mAct, R.id.edtCellphone);
|
|
|
if ("".equals(targetCellphone) || !util.isCellphone(targetCellphone)) {
|
|
|
- customDialog.msgAlert(act, Constants.MSG885);
|
|
|
+ customDialog.msgAlert(mAct, Constants.MSG885);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- comHandler.sendMessageDelayed(comHandler.obtainMessage(
|
|
|
- MSG_COM_P_HOMEGRP_MEMBERS_VALIDATION), 10);
|
|
|
+ comHandler.sendMessageDelayed(comHandler.obtainMessage(MSG_COM_P_HOMEGRP_MEMBERS_VALIDATION),
|
|
|
+ Constants.HANDLER_DELAY_MILLIS);
|
|
|
|
|
|
break;
|
|
|
case R.id.rlQuestion:
|
|
|
showSlidingMenu();
|
|
|
-// util.getView(act, R.id.rlQuestion).requestFocus();
|
|
|
+// util.getView(mAct, R.id.rlQuestion).requestFocus();
|
|
|
break;
|
|
|
case R.id.tvValueDate:
|
|
|
- DialogDate dp1 = new DialogDate(act);
|
|
|
- dp1.setDateVal(util.getTextViewVal(act, R.id.tvValueDate));
|
|
|
- dp1.setTitle(util.getString(act, R.string.layout_homemember_add_06));
|
|
|
- dp1.setBtn1Val(util.getString(act, R.string.layout_ok));
|
|
|
- dp1.setBtn2Val(util.getString(act, R.string.layout_cancel));
|
|
|
+ showDatePicker();
|
|
|
+ /*DialogDate dp1 = new DialogDate(mAct);
|
|
|
+ dp1.setDateVal(util.getTextViewVal(mAct, R.id.tvValueDate));
|
|
|
+ dp1.setTitle(util.getString(mAct, R.string.layout_homemember_add_06));
|
|
|
+ dp1.setBtn1Val(util.getString(mAct, R.string.layout_ok));
|
|
|
+ dp1.setBtn2Val(util.getString(mAct, R.string.layout_cancel));
|
|
|
dp1.setMinDateVal("1900-01-01");
|
|
|
dp1.setMaxDateVal("2100-12-31");
|
|
|
dp1.setDtpVal(new DialogDate.DatePickerListner() {
|
|
|
@@ -267,7 +355,8 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
public void onDoneButton(Dialog dialog, String date) {
|
|
|
|
|
|
dialog.dismiss();
|
|
|
- util.getTextView(act, R.id.tvValueDate).setText(date);
|
|
|
+ util.getTextView(mAct, R.id.tvValueDate).setText(date);
|
|
|
+ enableOkBtn();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -277,7 +366,7 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
}
|
|
|
});
|
|
|
dp1.init();
|
|
|
- dp1.show();
|
|
|
+ dp1.show();*/
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
@@ -295,7 +384,7 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
|
|
|
try {
|
|
|
HttpSend httpSend;
|
|
|
- httpSend = new HttpSend(act);
|
|
|
+ httpSend = new HttpSend(mAct);
|
|
|
httpSend.setOnDataSendToReslutEvent(new OnDataSendToReslut() {
|
|
|
@Override
|
|
|
public void resultResponse(Response result) {
|
|
|
@@ -304,7 +393,7 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- httpSend.P_homegrp_members_validation(util.getEditTextVal(act, R.id.edtCellphone));
|
|
|
+ httpSend.getHomegrpMembersValidation(util.getEditTextVal(mAct, R.id.edtCellphone));
|
|
|
} catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
}
|
|
|
@@ -319,40 +408,42 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
|
|
|
try {
|
|
|
if (response.getStatusCode() == 200) {
|
|
|
- String targetCellphone = util.getEditTextVal(act, R.id.edtCellphone);
|
|
|
+ String targetCellphone = util.getEditTextVal(mAct, R.id.edtCellphone);
|
|
|
if ("".equals(targetCellphone)) {
|
|
|
- util.setShowToast(act, util.getString(act, R.string.MSG885), Toast.LENGTH_SHORT);
|
|
|
+ customDialog.msgAlert(mAct, Constants.MSG885);
|
|
|
+// util.setShowToast(mAct, util.getString(mAct, R.string.MSG885), Toast.LENGTH_SHORT);
|
|
|
return;
|
|
|
}
|
|
|
- String gradeCode = "SIM";
|
|
|
+// String gradeCode = "SIM";
|
|
|
HashMap<String, Object> tempMap = new HashMap<String, Object>();
|
|
|
- tempMap.put(Constants.KEY_TARGET_EMAIL, targetCellphone);
|
|
|
- tempMap.put(Constants.KEY_GRADE_CODE, gradeCode);
|
|
|
+ tempMap.put(Constants.KEY_RECEIVE_PHONE, targetCellphone);
|
|
|
+// tempMap.put(Constants.KEY_GRADE_CODE, gradeCode);
|
|
|
totalList.add(tempMap);
|
|
|
- util.getEditText(act, R.id.edtCellphone).setText("");
|
|
|
+ util.getEditText(mAct, R.id.edtCellphone).setText("");
|
|
|
setDispContents();
|
|
|
scrollToEnd();
|
|
|
+ enableOkBtn();
|
|
|
} else {
|
|
|
JSONObject joResult = new JSONObject(response.getContent());
|
|
|
Dlog.v(joResult.toString());
|
|
|
- String errorCode = util.null2string(joResult.get(Constants.KEY_ERR_CODE));
|
|
|
- String errorMsg = util.null2string(joResult.get(Constants.KEY_ERR_MSG));
|
|
|
+ String errorCode = util.null2string(joResult.get(Constants.KEY_RESULT_CODE));
|
|
|
+ String errorMsg = util.null2string(joResult.get(Constants.KEY_RESULT_MSG));
|
|
|
|
|
|
- if (errorCode.equals("401")) {
|
|
|
- customDialog.msgAlert(act, Constants.MSG998, errorMsg);
|
|
|
- } else if (errorCode.equals("401-106")) {
|
|
|
- customDialog.msgAlert(act, Constants.MSG997, errorMsg);
|
|
|
+ if (errorCode.equals("91")) {
|
|
|
+ customDialog.msgAlert(mAct, Constants.MSG885);
|
|
|
+ } else if (errorCode.equals("92")) {
|
|
|
+ customDialog.msgAlert(mAct, Constants.MSG924);
|
|
|
} else {
|
|
|
- util.getEditText(act, R.id.edtCellphone).requestFocus();
|
|
|
- util.setShowToast(act, errorMsg, Toast.LENGTH_SHORT);
|
|
|
+ util.getEditText(mAct, R.id.edtCellphone).requestFocus();
|
|
|
+ util.setShowToast(mAct, errorMsg, Toast.LENGTH_SHORT);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
- customDialog.msgAlert(act, Constants.MSG807);
|
|
|
+ customDialog.msgAlert(mAct, Constants.MSG807);
|
|
|
}
|
|
|
try {
|
|
|
- util.getView(act, R.id.llBtn1).setEnabled(true);
|
|
|
+ util.getView(mAct, R.id.llBtn1).setEnabled(true);
|
|
|
} catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
}
|
|
|
@@ -361,69 +452,71 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
/**
|
|
|
* 홈그룹 멤버 초대(홈그룹의 멤버를 초대한다) 요청.
|
|
|
*/
|
|
|
- private void sendPostHomegrpMembers() {
|
|
|
+ private void sendPostHomeGroupInvite() {
|
|
|
|
|
|
try {
|
|
|
HttpSend httpSend;
|
|
|
- httpSend = new HttpSend(act);
|
|
|
+ httpSend = new HttpSend(mAct);
|
|
|
httpSend.setOnDataSendToReslutEvent(new OnDataSendToReslut() {
|
|
|
@Override
|
|
|
public void resultResponse(Response result) {
|
|
|
|
|
|
- resultPostHomegrpMembers(result);
|
|
|
+ resultPostHomeGroupInvite(result);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
HashMap<String, Object> tempMap = new HashMap<String, Object>();
|
|
|
- tempMap.put(Constants.KEY_AUTHORIZATION_QUESTION, authorizationQuestion);
|
|
|
- tempMap.put(Constants.KEY_AUTHORIZATION_REPLY, authorizationReply);
|
|
|
+ tempMap.put(Constants.KEY_MEMBER_ID, mAppConfig.getLogin_Member_Id());
|
|
|
+ tempMap.put(Constants.KEY_QUIZ_ID, mSelectedQuiz.get(Constants.KEY_QUIZ_ID));
|
|
|
+ tempMap.put(Constants.KEY_QUIZ, mSelectedQuiz.get(Constants.KEY_QUIZ));
|
|
|
+ tempMap.put(Constants.KEY_STATUS_CODE, mSelectedQuiz.get(Constants.KEY_STATUS_CODE));
|
|
|
+ tempMap.put(Constants.KEY_ANSWER, mQuizAnswer);
|
|
|
tempMap.put(Constants.KEY_INVITATION_LIST, totalList);
|
|
|
|
|
|
Dlog.v(util.MapToJson(tempMap));
|
|
|
|
|
|
- httpSend.P_homegrp_members(util.MapToJson(tempMap));
|
|
|
+ httpSend.postHomeGroupInvite(util.MapToJson(tempMap));
|
|
|
} catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * {@link #sendPostHomegrpMembers()} 요청 결과.
|
|
|
+ * {@link #sendPostHomeGroupInvite()} 요청 결과.
|
|
|
*
|
|
|
* @param response 결과 data
|
|
|
*/
|
|
|
- private void resultPostHomegrpMembers(Response response) {
|
|
|
+ private void resultPostHomeGroupInvite(Response response) {
|
|
|
|
|
|
try {
|
|
|
- if (response.getStatusCode() == 200) {
|
|
|
+ if (response.getStatusCode() == Response.CREATED) {
|
|
|
//종료 reload 하도록
|
|
|
- util.setShowToast(act, util.getString(act, R.string.MSG887), Toast.LENGTH_SHORT);
|
|
|
- isReloadFinish = true;
|
|
|
- setFinish();
|
|
|
+// util.setShowToast(mAct, util.getString(mAct, R.string.MSG887), Toast.LENGTH_SHORT);
|
|
|
+ customDialog.msgAlert(mAct, Constants.MSG887);
|
|
|
} else {
|
|
|
JSONObject joResult = new JSONObject(response.getContent());
|
|
|
Dlog.v(joResult.toString());
|
|
|
- String errorCode = util.null2string(joResult.get(Constants.KEY_ERR_CODE));
|
|
|
- String errorMsg = util.null2string(joResult.get(Constants.KEY_ERR_MSG));
|
|
|
+ String errorCode = util.null2string(joResult.get(Constants.KEY_RESULT_CODE));
|
|
|
+ String errorMsg = util.null2string(joResult.get(Constants.KEY_RESULT_MSG));
|
|
|
|
|
|
switch (errorCode) {
|
|
|
case "401":
|
|
|
- customDialog.msgAlert(act, Constants.MSG998, errorMsg);
|
|
|
+ customDialog.msgAlert(mAct, Constants.MSG998, errorMsg);
|
|
|
break;
|
|
|
case "401-106":
|
|
|
- customDialog.msgAlert(act, Constants.MSG997, errorMsg);
|
|
|
+ customDialog.msgAlert(mAct, Constants.MSG997, errorMsg);
|
|
|
break;
|
|
|
default:
|
|
|
- util.setShowToast(act, errorMsg, Toast.LENGTH_SHORT);
|
|
|
+ util.setShowToast(mAct, errorMsg, Toast.LENGTH_SHORT);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
- customDialog.msgAlert(act, Constants.MSG807);
|
|
|
+ customDialog.msgAlert(mAct, Constants.MSG807);
|
|
|
}
|
|
|
try {
|
|
|
- util.getView(act, R.id.llBtn1).setEnabled(true);
|
|
|
+ util.getView(mAct, R.id.llBtn1).setEnabled(true);
|
|
|
} catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
}
|
|
|
@@ -432,7 +525,7 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
private void sendGetHomegrpMembersQuizList() {
|
|
|
try {
|
|
|
HttpSend httpSend;
|
|
|
- httpSend = new HttpSend(act);
|
|
|
+ httpSend = new HttpSend(mAct);
|
|
|
httpSend.setOnDataSendToReslutEvent(new OnDataSendToReslut() {
|
|
|
@Override
|
|
|
public void resultResponse(Response result) {
|
|
|
@@ -441,12 +534,12 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- HashMap<String, Object> tempMap = new HashMap<String, Object>();
|
|
|
+ /*HashMap<String, Object> tempMap = new HashMap<String, Object>();
|
|
|
tempMap.put(Constants.KEY_AUTHORIZATION_QUESTION, authorizationQuestion);
|
|
|
- tempMap.put(Constants.KEY_AUTHORIZATION_REPLY, authorizationReply);
|
|
|
+ tempMap.put(Constants.KEY_AUTHORIZATION_REPLY, mQuizAnswer);
|
|
|
tempMap.put(Constants.KEY_INVITATION_LIST, totalList);
|
|
|
|
|
|
- Dlog.v(util.MapToJson(tempMap));
|
|
|
+ Dlog.v(util.MapToJson(tempMap));*/
|
|
|
|
|
|
httpSend.getHomeGroupMembersQuizList();
|
|
|
} catch (Exception ex) {
|
|
|
@@ -454,31 +547,31 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void resultGetHomegrpMemberQuizList(Response response) {
|
|
|
+ private void resultGetHomegrpMemberQuizList(Response result) {
|
|
|
try {
|
|
|
- if (response.getStatusCode() == 200) {
|
|
|
- JSONArray jaResult = new JSONObject(response.getContent()).getJSONArray(Constants.KEY_QUIZ_LIST);
|
|
|
- for (int i = 0; i < jaResult.length(); i++) {
|
|
|
- mQuizData.add(jaResult.getJSONObject(i).getString(Constants.KEY_QUIZ));
|
|
|
- }
|
|
|
+ if (result.getStatusCode() == 200) {
|
|
|
+ JSONObject joResult = new JSONObject(result.getContent());
|
|
|
+ String quizList = util.null2string(joResult.get(Constants.KEY_QUIZ_LIST));
|
|
|
+ mQuizData = util.jsonToArrayListMap(quizList);
|
|
|
+ mHomeMemberAddMenuAdapter.setData(mQuizData);
|
|
|
mHomeMemberAddMenuAdapter.notifyDataSetChanged();
|
|
|
} else {
|
|
|
- JSONObject joResult = new JSONObject(response.getContent());
|
|
|
+ JSONObject joResult = new JSONObject(result.getContent());
|
|
|
Dlog.v(joResult.toString());
|
|
|
String errorCode = util.null2string(joResult.get(Constants.KEY_ERR_CODE));
|
|
|
String errorMsg = util.null2string(joResult.get(Constants.KEY_ERR_MSG));
|
|
|
|
|
|
if (errorCode.equals("401")) {
|
|
|
- customDialog.msgAlert(act, Constants.MSG998, errorMsg);
|
|
|
+ customDialog.msgAlert(mAct, Constants.MSG998, errorMsg);
|
|
|
} else if (errorCode.equals("401-106")) {
|
|
|
- customDialog.msgAlert(act, Constants.MSG997, errorMsg);
|
|
|
+ customDialog.msgAlert(mAct, Constants.MSG997, errorMsg);
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
- customDialog.msgAlert(act, Constants.MSG807);
|
|
|
+ customDialog.msgAlert(mAct, Constants.MSG807);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -498,16 +591,20 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
|
|
|
switch (msgId) {
|
|
|
case Constants.MSG998:
|
|
|
- util.callApp_Start(act, "LOGOUT");
|
|
|
+ util.callApp_Start(mAct, "LOGOUT");
|
|
|
break;
|
|
|
case Constants.MSG997:
|
|
|
- util.callApp_Start(act, "HOME_RELOAD");
|
|
|
+ util.callApp_Start(mAct, "HOME_RELOAD");
|
|
|
break;
|
|
|
case Constants.MSG807:
|
|
|
if (btnResult == 1) {
|
|
|
- comHandler.sendMessageDelayed(comHandler.obtainMessage(type), 10);
|
|
|
+ comHandler.sendMessageDelayed(comHandler.obtainMessage(type), Constants.HANDLER_DELAY_MILLIS);
|
|
|
}
|
|
|
break;
|
|
|
+ case Constants.MSG887:
|
|
|
+ isReloadFinish = true;
|
|
|
+ setFinish();
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
@@ -518,13 +615,13 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
*/
|
|
|
void setDispContents() {
|
|
|
|
|
|
- util.getLinearLayout(act, R.id.llContents).removeAllViews();
|
|
|
+ util.getLinearLayout(mAct, R.id.llContents).removeAllViews();
|
|
|
|
|
|
for (int row = 0; row < totalList.size(); row++) {
|
|
|
- View viewChild = View.inflate(act, R.layout.row_homemember_add_list, null);
|
|
|
+ View viewChild = View.inflate(mAct, R.layout.row_homemember_add_list, null);
|
|
|
|
|
|
- String tempTargetEmail = util.null2string(totalList.get(row).get(Constants.KEY_TARGET_EMAIL));
|
|
|
- util.getTextView(viewChild, R.id.tvEmail).setText(tempTargetEmail);
|
|
|
+ String tempTargetCellphone = util.null2string(totalList.get(row).get(Constants.KEY_RECEIVE_PHONE));
|
|
|
+ util.getTextView(viewChild, R.id.tvCellphone).setText(tempTargetCellphone);
|
|
|
util.getView(viewChild, R.id.btnDel).setTag(row);
|
|
|
util.getView(viewChild, R.id.btnDel).setOnClickListener(new View.OnClickListener() {
|
|
|
int tag = 0;
|
|
|
@@ -535,9 +632,10 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
tag = (int) view.getTag();
|
|
|
totalList.remove(tag);
|
|
|
setDispContents();
|
|
|
+ enableOkBtn();
|
|
|
}
|
|
|
});
|
|
|
- util.getLinearLayout(act, R.id.llContents).addView(viewChild);
|
|
|
+ util.getLinearLayout(mAct, R.id.llContents).addView(viewChild);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -546,11 +644,11 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
*/
|
|
|
public void scrollToEnd() {
|
|
|
|
|
|
- util.getScrollView(act, R.id.svBody).post(new Runnable() {
|
|
|
+ util.getScrollView(mAct, R.id.svBody).post(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
|
|
|
- util.getScrollView(act, R.id.svBody).fullScroll(View.FOCUS_DOWN);
|
|
|
+ util.getScrollView(mAct, R.id.svBody).fullScroll(View.FOCUS_DOWN);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -563,10 +661,10 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
switch (requestCode) {
|
|
|
case Constants.ACT_HOMEMEMBER_ADD_EMAIL:
|
|
|
HashMap<String, Object> tempMap = new HashMap<String, Object>();
|
|
|
- String targetEmail = util.null2string(data.getStringExtra(Constants.KEY_TARGET_EMAIL));
|
|
|
+ String targetEmail = util.null2string(data.getStringExtra(Constants.KEY_TARGET_CELLPHONE));
|
|
|
String gradeCode = util.null2string(data.getStringExtra(Constants.KEY_GRADE_CODE));
|
|
|
String extraPosition = util.null2string(data.getStringExtra(Constants.EXTRA_POSITION));
|
|
|
- tempMap.put(Constants.KEY_TARGET_EMAIL, targetEmail);
|
|
|
+ tempMap.put(Constants.KEY_TARGET_CELLPHONE, targetEmail);
|
|
|
tempMap.put(Constants.KEY_GRADE_CODE, gradeCode);
|
|
|
if (extraPosition.equals("")) {
|
|
|
totalList.add(tempMap);
|
|
|
@@ -605,7 +703,7 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
type = msg.what;
|
|
|
switch (msg.what) {
|
|
|
case MSG_COM_P_HOMEGRP_MEMBERS:
|
|
|
- sendPostHomegrpMembers();
|
|
|
+ sendPostHomeGroupInvite();
|
|
|
;
|
|
|
break;
|
|
|
case MSG_COM_P_HOMEGRP_MEMBERS_VALIDATION:
|