Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
Dunbar
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PLN
Dunbar
Commits
2e335df3
Unverified
Commit
2e335df3
authored
Nov 02, 2019
by
PLN (Algolia)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(Friends): Accessors
parent
a36505eb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
15 deletions
+32
-15
Friend.kt
app/src/main/java/fr/plnech/dunbar/Friend.kt
+11
-10
contact.xml
app/src/main/res/layout/contact.xml
+21
-5
No files found.
app/src/main/java/fr/plnech/dunbar/Friend.kt
View file @
2e335df3
package
fr.plnech.dunbar
import
android.graphics.Bitmap
import
android.provider.ContactsContract
import
android.provider.ContactsContract
.Contacts
data class
Friend
(
val
map
:
MutableMap
<
String
,
String
?>,
val
photo
:
Bitmap
?)
{
override
fun
toString
():
String
=
"$
id: $name ($timesContacted times, last $lastTime)
"
override
fun
toString
():
String
=
"$
name
"
val
name
:
String
?
get
()
=
map
[
Contacts
Contract
.
Contacts
.
DISPLAY_NAME
]
get
()
=
map
[
Contacts
.
DISPLAY_NAME
]
val
id
:
String
get
()
=
map
[
Contacts
Contract
.
Contacts
.
_ID
]
!!
val
id
:
Int
get
()
=
map
[
Contacts
.
_ID
]
!!
.
toInt
()
val
lastTime
:
String
?
get
()
=
map
[
Contacts
Contract
.
Contacts
.
LAST_TIME_CONTACTED
]
get
()
=
map
[
Contacts
.
LAST_TIME_CONTACTED
]
val
timesContacted
:
String
?
get
()
=
map
[
Contacts
Contract
.
Contacts
.
TIMES_CONTACTED
]
val
timesContacted
:
Int
get
()
=
map
[
Contacts
.
TIMES_CONTACTED
]
?.
toInt
()
?:
0
val
isYou
:
String
?
get
()
=
map
[
Contacts
Contract
.
Contacts
.
IS_USER_PROFILE
]
get
()
=
map
[
Contacts
.
IS_USER_PROFILE
]
val
visibleOutsideSearch
:
String
?
get
()
=
map
[
Contacts
Contract
.
Contacts
.
IN_DEFAULT_DIRECTORY
]
get
()
=
map
[
Contacts
.
IN_DEFAULT_DIRECTORY
]
}
\ No newline at end of file
app/src/main/res/layout/contact.xml
View file @
2e335df3
...
...
@@ -30,21 +30,37 @@
<TextView
android:id=
"@+id/name"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0dp
"
android:layout_height=
"wrap_content"
android:layout_margin=
"15dp"
android:focusable=
"false"
android:focusableInTouchMode=
"false"
android:layout_marginEnd=
"15dp"
android:gravity=
"end"
android:maxLines=
"
3
"
android:maxLines=
"
2
"
android:textAppearance=
"@style/TextAppearance.AppCompat.Title"
android:textSize=
"24sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toTopOf=
"@id/metadata"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintLeft_toRightOf=
"@id/pic"
app:layout_constraintRight_toLeftOf=
"@id/name"
app:layout_constraintTop_toTopOf=
"parent"
tools:text=
"@tools:sample/full_names"
/>
<TextView
android:id=
"@+id/metadata"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"15dp"
android:layout_marginEnd=
"15dp"
android:focusable=
"false"
android:focusableInTouchMode=
"false"
android:gravity=
"end"
android:textAppearance=
"@style/TextAppearance.AppCompat.Subhead"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintLeft_toRightOf=
"@id/pic"
app:layout_constraintRight_toLeftOf=
"@id/name"
app:layout_constraintTop_toBottomOf=
"@id/name"
tools:text=
"@tools:sample/full_names"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
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