mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-18 11:49:01 +00:00
add profile button to inbox messages
This commit is contained in:
parent
55bac855db
commit
af286c8ac8
2 changed files with 26 additions and 3 deletions
6
Habitica/res/menu/inbox_chat.xml
Normal file
6
Habitica/res/menu/inbox_chat.xml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<menu 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">
|
||||
<item android:id="@+id/open_profile" android:title="@string/profile"
|
||||
android:orderInCategory="100" app:showAsAction="always" />
|
||||
</menu>
|
||||
|
|
@ -4,9 +4,7 @@ import android.content.ClipData
|
|||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.*
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
|
|
@ -101,6 +99,21 @@ class InboxMessageListFragment : BaseMainFragment(), androidx.swiperefreshlayout
|
|||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
this.activity?.menuInflater?.inflate(R.menu.inbox_chat, menu)
|
||||
super.onCreateOptionsMenu(menu, inflater)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.open_profile -> {
|
||||
openProfile()
|
||||
return true
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
override fun injectFragment(component: UserComponent) {
|
||||
component.inject(this)
|
||||
}
|
||||
|
|
@ -136,6 +149,7 @@ class InboxMessageListFragment : BaseMainFragment(), androidx.swiperefreshlayout
|
|||
private fun setReceivingUser(chatRoomUser: String?, replyToUserUUID: String) {
|
||||
this.chatRoomUser = chatRoomUser
|
||||
this.replyToUserUUID = replyToUserUUID
|
||||
activity?.title = chatRoomUser
|
||||
}
|
||||
|
||||
private fun copyMessageToClipboard(chatMessage: ChatMessage) {
|
||||
|
|
@ -165,4 +179,7 @@ class InboxMessageListFragment : BaseMainFragment(), androidx.swiperefreshlayout
|
|||
}
|
||||
}
|
||||
|
||||
private fun openProfile() {
|
||||
replyToUserUUID?.let { FullProfileActivity.open(it) }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue