Commit b716a458 authored by m-spi's avatar m-spi

Corrections des XML

parent d1ee753c
...@@ -4,16 +4,13 @@ import android.app.Activity ...@@ -4,16 +4,13 @@ import android.app.Activity
import android.content.Intent import android.content.Intent
import android.graphics.Bitmap import android.graphics.Bitmap
import android.net.Uri import android.net.Uri
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.provider.MediaStore import android.provider.MediaStore
import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageButton import android.widget.ImageButton
import android.widget.ImageView import android.widget.ImageView
import androidx.activity.result.ActivityResultCallback
import androidx.activity.result.ActivityResultLauncher import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
...@@ -29,15 +26,15 @@ class AddFragment : Fragment() { ...@@ -29,15 +26,15 @@ class AddFragment : Fragment() {
// onDestroyView. // onDestroyView.
private val binding get() = _binding!! private val binding get() = _binding!!
lateinit var camera_open_id: ImageButton private lateinit var cameraButton: ImageButton
lateinit var click_image_id: ImageView private lateinit var image: ImageView
private val galleryActivityResultLauncher: ActivityResultLauncher<Intent> = private val galleryActivityResultLauncher: ActivityResultLauncher<Intent> =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
result -> run { result -> run {
if (result.resultCode == Activity.RESULT_OK) { if (result.resultCode == Activity.RESULT_OK) {
val image = result?.data?.data as Uri val image = result?.data?.data as Uri
click_image_id.setImageURI(image) this.image.setImageURI(image)
} }
} }
} }
...@@ -47,7 +44,7 @@ class AddFragment : Fragment() { ...@@ -47,7 +44,7 @@ class AddFragment : Fragment() {
result -> run { result -> run {
if (result.resultCode == Activity.RESULT_OK) { if (result.resultCode == Activity.RESULT_OK) {
val image = result.data?.extras?.get("data") as Bitmap? val image = result.data?.extras?.get("data") as Bitmap?
click_image_id.setImageBitmap(image) this.image.setImageBitmap(image)
} }
} }
} }
...@@ -63,8 +60,8 @@ class AddFragment : Fragment() { ...@@ -63,8 +60,8 @@ class AddFragment : Fragment() {
_binding = FragmentAddBinding.inflate(inflater, container, false) _binding = FragmentAddBinding.inflate(inflater, container, false)
val root: View = binding.root val root: View = binding.root
click_image_id = binding.image image = binding.image
camera_open_id = binding.cameraButton cameraButton = binding.cameraButton
binding.image.setOnClickListener { binding.image.setOnClickListener {
val gallery = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI) val gallery = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
...@@ -76,10 +73,10 @@ class AddFragment : Fragment() { ...@@ -76,10 +73,10 @@ class AddFragment : Fragment() {
cameraActivityResultLauncher.launch(camera) cameraActivityResultLauncher.launch(camera)
} }
// val textView: TextView = binding.textNotifications binding.sendButton.setOnClickListener {
// notificationsViewModel.text.observe(viewLifecycleOwner) {
// textView.text = it }
// }
return root return root
} }
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:paddingTop="?attr/actionBarSize">
<fragment <fragment
android:id="@+id/nav_host_fragment_activity_main" android:id="@+id/nav_host_fragment_activity_main"
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
android:id="@+id/image" android:id="@+id/image"
android:layout_width="300dp" android:layout_width="300dp"
android:layout_height="300dp" android:layout_height="300dp"
android:layout_marginTop="100dp" android:layout_marginTop="16dp"
android:contentDescription="@string/gallery" android:contentDescription="@string/gallery"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<Button <Button
android:id="@+id/button" android:id="@+id/sendButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="32dp" android:layout_marginTop="32dp"
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
<ListView <ListView
android:id="@+id/listView" android:id="@+id/listView"
android:layout_width="409dp" android:layout_width="match_parent"
android:layout_height="681dp" android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
android:paddingHorizontal="20dp"> android:paddingHorizontal="20dp">
<Button <Button
android:id="@+id/button" android:id="@+id/sendButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment