Open account from notification
This commit is contained in:
parent
34446fc9de
commit
ce9b83fe60
|
@ -88,16 +88,20 @@ class NotificationsFragment : CachedFeedFragment<Notification>() {
|
||||||
private fun Notification.openActivity() {
|
private fun Notification.openActivity() {
|
||||||
val intent: Intent =
|
val intent: Intent =
|
||||||
when (type) {
|
when (type) {
|
||||||
Notification.NotificationType.mention, Notification.NotificationType.favourite,
|
Notification.NotificationType.favourite,
|
||||||
Notification.NotificationType.poll, Notification.NotificationType.reblog -> {
|
Notification.NotificationType.poll, Notification.NotificationType.reblog -> {
|
||||||
openPostFromNotification()
|
openPostFromNotification()
|
||||||
}
|
}
|
||||||
Notification.NotificationType.follow -> {
|
Notification.NotificationType.follow -> {
|
||||||
Intent(itemView.context, ProfileActivity::class.java).apply {
|
openAccountFromNotification()
|
||||||
putExtra(Account.ACCOUNT_TAG, account)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
null -> return //TODO show an error here?
|
Notification.NotificationType.mention -> {
|
||||||
|
/*Intent(itemView.context, PostActivity::class.java).apply {
|
||||||
|
putExtra(Status.POST_TAG, status?.in_reply_to_id)
|
||||||
|
}*/ // TODO
|
||||||
|
openPostFromNotification()
|
||||||
|
}
|
||||||
|
null -> return
|
||||||
}
|
}
|
||||||
itemView.context.startActivity(intent)
|
itemView.context.startActivity(intent)
|
||||||
}
|
}
|
||||||
|
@ -107,6 +111,11 @@ class NotificationsFragment : CachedFeedFragment<Notification>() {
|
||||||
putExtra(Status.POST_TAG, status)
|
putExtra(Status.POST_TAG, status)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun Notification.openAccountFromNotification(): Intent =
|
||||||
|
Intent(itemView.context, ProfileActivity::class.java).apply {
|
||||||
|
putExtra(Account.ACCOUNT_TAG, account)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun setNotificationType(
|
private fun setNotificationType(
|
||||||
type: Notification.NotificationType,
|
type: Notification.NotificationType,
|
||||||
|
@ -211,6 +220,11 @@ class NotificationsFragment : CachedFeedFragment<Notification>() {
|
||||||
"Bearer $accessToken",
|
"Bearer $accessToken",
|
||||||
lifecycleScope
|
lifecycleScope
|
||||||
)
|
)
|
||||||
|
|
||||||
|
avatar.setOnClickListener {
|
||||||
|
val intent = notification?.openAccountFromNotification()
|
||||||
|
itemView.context.startActivity(intent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -4,17 +4,12 @@ import android.app.DownloadManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.database.Cursor
|
import android.database.Cursor
|
||||||
import android.graphics.ColorMatrix
|
|
||||||
import android.graphics.ColorMatrixColorFilter
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.View.GONE
|
|
||||||
import android.view.View.VISIBLE
|
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.h.pixeldroid.R
|
import com.h.pixeldroid.R
|
||||||
import com.h.pixeldroid.databinding.PostFragmentBinding
|
|
||||||
import com.h.pixeldroid.posts.getDomain
|
import com.h.pixeldroid.posts.getDomain
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
@ -64,6 +59,7 @@ open class Status(
|
||||||
{
|
{
|
||||||
companion object {
|
companion object {
|
||||||
const val POST_TAG = "postTag"
|
const val POST_TAG = "postTag"
|
||||||
|
const val POST_ID_TAG = "post_id_tag"
|
||||||
const val VIEW_COMMENTS_TAG = "view_comments_tag"
|
const val VIEW_COMMENTS_TAG = "view_comments_tag"
|
||||||
const val POST_COMMENT_TAG = "post_comment_tag"
|
const val POST_COMMENT_TAG = "post_comment_tag"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue