Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
Ayudapy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yannine Alvarez
Ayudapy
Commits
12dbd616
Commit
12dbd616
authored
May 18, 2020
by
Yannine Alvarez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Insert de pedidos con room.
parent
7f81bfb4
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
247 additions
and
27 deletions
+247
-27
app/build.gradle
+2
-0
app/src/main/AndroidManifest.xml
+1
-0
app/src/main/java/com/example/ayudapy/Entity.kt
+20
-10
app/src/main/java/com/example/ayudapy/MapsActivity.kt
+29
-17
app/src/main/java/com/example/ayudapy/PendienteLista.kt
+14
-0
app/src/main/res/layout/pendientes_items.xml
+123
-0
app/src/main/res/layout/pendientes_lista.xml
+58
-0
No files found.
app/build.gradle
View file @
12dbd616
...
@@ -77,6 +77,8 @@ dependencies {
...
@@ -77,6 +77,8 @@ dependencies {
implementation
'org.jetbrains.anko:anko-common:0.9'
implementation
'org.jetbrains.anko:anko-common:0.9'
implementation
'com.chauthai.swipereveallayout:swipe-reveal-layout:1.4.1'
//implementation "android.arch.lifecycle:extensions:1.1.1"
//implementation "android.arch.lifecycle:extensions:1.1.1"
//implementation "android.arch.persistence.room:runtime:1.0.0-rc1"
//implementation "android.arch.persistence.room:runtime:1.0.0-rc1"
//kapt "android.arch.persistence.room:compiler:1.0.0-rc1"
//kapt "android.arch.persistence.room:compiler:1.0.0-rc1"
...
...
app/src/main/AndroidManifest.xml
View file @
12dbd616
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
android:name=
"com.google.android.geo.API_KEY"
android:name=
"com.google.android.geo.API_KEY"
android:value=
"@string/google_maps_key"
/>
android:value=
"@string/google_maps_key"
/>
<activity
android:name=
".InfoActivity"
/>
<activity
android:name=
".InfoActivity"
/>
<activity
android:name=
".PendienteLista"
/>
<activity
<activity
android:name=
".MapsActivity"
android:name=
".MapsActivity"
...
...
app/src/main/java/com/example/ayudapy/Entity.kt
View file @
12dbd616
...
@@ -6,16 +6,26 @@ import androidx.room.PrimaryKey
...
@@ -6,16 +6,26 @@ import androidx.room.PrimaryKey
import
org.jetbrains.annotations.NotNull
import
org.jetbrains.annotations.NotNull
@Entity
(
tableName
=
"pedido_save"
)
@Entity
(
tableName
=
"pedido_save"
)
data class
PedidoSave
(
class
PedidoSave
{
@PrimaryKey
var
id
:
Long
,
@ColumnInfo
(
name
=
"title"
)
var
title
:
String
,
@PrimaryKey
@ColumnInfo
(
name
=
"message"
)
var
message
:
String
,
var
id
:
Long
=
0
@ColumnInfo
(
name
=
"name"
)
var
name
:
String
,
@ColumnInfo
(
name
=
"phone"
)
var
phone
:
String
,
@ColumnInfo
(
name
=
"title"
)
@ColumnInfo
(
name
=
"address"
)
var
address
:
String
,
lateinit
var
title
:
String
// @ColumnInfo(name = "location") var location: String,
@ColumnInfo
(
name
=
"message"
)
lateinit
var
message
:
String
@ColumnInfo
(
name
=
"name"
)
lateinit
var
name
:
String
@ColumnInfo
(
name
=
"phone"
)
lateinit
var
phone
:
String
@ColumnInfo
(
name
=
"address"
)
lateinit
var
address
:
String
// @ColumnInfo(name = "location") var location: String,
// @ColumnInfo(name = "active") var active: String,
// @ColumnInfo(name = "active") var active: String,
@ColumnInfo
(
name
=
"added"
)
var
added
:
String
@ColumnInfo
(
name
=
"added"
)
)
lateinit
var
added
:
String
}
app/src/main/java/com/example/ayudapy/MapsActivity.kt
View file @
12dbd616
package
com.example.ayudapy
package
com.example.ayudapy
import
android.Manifest
import
android.Manifest
import
android.content.Entity
import
android.content.Intent
import
android.content.Intent
import
android.content.pm.PackageManager
import
android.content.pm.PackageManager
import
android.database.Observable
import
android.location.Location
import
android.location.Location
import
android.net.Uri
import
android.net.Uri
import
android.os.Build
import
android.os.Build
...
@@ -30,9 +30,8 @@ import com.google.android.gms.maps.model.Marker
...
@@ -30,9 +30,8 @@ import com.google.android.gms.maps.model.Marker
import
com.google.android.gms.maps.model.MarkerOptions
import
com.google.android.gms.maps.model.MarkerOptions
import
com.google.android.material.bottomsheet.BottomSheetDialog
import
com.google.android.material.bottomsheet.BottomSheetDialog
import
kotlinx.android.synthetic.main.alert_dialog_contacto.view.*
import
kotlinx.android.synthetic.main.alert_dialog_contacto.view.*
import
kotlinx.android.synthetic.main.fragment_pedido.*
import
kotlinx.android.synthetic.main.fragment_pedido.view.*
import
kotlinx.android.synthetic.main.fragment_pedido.view.*
import
kotlinx.android.synthetic.main.
fragment_pedido.view.pedido_id
import
kotlinx.android.synthetic.main.
info.*
import
org.jetbrains.anko.doAsync
import
org.jetbrains.anko.doAsync
import
retrofit2.Call
import
retrofit2.Call
import
retrofit2.Callback
import
retrofit2.Callback
...
@@ -41,7 +40,6 @@ import java.time.LocalDateTime
...
@@ -41,7 +40,6 @@ import java.time.LocalDateTime
import
java.time.format.DateTimeFormatter
import
java.time.format.DateTimeFormatter
class
MapsActivity
:
AppCompatActivity
(),
OnMapReadyCallback
,
GoogleMap
.
OnMarkerClickListener
{
class
MapsActivity
:
AppCompatActivity
(),
OnMapReadyCallback
,
GoogleMap
.
OnMarkerClickListener
{
private
lateinit
var
mMap
:
GoogleMap
private
lateinit
var
mMap
:
GoogleMap
...
@@ -98,6 +96,8 @@ class MapsActivity : AppCompatActivity(), OnMapReadyCallback, GoogleMap.OnMarker
...
@@ -98,6 +96,8 @@ class MapsActivity : AppCompatActivity(), OnMapReadyCallback, GoogleMap.OnMarker
val
myView
:
View
=
myLayout
.
findViewById
(
R
.
id
.
info_button
)
val
myView
:
View
=
myLayout
.
findViewById
(
R
.
id
.
info_button
)
val
ayudenme_button
:
View
=
myLayout
.
findViewById
(
R
.
id
.
help_button
)
val
ayudenme_button
:
View
=
myLayout
.
findViewById
(
R
.
id
.
help_button
)
val
pendientes_button
:
View
=
myLayout
.
findViewById
(
R
.
id
.
fav_button
)
myView
.
setOnClickListener
{
myView
.
setOnClickListener
{
...
@@ -105,7 +105,12 @@ class MapsActivity : AppCompatActivity(), OnMapReadyCallback, GoogleMap.OnMarker
...
@@ -105,7 +105,12 @@ class MapsActivity : AppCompatActivity(), OnMapReadyCallback, GoogleMap.OnMarker
val
i
=
Intent
(
this
,
InfoActivity
::
class
.
java
)
val
i
=
Intent
(
this
,
InfoActivity
::
class
.
java
)
startActivity
(
i
)
startActivity
(
i
)
}
pendientes_button
.
setOnClickListener
{
Toast
.
makeText
(
this
@MapsActivity
,
"Boton de info pendientes"
,
Toast
.
LENGTH_SHORT
).
show
()
val
i
=
Intent
(
this
,
PendienteLista
::
class
.
java
)
startActivity
(
i
)
}
}
ayudenme_button
.
setOnClickListener
{
ayudenme_button
.
setOnClickListener
{
...
@@ -117,6 +122,8 @@ class MapsActivity : AppCompatActivity(), OnMapReadyCallback, GoogleMap.OnMarker
...
@@ -117,6 +122,8 @@ class MapsActivity : AppCompatActivity(), OnMapReadyCallback, GoogleMap.OnMarker
}
}
//agregar permiso para llamar
//agregar permiso para llamar
val
permissionCheck
:
Int
=
ContextCompat
.
checkSelfPermission
(
val
permissionCheck
:
Int
=
ContextCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
CALL_PHONE
this
,
Manifest
.
permission
.
CALL_PHONE
...
@@ -344,24 +351,29 @@ class MapsActivity : AppCompatActivity(), OnMapReadyCallback, GoogleMap.OnMarker
...
@@ -344,24 +351,29 @@ class MapsActivity : AppCompatActivity(), OnMapReadyCallback, GoogleMap.OnMarker
pedidoDetalle.address,pedidoDetalle.added))*/
pedidoDetalle.address,pedidoDetalle.added))*/
// Initialize a new student
// Initialize a new student
val
pedido
=
PedidoSave
(
id
=
pedidoDetalle
!!
.
id
,
val
pedido
=
Thread
{
added
=
pedidoDetalle
!!
.
added
,
var
pedidoEntity
=
PedidoSave
()
address
=
pedidoDetalle
!!
.
address
,
pedidoEntity
.
id
=
pedidoDetalle
!!
.
id
message
=
pedidoDetalle
!!
.
message
,
pedidoEntity
.
added
=
pedidoDetalle
!!
.
added
name
=
pedidoDetalle
!!
.
name
,
pedidoEntity
.
address
=
pedidoDetalle
!!
.
address
phone
=
pedidoDetalle
!!
.
phone
,
pedidoEntity
.
message
=
pedidoDetalle
!!
.
message
title
=
pedidoDetalle
!!
.
title
pedidoEntity
.
name
=
pedidoDetalle
!!
.
name
pedidoEntity
.
phone
=
pedidoDetalle
!!
.
phone
pedidoEntity
.
title
=
pedidoDetalle
!!
.
title
)
mDb
.
daoPedido
().
insert
(
pedidoEntity
)
doAsync
{
//Application.database.myDAO().insertUser(user)
mDb
.
daoPedido
().
insert
(
pedido
)
mDb
.
daoPedido
().
getAll
().
forEach
()
{
Log
.
i
(
"Fetch Records"
,
"Id: ${it.id}"
)
println
(
"Name es de pedido: ${it.name}"
)
}
}
}
pedido
.
start
()
// imageView.setImageResource(R.drawable.icon_pendientes_checked)
view
.
pendiente_button
.
setBackgroundResource
(
R
.
drawable
.
icon_pendientes_checked
)
view
.
pendiente_button
.
setBackgroundResource
(
R
.
drawable
.
icon_pendientes_checked
)
...
...
app/src/main/java/com/example/ayudapy/PendienteLista.kt
0 → 100644
View file @
12dbd616
package
com.example.ayudapy
import
android.content.Intent
import
android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
class
PendienteLista
:
AppCompatActivity
()
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
pendientes_lista
)
val
intento
:
Intent
=
intent
}
}
app/src/main/res/layout/pendientes_items.xml
0 → 100644
View file @
12dbd616
<?xml version="1.0" encoding="utf-8"?>
<com.chauthai.swipereveallayout.SwipeRevealLayout
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:id=
"@+id/swipe_layout"
android:layout_width=
"match_parent"
android:layout_height=
"100dp"
app:dragEdge=
"right"
app:mode=
"same_level"
>
<FrameLayout
android:id=
"@+id/delete_layout"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:background=
"#f44336"
android:clickable=
"true"
android:focusable=
"true"
android:foreground=
"?android:attr/selectableItemBackground"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:padding=
"16dp"
android:textColor=
"@android:color/white"
android:textSize=
"18sp"
android:textStyle=
"bold"
/>
</FrameLayout>
<FrameLayout
android:id=
"@+id/front_layout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:paddingStart=
"8dp"
android:paddingEnd=
"8dp"
>
<androidx.cardview.widget.CardView
android:id=
"@+id/card_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:clickable=
"true"
android:focusable=
"true"
android:foreground=
"?android:attr/selectableItemBackground"
app:cardCornerRadius=
"16dp"
app:cardUseCompatPadding=
"true"
app:contentPaddingBottom=
"8dp"
app:contentPaddingLeft=
"16dp"
app:contentPaddingRight=
"16dp"
app:contentPaddingTop=
"8dp"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<LinearLayout
android:id=
"@+id/llDate"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerVertical=
"true"
android:gravity=
"center"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/date_day"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:includeFontPadding=
"false"
android:textColor=
"@color/colorPrimary"
android:textSize=
"28sp"
android:textStyle=
"bold"
tools:text=
"14"
/>
<TextView
android:id=
"@+id/date_month"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:lineSpacingExtra=
"0dp"
android:includeFontPadding=
"false"
android:textColor=
"#FD5C7F"
android:textSize=
"16sp"
tools:text=
"APR"
/>
</LinearLayout>
<View
android:id=
"@+id/view"
android:layout_width=
"1dp"
android:layout_height=
"match_parent"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"8dp"
android:layout_marginEnd=
"16dp"
android:layout_marginBottom=
"8dp"
android:layout_toEndOf=
"@id/llDate"
android:background=
"@color/colorPrimary"
/>
<TextView
android:id=
"@+id/title"
style=
"@style/TextAppearance.MaterialComponents.Body1"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_toEndOf=
"@id/view"
android:ellipsize=
"end"
android:maxLines=
"1"
android:textColor=
"@color/colorPrimary"
tools:text=
"Title"
/>
<TextView
android:id=
"@+id/message_view"
style=
"@style/TextAppearance.MaterialComponents.Body2"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_below=
"@id/title"
android:layout_marginTop=
"4dp"
android:layout_toEndOf=
"@id/view"
android:ellipsize=
"end"
android:maxLines=
"2"
tools:text=
"Message"
/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>
</com.chauthai.swipereveallayout.SwipeRevealLayout>
\ No newline at end of file
app/src/main/res/layout/pendientes_lista.xml
0 → 100644
View file @
12dbd616
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#FFFFFF"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<View
android:id=
"@+id/view"
android:layout_gravity=
"center"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
android:layout_height=
"30dp"
android:layout_width=
"wrap_content"
/>
<TextView
android:id=
"@+id/added_view"
style=
"@style/TextAppearance.MaterialComponents.Headline6"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:gravity=
"center"
android:text=
"Mis Pendientes"
android:textColor=
"#FD5C7F"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/view"
/>
<ImageView
android:id=
"@+id/imageView"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_marginStart=
"16dp"
app:layout_constraintBottom_toBottomOf=
"@+id/added_view"
app:layout_constraintStart_toEndOf=
"@+id/added_view"
app:layout_constraintTop_toTopOf=
"@+id/added_view"
app:srcCompat=
"@drawable/icon_pendientes_checked"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/recycler_view"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:minHeight=
"600dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/added_view"
>
</androidx.recyclerview.widget.RecyclerView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment