|
@@ -6,6 +6,7 @@ import android.graphics.PorterDuff;
|
|
|
import android.graphics.drawable.ColorDrawable;
|
|
|
import android.graphics.drawable.Drawable;
|
|
|
import android.os.Bundle;
|
|
|
+import android.util.Log;
|
|
|
import android.view.View;
|
|
|
import android.widget.Button;
|
|
|
import android.widget.CompoundButton;
|
|
@@ -18,9 +19,12 @@ import androidx.core.content.ContextCompat;
|
|
|
import com.dbs.consent.ynu.BuildConfig;
|
|
|
import com.dbs.consent.ynu.R;
|
|
|
import com.dbs.consent.ynu.activity.ConsentActivity;
|
|
|
+import com.dbs.consent.ynu.httpTask.HttpCallBack;
|
|
|
import com.dbs.consent.ynu.util.ConsentConfig;
|
|
|
import com.dbs.consent.ynu.util.Util;
|
|
|
|
|
|
+import org.json.JSONException;
|
|
|
+import org.json.JSONObject;
|
|
|
import org.ksoap2.serialization.SoapObject;
|
|
|
|
|
|
import java.util.HashMap;
|
|
@@ -87,9 +91,12 @@ public class CustomSettingAlertDialog extends Dialog {
|
|
|
|
|
|
Drawable confirmBg = (Drawable) btnConfirm.getBackground();
|
|
|
Drawable cancelBg = (Drawable) btnCancel.getBackground();
|
|
|
- confirmBg.setColorFilter(ContextCompat.getColor(mContext, R.color.commonColor), PorterDuff.Mode.SRC_ATOP);
|
|
|
|
|
|
- cancelBg.setColorFilter(ContextCompat.getColor(mContext, R.color.alertCancelColor), PorterDuff.Mode.SRC_ATOP);
|
|
|
+ confirmBg.setTint(ContextCompat.getColor(mContext, R.color.commonColor));
|
|
|
+ cancelBg.setTint(ContextCompat.getColor(mContext, R.color.alertCancelColor));
|
|
|
+
|
|
|
+// confirmBg.setColorFilter(ContextCompat.getColor(mContext, R.color.commonColor), PorterDuff.Mode.SRC_ATOP);
|
|
|
+// cancelBg.setColorFilter(ContextCompat.getColor(mContext, R.color.alertCancelColor), PorterDuff.Mode.SRC_ATOP);
|
|
|
}
|
|
|
|
|
|
private void setSetting() {
|
|
@@ -119,7 +126,90 @@ public class CustomSettingAlertDialog extends Dialog {
|
|
|
}
|
|
|
|
|
|
private void settingSubmit() {
|
|
|
-// ((ConsentActivity) mContext).showProgress();
|
|
|
+ ((ConsentActivity) mContext).showProgress();
|
|
|
+ HttpCallBack callBack = new HttpCallBack() {
|
|
|
+ @Override
|
|
|
+ public void result(String result) {
|
|
|
+ Log.e(TAG, "result -- > " + result);
|
|
|
+ if (result.equals("")) {
|
|
|
+ stop();
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ JSONObject jsonObject = Util.xmltoJsonObject(result);
|
|
|
+ String jsonStr = Util.xmlToJsonString(jsonObject);
|
|
|
+ JSONObject object = new JSONObject(jsonStr);
|
|
|
+ Log.e(TAG, "object -- > " + object);
|
|
|
+
|
|
|
+ int res = Integer.parseInt(object.get("responseData").toString().trim());
|
|
|
+
|
|
|
+ if (res == 1) {
|
|
|
+ Util.setStringPreference(mContext, "userInfo", "indexPage", status);
|
|
|
+ dismiss();
|
|
|
+ ((ConsentActivity) mContext).dismissProgress();
|
|
|
+ } else {
|
|
|
+ stop();
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (JSONException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void stop() {
|
|
|
+ ((ConsentActivity) mContext).showSingButtonDialog(mContext.getString(R.string.settingError));
|
|
|
+ ((ConsentActivity) mContext).dismissProgress();
|
|
|
+ dismiss();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void error() {
|
|
|
+ stop();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ String str = "";
|
|
|
+ String message = mContext.getString(R.string.settingAlertMsg);
|
|
|
+ if (status.equals("I")) {
|
|
|
+ str = mContext.getString(R.string.admission);
|
|
|
+ } else if (status.equals("O")) {
|
|
|
+ str = mContext.getString(R.string.outPatient);
|
|
|
+ } else if (status.equals("E")) {
|
|
|
+ str = mContext.getString(R.string.emergency);
|
|
|
+ } else if (status.equals("OP")) {
|
|
|
+ str = mContext.getString(R.string.surgery);
|
|
|
+ } else {
|
|
|
+ str = mContext.getString(R.string.search);
|
|
|
+ }
|
|
|
+
|
|
|
+ message = String.format(message, str);
|
|
|
+ ((ConsentActivity) mContext).csAlert.show();
|
|
|
+ ((ConsentActivity) mContext).csAlert.setContent(message, "");
|
|
|
+
|
|
|
+ ((ConsentActivity) mContext).csAlert.btnConfirm.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ HashMap<String, String> mData = new HashMap<String, String>();
|
|
|
+ mData.put("userId", userId);
|
|
|
+ mData.put("status", status);
|
|
|
+ mData.put("instCd", BuildConfig.INST_CD);
|
|
|
+ Util.callHttpUrlConnection(mContext, ConsentConfig.HOST_HOSPITAL, ConsentConfig.UPDATE_USER_SETUP, mData, callBack);
|
|
|
+// Util.callHttp(mContext, ConsentConfig.HOST_HOSPITAL, ConsentConfig.UPDATE_USER_SETUP , mData, callBack);
|
|
|
+ ((ConsentActivity) mContext).csAlert.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ ((ConsentActivity) mContext).csAlert.btnCancel.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ ((ConsentActivity) mContext).csAlert.dismiss();
|
|
|
+ ((ConsentActivity) mContext).dismissProgress();
|
|
|
+ dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
// final CallBack callBack = new CallBack() {
|
|
|
// @Override
|
|
|
// public void result(SoapObject result) {
|