diff --git a/app/src/main/java/org/ntlab/amaryllis/client/MyDialogFragment.java b/app/src/main/java/org/ntlab/amaryllis/client/MyDialogFragment.java index b369b18..593f3aa 100644 --- a/app/src/main/java/org/ntlab/amaryllis/client/MyDialogFragment.java +++ b/app/src/main/java/org/ntlab/amaryllis/client/MyDialogFragment.java @@ -4,6 +4,7 @@ import android.content.Context; import android.os.Bundle; +import android.view.LayoutInflater; import android.view.View; import android.app.Dialog; @@ -12,6 +13,8 @@ import androidx.fragment.app.Fragment; +import android.view.ViewGroup; +import android.widget.CheckBox; import android.widget.EditText; import android.widget.TextView; import android.widget.Button; @@ -23,6 +26,9 @@ import android.view.Window; import android.view.WindowManager; +import java.util.ArrayList; +import java.util.List; + public class MyDialogFragment extends DialogFragment { @@ -233,10 +239,33 @@ */ + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_dialog); + + + //chkbox.setChecked(true); + } + + private void setContentView(int activity_dialog) { + } + + /* + public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle saveInstanceState){ + View view = inflater.inflate(R.layout.activity_dialog,container,false); + + CheckBox check = (CheckBox)view.findViewById(R.id.checkbox_1); + + return view; + } +*/ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { //editText = + final int n = 5; + final Dialog dialog = new Dialog(getActivity()); // タイトル非表示 @@ -247,6 +276,9 @@ // 背景を透明にする dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + // + final CheckBox check = dialog.findViewById(R.id.checkbox_1); + // OK ボタンのリスナ dialog.findViewById(R.id.positive_button).setOnClickListener(new OnClickListener() { @Override @@ -261,6 +293,27 @@ TextView Overview = (TextView)getActivity().findViewById(R.id.VoiceOverview); Overview.setText(editOverview); + //for(int i = 0;i list = new ArrayList<>(); + //ViewGroup layout = check; + //int count = layout.getChildCount(); + //for(int j = 0;j< count;j++){ + //v = layout.getChildAt(j); + //if(v instanceof CheckBox){ + //CheckBox box = (CheckBox) v; + //if(box.isChecked())list.add(box.getText().toString()); + + //} + //} + //} + + //チェックされた状態だった + if(check.isChecked() == true){ + Title.setText("1"); + }else{//チェックされていない状態だった + Title.setText("ダメです。"); + }