From 0fac2ce4ca67b9a5b280fda5e9790a1957b0bd1e Mon Sep 17 00:00:00 2001 From: Paul-Louis NECH Date: Sat, 2 Nov 2019 18:00:21 +0100 Subject: [PATCH] feat: Basic notif, better layout --- app/src/main/AndroidManifest.xml | 2 +- app/src/main/java/fr/plnech/dunbar/Friend.kt | 31 ------------------------------- app/src/main/java/fr/plnech/dunbar/FriendsAdapter.kt | 48 ------------------------------------------------ app/src/main/java/fr/plnech/dunbar/MainActivity.kt | 139 ------------------------------------------------------------------------------------------------------------------------------------------- app/src/main/java/fr/plnech/dunbar/Messages.kt | 48 ------------------------------------------------ app/src/main/java/fr/plnech/dunbar/data/Messages.kt | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ app/src/main/java/fr/plnech/dunbar/model/Friend.kt | 34 ++++++++++++++++++++++++++++++++++ app/src/main/java/fr/plnech/dunbar/notif/FriendReminder.kt | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app/src/main/java/fr/plnech/dunbar/ui/FriendsActivity.kt | 157 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app/src/main/java/fr/plnech/dunbar/ui/FriendsAdapter.kt | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app/src/main/res/drawable/ic_friend.png | Bin 0 -> 30517 bytes app/src/main/res/layout/activity_friends.xml | 33 +++++++++++++++++++++++++++++++++ app/src/main/res/layout/activity_main.xml | 33 --------------------------------- app/src/main/res/layout/contact.xml | 39 ++++++++++++++++++++++++++++++++++----- app/src/main/res/layout/content_friends.xml | 36 ++++++++++++++++++++++++++++++++++++ app/src/main/res/layout/content_main.xml | 36 ------------------------------------ app/src/main/res/menu/menu_main.xml | 2 +- app/src/main/res/values/colors.xml | 2 +- app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/values/styles.xml | 3 +-- 20 files changed, 467 insertions(+), 345 deletions(-) delete mode 100644 app/src/main/java/fr/plnech/dunbar/Friend.kt delete mode 100644 app/src/main/java/fr/plnech/dunbar/FriendsAdapter.kt delete mode 100644 app/src/main/java/fr/plnech/dunbar/MainActivity.kt delete mode 100644 app/src/main/java/fr/plnech/dunbar/Messages.kt create mode 100644 app/src/main/java/fr/plnech/dunbar/data/Messages.kt create mode 100644 app/src/main/java/fr/plnech/dunbar/model/Friend.kt create mode 100644 app/src/main/java/fr/plnech/dunbar/notif/FriendReminder.kt create mode 100644 app/src/main/java/fr/plnech/dunbar/ui/FriendsActivity.kt create mode 100644 app/src/main/java/fr/plnech/dunbar/ui/FriendsAdapter.kt create mode 100644 app/src/main/res/drawable/ic_friend.png create mode 100644 app/src/main/res/layout/activity_friends.xml delete mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/layout/content_friends.xml delete mode 100644 app/src/main/res/layout/content_main.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7392302..e4c0ecf 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -14,7 +14,7 @@ android:supportsRtl="true" android:theme="@style/AppTheme"> diff --git a/app/src/main/java/fr/plnech/dunbar/Friend.kt b/app/src/main/java/fr/plnech/dunbar/Friend.kt deleted file mode 100644 index 22c6466..0000000 --- a/app/src/main/java/fr/plnech/dunbar/Friend.kt +++ /dev/null @@ -1,31 +0,0 @@ -package fr.plnech.dunbar - -import android.graphics.Bitmap -import android.provider.ContactsContract.Contacts -import java.util.* - -data class Friend(val map: MutableMap, val photo: Bitmap?) { - override fun toString(): String = "$name" - - fun mapString(): String = map.entries.filter { !it.value.isNullOrEmpty() }.toString() - - val name: String? - get() = map[Contacts.DISPLAY_NAME] - - val id: Int - get() = map[Contacts._ID]!!.toInt() - - val lastTimeStamp = map[Contacts.LAST_TIME_CONTACTED]!!.toLong() - - val lastDate: Date? - get() = if (lastTimeStamp > 0) Date(lastTimeStamp) else null - - val timesContacted: Int - get() = map[Contacts.TIMES_CONTACTED]?.toInt() ?: 0 - - val isYou: String? - get() = map[Contacts.IS_USER_PROFILE] - - val visibleOutsideSearch: String? - get() = map[Contacts.IN_DEFAULT_DIRECTORY] -} \ No newline at end of file diff --git a/app/src/main/java/fr/plnech/dunbar/FriendsAdapter.kt b/app/src/main/java/fr/plnech/dunbar/FriendsAdapter.kt deleted file mode 100644 index 1e361ea..0000000 --- a/app/src/main/java/fr/plnech/dunbar/FriendsAdapter.kt +++ /dev/null @@ -1,48 +0,0 @@ -package fr.plnech.dunbar - -import android.text.format.DateUtils -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.Toast -import androidx.recyclerview.widget.RecyclerView -import kotlinx.android.synthetic.main.contact.view.* - - -class FriendsAdapter( - private var friends: List = mutableListOf() -) : RecyclerView.Adapter() { - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FriendsViewHolder = - FriendsViewHolder(LayoutInflater.from(parent.context).inflate(viewType, parent, false)) - - override fun getItemCount(): Int = friends.size - - override fun getItemViewType(position: Int): Int = R.layout.contact - - override fun onBindViewHolder(holder: FriendsViewHolder, position: Int): Unit = - holder.bind(friends[position]) -} - -class FriendsViewHolder(private val view: View) : RecyclerView.ViewHolder(view) { - private val name = view.contactName - private val data = view.contactData - private val pic = view.pic - - fun bind(friend: Friend) { - name.text = friend.name - data.text = buildString { - if (friend.lastDate != null ) { - append(friend.timesContacted) - append(" interactions, last ") - append(DateUtils.getRelativeTimeSpanString(friend.lastTimeStamp)) - } else { - append("Never interacted") - } - } - view.setOnClickListener { - Toast.makeText(view.context, friend.mapString(), Toast.LENGTH_LONG).show() - } - } - -} diff --git a/app/src/main/java/fr/plnech/dunbar/MainActivity.kt b/app/src/main/java/fr/plnech/dunbar/MainActivity.kt deleted file mode 100644 index 8060628..0000000 --- a/app/src/main/java/fr/plnech/dunbar/MainActivity.kt +++ /dev/null @@ -1,139 +0,0 @@ -package fr.plnech.dunbar - -import android.content.ContentUris -import android.graphics.Bitmap -import android.graphics.BitmapFactory -import android.os.Bundle -import android.provider.ContactsContract -import android.view.Menu -import android.view.MenuItem -import android.widget.Toast -import androidx.appcompat.app.AppCompatActivity -import androidx.recyclerview.widget.LinearLayoutManager -import kotlinx.android.synthetic.main.activity_main.* -import kotlinx.android.synthetic.main.content_main.* -import java.io.IOException - - -class MainActivity : AppCompatActivity() { - - private lateinit var messages: Messages - private val friends = mutableListOf() - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_main) - setSupportActionBar(toolbar) - -// messages = Messages(applicationContext) - - fab.setOnClickListener { view -> - reloadFriends() - } - - reloadFriends() - } - - override fun onCreateOptionsMenu(menu: Menu): Boolean { - // Inflate the menu; this adds items to the action bar if it is present. - menuInflater.inflate(R.menu.menu_main, menu) - return true - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. - return when (item.itemId) { - R.id.action_settings -> true - else -> super.onOptionsItemSelected(item) - } - } - - private fun reloadFriends() { - fetchFriends() - displayFriends() -// fetchMessages() - } - - private fun fetchMessages() { - messages.fetchAll() - Toast.makeText( - this, "${messages.sent.size} messages sent, " + - "${messages.inbox.size} messages received.", Toast.LENGTH_SHORT - ).show() - } - - private fun fetchFriends() { - val newFriends = mutableListOf() - - contentResolver.query( - ContactsContract.CommonDataKinds.Phone.CONTENT_URI, - null, - null, - null, - null - )?.let { - while (it.moveToNext()) { - mutableMapOf().also { map -> - val indexId = it.getColumnIndex(ContactsContract.Contacts._ID) - val id = it.getLong(indexId) - val photo: Bitmap? = getPhoto(id) - - it.columnNames.forEach { name -> - val index = it.getColumnIndex(name) - map[name] = it.getString(index) - } - newFriends.add(Friend(map, photo)) - } - } - it.close() - - friends.clear() - friends.addAll(newFriends) - } - - friends.sortByDescending { it.timesContacted } - } - - private fun displayFriends() { - val adapter = FriendsAdapter(friends) - - friendsList.layoutManager = LinearLayoutManager(this) - friendsList.setHasFixedSize(true) - friendsList.adapter = adapter -// friendsList.setOnItemClickListener { parent, view, position, id -> -// val contact: String = adapter.getItem(position)?.toString() ?: "NONE" -// -// Snackbar.make(friendsList, contact, Snackbar.LENGTH_INDEFINITE).show() -// Toast.makeText(this, contact, Toast.LENGTH_LONG).show() -// } - - val nbFriends = adapter.itemCount - welcomeTitle.text = "$nbFriends ${"friend".plural(nbFriends)} on Dunbar" - } - - private fun getPhoto(id: Long): Bitmap? { - var photo: Bitmap? = null - - try { - val inputStream = ContactsContract.Contacts.openContactPhotoInputStream( - contentResolver, - ContentUris.withAppendedId( - ContactsContract.Contacts.CONTENT_URI, - java.lang.Long.valueOf(id) - ) - ) - - if (inputStream != null) { - photo = BitmapFactory.decodeStream(inputStream) - } - - inputStream?.close() - } catch (e: IOException) { - e.printStackTrace() - } - println("Photo for $id: $photo") - return photo - } -} diff --git a/app/src/main/java/fr/plnech/dunbar/Messages.kt b/app/src/main/java/fr/plnech/dunbar/Messages.kt deleted file mode 100644 index bccd691..0000000 --- a/app/src/main/java/fr/plnech/dunbar/Messages.kt +++ /dev/null @@ -1,48 +0,0 @@ -package fr.plnech.dunbar - -import android.content.Context -import android.net.Uri -import android.provider.Telephony - - -class Messages(context: Context) { - - private val contentResolver = context.contentResolver - var inbox: MutableList> = mutableListOf() - var sent: MutableList> = mutableListOf() - - fun fetchAll() { - inbox = fetchMessages(Telephony.Sms.Inbox.CONTENT_URI) - sent = fetchMessages(Telephony.Sms.Sent.CONTENT_URI) - } - - private fun fetchMessages(uri: Uri): MutableList> { - val messages = mutableListOf>() - - contentResolver.query(uri, null, null, null, null).let { - if (it != null) { - if (it.moveToFirst()) { - while (it.moveToNext()) { - - println("Processing message.") - val msg = mutableMapOf() - for (i in 0 until it.count) { - for (col in it.columnNames) { - val index = it.getColumnIndex(col) - msg[col] = it.getString(index) - } - } - messages.add(msg) - } - } else { - println("No messages in ${uri.toString().replace("content://sms/", "")}.") - } - it.close() - } else { - println("Null cursor.") - } - - } - return messages - } -} \ No newline at end of file diff --git a/app/src/main/java/fr/plnech/dunbar/data/Messages.kt b/app/src/main/java/fr/plnech/dunbar/data/Messages.kt new file mode 100644 index 0000000..446761a --- /dev/null +++ b/app/src/main/java/fr/plnech/dunbar/data/Messages.kt @@ -0,0 +1,48 @@ +package fr.plnech.dunbar.data + +import android.content.Context +import android.net.Uri +import android.provider.Telephony + + +class Messages(context: Context) { + + private val contentResolver = context.contentResolver + var inbox: MutableList> = mutableListOf() + var sent: MutableList> = mutableListOf() + + fun fetchAll() { + inbox = fetchMessages(Telephony.Sms.Inbox.CONTENT_URI) + sent = fetchMessages(Telephony.Sms.Sent.CONTENT_URI) + } + + private fun fetchMessages(uri: Uri): MutableList> { + val messages = mutableListOf>() + + contentResolver.query(uri, null, null, null, null).let { + if (it != null) { + if (it.moveToFirst()) { + while (it.moveToNext()) { + + println("Processing message.") + val msg = mutableMapOf() + for (i in 0 until it.count) { + for (col in it.columnNames) { + val index = it.getColumnIndex(col) + msg[col] = it.getString(index) + } + } + messages.add(msg) + } + } else { + println("No messages in ${uri.toString().replace("content://sms/", "")}.") + } + it.close() + } else { + println("Null cursor.") + } + + } + return messages + } +} \ No newline at end of file diff --git a/app/src/main/java/fr/plnech/dunbar/model/Friend.kt b/app/src/main/java/fr/plnech/dunbar/model/Friend.kt new file mode 100644 index 0000000..f740365 --- /dev/null +++ b/app/src/main/java/fr/plnech/dunbar/model/Friend.kt @@ -0,0 +1,34 @@ +package fr.plnech.dunbar.model + +import android.graphics.Bitmap +import android.provider.ContactsContract.Contacts +import java.util.* + +data class Friend(val map: MutableMap, val photo: Bitmap?) { + override fun toString(): String = "$name" + + fun mapString(): String = map.entries.filter { !it.value.isNullOrEmpty() }.toString() + + val name: String? + get() = map[Contacts.DISPLAY_NAME] + + val id: Int + get() = map[Contacts._ID]!!.toInt() + + val phone: String? + get() = map["data1"] + + val lastTimeStamp = map[Contacts.LAST_TIME_CONTACTED]!!.toLong() + + val lastDate: Date? + get() = if (lastTimeStamp > 0) Date(lastTimeStamp) else null + + val timesContacted: Int + get() = map[Contacts.TIMES_CONTACTED]?.toInt() ?: 0 + + val isYou: String? + get() = map[Contacts.IS_USER_PROFILE] + + val visibleOutsideSearch: String? + get() = map[Contacts.IN_DEFAULT_DIRECTORY] +} \ No newline at end of file diff --git a/app/src/main/java/fr/plnech/dunbar/notif/FriendReminder.kt b/app/src/main/java/fr/plnech/dunbar/notif/FriendReminder.kt new file mode 100644 index 0000000..c989bd6 --- /dev/null +++ b/app/src/main/java/fr/plnech/dunbar/notif/FriendReminder.kt @@ -0,0 +1,56 @@ +package fr.plnech.dunbar.notif + +import android.app.* +import android.content.Context +import android.content.Intent +import android.net.Uri +import android.os.Build +import androidx.core.app.NotificationCompat +import fr.plnech.dunbar.model.Friend + + +val CHANNEL_ID = "dunbar" + +class FriendReminder(val ctx: Context) { + + var channelCreated = false + + private fun createNotificationChannel() { + // Create the NotificationChannel, but only on API 26+ because + // the NotificationChannel class is new and not in the support library + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + val channel = NotificationChannel( + CHANNEL_ID, ctx.getString(fr.plnech.dunbar.R.string.channel_name), + NotificationManager.IMPORTANCE_DEFAULT + ).apply { description = ctx.getString(fr.plnech.dunbar.R.string.channel_description) } + + (ctx.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager) + .createNotificationChannel(channel) + } + channelCreated = true + } + + + fun createNotification(friend: Friend, activity: Activity): Notification? { + if (!channelCreated) createNotificationChannel() + + val uriSms = Uri.parse("smsto:1234567899") + val intentSMS = Intent(Intent.ACTION_SENDTO, uriSms) + intentSMS.putExtra("sms_body", "The SMS text") + val pendingIntent: PendingIntent = PendingIntent.getActivity(activity, 0, intentSMS, 0) + + return NotificationCompat.Builder(ctx, CHANNEL_ID) + .setContentTitle("What is ${friend.name} up to?") + .setContentText("Ask them for some news!") + .setSmallIcon(fr.plnech.dunbar.R.drawable.ic_friend) +// .setStyle( +// NotificationCompat.BigTextStyle() +// .bigText("Much longer text that cannot fit one line...") +// ) + .setContentIntent(pendingIntent) + .setAutoCancel(true) + .also { + it.priority = NotificationCompat.PRIORITY_HIGH + }.build() + } +} \ No newline at end of file diff --git a/app/src/main/java/fr/plnech/dunbar/ui/FriendsActivity.kt b/app/src/main/java/fr/plnech/dunbar/ui/FriendsActivity.kt new file mode 100644 index 0000000..6f10af2 --- /dev/null +++ b/app/src/main/java/fr/plnech/dunbar/ui/FriendsActivity.kt @@ -0,0 +1,157 @@ +package fr.plnech.dunbar.ui + +import android.content.ContentUris +import android.graphics.Bitmap +import android.graphics.BitmapFactory +import android.os.Bundle +import android.provider.ContactsContract +import android.view.Menu +import android.view.MenuItem +import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity +import androidx.core.app.NotificationManagerCompat +import androidx.recyclerview.widget.LinearLayoutManager +import fr.plnech.dunbar.R +import fr.plnech.dunbar.data.Messages +import fr.plnech.dunbar.model.Friend +import fr.plnech.dunbar.notif.FriendReminder +import fr.plnech.dunbar.plural +import kotlinx.android.synthetic.main.activity_friends.* +import kotlinx.android.synthetic.main.content_friends.* +import java.io.IOException + + +class FriendsActivity : AppCompatActivity() { + + private lateinit var messages: Messages + private val friends = mutableListOf() + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_friends) + setSupportActionBar(toolbar) + +// messages = Messages(applicationContext) + + fab.setOnClickListener { view -> + reloadFriends() + } + + reloadFriends() + notifyFriend() + } + + private fun notifyFriend() { + val idNotif = 0 + with(NotificationManagerCompat.from(this)) { + val notification = + FriendReminder(applicationContext).createNotification(friends[0], this@FriendsActivity) + notification?.let { + notify(idNotif, notification) + } + } + } + + override fun onCreateOptionsMenu(menu: Menu): Boolean { + // Inflate the menu; this adds items to the action bar if it is present. + menuInflater.inflate(R.menu.menu_main, menu) + return true + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + return when (item.itemId) { + R.id.action_settings -> true + else -> super.onOptionsItemSelected(item) + } + } + + private fun reloadFriends() { + fetchFriends() + displayFriends() +// fetchMessages() + } + + private fun fetchMessages() { + messages.fetchAll() + Toast.makeText( + this, "${messages.sent.size} messages sent, " + + "${messages.inbox.size} messages received.", Toast.LENGTH_SHORT + ).show() + } + + private fun fetchFriends() { + val newFriends = mutableListOf() + + contentResolver.query( + ContactsContract.CommonDataKinds.Phone.CONTENT_URI, + null, + null, + null, + null + )?.let { + while (it.moveToNext()) { + mutableMapOf().also { map -> + val indexId = it.getColumnIndex(ContactsContract.Contacts._ID) + val id = it.getLong(indexId) + val photo: Bitmap? = getPhoto(id) + + it.columnNames.forEach { name -> + val index = it.getColumnIndex(name) + map[name] = it.getString(index) + } + newFriends.add(Friend(map, photo)) + } + } + it.close() + + friends.clear() + friends.addAll(newFriends) + } + + friends.sortByDescending { it.timesContacted } + } + + private fun displayFriends() { + val adapter = FriendsAdapter(friends) + + friendsList.layoutManager = LinearLayoutManager(this) + friendsList.setHasFixedSize(true) + friendsList.adapter = adapter +// friendsList.setOnItemClickListener { parent, view, position, id -> +// val contact: String = adapter.getItem(position)?.toString() ?: "NONE" +// +// Snackbar.make(friendsList, contact, Snackbar.LENGTH_INDEFINITE).show() +// Toast.makeText(this, contact, Toast.LENGTH_LONG).show() +// } + + val nbFriends = adapter.itemCount + welcomeTitle.text = "$nbFriends ${"friend".plural(nbFriends)} on Dunbar" + } + + private fun getPhoto(id: Long): Bitmap? { + var photo: Bitmap? = null + + try { + val inputStream = ContactsContract.Contacts.openContactPhotoInputStream( + contentResolver, + ContentUris.withAppendedId( + ContactsContract.Contacts.CONTENT_URI, + java.lang.Long.valueOf(id) + ) + ) + + if (inputStream != null) { + photo = BitmapFactory.decodeStream(inputStream) + } + + inputStream?.close() + } catch (e: IOException) { + e.printStackTrace() + } + println("Photo for $id: $photo") + return photo + } +} diff --git a/app/src/main/java/fr/plnech/dunbar/ui/FriendsAdapter.kt b/app/src/main/java/fr/plnech/dunbar/ui/FriendsAdapter.kt new file mode 100644 index 0000000..8c71792 --- /dev/null +++ b/app/src/main/java/fr/plnech/dunbar/ui/FriendsAdapter.kt @@ -0,0 +1,63 @@ +package fr.plnech.dunbar.ui + +import android.text.format.DateUtils +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Toast +import androidx.recyclerview.widget.RecyclerView +import fr.plnech.dunbar.R +import fr.plnech.dunbar.model.Friend +import kotlinx.android.synthetic.main.contact.view.* + + +class FriendsAdapter( + private var friends: List = mutableListOf() +) : RecyclerView.Adapter() { + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FriendsViewHolder = + FriendsViewHolder( + LayoutInflater.from(parent.context).inflate( + viewType, + parent, + false + ) + ) + + override fun getItemCount(): Int = friends.size + + override fun getItemViewType(position: Int): Int = R.layout.contact + + override fun onBindViewHolder(holder: FriendsViewHolder, position: Int): Unit = + holder.bind(friends[position]) +} + +class FriendsViewHolder(private val view: View) : RecyclerView.ViewHolder(view) { + private val name = view.contactName + private val data = view.contactData + private val pic = view.pic + + fun bind(friend: Friend) { + name.text = friend.name + data.text = buildString { + if (friend.lastDate != null ) { + append(friend.timesContacted) + append(" interactions, last ") + append(DateUtils.getRelativeTimeSpanString(friend.lastTimeStamp)) + } else { + append("Never interacted") + } + friend.phone?.let { + append("\n$it") + } + friend.photo?.let { + pic.setImageBitmap(it) + } + } + view.setOnClickListener { + Toast.makeText(view.context, friend.mapString(), Toast.LENGTH_LONG).show() + println(friend.mapString()) + } + } + +} diff --git a/app/src/main/res/drawable/ic_friend.png b/app/src/main/res/drawable/ic_friend.png new file mode 100644 index 0000000..9fa3937 Binary files /dev/null and b/app/src/main/res/drawable/ic_friend.png differ diff --git a/app/src/main/res/layout/activity_friends.xml b/app/src/main/res/layout/activity_friends.xml new file mode 100644 index 0000000..a4bf715 --- /dev/null +++ b/app/src/main/res/layout/activity_friends.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml deleted file mode 100644 index e9fa907..0000000 --- a/app/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/contact.xml b/app/src/main/res/layout/contact.xml index 669d97f..c39bbde 100644 --- a/app/src/main/res/layout/contact.xml +++ b/app/src/main/res/layout/contact.xml @@ -32,9 +32,9 @@ android:id="@+id/contactName" android:layout_width="0dp" android:layout_height="wrap_content" + android:layout_marginEnd="15dp" android:focusable="false" android:focusableInTouchMode="false" - android:layout_marginEnd="15dp" android:gravity="end" android:maxLines="2" android:textAppearance="@style/TextAppearance.AppCompat.Title" @@ -49,18 +49,47 @@ android:id="@+id/contactData" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginBottom="15dp" android:layout_marginEnd="15dp" + android:layout_marginBottom="15dp" android:focusable="false" android:focusableInTouchMode="false" android:gravity="end" android:textAppearance="@style/TextAppearance.AppCompat.Subhead" - app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintBottom_toTopOf="@id/contactCall" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintLeft_toRightOf="@id/pic" + app:layout_constraintLeft_toRightOf="@id/contactText" app:layout_constraintRight_toLeftOf="@id/contactName" app:layout_constraintTop_toBottomOf="@id/contactName" - tools:text="@tools:sample/full_names" /> + tools:text="2 interactions, last 1 hour ago" /> + + + + diff --git a/app/src/main/res/layout/content_friends.xml b/app/src/main/res/layout/content_friends.xml new file mode 100644 index 0000000..14d32a1 --- /dev/null +++ b/app/src/main/res/layout/content_friends.xml @@ -0,0 +1,36 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml deleted file mode 100644 index 3e769d4..0000000 --- a/app/src/main/res/layout/content_main.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index ee433f1..3ca9b6b 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -1,7 +1,7 @@ + tools:context="fr.plnech.dunbar.ui.FriendsActivity"> #008577 #00574B - #D81B60 + #FF5900 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 85010f1..932fcfb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,4 +1,6 @@ Dunbar + Dunbar + Updates about friends you don\'t want to forget Settings diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 545b9c6..b18eab5 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,8 +1,7 @@ -