diff --git a/app/src/main/java/com/example/nemophila/MyPageActivity.java b/app/src/main/java/com/example/nemophila/MyPageActivity.java index d71b37f..502a50b 100644 --- a/app/src/main/java/com/example/nemophila/MyPageActivity.java +++ b/app/src/main/java/com/example/nemophila/MyPageActivity.java @@ -14,6 +14,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; @@ -31,7 +32,8 @@ super.onCreate(savedInstanceState); setContentView(R.layout.activity_mypage); - Nemophila nemophila = (Nemophila) getApplication(); + //初期化 + Nemophila nemophila = (Nemophila) this.getApplication(); String uid = nemophila.getUid(); String name = nemophila.getName(); String token = nemophila.getToken(); @@ -39,7 +41,6 @@ myName.setText(name); TextView id = (TextView) findViewById(R.id.id); id.setText(uid); - AccountViewModel accountViewModel = new ViewModelProvider(this).get(AccountViewModel.class); // 「閉じる」ボタンを押したときにメイン画面へ遷移する Button closeButton = (Button) findViewById(R.id.close); @@ -88,6 +89,7 @@ }); //getNameLiveDataとの通信により今のユーザーネームを表示する + AccountViewModel accountViewModel = new ViewModelProvider(this).get(AccountViewModel.class); accountViewModel.getNameLiveData().observe(this, new Observer () { @Override public void onChanged(String name) { @@ -101,12 +103,12 @@ RecyclerView rv = findViewById(R.id.postsList); LinearLayoutManager llm = new LinearLayoutManager(this); List myPageActDataset = new ArrayList<>(); - MyPageActivity.MyPageActAdapter adapter = new MyPageActivity.MyPageActAdapter(myPageActDataset) { + MyPageActAdapter adapter = new MyPageActAdapter(myPageActDataset) { @Override - void onDeleteButtonClick(View view, int position, MyPageActivity.MyPageActDataModel dataModel) { + void onDeleteButtonClick(View view, int position, MyPageActDataModel dataModel) { new AlertDialog.Builder(MyPageActivity.this) .setTitle("警告") - .setMessage("この投稿を削除しますか?\n削除すると二度と元に戻せなくなります。") + .setMessage("この投稿を削除しますか?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { @@ -201,7 +203,7 @@ public TextView rateView; public TextView genreView; public TextView commentView; - public Button deleteButton; + public ImageButton deleteButton; public MyPageActViewHolder(View view) { super(view);