Commit 1623ce2c by Yannine Alvarez

Iniciando repositorio de ayudapy

parents
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.ayudapy"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.material:material:1.2.0-alpha06'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
// implementation 'com.squareup.okhttp3:okhttp:3.4.0'
// implementation 'com.squareup.okhttp3:logging-interceptor:3.4.0'
//implementation 'com.squareup.okio:okio:2.4.3'
//noinspection GradleCompatible
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
implementation 'com.google.okhttp:okhttp:20120626'
implementation 'com.squareup.okio:okio:2.6.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'android.arch.persistence.room:runtime:1.1.1'
kapt 'android.arch.persistence.room:compiler:1.1.1'
//implementation "android.arch.lifecycle:extensions:1.1.1"
//implementation "android.arch.persistence.room:runtime:1.0.0-rc1"
//kapt "android.arch.persistence.room:compiler:1.0.0-rc1"
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
{
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "f617a1d61ee384e32e6ed730c8c23f64",
"entities": [
{
"tableName": "pedido_save",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT NOT NULL, `message` TEXT NOT NULL, `name` TEXT NOT NULL, `phone` TEXT NOT NULL, `address` TEXT NOT NULL, `added` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "message",
"columnName": "message",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "phone",
"columnName": "phone",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "address",
"columnName": "address",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "added",
"columnName": "added",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
}
],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"f617a1d61ee384e32e6ed730c8c23f64\")"
]
}
}
\ No newline at end of file
package com.example.ayudapy
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.ayudapy", appContext.packageName)
}
}
<resources>
<!--
TODO: Before you run your application, you need a Google Maps API key.
To get one, follow this link, follow the directions and press "Create" at the end:
https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=86:B2:6C:17:16:46:64:7B:43:D9:57:06:16:2C:0B:02:49:31:E7:2A%3Bcom.example.ayudapy
You can also add your credentials to an existing key, using these values:
Package name:
com.example.ayudapy
SHA-1 certificate fingerprint:
86:B2:6C:17:16:46:64:7B:43:D9:57:06:16:2C:0B:02:49:31:E7:2A
Alternatively, follow the directions here:
https://developers.google.com/maps/documentation/android/start#get-key
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
-->
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyCDCQFseYL7K7okR_YL7lmh2SCRct9YiiM</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ayudapy">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.NoActionBar">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<activity android:name=".InfoActivity" />
<activity
android:name=".MapsActivity"
android:label="@string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package com.example.ayudapy
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.GET
import retrofit2.http.Query
interface ApiPedidos {
companion object{
val instance:ApiService by lazy{
val builder_pedido = Retrofit.Builder()
.baseUrl("https://ayudapy.org/api/v1/helprequestsgeo/")
.addConverterFactory(GsonConverterFactory.create())
val client = OkHttpClient.Builder()
client.addInterceptor(HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
})
builder_pedido.client(client.build())
builder_pedido.build().create(ApiService::class.java)
}
}
}
\ No newline at end of file
package com.example.ayudapy
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query
import java.util.concurrent.TimeUnit
interface ApiService {
@GET("?in_bbox")
fun getListaCentro(
@Query("limit") limit : Int,
@Query("offset") offset : Int
): Call<CentroAyuda>
/* @GET("helprequestsgeo/")
fun getHelpRequests(@Query("in_bbox") boundaryBox: String): Call<CentroAyuda>*/
@GET("?in_bbox")
fun getListaPedidos(
@Query("limit") limit : Int,
@Query("offset") offset : Int
): Call<PedidosAyuda>
@GET("{id}")
fun getPedidoDetalle(
@Path("id") id : Int
): Call<Resultado>
companion object {
// init Retrofit base server instance
val redditClient by lazy { ApiService.invoke("https://ayudapy.org/api/v1/donationcenters/") }
val stackClient by lazy { ApiService.invoke("https://ayudapy.org/api/v1/helprequestsgeo/") }
val pedidoDetalle by lazy { ApiService.invoke("https://ayudapy.org/api/v1/helprequests/") }
private val loggingInterceptor = HttpLoggingInterceptor().apply {
this.level = HttpLoggingInterceptor.Level.BODY
}
operator fun invoke(baseUrl: String): ApiService {
val client = OkHttpClient.Builder().apply {
/**addNetworkInterceptor(StethoInterceptor()) */
addNetworkInterceptor(loggingInterceptor)
connectTimeout(10, TimeUnit.MINUTES)
readTimeout(10, TimeUnit.MINUTES)
writeTimeout(10, TimeUnit.MINUTES)
}.build()
return Retrofit.Builder()
.client(client)
.baseUrl(baseUrl)
// .addCallAdapterFactory(CoroutineCallAdapterFactory())
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(ApiService::class.java)
}
}
}
\ No newline at end of file
package com.example.ayudapy
data class CentroAyuda (
val count: Long,
val next: Any? = null,
val previous: Any? = null,
val results: List<Result>
)
data class Result (
val id: Long,
val name: String,
val phone: String,
val location: Location,
val address: String,
val city: String,
val cityCode: String,
val active: Boolean,
val added: String
)
data class Location (
val type: String,
val coordinates: List<Double>
)
package com.example.ayudapy
import androidx.lifecycle.LiveData
import androidx.room.*
import androidx.room.OnConflictStrategy.REPLACE
@Dao
interface DaoPedido {
@Query("SELECT * from pedido_save")
fun getAll(): List<PedidoSave>
@Insert(onConflict = REPLACE)
fun insert(pedido: PedidoSave)
@Delete
fun delete(pedido: PedidoSave)
}
/* @Query("UPDATE pedido_save SET name =:studentName, nim =:studentNim, gender =:studentGen WHERE id =:studentId")
fun update(studentId: Long, studentName:String, studentNim:String, studentGen:String)*/
package com.example.ayudapy
import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
@Database(entities = arrayOf(PedidoSave::class), version = 1)
abstract class PedidoDataBase : RoomDatabase() {
abstract fun daoPedido(): DaoPedido
companion object {
private var INSTANCE: PedidoDataBase? = null
fun getInstance(context: Context): PedidoDataBase? {
if (INSTANCE == null) {
synchronized(PedidoDataBase::class) {
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
PedidoDataBase::class.java, "pedidodata.db")
.build()
}
}
return INSTANCE
}
fun destroyInstance() {
INSTANCE = null
}
}
}
\ No newline at end of file
package com.example.ayudapy
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import org.jetbrains.annotations.NotNull
@Entity(tableName = "pedido_save")
data class PedidoSave(
@PrimaryKey var id: Long,
@ColumnInfo(name = "title") var title: String,
@ColumnInfo(name = "message") var message: String,
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "phone") var phone: String,
@ColumnInfo(name = "address") var address: String,
// @ColumnInfo(name = "location") var location: String,
// @ColumnInfo(name = "active") var active: String,
@ColumnInfo(name = "added") var added: String
)
package com.example.ayudapy
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.info.*
class InfoActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.info)
val intento : Intent =intent
terminos_de_uso.setOnClickListener {
val url = "https://ayudapy.org/legal"
val i = Intent(Intent.ACTION_VIEW)
i.data = Uri.parse(url)
startActivity(i)
}
preguntas_freq.setOnClickListener {
val url = "https://ayudapy.org/preguntas_frecuentes"
val i = Intent(Intent.ACTION_VIEW)
i.data = Uri.parse(url)
startActivity(i)
}
visitar_ayudapy.setOnClickListener {
val url = "https://ayudapy.org"
val i = Intent(Intent.ACTION_VIEW)
i.data = Uri.parse(url)
startActivity(i)
}
}
}
package com.example.ayudapy
import android.Manifest
import android.content.Intent
import android.content.pm.PackageManager
import android.database.Observable
import android.location.Location
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.provider.ContactsContract
import android.util.Log
import android.view.View
import android.widget.Button
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.google.android.gms.location.FusedLocationProviderClient
import com.google.android.gms.location.LocationServices
import com.google.android.gms.maps.CameraUpdateFactory
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.OnMapReadyCallback
import com.google.android.gms.maps.SupportMapFragment
import com.google.android.gms.maps.model.BitmapDescriptorFactory
import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.Marker
import com.google.android.gms.maps.model.MarkerOptions
import com.google.android.material.bottomsheet.BottomSheetDialog
import kotlinx.android.synthetic.main.alert_dialog_contacto.view.*
import kotlinx.android.synthetic.main.fragment_pedido.view.*
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
class MapsActivity : AppCompatActivity(), OnMapReadyCallback, GoogleMap.OnMarkerClickListener {
private lateinit var mMap: GoogleMap
private lateinit var lastLocation: Location
private lateinit var fusedLocationClient: FusedLocationProviderClient
internal lateinit var infoButton: Button
private var selectedMarker:Marker?=null
companion object{
private const val LOCATION_PERMISSION_REQUEST_CODE=1
}
val PERMISSIONS_REQUEST_READ_CONTACTS = 100
private val PROJECTION = arrayOf(
ContactsContract.CommonDataKinds.Phone.CONTACT_ID,
ContactsContract.Contacts.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Phone.NUMBER
)
private val markerClickListener = object: GoogleMap.OnMarkerClickListener{
override fun onMarkerClick(marker: Marker?):Boolean{
if(marker == selectedMarker){
selectedMarker=null
return true
}
selectedMarker =marker
return false
}
}
private var pedidoDatabase:PedidoDataBase? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_maps)
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as SupportMapFragment
mapFragment.getMapAsync(this)
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this)
//intent para mandar a la siguiente pantalla el boton
val myLayout: View = findViewById(R.id.menu_layout) // root View id from that link
val myView: View = myLayout.findViewById(R.id.info_button)
val ayudenme_button: View = myLayout.findViewById(R.id.help_button)
myView.setOnClickListener {
Toast.makeText(this@MapsActivity, "Boton de info probar", Toast.LENGTH_SHORT).show()
val i = Intent(this, InfoActivity::class.java)
startActivity(i)
}
ayudenme_button.setOnClickListener {
Toast.makeText(this@MapsActivity, "Boton de info probar ayudenme", Toast.LENGTH_SHORT).show()
val url = "https://ayudapy.org/recibir"
val i = Intent(Intent.ACTION_VIEW)
i.data = Uri.parse(url)
startActivity(i)
}
//agregar permiso para llamar
val permissionCheck: Int = ContextCompat.checkSelfPermission(
this, Manifest.permission.CALL_PHONE
)
if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
Log.i("Mensaje", "No se tiene permiso para realizar llamadas telefónicas.")
ActivityCompat.requestPermissions(
this,
arrayOf(Manifest.permission.CALL_PHONE),
225
)
} else {
Log.i("Mensaje", "Se tiene permiso!")
}
pedidoDatabase = PedidoDataBase.getInstance(this)
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
override fun onMapReady(googleMap: GoogleMap) {
mMap = googleMap
// Add a marker in Sydney and move the camera
/* val sydney = LatLng(-34.0, 151.0)
mMap.addMarker(MarkerOptions().position(sydney).title("Marker in Sydney"))
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 15f))*/
mMap.setOnMarkerClickListener(this)
mMap.uiSettings.isZoomControlsEnabled = true
setup()
ApiService.redditClient.getListaCentro(15, 0).enqueue(
object: Callback<CentroAyuda> {
override fun onFailure(call: Call<CentroAyuda>, t: Throwable) {
t.printStackTrace()
}
override fun onResponse(call: Call<CentroAyuda>, response: Response<CentroAyuda>) {
if (response.isSuccessful) {
val listaCentro = response.body()
val CentroDeAyudas = listaCentro!!.results
var item = Int
for( item in CentroDeAyudas.indices ){
var name=listaCentro.results[item].name
var lat =listaCentro.results[item].location.coordinates
println("Este es el nombre $name")
println("Este son coordenadas $lat")
mMap.addMarker(
MarkerOptions()
.position(LatLng(lat[1],lat[0]))
.title(name)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.centro_donacion))
)
}
//print("Este es el centro ${CentroDeAyudas.size}")
//Log.d("centro","$CentroDeAyudas")
}else{
Toast.makeText(this@MapsActivity, "NO HUBO RESPUESTA EXITOSA", Toast.LENGTH_SHORT).show()
}
}
}
)
ApiService.stackClient.getListaPedidos(15, 0).enqueue(
object: Callback<PedidosAyuda> {
override fun onFailure(call: Call<PedidosAyuda>, t: Throwable) {
t.printStackTrace()
}
@RequiresApi(Build.VERSION_CODES.O)
override fun onResponse(call: Call<PedidosAyuda>, response: Response<PedidosAyuda>) {
if (response.isSuccessful) {
val listaPedidos = response.body()
val PedidosDeAyudas = listaPedidos!!.features
var fec_actual = LocalDateTime.now()
var fec_actual_formato = DateTimeFormatter.ofPattern("yyyy-MM-dd")
var fec_actual_formateado = fec_actual.format(fec_actual_formato)
//print("La fecha es: $fec_actual_formateado")
for( item in PedidosDeAyudas.indices ){
var name=listaPedidos.features[item].properties.name
var id=listaPedidos.features[item].properties.pk.toInt()
var lat =listaPedidos.features[item].geometry.coordinates
//println("Este es el nombre $name")
//println("Este son coordenadas $lat")
// val bounds = LatLngBounds.Builder()//Prueba Bounds
mMap.addMarker(
MarkerOptions()
.position(LatLng(lat[1],lat[0]))
.title(name)
.snippet(id.toString())
.icon(BitmapDescriptorFactory.fromResource(R.drawable.pedido)
)
)
//bounds.include(LatLng(lat[1],lat[0]))
// moveCamera(CameraUpdateFactory.newLatLngBounds(bounds.build(), 50))
// println("Este es el id sin hacer clic $id")
mMap.setOnMarkerClickListener {marker ->
var marcador = marker.snippet
// var filtrarMarcador = marcador.replace("m","")
// var idMarcador = filtrarMarcador.toInt()
//println("Este es el marcador filtrado ${marcador.replace("m","")}")
//println("Este es el id Marcador $idMarcador")
Toast.makeText(this@MapsActivity, "Este es el marker $marcador", Toast.LENGTH_SHORT).show()
callApiDetalle(marcador.toInt())
true
}
}//termina el for
}else{
Toast.makeText(this@MapsActivity, "NO HUBO RESPUESTA EXITOSA", Toast.LENGTH_SHORT).show()
}
}
}
)
}
//llamar con la función a la siguiente api para los detalles de acuerdo al parametro ingresado, es decir de acuerdo a la url pk
fun callApiDetalle(id: Int){
ApiService.pedidoDetalle.getPedidoDetalle(id).enqueue(
object: Callback<Resultado> {
override fun onFailure(call: Call<Resultado>, t: Throwable) {
t.printStackTrace()
}
@RequiresApi(Build.VERSION_CODES.O)
override fun onResponse(call: Call<Resultado>, response: Response<Resultado>) {
if (response.isSuccessful) {
val pedidoDetalle = response.body()
println("Probar pedido de Detalle $pedidoDetalle")
//fecha_publicado = findViewById(R.id.fecha_publicado)
// Publicado el 12 de abril de 2020 a las 00:04
val dialog = BottomSheetDialog(this@MapsActivity)
val view = layoutInflater.inflate(R.layout.fragment_pedido,null)
dialog.setContentView(view)
if (pedidoDetalle != null) {
view.fecha_publicado.setText("Publicado el ${pedidoDetalle.added}")
view.direccion_id.setText(pedidoDetalle.address)
view.contacto_id.setText(pedidoDetalle.name)
view.contacto_numero.setText(pedidoDetalle.phone)
view.pedido_id.setText(pedidoDetalle.title)
view.mensaje_id.setText(pedidoDetalle.message)
}
dialog.show()
view.llegar_id.setOnClickListener{
Toast.makeText(this@MapsActivity, "Boton de como llegar", Toast.LENGTH_SHORT).show()
}
view.contacto_numero.setOnClickListener{
val dialogo = layoutInflater.inflate(R.layout.alert_dialog_contacto,null)
val mBuilder =AlertDialog.Builder(this@MapsActivity)
.setView(dialogo)
.setTitle("¿Desea llamar o enviar mensaje?")
val mAlertDialog = mBuilder.show()
dialogo.llamar_contacto.setOnClickListener{
Toast.makeText(this@MapsActivity, "boton alerta llamar contacto", Toast.LENGTH_SHORT).show()
val i = Intent(Intent.ACTION_CALL)
i.data = Uri.parse("tel:${pedidoDetalle?.phone}")
if (ActivityCompat.checkSelfPermission(
this@MapsActivity,
Manifest.permission.CALL_PHONE
) != PackageManager.PERMISSION_GRANTED
) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return@setOnClickListener
}
startActivity(i)
// mAlertDialog.dismiss()
}
dialogo.msm_whatsapp.setOnClickListener {
Toast.makeText(this@MapsActivity, "boton alerta enviar mensaje whatsapp", Toast.LENGTH_SHORT).show()
//marcar que no existe el numero en mis contactos
val msj = "Mi mensaje es abcdef 1234567890"
val numeroTel = pedidoDetalle?.phone
val intent = Intent(Intent.ACTION_VIEW)
val uri =
"whatsapp://send?phone=$numeroTel&text=$msj"
intent.data = Uri.parse(uri)
startActivity(intent)
}
Toast.makeText(this@MapsActivity, "Numero de contacto ${pedidoDetalle?.phone}", Toast.LENGTH_SHORT).show()
}
//Guardar los datos de la lista pendiente, usando la librería Room
view.pendiente_button.setOnClickListener{
Toast.makeText(this@MapsActivity, "Boton de pendiente ", Toast.LENGTH_SHORT).show()
//InsertTask(this, chapterObj).execute()
/* insertToDb(PedidoSave(pedidoDetalle!!.id,
pedidoDetalle.title,pedidoDetalle.message,pedidoDetalle.name,pedidoDetalle.phone,
pedidoDetalle.address,pedidoDetalle.added))*/
}
view.listo_button.setOnClickListener{
Toast.makeText(this@MapsActivity, "boton de listo", Toast.LENGTH_SHORT).show()
}
Toast.makeText(this@MapsActivity, "Probar clic nuevo ${id}", Toast.LENGTH_SHORT).show()
}else{
Toast.makeText(this@MapsActivity, "El id es : $id", Toast.LENGTH_SHORT).show()
}
}
}
)
}
/* fun insertToDb(pedido:PedidoSave){
}*/
//permiso para acceder a la ubicacion del dispositvo
private fun setup(){
if(ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED){
ActivityCompat.requestPermissions(this,
arrayOf(android.Manifest.permission.ACCESS_FINE_LOCATION),LOCATION_PERMISSION_REQUEST_CODE)
return
}
mMap.isMyLocationEnabled= true
fusedLocationClient.lastLocation.addOnSuccessListener(this){ location ->
if(location != null){
lastLocation = location
val currentLatLong = LatLng(location.latitude, location.longitude)
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLatLong, 18f))
}
}
}
override fun onMarkerClick(p0: Marker?): Boolean = false
/*
* CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(builder.build(), padding);
try {
map.moveCamera(cameraUpdate);
} catch (Exception e) {
int width = getResources().getDisplayMetrics().widthPixels;
int height = getResources().getDisplayMetrics().heightPixels;
cameraUpdate = CameraUpdateFactory.newLatLngBounds(builder.build(), width, height, padding);
map.moveCamera(cameraUpdate);
}*/
}
\ No newline at end of file
package com.example.ayudapy
import android.content.Context
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"
/**
* A simple [Fragment] subclass.
* Use the [Pedido.newInstance] factory method to
* create an instance of this fragment.
*/
class Pedido : Fragment() {
// TODO: Rename and change types of parameters
private var param1: String? = null
private var param2: String? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
arguments?.let {
param1 = it.getString(ARG_PARAM1)
param2 = it.getString(ARG_PARAM2)
}
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_pedido, container, false)
}
companion object {
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment Pedido.
*/
// TODO: Rename and change types and number of parameters
@JvmStatic
fun newInstance(param1: String, param2: String) =
Pedido().apply {
arguments = Bundle().apply {
putString(ARG_PARAM1, param1)
putString(ARG_PARAM2, param2)
}
}
}
}
package com.example.ayudapy
data class PedidoDetalle (
val count: Long,
val next: String,
val previous: Any? = null,
val results: List<Resultado>
)
data class Resultado (
val id: Long,
val title: String,
val message: String,
val name: String,
val phone: String,
val address: String,
val city: String,
val location: locacion,
val picture: String? = null,
val active: Boolean,
val added: String
)
data class locacion (
val type: Type,
val coordinates: List<Double>
)
enum class Type {
Point
}
package com.example.ayudapy
data class PedidosAyuda (
val type: String,
val features: List<Feature>
)
data class Feature (
val type: FeatureType,
val geometry: Geometry,
val properties: Properties
)
data class Geometry (
val type: GeometryType,
val coordinates: List<Double>
)
enum class GeometryType {
Point
}
data class Properties (
val pk: Long,
val title: String,
val name: String,
val added: String
)
enum class FeatureType {
Feature
}
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:centerColor="#EEFFFFFF"
android:endColor="#FFFFFFFF"
android:startColor="#00FFFFFF" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners android:radius="20dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity">
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<View
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@drawable/background_gradient" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="4dp"
android:src="@drawable/logoheader" />
<include
android:id="@+id/menu_layout"
layout="@layout/menu_buttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_marginBottom="40dp" />
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF">
<TextView
android:id="@+id/textView4"
android:layout_width="318dp"
android:layout_height="31dp"
android:layout_marginStart="44dp"
android:layout_marginTop="4dp"
android:text="TextView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/llamar_contacto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="44dp"
android:text="Call"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView4" />
<Button
android:id="@+id/msm_whatsapp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="44dp"
android:text="whatsapp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/button4"
app:layout_constraintTop_toBottomOf="@+id/textView4" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
>
<TextView
android:id="@+id/fecha_publicado"
style="@style/TextAppearance.MaterialComponents.Caption"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="32dp"
android:textColor="@color/colorPrimaryDark"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/pedido_id"
style="@style/TextAppearance.MaterialComponents.Headline5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textColor="#FD5C7F"
app:layout_constraintEnd_toEndOf="@+id/fecha_publicado"
app:layout_constraintStart_toStartOf="@+id/fecha_publicado"
app:layout_constraintTop_toBottomOf="@+id/fecha_publicado" />
<TextView
android:id="@+id/mensaje_id"
style="@style/TextAppearance.MaterialComponents.Body1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textColor="@color/colorPrimaryDark"
app:layout_constraintEnd_toEndOf="@+id/pedido_id"
app:layout_constraintStart_toStartOf="@+id/pedido_id"
app:layout_constraintTop_toBottomOf="@+id/pedido_id" />
<TextView
android:id="@+id/direccion_titulo"
style="@style/TextAppearance.MaterialComponents.Headline6"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Dirección"
android:textColor="@color/colorPrimary"
app:layout_constraintEnd_toEndOf="@+id/mensaje_id"
app:layout_constraintStart_toStartOf="@+id/mensaje_id"
app:layout_constraintTop_toBottomOf="@+id/mensaje_id" />
<TextView
android:id="@+id/direccion_id"
style="@style/TextAppearance.MaterialComponents.Body1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textColor="@color/colorPrimary"
app:layout_constraintEnd_toEndOf="@+id/direccion_titulo"
app:layout_constraintStart_toStartOf="@+id/direccion_titulo"
app:layout_constraintTop_toBottomOf="@+id/direccion_titulo" />
<Button
android:id="@+id/llegar_id"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Como llegar"
android:background="@color/colorPrimary"
app:layout_constraintEnd_toEndOf="@+id/direccion_id"
app:layout_constraintStart_toStartOf="@+id/direccion_id"
app:layout_constraintTop_toBottomOf="@+id/direccion_id" />
<TextView
android:id="@+id/contacto_titulo"
style="@style/TextAppearance.MaterialComponents.Headline6"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Contacto"
android:textColor="@color/colorPrimary"
app:layout_constraintEnd_toEndOf="@+id/llegar_id"
app:layout_constraintStart_toStartOf="@+id/llegar_id"
app:layout_constraintTop_toBottomOf="@+id/llegar_id" />
<TextView
android:id="@+id/contacto_id"
style="@style/TextAppearance.MaterialComponents.Body1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textColor="@color/colorPrimary"
app:layout_constraintEnd_toEndOf="@+id/contacto_titulo"
app:layout_constraintStart_toStartOf="@+id/contacto_titulo"
app:layout_constraintTop_toBottomOf="@+id/contacto_titulo"/>
<Button
android:id="@+id/contacto_numero"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:background="@color/colorPrimary"
app:layout_constraintEnd_toEndOf="@+id/contacto_id"
app:layout_constraintStart_toStartOf="@+id/contacto_id"
app:layout_constraintTop_toBottomOf="@+id/contacto_id"/>
<Button
android:id="@+id/pendiente_button"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_marginTop="37dp"
android:drawableTop="@drawable/icon_pendientes_unchecked"
android:text="Agregar a Mis Pendientes"
android:textSize="14dp"
app:layout_constraintStart_toStartOf="@+id/contacto_numero"
app:layout_constraintTop_toBottomOf="@+id/contacto_numero" />
<Button
android:id="@+id/listo_button"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/icon_listo_unchecked"
android:text="Completado"
android:textSize="14dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/pendiente_button"
app:layout_constraintTop_toTopOf="@+id/pendiente_button" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/design_default_color_background"
tools:context=".MapsActivity">
<ImageView
android:id="@+id/imageView"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_marginTop="32dp"
android:contentDescription="TODO"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/logoheader" />
<TextView
android:id="@+id/terminos_de_uso"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:text="Términos de Uso"
android:textColor="@color/colorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView" />
<TextView
android:id="@+id/preguntas_freq"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="Preguntas frecuentes"
android:textColor="@color/colorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/terminos_de_uso" />
<TextView
android:id="@+id/visitar_ayudapy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="Visitar ayudapy.org"
android:textColor="@color/colorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/preguntas_freq" />
<TextView
android:id="@+id/textView"
android:layout_width="126dp"
android:layout_height="24dp"
android:layout_marginBottom="45dp"
android:text="By Yanni"
android:textAlignment="center"
android:textColor="@color/colorPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<View
android:id="@+id/view2"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="4dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="4dp"
android:layout_marginBottom="4dp"
android:alpha="0.85"
android:background="@drawable/background_round"
android:elevation="2dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/info_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginEnd="24dp"
android:backgroundTint="@android:color/white"
app:backgroundTint="?colorPrimary"
app:layout_constraintBottom_toBottomOf="@+id/help_button"
app:layout_constraintEnd_toStartOf="@+id/help_button"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/infobutton"
app:tint="?colorPrimary" />
<TextView
android:id="@+id/info_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:elevation="4dp"
android:text="Info"
android:textAllCaps="true"
android:textColor="?colorPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/info_button"
app:layout_constraintStart_toStartOf="@+id/info_button"
app:layout_constraintTop_toBottomOf="@+id/info_button" />
<ImageButton
android:id="@+id/help_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ayuda"
android:elevation="4dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/help_text"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:background="?selectableItemBackground"
android:elevation="4dp"
android:gravity="bottom"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:text="Ayudenme"
android:textAllCaps="true"
android:textColor="#FD5C7F"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/info_text"
app:layout_constraintEnd_toEndOf="@+id/help_button"
app:layout_constraintStart_toStartOf="@+id/help_button"
app:layout_constraintTop_toTopOf="@+id/help_button" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fav_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="32dp"
android:backgroundTint="@android:color/white"
app:backgroundTint="?colorPrimary"
app:layout_constraintBottom_toBottomOf="@+id/help_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/help_button"
app:srcCompat="@drawable/pendientesbutton"
app:tint="?colorPrimary" />
<TextView
android:id="@+id/favs_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:elevation="4dp"
android:text="Pendientes"
android:textAllCaps="true"
android:textColor="?colorPrimary"
app:layout_constraintEnd_toEndOf="@+id/fav_button"
app:layout_constraintStart_toStartOf="@+id/fav_button"
app:layout_constraintTop_toBottomOf="@+id/fav_button" />
</androidx.constraintlayout.widget.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
<color name="colorBlancoTransparente">#33FFFFFF</color>
<color name="light_gray">#CCC</color>
</resources>
<?xml version="1.0"?>
<resources>
<dimen name="list_item_spacing">16dp</dimen>
<dimen name="list_item_spacing_half">8dp</dimen>
</resources>
<resources>
<string name="app_name">Ayudapy</string>
<string name="title_activity_maps">Map</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:background">@color/colorBlancoTransparente</item>
</style>
<style name="CustomButton" parent="Widget.MaterialComponents.Button">
<item name="android:padding">12dp</item>
<item name="cornerRadius">12dp</item>
</style>
</resources>
<resources>
<!--
TODO: Before you release your application, you need a Google Maps API key.
To do this, you can either add your release key credentials to your existing
key, or create a new key.
Note that this file specifies the API key for the release build target.
If you have previously set up a key for the debug target with the debug signing certificate,
you will also need to set up a key for your release certificate.
Follow the directions here:
https://developers.google.com/maps/documentation/android/signup
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
-->
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">YOUR_KEY_HERE</string>
</resources>
package com.example.ayudapy
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.71'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
#Thu Apr 30 11:17:22 PYT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
rootProject.name='Ayudapy'
include ':app'
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