| | package com.example.nemophila; |
---|
| | |
---|
| | import androidx.annotation.NonNull; |
---|
| | import androidx.annotation.Nullable; |
---|
| | import androidx.appcompat.app.AlertDialog; |
---|
| | import androidx.appcompat.app.AppCompatActivity; |
---|
| | import androidx.fragment.app.DialogFragment; |
---|
| | |
---|
| | import android.app.Dialog; |
---|
| | import android.content.DialogInterface; |
---|
| | import android.content.Intent; |
---|
| | import android.os.Bundle; |
---|
| | import android.view.View; |
---|
| | import android.widget.Button; |
---|
| |
---|
| | protected void onCreate(Bundle savedInstanceState) { |
---|
| | super.onCreate(savedInstanceState); |
---|
| | setContentView(R.layout.activity_requesting); |
---|
| | |
---|
| | //右上のボタンで投稿画面(PostActivity)へ遷移 |
---|
| | //フレンド検索ボタン |
---|
| | Button toPostButton = (Button)findViewById(R.id.requestingSearchButton); |
---|
| | toPostButton.setOnClickListener(new View.OnClickListener(){ |
---|
| | public void onClick(View v){ |
---|
| | } |
---|
| | }); |
---|
| | } |
---|
| | |
---|
| | //フレンド送信のダイアログを表示 |
---|
| | public void showDialog(View view) { |
---|
| | DialogFragment dialogFragment = new RequestingFragment(); |
---|
| | dialogFragment.show(getSupportFragmentManager(), "requesting_dialog"); |
---|
| | } |
---|
| | |
---|
| | //フレンド申請のためのダイアログフラグメント |
---|
| | public class RequestingFragment extends DialogFragment { |
---|
| | |
---|
| | @NonNull |
---|
| | @Override |
---|
| | public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { |
---|
| | AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); |
---|
| | |
---|
| | builder.setTitle("フレンド申請") |
---|
| | .setMessage("(申請先のユーザー名)") |
---|
| | .setPositiveButton("フレンド申請", new DialogInterface.OnClickListener() { |
---|
| | public void onClick(DialogInterface dialog, int id) { |
---|
| | // このボタンを押した時の処理を書きます。 |
---|
| | } |
---|
| | }) |
---|
| | .setNegativeButton("キャンセル", null); |
---|
| | return builder.create(); |
---|
| | } |
---|
| | } |
---|
| | } |
---|
| | |