|
@@ -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);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
-}
|
|
|
+}
|