Pārlūkot izejas kodu

1. 설정 팝업 완료

songjunekeun 5 gadi atpakaļ
vecāks
revīzija
560dd2046c

+ 2 - 2
app/src/main/java/com/dbs/mplus/knuh/activity/activityEvent/LeftMenu.java

@@ -183,11 +183,11 @@ public class LeftMenu {
 
     }
 
-    if (instance.jobKindCd.indexOf("03") == 0 || instance.indexPage.equals("S")) {
+    if (instance.jobKindCd.indexOf("03") == 0 || instance.indexPage.equals("SR")) {
       instance.radioButton1.setChecked(true);
       patientState = "A";
     } else {
-      if (!indexPage.equals("S")) {
+      if (!indexPage.equals("SR")) {
         instance.radioButton4.setChecked(true);
       }
     }

+ 3 - 1
app/src/main/java/com/dbs/mplus/knuh/activity/activityEvent/TopMenu.java

@@ -11,6 +11,7 @@ import com.dbs.mplus.knuh.R;
 import com.dbs.mplus.knuh.activity.LoginActivity;
 import com.dbs.mplus.knuh.consent.sign.SignWrapper;
 import com.dbs.mplus.knuh.customView.CustomAlertDialog;
+import com.dbs.mplus.knuh.customView.CustomSettingAlertDialog;
 import com.dbs.mplus.knuh.util.Util;
 
 public class TopMenu {
@@ -30,7 +31,8 @@ public class TopMenu {
   public View.OnClickListener settingClickListener = new View.OnClickListener() {
     @Override
     public void onClick(View v) {
-      Log.e(TAG, "settingClickListener");
+      CustomSettingAlertDialog customSettingAlertDialog = new CustomSettingAlertDialog(mContext);
+      customSettingAlertDialog.show();
     }
   };
 

+ 2 - 3
app/src/main/java/com/dbs/mplus/knuh/customView/CustomAlertDialog.java

@@ -60,11 +60,10 @@ public class CustomAlertDialog extends Dialog {
     Drawable confirmBg  = (Drawable) btnConfirm.getBackground();
     Drawable confirmBg2 = (Drawable) btnConfirm2.getBackground();
     Drawable cancelBg   = (Drawable) btnCancel.getBackground();
-    
-//    confirmBg.setColorFilter(Color.parseColor("#53B44D"), PorterDuff.Mode.SRC_ATOP);
+
     confirmBg.setColorFilter(ContextCompat.getColor(mContext, R.color.alertConfirmColor), PorterDuff.Mode.SRC_ATOP);
     confirmBg2.setColorFilter(ContextCompat.getColor(mContext, R.color.alertConfirmColor), PorterDuff.Mode.SRC_ATOP);
-    cancelBg.setColorFilter(Color.parseColor("#797979"), PorterDuff.Mode.SRC_ATOP);
+    cancelBg.setColorFilter(ContextCompat.getColor(mContext, R.color.alertCancelColor), PorterDuff.Mode.SRC_ATOP);
   }
   
   public void setContent(String message, String btnType) {

+ 235 - 0
app/src/main/java/com/dbs/mplus/knuh/customView/CustomSettingAlertDialog.java

@@ -0,0 +1,235 @@
+package com.dbs.mplus.knuh.customView;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+
+import android.view.View;
+import android.widget.Button;
+import android.widget.CompoundButton;
+import android.widget.RadioButton;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.core.content.ContextCompat;
+
+import com.dbs.mplus.knuh.BuildConfig;
+import com.dbs.mplus.knuh.R;
+import com.dbs.mplus.knuh.activity.ConsentActivity;
+import com.dbs.mplus.knuh.httpTask.CallBack;
+import com.dbs.mplus.knuh.util.ConsentConfig;
+import com.dbs.mplus.knuh.util.Util;
+
+import org.ksoap2.serialization.SoapObject;
+
+import java.util.HashMap;
+
+public class CustomSettingAlertDialog extends Dialog {
+  
+  private static final String TAG = "CustomSettingAlertDialog";
+  private Context mContext;
+  
+  private RadioButton inPatientRid;
+  private RadioButton outPatientRid;
+  private RadioButton erPatientRid;
+  private RadioButton opPatientRid;
+  private RadioButton searchRid;
+  private Button btnConfirm;
+  private Button btnCancel;
+  
+  private String userId    = "";
+  private String indexPage = "";
+  private String status    = "";
+  
+  public CustomSettingAlertDialog(@NonNull Context context) {
+    super(context);
+    this.mContext = context;
+  }
+  
+  public CustomSettingAlertDialog(@NonNull Context context, int themeResId) {
+    super(context, themeResId);
+  }
+  
+  protected CustomSettingAlertDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
+    super(context, cancelable, cancelListener);
+  }
+  
+  @Override
+  protected void onCreate(Bundle savedInstanceState) {
+    super.onCreate(savedInstanceState);
+    getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
+    setContentView(R.layout.custom_setting_alert);
+    
+    init();
+  }
+  
+  private void init() {
+    userId = Util.getStringPreference(mContext, "userInfo", "userId");
+    indexPage = Util.getStringPreference(mContext,  "userInfo", "indexPage");
+    
+    setLayout();
+    setSetting();
+    setEvent();
+  }
+  
+  private void setLayout() {
+    inPatientRid  = (RadioButton) findViewById(R.id.inPatientRid);
+    outPatientRid = (RadioButton) findViewById(R.id.outPatientRid);
+    erPatientRid  = (RadioButton) findViewById(R.id.erPatientRid);
+    opPatientRid  = (RadioButton) findViewById(R.id.opPatientRid);
+    searchRid     = (RadioButton) findViewById(R.id.searchRid);
+    btnConfirm    = (Button) findViewById(R.id.btnConfirm);
+    btnCancel     = (Button) findViewById(R.id.btnCancel);
+
+    setCanceledOnTouchOutside(false); //화면 밖을 터치했을때 사라지지 않게
+
+    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);
+  }
+  
+  private void setSetting() {
+    status = indexPage;
+    if (indexPage.equals("I")) { // 입원
+      inPatientRid.setChecked(true);
+    } else if (indexPage.equals("O")) { // 외래
+      outPatientRid.setChecked(true);
+    } else if (indexPage.equals("E")) { // 응급
+      erPatientRid.setChecked(true);
+    } else if (indexPage.equals("OP")) { // 수술
+      opPatientRid.setChecked(true);
+    } else if (indexPage.equals("SR")) { // 검색
+      searchRid.setChecked(true);
+    }
+  }
+  
+  private void setEvent() {
+    btnConfirm.setOnClickListener(onClickListener);
+    btnCancel.setOnClickListener(onClickListener);
+    
+    inPatientRid.setOnCheckedChangeListener(onCheckedChangeListener);
+    outPatientRid.setOnCheckedChangeListener(onCheckedChangeListener);
+    erPatientRid.setOnCheckedChangeListener(onCheckedChangeListener);
+    opPatientRid.setOnCheckedChangeListener(onCheckedChangeListener);
+    searchRid.setOnCheckedChangeListener(onCheckedChangeListener);
+  }
+  
+  private void settingSubmit() {
+    ((ConsentActivity) mContext).showProgress();
+    final CallBack callBack = new CallBack() {
+      @Override
+      public void result(SoapObject result) {
+        if (result == null || result.toString().indexOf("null") > 0 || result.getPropertyCount() == 0) {
+          stop();
+        } else {
+          String rts = result.getProperty("responseData").toString().trim();
+          int res = Integer.parseInt(rts);
+
+          if (res == 0) {
+            stop();
+          } else {
+            Util.setStringPreference(mContext, "userInfo", "indexPage", status);
+          }
+
+          ((ConsentActivity) mContext).dismissProgress();
+          dismiss();
+        }
+      }
+  
+      @Override
+      public void stop() {
+        ((ConsentActivity) mContext).showSingButtonDialog(mContext.getString(R.string.settingError));
+//        ((ConsentActivity) mContext).dismissProgress();
+//        dismiss();
+      }
+  
+      @Override
+      public void error() {
+    
+      }
+    };
+    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.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();
+      }
+    });
+
+
+  }
+  
+  private RadioButton.OnCheckedChangeListener onCheckedChangeListener = new CompoundButton.OnCheckedChangeListener() {
+    @Override
+    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+      if (inPatientRid == buttonView && isChecked) {
+        status = "I";
+      } else if (outPatientRid == buttonView && isChecked) {
+        status = "O";
+      } else if (erPatientRid == buttonView && isChecked) {
+        status = "E";
+      } else if (opPatientRid == buttonView && isChecked) {
+        status = "OP";
+      } else if (searchRid == buttonView && isChecked) {
+        status = "SR";
+      }
+    }
+  };
+  
+  private View.OnClickListener onClickListener = new View.OnClickListener() {
+    @Override
+    public void onClick(View v) {
+      if (btnConfirm == v) {
+        settingSubmit();
+      } else if (btnCancel == v) {
+        dismiss();
+      }
+    }
+  };
+  
+  @Override
+  public void show() {
+    super.show();
+  }
+  
+  @Override
+  public void dismiss() {
+    super.dismiss();
+  }
+}

