|
|
@@ -16,6 +16,7 @@ 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;
|
|
|
@@ -39,6 +40,7 @@ import android.widget.ScrollView;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
+import java.lang.reflect.Type;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
@@ -63,6 +65,7 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
|
|
|
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;
|
|
|
|
|
|
Handler comHandler = new Handler(new IncomingHandlerCallBack());
|
|
|
private Util util = new Util();
|
|
|
@@ -76,11 +79,12 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
@BindView(R.id.tvQuestion) TextView mQuestion;
|
|
|
@BindView(R.id.llSlidingMenu) LinearLayout mSlidingMenu;
|
|
|
@BindView(R.id.rcvList) RecyclerView mQuizList;
|
|
|
- LinearLayoutManager mLinearLayoutManager;
|
|
|
- HomeMemberAddMenuAdapter mHomeMemberAddMenuAdapter;
|
|
|
+ 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<>();
|
|
|
|
|
|
@Override
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
@@ -98,6 +102,7 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
|
|
|
setToolbar();
|
|
|
displayListView();
|
|
|
+ comHandler.sendMessageDelayed(comHandler.obtainMessage(MSG_COM_G_HOMEGRP_MEMBERS_QUIZ_LIST), Constants.HANDLER_DELAY_MILLIS);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -132,7 +137,7 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
util.getView(act, R.id.tvValueDate).setOnClickListener(this);
|
|
|
|
|
|
util.setKeyboardHide(act, util.getLinearLayout(act, R.id.llSvbody));
|
|
|
- util.getEditText(act, R.id.edtEmail)
|
|
|
+ util.getEditText(act, R.id.edtCellphone)
|
|
|
.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
|
@Override
|
|
|
public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
|
|
|
@@ -147,19 +152,9 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- // TODO: 2017-04-05 하드코딩 변경 필요
|
|
|
- List<String> quizList = Arrays.asList(
|
|
|
- "초대한 사람의 생일은?",
|
|
|
- "초대받은 사람의 생일은?",
|
|
|
- "우리 집 막내 생일은?",
|
|
|
- "우리 아버지 생일은?",
|
|
|
- "우리 결혼기념일은?",
|
|
|
- "퀴즈 직접 입력하기"
|
|
|
- );
|
|
|
mLinearLayoutManager = new LinearLayoutManager(this);
|
|
|
mQuizList.setLayoutManager(mLinearLayoutManager);
|
|
|
- mHomeMemberAddMenuAdapter = new HomeMemberAddMenuAdapter(this, quizList, mQuizOnClickListener);
|
|
|
+ mHomeMemberAddMenuAdapter = new HomeMemberAddMenuAdapter(this, mQuizData, mQuizOnClickListener);
|
|
|
mQuizList.setAdapter(mHomeMemberAddMenuAdapter);
|
|
|
}
|
|
|
|
|
|
@@ -245,9 +240,9 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- String targetEmail = util.getEditTextVal(act, R.id.edtEmail);
|
|
|
- if ("".equals(targetEmail)) {
|
|
|
- util.setShowToast(act, util.getString(act, R.string.MSG885), Toast.LENGTH_SHORT);
|
|
|
+ String targetCellphone = util.getEditTextVal(act, R.id.edtCellphone);
|
|
|
+ if ("".equals(targetCellphone) || !util.isCellphone(targetCellphone)) {
|
|
|
+ customDialog.msgAlert(act, Constants.MSG885);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -309,7 +304,7 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- httpSend.P_homegrp_members_validation(util.getEditTextVal(act, R.id.edtEmail));
|
|
|
+ httpSend.P_homegrp_members_validation(util.getEditTextVal(act, R.id.edtCellphone));
|
|
|
} catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
}
|
|
|
@@ -324,17 +319,17 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
|
|
|
try {
|
|
|
if (response.getStatusCode() == 200) {
|
|
|
- String targetEmail = util.getEditTextVal(act, R.id.edtEmail);
|
|
|
- if ("".equals(targetEmail)) {
|
|
|
+ String targetCellphone = util.getEditTextVal(act, R.id.edtCellphone);
|
|
|
+ if ("".equals(targetCellphone)) {
|
|
|
util.setShowToast(act, util.getString(act, R.string.MSG885), Toast.LENGTH_SHORT);
|
|
|
return;
|
|
|
}
|
|
|
String gradeCode = "SIM";
|
|
|
HashMap<String, Object> tempMap = new HashMap<String, Object>();
|
|
|
- tempMap.put(Constants.KEY_TARGET_EMAIL, targetEmail);
|
|
|
+ tempMap.put(Constants.KEY_TARGET_EMAIL, targetCellphone);
|
|
|
tempMap.put(Constants.KEY_GRADE_CODE, gradeCode);
|
|
|
totalList.add(tempMap);
|
|
|
- util.getEditText(act, R.id.edtEmail).setText("");
|
|
|
+ util.getEditText(act, R.id.edtCellphone).setText("");
|
|
|
setDispContents();
|
|
|
scrollToEnd();
|
|
|
} else {
|
|
|
@@ -348,7 +343,7 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
} else if (errorCode.equals("401-106")) {
|
|
|
customDialog.msgAlert(act, Constants.MSG997, errorMsg);
|
|
|
} else {
|
|
|
- util.getEditText(act, R.id.edtEmail).requestFocus();
|
|
|
+ util.getEditText(act, R.id.edtCellphone).requestFocus();
|
|
|
util.setShowToast(act, errorMsg, Toast.LENGTH_SHORT);
|
|
|
}
|
|
|
}
|
|
|
@@ -434,6 +429,59 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void sendGetHomegrpMembersQuizList() {
|
|
|
+ try {
|
|
|
+ HttpSend httpSend;
|
|
|
+ httpSend = new HttpSend(act);
|
|
|
+ httpSend.setOnDataSendToReslutEvent(new OnDataSendToReslut() {
|
|
|
+ @Override
|
|
|
+ public void resultResponse(Response result) {
|
|
|
+
|
|
|
+ resultGetHomegrpMemberQuizList(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_INVITATION_LIST, totalList);
|
|
|
+
|
|
|
+ Dlog.v(util.MapToJson(tempMap));
|
|
|
+
|
|
|
+ httpSend.getHomeGroupMembersQuizList();
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void resultGetHomegrpMemberQuizList(Response response) {
|
|
|
+ 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));
|
|
|
+ }
|
|
|
+ mHomeMemberAddMenuAdapter.notifyDataSetChanged();
|
|
|
+ } 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));
|
|
|
+
|
|
|
+ if (errorCode.equals("401")) {
|
|
|
+ customDialog.msgAlert(act, Constants.MSG998, errorMsg);
|
|
|
+ } else if (errorCode.equals("401-106")) {
|
|
|
+ customDialog.msgAlert(act, Constants.MSG997, errorMsg);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ customDialog.msgAlert(act, Constants.MSG807);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Activity 종료 처리.
|
|
|
*/
|
|
|
@@ -563,6 +611,9 @@ public class HomeMemberAdd extends CustomActivity implements View.OnClickListene
|
|
|
case MSG_COM_P_HOMEGRP_MEMBERS_VALIDATION:
|
|
|
sendGetHomegrpMembersValidation();
|
|
|
break;
|
|
|
+ case MSG_COM_G_HOMEGRP_MEMBERS_QUIZ_LIST:
|
|
|
+ sendGetHomegrpMembersQuizList();
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|