diff --git a/app/src/main/java/com/example/nemophila/MyPageEditorActivity.java b/app/src/main/java/com/example/nemophila/MyPageEditorActivity.java index e46feb8..a92b444 100644 --- a/app/src/main/java/com/example/nemophila/MyPageEditorActivity.java +++ b/app/src/main/java/com/example/nemophila/MyPageEditorActivity.java @@ -29,12 +29,14 @@ private String icon; //マイページ編集画面の作成 - private ActivityResultLauncher launcher = registerForActivityResult(new ActivityResultContracts.OpenMultipleDocuments(), new ActivityResultCallback>() { + private ActivityResultLauncher launcher = registerForActivityResult(new ActivityResultContracts.OpenDocument(), new ActivityResultCallback() { @Override - public void onActivityResult(List uriList) { + public void onActivityResult(Uri uri) { - if(uriList.size() == 0)return; - icon = new String(Base64.getEncoder().encode(uriList.get(0).toString().getBytes())); + if(uri == null)return; + icon = new String(Base64.getEncoder().encode(uri.toString().getBytes())); + ImageButton changeIconButton = (ImageButton)findViewById(R.id.changeIconButton); + changeIconButton.setImageURI(uri); } }); @@ -100,7 +102,7 @@ ImageButton changeIconButton = (ImageButton)findViewById(R.id.changeIconButton); changeIconButton.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { - launcher.launch(new String[]{"image/*"}); + launcher.launch(new String[] {"image/*"}); } }); @@ -140,7 +142,7 @@ String uid = nemophila.getUid(); String token = nemophila.getToken(); accountViewModel.deleteAccount(uid,token); - Intent intent = new Intent(MyPageEditorActivity.this, LoginActivity.class); + Intent intent = new Intent(MyPageEditorActivity.this, SignUpActivity.class); startActivity(intent); } }); diff --git a/app/src/main/res/layout/activity_my_page_editor.xml b/app/src/main/res/layout/activity_my_page_editor.xml index f10111c..b58c5f0 100644 --- a/app/src/main/res/layout/activity_my_page_editor.xml +++ b/app/src/main/res/layout/activity_my_page_editor.xml @@ -33,9 +33,10 @@ android:textSize="12sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_bias="0.471" + app:layout_constraintHorizontal_bias="0.503" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.622" /> @@ -86,10 +87,10 @@ android:textSize="24sp" app:layout_constraintBottom_toTopOf="@+id/editName" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_bias="0.634" + app:layout_constraintHorizontal_bias="0.578" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintVertical_bias="0.17" /> + app:layout_constraintVertical_bias="0.154" /> + app:layout_constraintVertical_bias="0.149" />