+ 1 - 0
app/src/main/java/com/dbs/mplus/knuh/util/ConsentConfig.java

@@ -15,6 +15,7 @@ public class ConsentConfig {
   public static final String GET_CONSENT_SET_LIST  = "GetConsentSetList"; // 사용자 동의서 즐겨찾기
   public static final String SET_USER_FORM_SET     = "SetUserFormSetList"; // 즐겨찾기 추가
   public static final String DEL_USER_FORM_SET     = "DelUserFormSetList"; // 즐겨찾기 삭제
+  public static final String UPDATE_USER_SETUP     = "UpdateUserSetup";    // 사용자 기본 화면 설정 외래 O 입원 I 응급 E 수술 OP 검색 SR
 
   public static final String HOST_CONSENT = BuildConfig.CONSENT_SERVER_URL + "ConsentSvc.asmx";
   public static final String GET_CONSENT_CATEGORYY = "GetCategoryForDropdown";

+ 7 - 4
app/src/main/res/layout/custom_setting_alert.xml

@@ -6,7 +6,7 @@
 
     <LinearLayout
         android:layout_width="350dp"
-        android:layout_height="380dp"
+        android:layout_height="360dp"
         android:layout_centerInParent="true"
         android:background="@drawable/department_layer"
         android:orientation="vertical">
@@ -34,6 +34,9 @@
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="match_parent"
+            android:layout_marginBottom="4dp"
+            android:layout_marginLeft="4dp"
+            android:layout_marginRight="4dp"
             android:orientation="vertical">
 
             <LinearLayout
@@ -82,7 +85,7 @@
                         android:text="@string/surgery" />
 
                     <RadioButton
-                        android:id="@+id/examRid"
+                        android:id="@+id/searchRid"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:padding="8dp"
@@ -98,7 +101,7 @@
                 android:layout_height="match_parent"
                 android:background="@xml/border_top"
                 android:layout_margin="2dp"
-                android:layout_weight="3.4">
+                android:layout_weight="3">
 
                 <LinearLayout
                     android:id="@+id/btnLayout"
@@ -120,7 +123,7 @@
                         android:background="@drawable/shape2"
                         android:textColor="@color/white"
                         android:textSize="16sp"
-                        android:text="@string/confirm"/>
+                        android:text="@string/save"/>
 
                     <Button
                         android:id="@+id/btnCancel"

+ 1 - 0
app/src/main/res/values/colors.xml

@@ -11,6 +11,7 @@
     <color name="transparentColor">@android:color/transparent</color>
     <color name="loginBtnColor">#00AC98</color>
     <color name="alertConfirmColor">#53B44D</color>
+    <color name="alertCancelColor">#797979</color>
     <color name="departmentBtnColor">#F0F0F0</color>
     <color name="infoColor">#dddddd</color>
     <color name="patientListColumn">#EEEEEE</color>

+ 2 - 0
app/src/main/res/values/strings.xml

@@ -82,6 +82,8 @@
     <string name="emptySign">서명이 누락되었습니다.</string>
     <string name="emptySearchConsent">조회된 동의서가 없습니다.</string>
 
+    <string name="settingAlertMsg">로그인 후 초기화면이 [%1s] 화면으로 설정됩니다. \n 계속 진행하시겠습니까?</string>
+    <string name="settingError">설정이 변경에 실패하였습니다.</string>
     <string name="deleteMaker">삭제하시겠습니까?</string>
     <string name="addMaker">즐겨찾기로 추가하시겠습니까?</string>
     <string name="failMakerEvent">즐겨찾기 %1$s에 실패하였습니다. \n 다시 시도해주세요.</string>