mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
adding images to attendee suggestions
This commit is contained in:
@@ -60,6 +60,7 @@ dependencies {
|
|||||||
implementation 'com.simplemobiletools:commons:5.10.10'
|
implementation 'com.simplemobiletools:commons:5.10.10'
|
||||||
implementation 'joda-time:joda-time:2.10.1'
|
implementation 'joda-time:joda-time:2.10.1'
|
||||||
implementation 'androidx.multidex:multidex:2.0.1'
|
implementation 'androidx.multidex:multidex:2.0.1'
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
|
||||||
|
|
||||||
kapt 'androidx.room:room-compiler:2.0.0'
|
kapt 'androidx.room:room-compiler:2.0.0'
|
||||||
implementation 'androidx.room:room-runtime:2.0.0'
|
implementation 'androidx.room:room-runtime:2.0.0'
|
||||||
|
@@ -1182,7 +1182,7 @@ class EventActivity : SimpleActivity() {
|
|||||||
val attendeeEmails = mAttendeeViews.map { it.value }.filter { it.isNotEmpty() }.toMutableList() as ArrayList<String>
|
val attendeeEmails = mAttendeeViews.map { it.value }.filter { it.isNotEmpty() }.toMutableList() as ArrayList<String>
|
||||||
val attendees = ArrayList<Attendee>()
|
val attendees = ArrayList<Attendee>()
|
||||||
attendeeEmails.mapTo(attendees) {
|
attendeeEmails.mapTo(attendees) {
|
||||||
Attendee(0, "", it, CalendarContract.Attendees.ATTENDEE_STATUS_INVITED)
|
Attendee(0, "", it, CalendarContract.Attendees.ATTENDEE_STATUS_INVITED, "")
|
||||||
}
|
}
|
||||||
return Gson().toJson(attendees)
|
return Gson().toJson(attendees)
|
||||||
}
|
}
|
||||||
@@ -1196,7 +1196,8 @@ class EventActivity : SimpleActivity() {
|
|||||||
ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME,
|
ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME,
|
||||||
ContactsContract.CommonDataKinds.StructuredName.MIDDLE_NAME,
|
ContactsContract.CommonDataKinds.StructuredName.MIDDLE_NAME,
|
||||||
ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME,
|
ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME,
|
||||||
ContactsContract.CommonDataKinds.StructuredName.SUFFIX)
|
ContactsContract.CommonDataKinds.StructuredName.SUFFIX,
|
||||||
|
ContactsContract.CommonDataKinds.StructuredName.PHOTO_URI)
|
||||||
|
|
||||||
val selection = "${ContactsContract.Data.MIMETYPE} = ?"
|
val selection = "${ContactsContract.Data.MIMETYPE} = ?"
|
||||||
val selectionArgs = arrayOf(ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)
|
val selectionArgs = arrayOf(ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)
|
||||||
@@ -1212,11 +1213,12 @@ class EventActivity : SimpleActivity() {
|
|||||||
val middleName = cursor.getStringValue(ContactsContract.CommonDataKinds.StructuredName.MIDDLE_NAME) ?: ""
|
val middleName = cursor.getStringValue(ContactsContract.CommonDataKinds.StructuredName.MIDDLE_NAME) ?: ""
|
||||||
val surname = cursor.getStringValue(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME) ?: ""
|
val surname = cursor.getStringValue(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME) ?: ""
|
||||||
val suffix = cursor.getStringValue(ContactsContract.CommonDataKinds.StructuredName.SUFFIX) ?: ""
|
val suffix = cursor.getStringValue(ContactsContract.CommonDataKinds.StructuredName.SUFFIX) ?: ""
|
||||||
|
val photoUri = cursor.getStringValue(ContactsContract.CommonDataKinds.StructuredName.PHOTO_URI) ?: ""
|
||||||
|
|
||||||
val names = arrayListOf(prefix, firstName, middleName, surname, suffix).filter { it.trim().isNotEmpty() }
|
val names = arrayListOf(prefix, firstName, middleName, surname, suffix).filter { it.trim().isNotEmpty() }
|
||||||
val fullName = TextUtils.join("", names)
|
val fullName = TextUtils.join("", names)
|
||||||
if (fullName.isNotEmpty()) {
|
if (fullName.isNotEmpty()) {
|
||||||
val contact = Attendee(id, fullName, "", 0)
|
val contact = Attendee(id, fullName, "", 0, photoUri)
|
||||||
contacts.add(contact)
|
contacts.add(contact)
|
||||||
}
|
}
|
||||||
} while (cursor.moveToNext())
|
} while (cursor.moveToNext())
|
||||||
@@ -1243,7 +1245,7 @@ class EventActivity : SimpleActivity() {
|
|||||||
do {
|
do {
|
||||||
val id = cursor.getIntValue(ContactsContract.Data.CONTACT_ID)
|
val id = cursor.getIntValue(ContactsContract.Data.CONTACT_ID)
|
||||||
val email = cursor.getStringValue(ContactsContract.CommonDataKinds.Email.DATA) ?: continue
|
val email = cursor.getStringValue(ContactsContract.CommonDataKinds.Email.DATA) ?: continue
|
||||||
val contact = Attendee(id, "", email, 0)
|
val contact = Attendee(id, "", email, 0, "")
|
||||||
contacts.add(contact)
|
contacts.add(contact)
|
||||||
} while (cursor.moveToNext())
|
} while (cursor.moveToNext())
|
||||||
}
|
}
|
||||||
|
@@ -17,13 +17,16 @@ class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: Ar
|
|||||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
|
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
|
||||||
val contact = resultList[position]
|
val contact = resultList[position]
|
||||||
var listItem = convertView
|
var listItem = convertView
|
||||||
if (listItem == null) {
|
if (listItem == null || listItem.tag != contact.name.isNotEmpty()) {
|
||||||
val layout = if (contact.name.isNotEmpty()) R.layout.item_autocomplete_email_name else R.layout.item_autocomplete_email
|
val layout = if (contact.name.isNotEmpty()) R.layout.item_autocomplete_email_name else R.layout.item_autocomplete_email
|
||||||
listItem = LayoutInflater.from(activity).inflate(layout, parent, false)
|
listItem = LayoutInflater.from(activity).inflate(layout, parent, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
listItem!!.item_autocomplete_name?.text = contact.name
|
listItem!!.apply {
|
||||||
listItem.item_autocomplete_email.text = contact.email
|
tag = contact.name.isNotEmpty()
|
||||||
|
item_autocomplete_name?.text = contact.name
|
||||||
|
item_autocomplete_email.text = contact.email
|
||||||
|
}
|
||||||
|
|
||||||
return listItem
|
return listItem
|
||||||
}
|
}
|
||||||
|
@@ -514,7 +514,7 @@ class CalDAVHelper(val context: Context) {
|
|||||||
val name = cursor.getStringValue(CalendarContract.Attendees.ATTENDEE_NAME)
|
val name = cursor.getStringValue(CalendarContract.Attendees.ATTENDEE_NAME)
|
||||||
val email = cursor.getStringValue(CalendarContract.Attendees.ATTENDEE_EMAIL)
|
val email = cursor.getStringValue(CalendarContract.Attendees.ATTENDEE_EMAIL)
|
||||||
val status = cursor.getIntValue(CalendarContract.Attendees.ATTENDEE_STATUS)
|
val status = cursor.getIntValue(CalendarContract.Attendees.ATTENDEE_STATUS)
|
||||||
val attendee = Attendee(0, name, email, status)
|
val attendee = Attendee(0, name, email, status, "")
|
||||||
attendees.add(attendee)
|
attendees.add(attendee)
|
||||||
} while (cursor.moveToNext())
|
} while (cursor.moveToNext())
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
package com.simplemobiletools.calendar.pro.models
|
package com.simplemobiletools.calendar.pro.models
|
||||||
|
|
||||||
data class Attendee(val contactId: Int, var name: String, val email: String, val status: Int) {
|
data class Attendee(val contactId: Int, var name: String, val email: String, val status: Int, val photoUri: String) {
|
||||||
fun getPublicName() = if (name.isNotEmpty()) name else email
|
fun getPublicName() = if (name.isNotEmpty()) name else email
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
|
||||||
|
<solid android:color="@color/color_primary"/>
|
||||||
|
</shape>
|
@@ -1,24 +1,41 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/item_autocomplete_holder"
|
android:id="@+id/item_autocomplete_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="@dimen/small_margin"
|
||||||
android:paddingTop="@dimen/medium_margin"
|
android:paddingTop="@dimen/medium_margin"
|
||||||
|
android:paddingEnd="@dimen/medium_margin"
|
||||||
android:paddingBottom="@dimen/medium_margin">
|
android:paddingBottom="@dimen/medium_margin">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/item_autocomplete_image"
|
||||||
|
android:layout_width="@dimen/avatar_size"
|
||||||
|
android:layout_height="@dimen/avatar_size"
|
||||||
|
android:layout_margin="@dimen/tiny_margin"
|
||||||
|
android:background="@drawable/attendee_circular_background"
|
||||||
|
android:padding="@dimen/medium_margin"
|
||||||
|
android:src="@drawable/ic_person"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/item_autocomplete_email"
|
android:id="@+id/item_autocomplete_email"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_marginEnd="@dimen/activity_margin"
|
|
||||||
android:lines="1"
|
android:lines="1"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:padding="@dimen/medium_margin"
|
android:paddingStart="@dimen/medium_margin"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textSize="@dimen/bigger_text_size"
|
android:textSize="@dimen/bigger_text_size"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/item_autocomplete_image"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="hello@simplemobiletools.com"/>
|
tools:text="hello@simplemobiletools.com"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
@@ -1,39 +1,59 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/item_autocomplete_holder"
|
android:id="@+id/item_autocomplete_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="@dimen/small_margin"
|
||||||
android:paddingTop="@dimen/medium_margin"
|
android:paddingTop="@dimen/medium_margin"
|
||||||
|
android:paddingEnd="@dimen/medium_margin"
|
||||||
android:paddingBottom="@dimen/medium_margin">
|
android:paddingBottom="@dimen/medium_margin">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/item_autocomplete_image"
|
||||||
|
android:layout_width="@dimen/avatar_size"
|
||||||
|
android:layout_height="@dimen/avatar_size"
|
||||||
|
android:layout_margin="@dimen/tiny_margin"
|
||||||
|
android:background="@drawable/attendee_circular_background"
|
||||||
|
android:padding="@dimen/medium_margin"
|
||||||
|
android:src="@drawable/ic_person"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/item_autocomplete_name"
|
android:id="@+id/item_autocomplete_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/activity_margin"
|
|
||||||
android:lines="1"
|
android:lines="1"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:paddingLeft="@dimen/medium_margin"
|
android:paddingStart="@dimen/medium_margin"
|
||||||
android:paddingRight="@dimen/medium_margin"
|
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textSize="@dimen/bigger_text_size"
|
android:textSize="@dimen/bigger_text_size"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/item_autocomplete_email"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/item_autocomplete_image"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_chainStyle="packed"
|
||||||
tools:text="Simple Mobile"/>
|
tools:text="Simple Mobile"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/item_autocomplete_email"
|
android:id="@+id/item_autocomplete_email"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/item_autocomplete_name"
|
android:layout_below="@+id/item_autocomplete_name"
|
||||||
android:layout_marginEnd="@dimen/activity_margin"
|
android:layout_marginEnd="8dp"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:lines="1"
|
android:lines="1"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:paddingLeft="@dimen/medium_margin"
|
android:paddingStart="@dimen/medium_margin"
|
||||||
android:paddingRight="@dimen/medium_margin"
|
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textSize="@dimen/normal_text_size"
|
android:textSize="@dimen/normal_text_size"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/item_autocomplete_image"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/item_autocomplete_name"
|
||||||
tools:text="hello@simplemobiletools.com"/>
|
tools:text="hello@simplemobiletools.com"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
@@ -28,4 +28,6 @@
|
|||||||
|
|
||||||
<dimen name="event_color_bar_width">4dp</dimen>
|
<dimen name="event_color_bar_width">4dp</dimen>
|
||||||
<dimen name="event_color_bar_height">100dp</dimen>
|
<dimen name="event_color_bar_height">100dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="avatar_size">40dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
Reference in New Issue
Block a user