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
794df526
Commit
794df526
authored
May 19, 2020
by
Yannine Alvarez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Agregar formato fecha en el cardview dias en numero y mes en letras.
parent
dc67dd59
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletions
+28
-1
app/src/main/java/com/example/ayudapy/ListaPedidoAdapter.kt
+28
-1
No files found.
app/src/main/java/com/example/ayudapy/ListaPedidoAdapter.kt
View file @
794df526
package
com.example.ayudapy
package
com.example.ayudapy
import
android.content.Context
import
android.content.Context
import
android.os.Build
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.TextView
import
android.widget.TextView
import
androidx.annotation.RequiresApi
import
androidx.recyclerview.widget.RecyclerView
import
androidx.recyclerview.widget.RecyclerView
import
kotlinx.android.synthetic.main.pendientes_items.view.*
import
kotlinx.android.synthetic.main.pendientes_items.view.*
import
java.time.LocalDate
import
java.time.LocalDateTime
import
java.time.format.DateTimeFormatter
import
java.time.format.FormatStyle
class
RecyclerViewAdapter
(
val
pedido
:
List
<
PedidoSave
>)
class
RecyclerViewAdapter
(
val
pedido
:
List
<
PedidoSave
>)
:
RecyclerView
.
Adapter
<
RecyclerViewAdapter
.
ViewHolder
>(){
:
RecyclerView
.
Adapter
<
RecyclerViewAdapter
.
ViewHolder
>(){
...
@@ -18,9 +24,29 @@ class RecyclerViewAdapter(val pedido: List<PedidoSave>)
...
@@ -18,9 +24,29 @@ class RecyclerViewAdapter(val pedido: List<PedidoSave>)
return
ViewHolder
(
v
)
return
ViewHolder
(
v
)
}
}
@RequiresApi
(
Build
.
VERSION_CODES
.
O
)
override
fun
onBindViewHolder
(
holder
:
RecyclerViewAdapter
.
ViewHolder
,
position
:
Int
)
{
override
fun
onBindViewHolder
(
holder
:
RecyclerViewAdapter
.
ViewHolder
,
position
:
Int
)
{
// localDate.getDayOfMonth();
//localDate.getMonthValue();
val
formatter
=
DateTimeFormatter
.
BASIC_ISO_DATE
val
formatted
=
pedido
[
position
].
added
.
format
(
formatter
)
val
fecha
=
formatted
.
substring
(
8
..
9
)
// dateTime.format(DateTimeFormatter.ofLocalizedTime(FormatStyle.MEDIUM))
val
parsedDate
=
LocalDateTime
.
parse
(
pedido
[
position
].
added
,
DateTimeFormatter
.
ISO_DATE_TIME
)
val
formatteDate
=
parsedDate
.
format
(
DateTimeFormatter
.
ofPattern
(
"dd MMM yyyy HH:mm"
))
val
mes
=
formatteDate
.
substring
(
3
..
5
)
println
(
"Este es el substring de mes: $mes y este es formateadp $formatteDate"
)
holder
.
date_day
.
text
=
pedido
[
position
].
added
holder
.
date_day
.
text
=
fecha
holder
.
date_month
.
text
=
mes
.
toUpperCase
()
holder
.
title
.
text
=
pedido
[
position
].
title
holder
.
title
.
text
=
pedido
[
position
].
title
holder
.
message_view
.
text
=
pedido
[
position
].
message
holder
.
message_view
.
text
=
pedido
[
position
].
message
}
}
...
@@ -39,6 +65,7 @@ class RecyclerViewAdapter(val pedido: List<PedidoSave>)
...
@@ -39,6 +65,7 @@ class RecyclerViewAdapter(val pedido: List<PedidoSave>)
class
ViewHolder
(
itemView
:
View
):
RecyclerView
.
ViewHolder
(
itemView
){
class
ViewHolder
(
itemView
:
View
):
RecyclerView
.
ViewHolder
(
itemView
){
val
date_day
=
itemView
.
date_day
val
date_day
=
itemView
.
date_day
val
date_month
=
itemView
.
date_month
val
title
=
itemView
.
title
val
title
=
itemView
.
title
val
message_view
=
itemView
.
message_view
val
message_view
=
itemView
.
message_view
}
}
...
...
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