Переглянути джерело

동의서 이력 카테고리 체크박스 추가, 레이아웃 불균형 수정, EditText 깜빡임 커서 추가

3cooking 5 роки тому
батько
коміт
5822fc44d9

+ 116 - 18
app/src/main/java/com/dbs/mplus/knuh/fragment/HistoryFragment.java

@@ -6,6 +6,7 @@ import androidx.appcompat.app.AppCompatActivity;
 import androidx.core.content.ContextCompat;
 import androidx.fragment.app.Fragment;
 
+import android.app.DatePickerDialog;
 import android.content.Context;
 
 import android.graphics.PorterDuff;
@@ -17,34 +18,51 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.DatePicker;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
 
 import com.dbs.mplus.knuh.R;
+import com.dbs.mplus.knuh.util.Util;
 
 
 public class HistoryFragment extends Fragment {
 
   private static final String TAG = "HistoryFragment";
   private AppCompatActivity mActiyivy;
-  private Context           mContext;
+  private Context mContext;
+
+  private DatePickerDialog dateDialog;
 
   private LinearLayout typePatient;
   private LinearLayout patientLeftRound;
-  private ImageView    ivPatient;
+  private ImageView ivPatient;
   private LinearLayout patientRightRound;
-  private TextView     tvPatient;
+  private TextView tvPatient;
 
   private LinearLayout typeWriter;
   private LinearLayout writerLeftRound;
-  private ImageView    ivWriter;
+  private ImageView ivWriter;
   private LinearLayout writerRightRound;
-  private TextView     tvWriter;
+  private TextView tvWriter;
 
   private Button btnHistorySearch;
 
+  private LinearLayout leftDateLayout;
+  private LinearLayout rightDateLayout;
+  private TextView tvLeftDate;
+  private TextView tvRightDate;
+
+  private CheckBox checkAll;
+  private CheckBox checkTemp;
+  private CheckBox checkCert;
+  private CheckBox checkConfirm;
+  private CheckBox checkPrint;
+
   public HistoryFragment() {
 
   }
@@ -53,7 +71,7 @@ public class HistoryFragment extends Fragment {
   public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
 
-    mContext  = getActivity();
+    mContext = getActivity();
     mActiyivy = (AppCompatActivity) getActivity();
   }
 
@@ -64,7 +82,6 @@ public class HistoryFragment extends Fragment {
     View view = (View) inflater.inflate(R.layout.activity_history_fragment, container, false);
 
     typePatient       = (LinearLayout) view.findViewById(R.id.typePatient);
-    Log.e(TAG, "typePatient --> " + typePatient);
     patientLeftRound  = (LinearLayout) view.findViewById(R.id.patientLeftRound);
     ivPatient         = (ImageView) view.findViewById(R.id.ivPatient);
     patientRightRound = (LinearLayout) view.findViewById(R.id.patientRightRound);
@@ -76,31 +93,70 @@ public class HistoryFragment extends Fragment {
     tvWriter          = (TextView) view.findViewById(R.id.tvWriter);
     btnHistorySearch  = (Button) view.findViewById(R.id.btnHistorySearch);
 
-    GradientDrawable btnSearchBg  = (GradientDrawable) btnHistorySearch.getBackground();
+    leftDateLayout  = (LinearLayout) view.findViewById(R.id.leftDateLayout);
+    rightDateLayout = (LinearLayout) view.findViewById(R.id.rightDateLayout);
+    tvLeftDate      = (TextView) view.findViewById(R.id.tvLeftDate);
+    tvRightDate     = (TextView) view.findViewById(R.id.tvRightDate);
+
+    checkAll     = (CheckBox) view.findViewById(R.id.checkAll);
+    checkTemp    = (CheckBox) view.findViewById(R.id.checkTemp);
+    checkCert    = (CheckBox) view.findViewById(R.id.checkCert);
+    checkConfirm = (CheckBox) view.findViewById(R.id.checkConfirm);
+    checkPrint   = (CheckBox) view.findViewById(R.id.checkPrint);
+
+    GradientDrawable btnSearchBg = (GradientDrawable) btnHistorySearch.getBackground();
     btnSearchBg.setColorFilter(ContextCompat.getColor(mContext, R.color.typeLeftColor), PorterDuff.Mode.SRC_ATOP);
+
+    setDate();
     setEvent();
 
     return view;
   }
 
-  public void setEvent() {
+  private void setEvent() {
 
+    // 환자별/작성자별 색상 변경 리스너
     typePatient.setOnClickListener(onClickListener);
     typeWriter.setOnClickListener(onClickListener);
 
+    leftDateLayout.setOnClickListener(onClickListener);
+    rightDateLayout.setOnClickListener(onClickListener);
+
+    // 체크박스 체크 리스너
+    checkAll.setOnCheckedChangeListener(onCheckedChangeListener);
+    checkTemp.setOnCheckedChangeListener(onCheckedChangeListener);
+    checkCert.setOnCheckedChangeListener(onCheckedChangeListener);
+    checkConfirm.setOnCheckedChangeListener(onCheckedChangeListener);
+    checkPrint.setOnCheckedChangeListener(onCheckedChangeListener);
+  }
+
+
+  private void setDate() {
+    int year  = Util.toDayDate()[0];
+    int month = Integer.parseInt(Util.plusZero(Util.toDayDate()[1] - 1));
+    int day   = Integer.parseInt(Util.plusZero(Util.toDayDate()[2]));
+
+    dateDialog = new DatePickerDialog(mContext, R.style.DatePickerDialogTheme ,onDateSetListener, year, month, day);
   }
 
+  private DatePickerDialog.OnDateSetListener onDateSetListener = new DatePickerDialog.OnDateSetListener() {
+    @Override
+    public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
+
+    }
+  };
+
 
-  public View.OnClickListener onClickListener = new View.OnClickListener() {
+  private View.OnClickListener onClickListener = new View.OnClickListener() {
     @Override
     public void onClick(View v) {
-      GradientDrawable patientLeftBg  = (GradientDrawable) patientLeftRound.getBackground();
+      GradientDrawable patientLeftBg = (GradientDrawable) patientLeftRound.getBackground();
       GradientDrawable patientRightBg = (GradientDrawable) patientRightRound.getBackground();
-      GradientDrawable writerLeftBg   = (GradientDrawable) writerLeftRound.getBackground();
-      GradientDrawable writerRightBg  = (GradientDrawable) writerRightRound.getBackground();
+      GradientDrawable writerLeftBg = (GradientDrawable) writerLeftRound.getBackground();
+      GradientDrawable writerRightBg = (GradientDrawable) writerRightRound.getBackground();
 
-      if(v == typePatient) {
-        Log.e(TAG,"v -- > " + v);
+      if (v == typePatient) {
+        Log.e(TAG, "v -- > " + v);
         patientLeftBg.setColorFilter(ContextCompat.getColor(mContext, R.color.typeLeftColor), PorterDuff.Mode.SRC_ATOP);
         patientRightBg.setColorFilter(ContextCompat.getColor(mContext, R.color.typeRightColor), PorterDuff.Mode.SRC_ATOP);
         ivPatient.setColorFilter(ContextCompat.getColor(mContext, R.color.white), PorterDuff.Mode.SRC_ATOP);
@@ -110,8 +166,8 @@ public class HistoryFragment extends Fragment {
         writerRightBg.setColorFilter(ContextCompat.getColor(mContext, R.color.departmentBtnColor), PorterDuff.Mode.SRC_ATOP);
         ivWriter.setColorFilter(ContextCompat.getColor(mContext, R.color.black), PorterDuff.Mode.SRC_ATOP);
         tvWriter.setTextColor(ContextCompat.getColor(mContext, R.color.black));
-      } else if(v == typeWriter) {
-        Log.e(TAG,"v -- > " + v);
+      } else if (v == typeWriter) {
+        Log.e(TAG, "v -- > " + v);
         patientLeftBg.setColorFilter(ContextCompat.getColor(mContext, R.color.historyTypeColor), PorterDuff.Mode.SRC_ATOP);
         patientRightBg.setColorFilter(ContextCompat.getColor(mContext, R.color.departmentBtnColor), PorterDuff.Mode.SRC_ATOP);
         ivPatient.setColorFilter(ContextCompat.getColor(mContext, R.color.black), PorterDuff.Mode.SRC_ATOP);
@@ -121,7 +177,49 @@ public class HistoryFragment extends Fragment {
         writerRightBg.setColorFilter(ContextCompat.getColor(mContext, R.color.typeRightColor), PorterDuff.Mode.SRC_ATOP);
         ivWriter.setColorFilter(ContextCompat.getColor(mContext, R.color.white), PorterDuff.Mode.SRC_ATOP);
         tvWriter.setTextColor(ContextCompat.getColor(mContext, R.color.white));
+      } else if (v == leftDateLayout) {
+        dateDialog.show();
+      } else if (v == rightDateLayout) {
+        dateDialog.show();
+      }
+    }
+  };
+
+  private CheckBox.OnCheckedChangeListener onCheckedChangeListener = new CheckBox.OnCheckedChangeListener() {
+    @Override
+    public void onCheckedChanged(CompoundButton v, boolean isChecked) {
+
+      if (v == checkAll) {
+        if (isChecked == true) {
+          checkTemp.setChecked(false);
+          checkCert.setChecked(false);
+          checkConfirm.setChecked(false);
+          checkPrint.setChecked(false);
+        }
+      } else if (v == checkTemp) {
+        if (isChecked == true) {
+          checkAll.setChecked(false);
+        }
+      } else if (v == checkCert) {
+        if (isChecked == true) {
+          checkAll.setChecked(false);
+        }
+      } else if (v == checkConfirm) {
+        if (isChecked == true) {
+          checkAll.setChecked(false);
+        }
+      } else if (v == checkPrint) {
+        if (isChecked == true) {
+          checkAll.setChecked(false);
+        }
+      }
+      if (checkCert.isChecked() && checkTemp.isChecked() && checkConfirm.isChecked() && checkPrint.isChecked()) {
+        checkAll.setChecked(true);
+        checkCert.setChecked(false);
+        checkTemp.setChecked(false);
+        checkConfirm.setChecked(false);
+        checkPrint.setChecked(false);
       }
     }
   };
-}
+}

+ 28 - 11
app/src/main/java/com/dbs/mplus/knuh/fragment/SearchFragment.java

@@ -11,8 +11,9 @@ import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.LinearLayout;
+import android.widget.AdapterView;
 import android.widget.Spinner;
+import android.widget.TextView;
 
 import com.dbs.mplus.knuh.BuildConfig;
 import com.dbs.mplus.knuh.R;
@@ -37,9 +38,8 @@ public class SearchFragment extends Fragment {
 
   private CategoryAdapter categoryAdapter;
 
-  private Spinner      searchDeptSpinner;
-  private LinearLayout searchHospitalLayout;
-  private LinearLayout searchDeptLayout;
+  private Spinner searchDeptSpinner;
+  private TextView tvHospitalName;
 
   public SearchFragment() {
   }
@@ -52,23 +52,21 @@ public class SearchFragment extends Fragment {
     mActivity = (AppCompatActivity) getActivity();
   }
 
-
   @Nullable
   @Override
   public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
 
     View view = (View) inflater.inflate(R.layout.activity_search_fragment, container, false);
 
-    searchHospitalLayout  = (LinearLayout) view.findViewById(R.id.searchHospitalLayout);
-    searchDeptLayout      = (LinearLayout) view.findViewById(R.id.searchDeptLayout);
-    searchDeptSpinner     = (Spinner) view.findViewById(R.id.searchDeptSpinner);
+    searchDeptSpinner = (Spinner) view.findViewById(R.id.searchDeptSpinner);
+    tvHospitalName    = (TextView) view.findViewById(R.id.tvHospitalName);
 
-    getHospitalList(BuildConfig.INST_CD);
+    getCategoryList(BuildConfig.INST_CD);
 
     return view;
   }
 
-  private void getHospitalList(final String instCd) {
+  private void getCategoryList(final String instCd) {
     CallBack callBack = new CallBack() {
       @Override
       public void result(SoapObject result) {
@@ -92,8 +90,14 @@ public class SearchFragment extends Fragment {
       }
     };
 
+    if (instCd.equals(BuildConfig.INST_CD)) {
+      tvHospitalName.setText(getText(R.string.knuh));
+    } else {
+      tvHospitalName.setText(getText(R.string.chilgok));
+    }
+
     HashMap<String, String> mData = new HashMap<String, String>();
-    mData.put("categoryId", instCd);
+    mData.put("instCd", instCd);
     Util.callHttp(mContext, ConsentConfig.HOST_CONSENT, ConsentConfig.GET_CONSENT_CATEGORYY, mData, callBack);
   }
 
@@ -103,7 +107,20 @@ public class SearchFragment extends Fragment {
       public void run() {
         categoryAdapter = new CategoryAdapter(mActivity, arrayList);
         searchDeptSpinner.setAdapter(categoryAdapter);
+        searchDeptSpinner.setOnItemSelectedListener(onItemSelectedListener);
       }
     });
   }
+
+  private Spinner.OnItemSelectedListener onItemSelectedListener = new Spinner.OnItemSelectedListener() {
+    @Override
+    public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+      
+    }
+
+    @Override
+    public void onNothingSelected(AdapterView<?> parent) {
+
+    }
+  };
 }

+ 23 - 10
app/src/main/res/layout/activity_history_fragment.xml

@@ -105,8 +105,7 @@
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginLeft="8dp"
-                android:layout_marginTop="5dp">
+                android:layout_marginLeft="8dp">
 
                 <TextView
                     android:layout_width="match_parent"
@@ -120,7 +119,9 @@
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_margin="8dp"
+                android:layout_marginTop="8dp"
+                android:layout_marginLeft="8dp"
+                android:layout_marginRight="8dp"
                 android:orientation="horizontal">
 
                 <LinearLayout
@@ -167,7 +168,7 @@
                     android:id="@+id/rightDateLayout"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:layout_marginRight="4dp"
+                    android:layout_marginLeft="4dp"
                     android:layout_weight="1"
                     android:background="@drawable/shape_item"
                     android:orientation="horizontal">
@@ -220,40 +221,52 @@
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginHorizontal="8dp"
-                android:layout_marginBottom="8dp">
+                android:layout_marginHorizontal="8dp">
 
                 <CheckBox
                     android:id="@+id/checkAll"
+                    android:theme="@style/CheckBoxTheme"
                     android:layout_width="match_parent"
                     android:layout_height="match_parent"
                     android:layout_weight="1"
                     android:text="@string/all"
-                    android:textSize="12sp" />
+                    android:textSize="14sp" />
 
                 <CheckBox
                     android:id="@+id/checkTemp"
+                    android:theme="@style/CheckBoxTheme"
                     android:layout_width="match_parent"
                     android:layout_height="match_parent"
                     android:layout_weight="1"
                     android:text="@string/temp"
-                    android:textSize="12sp" />
+                    android:textSize="14sp" />
 
                 <CheckBox
                     android:id="@+id/checkCert"
+                    android:theme="@style/CheckBoxTheme"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_weight="1"
                     android:text="@string/cert"
-                    android:textSize="12sp" />
+                    android:textSize="14sp" />
 
                 <CheckBox
                     android:id="@+id/checkConfirm"
+                    android:theme="@style/CheckBoxTheme"
                     android:layout_width="match_parent"
                     android:layout_height="match_parent"
                     android:layout_weight="1"
                     android:text="@string/confirm"
-                    android:textSize="12sp" />
+                    android:textSize="14sp" />
+
+                <CheckBox
+                    android:id="@+id/checkPrint"
+                    android:theme="@style/CheckBoxTheme"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_weight="1"
+                    android:text="@string/print"
+                    android:textSize="14sp" />
             </LinearLayout>
 
             <LinearLayout

+ 0 - 1
app/src/main/res/layout/activity_left.xml

@@ -353,7 +353,6 @@
             <LinearLayout
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_marginRight="5dp"
                 android:layout_gravity="center">
                 <CheckBox
                     android:id="@+id/chkMyPatient"

+ 6 - 2
app/src/main/res/layout/activity_search_fragment.xml

@@ -21,11 +21,14 @@
             android:layout_marginRight="8dp"
             android:background="@drawable/shape_item">
             <TextView
-                android:id="@+id/tvHospital"
+                android:id="@+id/tvHospitalName"
                 android:layout_width="match_parent"
                 android:layout_height="35dp"
+                android:layout_marginLeft="8dp"
+                android:gravity="center_vertical"
                 android:textSize="16sp"
-                android:textColor="@color/black" />
+                android:textColor="@color/black"
+                android:text="Test"/>
         </LinearLayout>
         <LinearLayout
             android:id="@+id/searchDeptLayout"
@@ -38,6 +41,7 @@
                 android:id="@+id/searchDeptSpinner"
                 android:layout_width="match_parent"
                 android:layout_height="35dp"
+                android:layout_marginLeft="8dp"
                 android:spinnerMode="dropdown"
                 android:overlapAnchor="false"/>
         </LinearLayout>

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

@@ -11,6 +11,7 @@
     <string name="certficate">인증적용</string>
     <string name="login">로그인</string>
     <string name="confirm">확인</string>
+    <string name="print">출력</string>
     <string name="cancel">취소</string>
     <string name="alrim">알림</string>
     <string name="emptyId">사용자 ID를 입력하세요.</string>

+ 6 - 1
app/src/main/res/values/styles.xml

@@ -20,6 +20,11 @@
 
     </style>
 
+    <!-- 동의서 이력 카테고리 체크박스 색상 스타일 -->
+    <style name="CheckBoxTheme" parent="Theme.AppCompat.Light">
+        <item name="colorAccent">@color/typeRightColor</item>
+    </style>
+
     <style name="Theme.AppCompat.Translucent">
         <item name="android:windowBackground">@android:color/transparent</item>
         <item name="android:colorBackgroundCacheHint">@null</item>
@@ -37,7 +42,7 @@
 <!--        <item name="android:textColor">@color/black</item>-->
         <item name="android:textColor">@android:color/black</item>
         <item name="android:textColorHint">@android:color/darker_gray</item>
-        <item name="android:textCursorDrawable">@color/black</item>
+        <item name="android:textCursorDrawable">@null</item>
         <item name="colorControlNormal">@android:color/transparent</item>
         <item name="colorControlActivated">@android:color/transparent</item>
     </style>