diff --git a/app/src/main/java/com/example/citrusclient/views/AccountColorDialogFragment.java b/app/src/main/java/com/example/citrusclient/views/AccountColorDialogFragment.java new file mode 100644 index 0000000..51451ca --- /dev/null +++ b/app/src/main/java/com/example/citrusclient/views/AccountColorDialogFragment.java @@ -0,0 +1,69 @@ +package com.example.citrusclient.views; + +import android.app.Dialog; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.os.Bundle; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import com.example.citrusclient.Citrus; +import com.example.citrusclient.R; +import android.widget.RadioButton; +import android.widget.RadioGroup; + + +public class AccountColorDialogFragment extends DialogFragment { + private Citrus citrus; + + SettingsFragment target; //なにこれ + + AccountColorDialogFragment(SettingsFragment st) {target=st;} + @NonNull //なにこれ + @Override + public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { + // ダイアログを生成 + Dialog dialog = new Dialog(requireContext()); + dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + dialog.setContentView(R.layout.fragment_account_color_dialog); + + RadioGroup rg = dialog.findViewById(R.id.radioGroupColors); + // ラジオグループのチェック状態変更リスナーを設定 + rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + // チェックされたラジオボタンのIDを取得 + RadioButton radioButton = group.findViewById(checkedId); + if (radioButton != null) { + int selectedId = radioButton.getId(); + // ここで選択されたラジオボタンのID(selectedId)を使用して処理を行う + if (selectedId == R.id.radioButtonShadow) { + target.returnAcountColor("#D5D5D5"); + } else if (selectedId == R.id.radioButtonSprout) { + target.returnAcountColor("#BEECAE"); + } else if (selectedId == R.id.radioButtonAqua) { + target.returnAcountColor("#BEF7FF"); + } else if (selectedId == R.id.radioButtonLavender) { + target.returnAcountColor("#D297FC"); + } else if (selectedId == R.id.radioButtonJasmine) { + target.returnAcountColor("#FFFFFF"); + } else if (selectedId == R.id.radioButtonCitrus) { + target.returnAcountColor("#FFFF99"); + } else if (selectedId == R.id.radioButtonSakura) { + target.returnAcountColor("#FFECEF"); + } + + } + dismiss(); + } + }); + + return dialog; + } + } \ No newline at end of file