refactor: Renaming

parent baee5a94
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="fr.plnech.dunbar"> package="fr.plnech.dunbar">
<uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.READ_CONTACTS" />
...@@ -12,10 +13,13 @@ ...@@ -12,10 +13,13 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<!-- TODO: https://developer.android.com/studio/write/app-link-indexing -->
<activity <activity
android:name=".BuddyListActivity" android:name=".FriendListActivity"
android:label="@string/title_buddy_list" android:label="@string/title_friend_list"
android:parentActivityName=".ui.FriendsActivity" android:parentActivityName=".ui.FriendsActivity"
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">
<meta-data <meta-data
...@@ -23,13 +27,13 @@ ...@@ -23,13 +27,13 @@
android:value="fr.plnech.dunbar.ui.FriendsActivity" /> android:value="fr.plnech.dunbar.ui.FriendsActivity" />
</activity> </activity>
<activity <activity
android:name=".BuddyDetailActivity" android:name=".FriendDetailActivity"
android:label="@string/title_buddy_detail" android:label="@string/title_friend_detail"
android:parentActivityName=".BuddyListActivity" android:parentActivityName=".FriendListActivity"
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value="fr.plnech.dunbar.BuddyListActivity" /> android:value="fr.plnech.dunbar.FriendListActivity" />
</activity> </activity>
<activity <activity
android:name=".ui.FriendsActivity" android:name=".ui.FriendsActivity"
......
...@@ -5,19 +5,19 @@ import android.os.Bundle ...@@ -5,19 +5,19 @@ import android.os.Bundle
import android.view.MenuItem import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import kotlinx.android.synthetic.main.activity_buddy_detail.* import kotlinx.android.synthetic.main.activity_friend_detail.*
/** /**
* An activity representing a single Friend detail screen. This * An activity representing a single Friend detail screen. This
* activity is only used on narrow width devices. On tablet-size devices, * activity is only used on narrow width devices. On tablet-size devices,
* item details are presented side-by-side with a list of items * item details are presented side-by-side with a list of items
* in a [BuddyListActivity]. * in a [FriendListActivity].
*/ */
class BuddyDetailActivity : AppCompatActivity() { class FriendDetailActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_buddy_detail) setContentView(R.layout.activity_friend_detail)
setSupportActionBar(detail_toolbar) setSupportActionBar(detail_toolbar)
fab.setOnClickListener { view -> fab.setOnClickListener { view ->
...@@ -25,32 +25,18 @@ class BuddyDetailActivity : AppCompatActivity() { ...@@ -25,32 +25,18 @@ class BuddyDetailActivity : AppCompatActivity() {
.setAction("Action", null).show() .setAction("Action", null).show()
} }
// Show the Up button in the action bar.
supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true)
// savedInstanceState is non-null when there is fragment state
// saved from previous configurations of this activity
// (e.g. when rotating the screen from portrait to landscape).
// In this case, the fragment will automatically be re-added
// to its container so we don't need to manually add it.
// For more information, see the Fragments API guide at:
//
// http://developer.android.com/guide/components/fragments.html
//
if (savedInstanceState == null) { if (savedInstanceState == null) {
// Create the detail fragment and add it to the activity
// using a fragment transaction.
val fragment = BuddyDetailFragment().apply {
arguments = Bundle().apply {
putString(
BuddyDetailFragment.ARG_ITEM_ID,
intent.getStringExtra(BuddyDetailFragment.ARG_ITEM_ID)
)
}
}
supportFragmentManager.beginTransaction() supportFragmentManager.beginTransaction()
.add(R.id.buddy_detail_container, fragment) .add(R.id.friend_detail_container, FriendDetailFragment().apply {
arguments = Bundle().apply {
putString(
FriendDetailFragment.ARG_ITEM_ID,
intent.getStringExtra(FriendDetailFragment.ARG_ITEM_ID)
)
}
})
.commit() .commit()
} }
} }
...@@ -58,13 +44,7 @@ class BuddyDetailActivity : AppCompatActivity() { ...@@ -58,13 +44,7 @@ class BuddyDetailActivity : AppCompatActivity() {
override fun onOptionsItemSelected(item: MenuItem) = override fun onOptionsItemSelected(item: MenuItem) =
when (item.itemId) { when (item.itemId) {
android.R.id.home -> { android.R.id.home -> {
// This ID represents the Home or Up button. In the case of this navigateUpTo(Intent(this, FriendListActivity::class.java))
// activity, the Up button is shown. For
// more details, see the Navigation pattern on Android Design:
//
// http://developer.android.com/design/patterns/navigation.html#up-vs-back
navigateUpTo(Intent(this, BuddyListActivity::class.java))
true true
} }
else -> super.onOptionsItemSelected(item) else -> super.onOptionsItemSelected(item)
......
...@@ -7,16 +7,16 @@ import android.view.ViewGroup ...@@ -7,16 +7,16 @@ import android.view.ViewGroup
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import fr.plnech.dunbar.dummy.DummyContent import fr.plnech.dunbar.dummy.DummyContent
import fr.plnech.dunbar.model.Friend import fr.plnech.dunbar.model.Friend
import kotlinx.android.synthetic.main.activity_buddy_detail.* import kotlinx.android.synthetic.main.activity_friend_detail.*
import kotlinx.android.synthetic.main.buddy_detail.view.* import kotlinx.android.synthetic.main.friend_detail.view.*
/** /**
* A fragment representing a single Buddy detail screen. * A fragment representing a single Friend detail screen.
* This fragment is either contained in a [FriendListActivity] * This fragment is either contained in a [FriendListActivity]
* in two-pane mode (on tablets) or a [FriendDetailActivity] * in two-pane mode (on tablets) or a [FriendDetailActivity]
* on handsets. * on handsets.
*/ */
class BuddyDetailFragment : Fragment() { class FriendDetailFragment : Fragment() {
/** /**
* The dummy content this fragment is presenting. * The dummy content this fragment is presenting.
...@@ -41,11 +41,11 @@ class BuddyDetailFragment : Fragment() { ...@@ -41,11 +41,11 @@ class BuddyDetailFragment : Fragment() {
inflater: LayoutInflater, container: ViewGroup?, inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle? savedInstanceState: Bundle?
): View? { ): View? {
val rootView = inflater.inflate(R.layout.buddy_detail, container, false) val rootView = inflater.inflate(R.layout.friend_detail, container, false)
// Show the dummy content as text in a TextView. // Show the dummy content as text in a TextView.
item?.let { item?.let {
rootView.buddy_detail.text = it.mapString() rootView.friend_detail.text = it.mapString()
activity?.title = it.name activity?.title = it.name
} }
......
...@@ -13,11 +13,11 @@ import androidx.recyclerview.widget.RecyclerView ...@@ -13,11 +13,11 @@ import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import fr.plnech.dunbar.dummy.DummyContent import fr.plnech.dunbar.dummy.DummyContent
import fr.plnech.dunbar.model.Friend import fr.plnech.dunbar.model.Friend
import kotlinx.android.synthetic.main.activity_buddy_list.* import kotlinx.android.synthetic.main.activity_friends_list.*
import kotlinx.android.synthetic.main.buddy_list.* import kotlinx.android.synthetic.main.friend_list.*
import kotlinx.android.synthetic.main.buddy_list_content.view.* import kotlinx.android.synthetic.main.friend_list_content.view.*
class BuddyListActivity : AppCompatActivity() { class FriendListActivity : AppCompatActivity() {
/** /**
* Whether or not the activity is in two-pane mode, i.e. running on a tablet * Whether or not the activity is in two-pane mode, i.e. running on a tablet
...@@ -27,7 +27,7 @@ class BuddyListActivity : AppCompatActivity() { ...@@ -27,7 +27,7 @@ class BuddyListActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_buddy_list) setContentView(R.layout.activity_friends_list)
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
toolbar.title = title toolbar.title = title
...@@ -39,7 +39,7 @@ class BuddyListActivity : AppCompatActivity() { ...@@ -39,7 +39,7 @@ class BuddyListActivity : AppCompatActivity() {
// Show the Up button in the action bar. // Show the Up button in the action bar.
supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true)
if (buddy_detail_container != null) { if (friend_detail_container != null) {
// The detail container view will be present only in the // The detail container view will be present only in the
// large-screen layouts (res/values-w900dp). // large-screen layouts (res/values-w900dp).
// If this view is present, then the // If this view is present, then the
...@@ -47,7 +47,7 @@ class BuddyListActivity : AppCompatActivity() { ...@@ -47,7 +47,7 @@ class BuddyListActivity : AppCompatActivity() {
twoPane = true twoPane = true
} }
setupRecyclerView(buddy_list) setupRecyclerView(friend_list)
} }
override fun onOptionsItemSelected(item: MenuItem) = override fun onOptionsItemSelected(item: MenuItem) =
...@@ -64,7 +64,7 @@ class BuddyListActivity : AppCompatActivity() { ...@@ -64,7 +64,7 @@ class BuddyListActivity : AppCompatActivity() {
} }
class SimpleItemRecyclerViewAdapter( class SimpleItemRecyclerViewAdapter(
private val parentActivity: BuddyListActivity, private val parentActivity: FriendListActivity,
private val values: List<Friend>, private val values: List<Friend>,
private val twoPane: Boolean private val twoPane: Boolean
) : ) :
...@@ -76,18 +76,18 @@ class BuddyListActivity : AppCompatActivity() { ...@@ -76,18 +76,18 @@ class BuddyListActivity : AppCompatActivity() {
onClickListener = View.OnClickListener { v -> onClickListener = View.OnClickListener { v ->
val item = v.tag as Friend val item = v.tag as Friend
if (twoPane) { if (twoPane) {
val fragment = BuddyDetailFragment().apply { val fragment = FriendDetailFragment().apply {
arguments = Bundle().apply { arguments = Bundle().apply {
putString(BuddyDetailFragment.ARG_ITEM_ID, "friend_${item.id}") putString(FriendDetailFragment.ARG_ITEM_ID, "friend_${item.id}")
} }
} }
parentActivity.supportFragmentManager parentActivity.supportFragmentManager
.beginTransaction() .beginTransaction()
.replace(R.id.buddy_detail_container, fragment) .replace(R.id.friend_detail_container, fragment)
.commit() .commit()
} else { } else {
val intent = Intent(v.context, BuddyDetailActivity::class.java).apply { val intent = Intent(v.context, FriendDetailActivity::class.java).apply {
putExtra(BuddyDetailFragment.ARG_ITEM_ID, "friend_${item.id}") putExtra(FriendDetailFragment.ARG_ITEM_ID, "friend_${item.id}")
} }
v.context.startActivity(intent) v.context.startActivity(intent)
} }
...@@ -96,7 +96,7 @@ class BuddyListActivity : AppCompatActivity() { ...@@ -96,7 +96,7 @@ class BuddyListActivity : AppCompatActivity() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(parent.context) val view = LayoutInflater.from(parent.context)
.inflate(R.layout.buddy_list_content, parent, false) .inflate(R.layout.friend_list_content, parent, false)
return ViewHolder(view) return ViewHolder(view)
} }
......
package fr.plnech.dunbar.data package fr.plnech.dunbar.data
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.net.Uri import android.net.Uri
import android.provider.Telephony import android.provider.Telephony
...@@ -16,6 +17,7 @@ class Messages(context: Context) { ...@@ -16,6 +17,7 @@ class Messages(context: Context) {
sent = fetchMessages(Telephony.Sms.Sent.CONTENT_URI) sent = fetchMessages(Telephony.Sms.Sent.CONTENT_URI)
} }
@SuppressLint("Recycle") // Cursor is recycled when nonnull
private fun fetchMessages(uri: Uri): MutableList<Map<String, String?>> { private fun fetchMessages(uri: Uri): MutableList<Map<String, String?>> {
val messages = mutableListOf<Map<String, String?>>() val messages = mutableListOf<Map<String, String?>>()
...@@ -41,7 +43,6 @@ class Messages(context: Context) { ...@@ -41,7 +43,6 @@ class Messages(context: Context) {
} else { } else {
println("Null cursor.") println("Null cursor.")
} }
} }
return messages return messages
} }
......
...@@ -18,7 +18,7 @@ data class Friend(val map: Map<String, String?> = mutableMapOf(), val photo: Bit ...@@ -18,7 +18,7 @@ data class Friend(val map: Map<String, String?> = mutableMapOf(), val photo: Bit
get() = name?.split(Regex("\\s"))?.firstOrNull() get() = name?.split(Regex("\\s"))?.firstOrNull()
val id: Int val id: Int
get() = map[Contacts._ID]!!.toInt() get() = (map[Contacts._ID] ?: error("No id for friend $name")).toInt()
val phone: String? val phone: String?
get() = if (map[Contacts.HAS_PHONE_NUMBER] == "1") map["data1"] else null get() = if (map[Contacts.HAS_PHONE_NUMBER] == "1") map["data1"] else null
......
...@@ -7,11 +7,11 @@ import androidx.core.app.NotificationCompat ...@@ -7,11 +7,11 @@ import androidx.core.app.NotificationCompat
import fr.plnech.dunbar.model.Friend import fr.plnech.dunbar.model.Friend
val CHANNEL_ID = "dunbar" const val CHANNEL_ID = "dunbar"
class FriendReminder(val ctx: Context) { class FriendReminder(private val ctx: Context) {
var channelCreated = false private var channelCreated = false
private fun createNotificationChannel() { private fun createNotificationChannel() {
// Create the NotificationChannel, but only on API 26+ because // Create the NotificationChannel, but only on API 26+ because
......
...@@ -8,14 +8,14 @@ import android.widget.Toast ...@@ -8,14 +8,14 @@ import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.NotificationManagerCompat import androidx.core.app.NotificationManagerCompat
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import fr.plnech.dunbar.BuddyListActivity import fr.plnech.dunbar.FriendListActivity
import fr.plnech.dunbar.R import fr.plnech.dunbar.R
import fr.plnech.dunbar.data.Messages import fr.plnech.dunbar.data.Messages
import fr.plnech.dunbar.fetchFriends import fr.plnech.dunbar.fetchFriends
import fr.plnech.dunbar.model.Friend import fr.plnech.dunbar.model.Friend
import fr.plnech.dunbar.notif.FriendReminder import fr.plnech.dunbar.notif.FriendReminder
import fr.plnech.dunbar.plural import fr.plnech.dunbar.plural
import kotlinx.android.synthetic.main.activity_friends.* import kotlinx.android.synthetic.main.activity_contacts.*
import kotlinx.android.synthetic.main.content_friends.* import kotlinx.android.synthetic.main.content_friends.*
import java.util.* import java.util.*
...@@ -27,7 +27,7 @@ class FriendsActivity : AppCompatActivity() { ...@@ -27,7 +27,7 @@ class FriendsActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_friends) setContentView(R.layout.activity_contacts)
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
// messages = Messages(applicationContext) // messages = Messages(applicationContext)
...@@ -42,7 +42,7 @@ class FriendsActivity : AppCompatActivity() { ...@@ -42,7 +42,7 @@ class FriendsActivity : AppCompatActivity() {
} }
private fun notifyFriend() { private fun notifyFriend() {
val idNotif = 0 val idNotification = 0
val notRecentlyTalked = friends.filter { val notRecentlyTalked = friends.filter {
it.lastDate != null && (Date().time - it.lastDate!!.time) > 1 * 60 * 60 * 1000 it.lastDate != null && (Date().time - it.lastDate!!.time) > 1 * 60 * 60 * 1000
} }
...@@ -58,7 +58,7 @@ class FriendsActivity : AppCompatActivity() { ...@@ -58,7 +58,7 @@ class FriendsActivity : AppCompatActivity() {
this@FriendsActivity this@FriendsActivity
) )
notification?.let { notification?.let {
notify(idNotif, notification) notify(idNotification, notification)
} }
} }
} }
...@@ -76,8 +76,8 @@ class FriendsActivity : AppCompatActivity() { ...@@ -76,8 +76,8 @@ class FriendsActivity : AppCompatActivity() {
// as you specify a parent activity in AndroidManifest.xml. // as you specify a parent activity in AndroidManifest.xml.
return when (item.itemId) { return when (item.itemId) {
R.id.action_settings -> true R.id.action_settings -> true
R.id.action_buddies -> { R.id.action_friends -> {
startActivity(Intent(this, BuddyListActivity::class.java)) startActivity(Intent(this, FriendListActivity::class.java))
true true
} }
else -> super.onOptionsItemSelected(item) else -> super.onOptionsItemSelected(item)
...@@ -106,7 +106,7 @@ class FriendsActivity : AppCompatActivity() { ...@@ -106,7 +106,7 @@ class FriendsActivity : AppCompatActivity() {
friendsList.layoutManager = LinearLayoutManager(this) friendsList.layoutManager = LinearLayoutManager(this)
friendsList.setHasFixedSize(true) friendsList.setHasFixedSize(true)
friendsList.adapter = adapter friendsList.adapter = adapter
welcomeTitle.text = "$nbFriends ${"friend".plural(nbFriends)} on Dunbar" welcomeTitle.text = getString(R.string.text_welcome).format(nbFriends, "friend".plural(nbFriends))
} }
} }
...@@ -17,11 +17,7 @@ class FriendsAdapter( ...@@ -17,11 +17,7 @@ class FriendsAdapter(
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FriendsViewHolder = override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FriendsViewHolder =
FriendsViewHolder( FriendsViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(viewType, parent, false)
viewType,
parent,
false
)
) )
override fun getItemCount(): Int = friends.size override fun getItemCount(): Int = friends.size
...@@ -43,35 +39,12 @@ class FriendsViewHolder(private val view: View) : RecyclerView.ViewHolder(view) ...@@ -43,35 +39,12 @@ class FriendsViewHolder(private val view: View) : RecyclerView.ViewHolder(view)
fun bind(friend: Friend) { fun bind(friend: Friend) {
name.text = friend.name name.text = friend.name
data.text = buildDataString(friend) data.text = buildDataString(friend)
bindPhone(friend)
bindPhone(friend)
bindPic(friend) bindPic(friend)
bindClick(friend) bindClick(friend)
} }
private fun buildDataString(friend: Friend): String {
return buildString {
if (friend.lastDate != null) {
append(friend.timesContacted)
append(" interactions, last ")
append(DateUtils.getRelativeTimeSpanString(friend.lastTimeStamp))
} else {
append("Never interacted")
}
}
}
private fun bindClick(friend: Friend) {
view.setOnClickListener {
Toast.makeText(view.context, friend.mapString(), Toast.LENGTH_LONG).show()
println(friend.mapString())
}
}
private fun bindPic(friend: Friend) {
pic.setImageBitmap(friend.photo)
}
private fun bindPhone(friend: Friend) { private fun bindPhone(friend: Friend) {
friend.phone?.let { friend.phone?.let {
phone.text = it phone.text = it
...@@ -90,4 +63,27 @@ class FriendsViewHolder(private val view: View) : RecyclerView.ViewHolder(view) ...@@ -90,4 +63,27 @@ class FriendsViewHolder(private val view: View) : RecyclerView.ViewHolder(view)
} }
} }
private fun bindPic(friend: Friend) {
pic.setImageBitmap(friend.photo)
}
private fun bindClick(friend: Friend) {
view.setOnClickListener {
Toast.makeText(view.context, friend.mapString(), Toast.LENGTH_LONG).show()
println(friend.mapString())
}
}
private fun buildDataString(friend: Friend): String {
return buildString {
if (friend.lastDate != null) {
append(friend.timesContacted)
append(" interactions, last ")
append(DateUtils.getRelativeTimeSpanString(friend.lastTimeStamp))
} else {
append("Never interacted")
}
}
}
} }
...@@ -10,28 +10,28 @@ ...@@ -10,28 +10,28 @@
android:divider="?android:attr/dividerHorizontal" android:divider="?android:attr/dividerHorizontal"
android:orientation="horizontal" android:orientation="horizontal"
android:showDividers="middle" android:showDividers="middle"
tools:context=".BuddyListActivity"> tools:context=".FriendListActivity">
<!-- <!--
This layout is a two-pane layout for the Buddies This layout is a two-pane layout for the Friends
master/detail flow. master/detail flow.
--> -->
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" <androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/buddy_list" android:id="@+id/friend_list"
android:name="fr.plnech.dunbar.BuddyListFragment" android:name="fr.plnech.dunbar.FriendListFragment"
android:layout_width="@dimen/item_width" android:layout_width="@dimen/item_width"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
app:layoutManager="LinearLayoutManager" app:layoutManager="LinearLayoutManager"
tools:context="fr.plnech.dunbar.BuddyListActivity" tools:context="fr.plnech.dunbar.FriendListActivity"
tools:listitem="@layout/buddy_list_content" /> tools:listitem="@layout/friend_list_content" />
<FrameLayout <FrameLayout
android:id="@+id/buddy_detail_container" android:id="@+id/friend_detail_container"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="3" /> android:layout_weight="3" />
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:id="@+id/buddy_detail_container" android:id="@+id/friend_detail_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start" android:layout_gravity="center_vertical|start"
android:layout_margin="@dimen/fab_margin" android:layout_margin="@dimen/fab_margin"
app:layout_anchor="@+id/buddy_detail_container" app:layout_anchor="@+id/friend_detail_container"
app:layout_anchorGravity="top|end" app:layout_anchorGravity="top|end"
app:srcCompat="@android:drawable/stat_notify_chat" /> app:srcCompat="@android:drawable/stat_notify_chat" />
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android" <TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/buddy_detail" android:id="@+id/friend_detail"
style="?android:attr/textAppearanceLarge" style="?android:attr/textAppearanceLarge"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:textSize="24sp" android:textSize="24sp"
app:layout_constraintBottom_toTopOf="@id/buddy_list" app:layout_constraintBottom_toTopOf="@id/friend_list"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
tools:text="N friends on Dunbar" /> tools:text="N friends on Dunbar" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/buddy_list" android:id="@+id/friend_list"
android:name="fr.plnech.dunbar.BuddyListFragment" android:name="fr.plnech.dunbar.FriendListFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
tools:context="fr.plnech.dunbar.ui.FriendsActivity"> tools:context="fr.plnech.dunbar.ui.FriendsActivity">
<item <item
android:id="@+id/action_buddies" android:id="@+id/action_friends"
android:orderInCategory="100" android:orderInCategory="100"
android:title="@string/action_buddies" android:title="@string/action_friends"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
<item <item
android:id="@+id/action_settings" android:id="@+id/action_settings"
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
<string name="channel_name">Dunbar</string> <string name="channel_name">Dunbar</string>
<string name="channel_description">Updates about friends you don\'t want to forget</string> <string name="channel_description">Updates about friends you don\'t want to forget</string>
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<string name="action_buddies">Buddies</string> <string name="action_friends">Friends</string>
<string name="title_buddy_list">Buddies</string> <string name="title_friend_list">Friends</string>
<string name="title_buddy_detail">Buddy Detail</string> <string name="title_friend_detail">Friend Detail</string>
<string name="text_welcome">"%1$d %2$s on Dunbar"</string>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment