| |
---|
| | import com.google.android.gms.maps.model.LatLng; |
---|
| | import com.google.android.gms.maps.model.MarkerOptions; |
---|
| | |
---|
| | import org.ntlab.amaryllis.client.Amaryllis; |
---|
| | import org.ntlab.amaryllis.client.DialogFragment; |
---|
| | import org.ntlab.amaryllis.client.MyDialogFragment; |
---|
| | import org.ntlab.amaryllis.client.R; |
---|
| | import org.ntlab.amaryllis.client.VoiceActivity; |
---|
| | import org.ntlab.amaryllis.client.entities.SignUpJson; |
---|
| | import org.ntlab.amaryllis.client.entities.Voicememo; |
---|
| |
---|
| | dialogButton = (Button)v.findViewById(R.id.dialog); |
---|
| | dialogButton.setOnClickListener(new View.OnClickListener() { |
---|
| | public void onClick(View v) { |
---|
| | //Record(); |
---|
| | FragmentManager manager = getActivity().getSupportFragmentManager(); |
---|
| | MyDialogFragment dialog = MyDialogFragment.newInstance(); |
---|
| | dialog.setTargetFragment(MapsFragment.this, 0); |
---|
| | dialog.show(manager, "MyDialogFragment"); |
---|
| | //FragmentManager manager = getActivity().getSupportFragmentManager(); |
---|
| | //MyDialogFragment dialog = MyDialogFragment.newInstance(); |
---|
| | //dialog.setTargetFragment(MapsFragment.this, 0); |
---|
| | //dialog.show(manager, "MyDialogFragment"); |
---|
| | |
---|
| | |
---|
| | } |
---|
| | }); |
---|
| |
---|
| | |
---|
| | |
---|
| | |
---|
| | |
---|
| | public static class MyDialogFragment extends DialogFragment { |
---|
| | //public static class MyDialogFragment extends DialogFragment { |
---|
| | |
---|
| | private DialogFragmentListener dialogFragmentListener; |
---|
| | |
---|
| | public interface DialogFragmentListener { |
---|
| |
---|
| | return new MyDialogFragment(); |
---|
| | } |
---|
| | |
---|
| | // |
---|
| | @Override |
---|
| | public void onAttach(Context context) { |
---|
| | super.onAttach(context); |
---|
| | |
---|
| | |
---|
| | Fragment targetFragment = this.getTargetFragment(); |
---|
| | try{ |
---|
| | if(targetFragment != null){ |
---|
| | dialogFragmentListener = (DialogFragmentListener)targetFragment; |
---|
| | } |
---|
| | }catch (ClassCastException e){ |
---|
| | throw new ClassCastException("DialogFragmentListenerをimplementしていません"); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | public MyDialogFragment newInstance(Fragment fragment){ |
---|
| | MyDialogFragment instance = new MyDialogFragment(); |
---|
| | instance.setTargetFragment(fragment, 0); |
---|
| | return instance; |
---|
| | } |
---|
| | |
---|
| | @NonNull |
---|
| | //@Override |
---|
| | public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { |
---|
| | |
---|
| | AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity()) |
---|
| | .setTitle("購入") |
---|
| | .setMessage("購入しますか?") |
---|
| | .setPositiveButton("購入する", new DialogInterface.OnClickListener() { |
---|
| | @Override |
---|
| | public void onClick(DialogInterface dialog, int which) { |
---|
| | dialogFragmentListener.onDialogPositiveButtonClicked(); |
---|
| | } |
---|
| | }) |
---|
| | .setNegativeButton("やめる", null); |
---|
| | |
---|
| | return dialogBuilder.create(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | |
---|
| | |
---|
| | |
---|
| | |
---|
| | |
---|
| | |
---|
| | |
---|
| | |
---|
| | |
---|
| | //public class FireMissilesDialogFragment extends DialogFragment { |
---|
| | //@Override |
---|
| | //public Dialog onCreateDialog(Bundle savedInstanceState) { |
---|
| | //public void onAttach(Context context) { |
---|
| | //super.onAttach(context); |
---|
| | |
---|
| | |
---|
| | //Fragment targetFragment = this.getTargetFragment(); |
---|
| | //try{ |
---|
| | //if(targetFragment != null){ |
---|
| | //dialogFragmentListener = (DialogFragmentListener)targetFragment; |
---|
| | //} |
---|
| | //}catch (ClassCastException e){ |
---|
| | //throw new ClassCastException("DialogFragmentListenerをimplementしていません"); |
---|
| | //} |
---|
| | //} |
---|
| | |
---|
| | //public MyDialogFragment newInstance(Fragment fragment){ |
---|
| | //MyDialogFragment instance = new MyDialogFragment(); |
---|
| | //instance.setTargetFragment(fragment, 0); |
---|
| | //return instance; |
---|
| | //} |
---|
| | |
---|
| | //@NonNull |
---|
| | //@Override |
---|
| | //public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { |
---|
| | |
---|
| | //AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity()) |
---|
| | //.setTitle("購入") |
---|
| | //.setMessage("購入しますか?") |
---|
| | //.setPositiveButton("購入する", new DialogInterface.OnClickListener() { |
---|
| | //@Override |
---|
| | //public void onClick(DialogInterface dialog, int which) { |
---|
| | //dialogFragmentListener.onDialogPositiveButtonClicked(); |
---|
| | //} |
---|
| | //}) |
---|
| | //.setNegativeButton("やめる", null); |
---|
| | |
---|
| | //return dialogBuilder.create(); |
---|
| | //} |
---|
| | //} |
---|
| | |
---|
| | |
---|
| | //public class FireMissilesDialogFragment extends DialogFragment { |
---|
| | //@Override |
---|
| | //public Dialog onCreateDialog(Bundle savedInstanceState) { |
---|
| | // Use the Builder class for convenient dialog construction |
---|
| | //AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); |
---|
| | //builder.setMessage("R.string.dialog_fire_missiles") |
---|
| | //.setPositiveButton("R.string.fire", new DialogInterface.OnClickListener() { |
---|
| | //public void onClick(DialogInterface dialog, int id) { |
---|
| | // FIRE ZE MISSILES! |
---|
| | //} |
---|
| | //}) |
---|
| | //.setNegativeButton("R.string.cancel", new DialogInterface.OnClickListener() { |
---|
| | //public void onClick(DialogInterface dialog, int id) { |
---|
| | // User cancelled the dialog |
---|
| | //} |
---|
| | //}); |
---|
| | //.setPositiveButton("R.string.fire", new DialogInterface.OnClickListener() { |
---|
| | //public void onClick(DialogInterface dialog, int id) { |
---|
| | // FIRE ZE MISSILES! |
---|
| | //} |
---|
| | //}) |
---|
| | //.setNegativeButton("R.string.cancel", new DialogInterface.OnClickListener() { |
---|
| | //public void onClick(DialogInterface dialog, int id) { |
---|
| | // User cancelled the dialog |
---|
| | //} |
---|
| | //}); |
---|
| | // Create the AlertDialog object and return it |
---|
| | //return builder.create(); |
---|
| | //} |
---|
| | //} |
---|
| | |
---|
| | //FireMissilesDialogFragment F1 = new FireMissilesDialogFragment(); |
---|
| | |
---|
| | |
---|
| | |
---|
| | |
---|
| | |
---|
| | //private DialogFragment.OnOkButtonClickedListener mListener; |
---|
| | //private void Record() { |
---|
| | //ダイアログの作成 |
---|
| | //AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); |
---|
| | //builder.setTitle("mTitle") |
---|
| | //.setMessage("mMessage") |
---|
| | //.setPositiveButton("OK", new DialogInterface.OnClickListener() { |
---|
| | //public void onClick(DialogInterface dialog, int id) { |
---|
| | //mListener.onOkButtonClicked(); |
---|
| | //} |
---|
| | //}); |
---|
| | //} |
---|
| | |
---|
| | } |
---|
| | //} |
---|
| | //} |
---|
| | |
---|
| | //FireMissilesDialogFragment F1 = new FireMissilesDialogFragment(); |
---|
| | |
---|
| | |
---|
| | //private DialogFragment.OnOkButtonClickedListener mListener; |
---|
| | //private void Record() { |
---|
| | //ダイアログの作成 |
---|
| | //AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); |
---|
| | //builder.setTitle("mTitle") |
---|
| | //.setMessage("mMessage") |
---|
| | //.setPositiveButton("OK", new DialogInterface.OnClickListener() { |
---|
| | //public void onClick(DialogInterface dialog, int id) { |
---|
| | //mListener.onOkButtonClicked(); |
---|
| | //} |
---|
| | //}); |
---|
| | //} |
---|
| | |
---|
| | } |
---|
| | |
---|
| | |