Commit 4cd4994f authored by Timothé KOBAK's avatar Timothé KOBAK

call button ?

parent dac8b0cd
...@@ -2,24 +2,8 @@ ...@@ -2,24 +2,8 @@
<project version="4"> <project version="4">
<component name="deploymentTargetDropDown"> <component name="deploymentTargetDropDown">
<value> <value>
<entry key="Basic">
<State />
</entry>
<entry key="app"> <entry key="app">
<State> <State />
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Medium_Phone_API_34.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-02-20T19:11:44.730496602Z" />
</State>
</entry> </entry>
</value> </value>
</component> </component>
......
package com.example.elbuenopeso.adapters package com.example.elbuenopeso.adapters
import android.content.Context import android.content.Context
import android.content.Intent
import android.database.Cursor import android.database.Cursor
import android.net.Uri import android.net.Uri
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.Button
import android.widget.CursorAdapter import android.widget.CursorAdapter
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
...@@ -35,6 +38,19 @@ class DbAdapter(context: Context, c: Cursor, layout: Int): CursorAdapter(context ...@@ -35,6 +38,19 @@ class DbAdapter(context: Context, c: Cursor, layout: Int): CursorAdapter(context
addressTextView.text = address addressTextView.text = address
prixView.text = "${usingJavaStringFormat(prix, 2)} €" prixView.text = "${usingJavaStringFormat(prix, 2)} €"
val Bouton: Button =view.findViewById(R.id.buttonCall)
Bouton.setOnClickListener{
Bouton.setOnClickListener {
Log.d("TAG", "TEST")
val callIntent = Intent(Intent.ACTION_DIAL)
callIntent.data = Uri.parse("tel:${Cursor.num}")
context.startActivity(callIntent)
}
}
imageView.setImageURI(Uri.parse(image)) imageView.setImageURI(Uri.parse(image))
} }
} }
\ No newline at end of file
package com.example.elbuenopeso.models package com.example.elbuenopeso.models
class DbAdModel(var _id: Int, var title: String, var address: String, var image: String, var prix: Double) { class DbAdModel(var _id: Int, var title: String, var address: String, var image: String, var prix: Double, var num: String) {
} }
\ No newline at end of file
...@@ -5,6 +5,12 @@ ...@@ -5,6 +5,12 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="8dp"> android:padding="8dp">
<Button
android:id="@+id/buttonCall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Call" />
<ImageView <ImageView
android:id="@+id/itemListViewImageView" android:id="@+id/itemListViewImageView"
android:layout_width="117dp" android:layout_width="117dp"
......
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