chore: cleanup

This commit is contained in:
aayush262 2024-04-23 00:38:33 +05:30
parent e81773f2b5
commit 55ad8dccad
7 changed files with 249 additions and 274 deletions

View file

@ -172,7 +172,7 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi
binding.mediaCoverImage.loadImage(media.cover) binding.mediaCoverImage.loadImage(media.cover)
binding.mediaCoverImage.setOnLongClickListener { binding.mediaCoverImage.setOnLongClickListener {
val coverTitle = "${media.userPreferredName}[Cover]" val coverTitle = getString(R.string.cover, media.userPreferredName)
ImageViewDialog.newInstance( ImageViewDialog.newInstance(
this, this,
coverTitle, coverTitle,
@ -192,7 +192,7 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi
} }
override fun onLongClick(event: MotionEvent) { override fun onLongClick(event: MotionEvent) {
val bannerTitle = "${media.userPreferredName}[Banner]" val bannerTitle = getString(R.string.banner, media.userPreferredName)
ImageViewDialog.newInstance( ImageViewDialog.newInstance(
this@MediaDetailsActivity, this@MediaDetailsActivity,
bannerTitle, bannerTitle,

View file

@ -580,7 +580,7 @@ class MediaInfoFragment : Fragment() {
).apply { ).apply {
itemTitle.setText(R.string.social) itemTitle.setText(R.string.social)
itemRecycler.adapter = itemRecycler.adapter =
MediaSocialAdapter(media.users!!, type) MediaSocialAdapter(media.users!!, type, requireActivity())
itemRecycler.layoutManager = LinearLayoutManager( itemRecycler.layoutManager = LinearLayoutManager(
requireContext(), requireContext(),
LinearLayoutManager.HORIZONTAL, LinearLayoutManager.HORIZONTAL,

View file

@ -1,28 +1,32 @@
package ani.dantotsu.media package ani.dantotsu.media
import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import ani.dantotsu.R import ani.dantotsu.R
import ani.dantotsu.databinding.ItemFollowerGridBinding import ani.dantotsu.databinding.ItemFollowerGridBinding
import ani.dantotsu.getAppString import ani.dantotsu.getAppString
import ani.dantotsu.loadImage import ani.dantotsu.loadImage
import ani.dantotsu.others.ImageViewDialog
import ani.dantotsu.profile.ProfileActivity import ani.dantotsu.profile.ProfileActivity
import ani.dantotsu.profile.User import ani.dantotsu.profile.User
import ani.dantotsu.setAnimation import ani.dantotsu.setAnimation
class MediaSocialAdapter(private val user: ArrayList<User>, private val type: String) : class MediaSocialAdapter(
RecyclerView.Adapter<MediaSocialAdapter.DeveloperViewHolder>() { val user: ArrayList<User>,
val type: String,
val activity: FragmentActivity
) : RecyclerView.Adapter<MediaSocialAdapter.FollowerGridViewHolder>() {
inner class DeveloperViewHolder(val binding: ItemFollowerGridBinding) : inner class FollowerGridViewHolder(val binding: ItemFollowerGridBinding) :
RecyclerView.ViewHolder(binding.root) RecyclerView.ViewHolder(binding.root)
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DeveloperViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FollowerGridViewHolder {
return DeveloperViewHolder( return FollowerGridViewHolder(
ItemFollowerGridBinding.inflate( ItemFollowerGridBinding.inflate(
LayoutInflater.from(parent.context), LayoutInflater.from(parent.context),
parent, parent,
@ -31,8 +35,8 @@ class MediaSocialAdapter(private val user: ArrayList<User>, private val type: St
) )
} }
@SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: DeveloperViewHolder, position: Int) { override fun onBindViewHolder(holder: FollowerGridViewHolder, position: Int) {
holder.binding.apply { holder.binding.apply {
val user = user[position] val user = user[position]
val score = user.score?.div(10.0) ?: 0.0 val score = user.score?.div(10.0) ?: 0.0
@ -47,7 +51,7 @@ class MediaSocialAdapter(private val user: ArrayList<User>, private val type: St
} }
profileCompactUserProgress.text = user.progress.toString() profileCompactUserProgress.text = user.progress.toString()
profileCompactScore.text = score.toString() profileCompactScore.text = score.toString()
profileCompactTotal.text = " | ${user.totalEpisodes ?: "~"}" " | ${user.totalEpisodes ?: "~"}".also { profileCompactTotal.text = it }
profileUserAvatar.loadImage(user.pfp) profileUserAvatar.loadImage(user.pfp)
val scoreDrawable = if (score == 0.0) R.drawable.score else R.drawable.user_score val scoreDrawable = if (score == 0.0) R.drawable.score else R.drawable.user_score
@ -59,10 +63,17 @@ class MediaSocialAdapter(private val user: ArrayList<User>, private val type: St
profileCompactProgressContainer.visibility = View.VISIBLE profileCompactProgressContainer.visibility = View.VISIBLE
profileUserAvatar.setOnClickListener { profileUserAvatar.setOnClickListener {
val intent = Intent(root.context, ProfileActivity::class.java).apply { ContextCompat.startActivity(root.context,
putExtra("userId", user.id) Intent(root.context, ProfileActivity::class.java)
.putExtra("userId", user.id),
null)
} }
ContextCompat.startActivity(root.context, intent, null) profileUserAvatarContainer.setOnLongClickListener {
ImageViewDialog.newInstance(
activity,
activity.getString(R.string.avatar, user.name),
user.pfp
)
} }
} }
} }

View file

@ -60,26 +60,28 @@ class CommentItem(
override fun bind(viewBinding: ItemCommentsBinding, position: Int) { override fun bind(viewBinding: ItemCommentsBinding, position: Int) {
binding = viewBinding binding = viewBinding
setAnimation(binding.root.context, binding.root) setAnimation(binding.root.context, binding.root)
viewBinding.commentRepliesList.layoutManager = val item = this
viewBinding.apply {
commentRepliesList.layoutManager =
LinearLayoutManager(commentsFragment.activity) LinearLayoutManager(commentsFragment.activity)
viewBinding.commentRepliesList.adapter = adapter commentRepliesList.adapter = adapter
val isUserComment = CommentsAPI.userId == comment.userId val isUserComment = CommentsAPI.userId == comment.userId
val levelColor = getAvatarColor(comment.totalVotes, backgroundColor) val levelColor = getAvatarColor(comment.totalVotes, backgroundColor)
markwon.setMarkdown(viewBinding.commentText, comment.content) markwon.setMarkdown(commentText, comment.content)
viewBinding.commentEdit.visibility = if (isUserComment) View.VISIBLE else View.GONE commentEdit.visibility = if (isUserComment) View.VISIBLE else View.GONE
if (comment.tag == null) { if (comment.tag == null) {
viewBinding.commentUserTagLayout.visibility = View.GONE commentUserTagLayout.visibility = View.GONE
} else { } else {
viewBinding.commentUserTagLayout.visibility = View.VISIBLE commentUserTagLayout.visibility = View.VISIBLE
viewBinding.commentUserTag.text = comment.tag.toString() commentUserTag.text = comment.tag.toString()
} }
replying(isReplying) //sets default text replying(isReplying) //sets default text
editing(isEditing) editing(isEditing)
if ((comment.replyCount ?: 0) > 0) { if ((comment.replyCount ?: 0) > 0) {
viewBinding.commentTotalReplies.visibility = View.VISIBLE commentTotalReplies.visibility = View.VISIBLE
viewBinding.commentRepliesDivider.visibility = View.VISIBLE commentRepliesDivider.visibility = View.VISIBLE
viewBinding.commentTotalReplies.context.run { commentTotalReplies.context.run {
viewBinding.commentTotalReplies.text = if (repliesVisible) commentTotalReplies.text = if (repliesVisible)
getString(R.string.hide_replies) getString(R.string.hide_replies)
else else
if (comment.replyCount == 1) if (comment.replyCount == 1)
@ -88,65 +90,64 @@ class CommentItem(
getString(R.string.view_replies_count, comment.replyCount) getString(R.string.view_replies_count, comment.replyCount)
} }
} else { } else {
viewBinding.commentTotalReplies.visibility = View.GONE commentTotalReplies.visibility = View.GONE
viewBinding.commentRepliesDivider.visibility = View.GONE commentRepliesDivider.visibility = View.GONE
} }
viewBinding.commentReply.visibility = View.VISIBLE commentReply.visibility = View.VISIBLE
viewBinding.commentTotalReplies.setOnClickListener { commentTotalReplies.setOnClickListener {
if (repliesVisible) { if (repliesVisible) {
repliesSection.clear() repliesSection.clear()
removeSubCommentIds() removeSubCommentIds()
viewBinding.commentTotalReplies.context.run { commentTotalReplies.context.run {
viewBinding.commentTotalReplies.text = if (comment.replyCount == 1) commentTotalReplies.text = if (comment.replyCount == 1)
getString(R.string.view_reply) getString(R.string.view_reply)
else else
getString(R.string.view_replies_count, comment.replyCount) getString(R.string.view_replies_count, comment.replyCount)
} }
repliesVisible = false repliesVisible = false
} else { } else {
viewBinding.commentTotalReplies.setText(R.string.hide_replies) commentTotalReplies.setText(R.string.hide_replies)
repliesSection.clear() repliesSection.clear()
commentsFragment.viewReplyCallback(this) commentsFragment.viewReplyCallback(item)
repliesVisible = true repliesVisible = true
} }
} }
viewBinding.commentUserName.setOnClickListener { commentUserName.setOnClickListener {
ContextCompat.startActivity( ContextCompat.startActivity(
commentsFragment.activity, commentsFragment.activity,
Intent(commentsFragment.activity, ProfileActivity::class.java) Intent(commentsFragment.activity, ProfileActivity::class.java)
.putExtra("userId", comment.userId.toInt()) .putExtra("userId", comment.userId.toInt()),
.putExtra("userLVL", "[${levelColor.second}]"),
null null
) )
} }
viewBinding.commentUserAvatar.setOnClickListener { commentUserAvatar.setOnClickListener {
ContextCompat.startActivity( ContextCompat.startActivity(
commentsFragment.activity, commentsFragment.activity,
Intent(commentsFragment.activity, ProfileActivity::class.java) Intent(commentsFragment.activity, ProfileActivity::class.java)
.putExtra("userId", comment.userId.toInt()) .putExtra("userId", comment.userId.toInt()),
.putExtra("userLVL", "[${levelColor.second}]"),
null null
) )
} }
viewBinding.commentText.setOnLongClickListener { commentText.setOnLongClickListener {
copyToClipboard(comment.content) copyToClipboard(comment.content)
true true
} }
viewBinding.commentEdit.setOnClickListener { commentEdit.setOnClickListener {
editing(!isEditing) editing(!isEditing)
commentsFragment.editCallback(this) commentsFragment.editCallback(item)
} }
viewBinding.commentReply.setOnClickListener { commentReply.setOnClickListener {
replying(!isReplying) replying(!isReplying)
commentsFragment.replyTo(this, comment.username) commentsFragment.replyTo(item, comment.username)
commentsFragment.replyCallback(this) commentsFragment.replyCallback(item)
} }
viewBinding.modBadge.visibility = if (comment.isMod == true) View.VISIBLE else View.GONE modBadge.visibility = if (comment.isMod == true) View.VISIBLE else View.GONE
viewBinding.adminBadge.visibility = if (comment.isAdmin == true) View.VISIBLE else View.GONE adminBadge.visibility =
viewBinding.commentInfo.setOnClickListener { if (comment.isAdmin == true) View.VISIBLE else View.GONE
val popup = PopupMenu(commentsFragment.requireContext(), viewBinding.commentInfo) commentInfo.setOnClickListener {
val popup = PopupMenu(commentsFragment.requireContext(), commentInfo)
popup.menuInflater.inflate(R.menu.profile_details_menu, popup.menu) popup.menuInflater.inflate(R.menu.profile_details_menu, popup.menu)
popup.menu.findItem(R.id.commentDelete)?.isVisible = popup.menu.findItem(R.id.commentDelete)?.isVisible =
isUserComment || CommentsAPI.isAdmin || CommentsAPI.isMod isUserComment || CommentsAPI.isAdmin || CommentsAPI.isMod
@ -215,7 +216,7 @@ class CommentItem(
} }
//fill the icon if the user has liked the comment //fill the icon if the user has liked the comment
setVoteButtons(viewBinding) setVoteButtons(viewBinding)
viewBinding.commentUpVote.setOnClickListener { commentUpVote.setOnClickListener {
val voteType = if (comment.userVoteType == 1) 0 else 1 val voteType = if (comment.userVoteType == 1) 0 else 1
val previousVoteType = comment.userVoteType val previousVoteType = comment.userVoteType
val scope = CoroutineScope(Dispatchers.Main + SupervisorJob()) val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
@ -228,13 +229,12 @@ class CommentItem(
comment.downvotes -= 1 comment.downvotes -= 1
} }
comment.upvotes += if (voteType == 1) 1 else -1 comment.upvotes += if (voteType == 1) 1 else -1
notifyChanged() notifyChanged()
} }
} }
} }
viewBinding.commentDownVote.setOnClickListener { commentDownVote.setOnClickListener {
val voteType = if (comment.userVoteType == -1) 0 else -1 val voteType = if (comment.userVoteType == -1) 0 else -1
val previousVoteType = comment.userVoteType val previousVoteType = comment.userVoteType
val scope = CoroutineScope(Dispatchers.Main + SupervisorJob()) val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
@ -242,7 +242,6 @@ class CommentItem(
val success = CommentsAPI.vote(comment.commentId, voteType) val success = CommentsAPI.vote(comment.commentId, voteType)
if (success) { if (success) {
comment.userVoteType = voteType comment.userVoteType = voteType
if (previousVoteType == 1) { if (previousVoteType == 1) {
comment.upvotes -= 1 comment.upvotes -= 1
} }
@ -251,20 +250,21 @@ class CommentItem(
} }
} }
} }
viewBinding.commentTotalVotes.text = (comment.upvotes - comment.downvotes).toString() commentTotalVotes.text = (comment.upvotes - comment.downvotes).toString()
viewBinding.commentUserAvatar.setOnLongClickListener { commentUserAvatar.setOnLongClickListener {
ImageViewDialog.newInstance( ImageViewDialog.newInstance(
commentsFragment.activity, commentsFragment.activity,
"${comment.username}'s [Cover]", commentsFragment.activity.getString(R.string.avatar, comment.username),
comment.profilePictureUrl comment.profilePictureUrl
) )
} }
comment.profilePictureUrl?.let { viewBinding.commentUserAvatar.loadImage(it) } comment.profilePictureUrl?.let { commentUserAvatar.loadImage(it) }
viewBinding.commentUserName.text = comment.username commentUserName.text = comment.username
val userColor = "[${levelColor.second}]" val userColor = "[${levelColor.second}]"
viewBinding.commentUserLevel.text = userColor commentUserLevel.text = userColor
viewBinding.commentUserLevel.setTextColor(levelColor.first) commentUserLevel.setTextColor(levelColor.first)
viewBinding.commentUserTime.text = formatTimestamp(comment.timestamp) commentUserTime.text = formatTimestamp(comment.timestamp)
}
} }
override fun getLayout(): Int { override fun getLayout(): Int {

View file

@ -6,6 +6,7 @@ import android.content.res.Configuration
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView
import android.widget.PopupMenu import android.widget.PopupMenu
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
@ -56,6 +57,7 @@ class ProfileActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedListene
initActivity(this) initActivity(this)
binding = ActivityProfileBinding.inflate(layoutInflater) binding = ActivityProfileBinding.inflate(layoutInflater)
setContentView(binding.root) setContentView(binding.root)
val context = this
screenWidth = resources.displayMetrics.widthPixels.toFloat() screenWidth = resources.displayMetrics.widthPixels.toFloat()
navBar = binding.profileNavBar navBar = binding.profileNavBar
val navBarRightMargin = if (resources.configuration.orientation == val navBarRightMargin = if (resources.configuration.orientation ==
@ -89,8 +91,7 @@ class ProfileActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedListene
finish() finish()
return@launch return@launch
} }
val following = respond.data.followingPage?.pageInfo?.total ?: 0
val followers = respond.data.followerPage?.pageInfo?.total ?: 0
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
binding.profileViewPager.updateLayoutParams<ViewGroup.MarginLayoutParams> { binding.profileViewPager.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = navBarHeight bottomMargin = navBarHeight
@ -114,19 +115,23 @@ class ProfileActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedListene
}) })
bindingProfileAppBar = ItemProfileAppBarBinding.bind(binding.root).apply { bindingProfileAppBar = ItemProfileAppBarBinding.bind(binding.root).apply {
binding.profileProgressBar.visibility = View.GONE
val userLevel = intent.getStringExtra("userLVL") ?: ""
followButton.isGone = followButton.isGone =
user.id == Anilist.userid || Anilist.userid == null user.id == Anilist.userid || Anilist.userid == null
followButton.text = getString(
fun followText(): String {
return getString(
when { when {
user.isFollowing && user.isFollower -> R.string.mutual
user.isFollowing -> R.string.unfollow user.isFollowing -> R.string.unfollow
user.isFollower -> R.string.follows_you user.isFollower -> R.string.follows_you
else -> R.string.follow else -> R.string.follow
} }
) )
if (user.isFollowing && user.isFollower) followButton.text = }
getString(R.string.mutual)
followButton.text = followText()
followButton.setOnClickListener { followButton.setOnClickListener {
lifecycleScope.launch(Dispatchers.IO) { lifecycleScope.launch(Dispatchers.IO) {
val res = Anilist.query.toggleFollow(user.id) val res = Anilist.query.toggleFollow(user.id)
@ -134,53 +139,21 @@ class ProfileActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedListene
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
snackString(R.string.success) snackString(R.string.success)
user.isFollowing = res.data.toggleFollow.isFollowing user.isFollowing = res.data.toggleFollow.isFollowing
followButton.text = getString( followButton.text = followText()
when {
user.isFollowing -> R.string.unfollow
user.isFollower -> R.string.follows_you
else -> R.string.follow
}
)
if (user.isFollowing && user.isFollower)
followButton.text = getString(R.string.mutual)
} }
} }
} }
} }
binding.profileProgressBar.visibility = View.GONE
profileAppBar.visibility = View.VISIBLE profileAppBar.visibility = View.VISIBLE
profileMenuButton.setOnClickListener { profileMenuButton.setOnClickListener {
val popup = PopupMenu(this@ProfileActivity, profileMenuButton) val popup = PopupMenu(context, profileMenuButton)
popup.menuInflater.inflate(R.menu.menu_profile, popup.menu) popup.menuInflater.inflate(R.menu.menu_profile, popup.menu)
popup.setOnMenuItemClickListener { item -> popup.setOnMenuItemClickListener { item ->
when (item.itemId) { when (item.itemId) {
R.id.action_view_following -> {
ContextCompat.startActivity(
this@ProfileActivity,
Intent(this@ProfileActivity, FollowActivity::class.java)
.putExtra("title", "Following")
.putExtra("userId", user.id),
null
)
true
}
R.id.action_view_followers -> {
ContextCompat.startActivity(
this@ProfileActivity,
Intent(this@ProfileActivity, FollowActivity::class.java)
.putExtra("title", "Followers")
.putExtra("userId", user.id),
null
)
true
}
R.id.action_view_on_anilist -> { R.id.action_view_on_anilist -> {
openLinkInBrowser("https://anilist.co/user/${user.name}") openLinkInBrowser("https://anilist.co/user/${user.name}")
true true
} }
else -> false else -> false
} }
} }
@ -190,18 +163,16 @@ class ProfileActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedListene
profileUserAvatar.loadImage(user.avatar?.medium) profileUserAvatar.loadImage(user.avatar?.medium)
profileUserAvatar.setOnLongClickListener { profileUserAvatar.setOnLongClickListener {
ImageViewDialog.newInstance( ImageViewDialog.newInstance(
this@ProfileActivity, context,
"${user.name}'s [Avatar]", getString(R.string.avatar, user.name),
user.avatar?.medium user.avatar?.medium
) )
} }
profileUserName.text = user.name
val userLevelText = "${user.name} $userLevel" val bannerAnimations: ImageView= if (PrefManager.getVal(PrefName.BannerAnimations)) profileBannerImage else profileBannerImageNoKen
profileUserName.text = userLevelText
val bannerAnimations: Boolean = PrefManager.getVal(PrefName.BannerAnimations)
blurImage( blurImage(
if (bannerAnimations) profileBannerImage else profileBannerImageNoKen, bannerAnimations,
user.bannerImage ?: user.avatar?.medium user.bannerImage ?: user.avatar?.medium
) )
profileBannerImage.updateLayoutParams { height += statusBarHeight } profileBannerImage.updateLayoutParams { height += statusBarHeight }
@ -210,34 +181,34 @@ class ProfileActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedListene
profileCloseButton.updateLayoutParams<ViewGroup.MarginLayoutParams> { topMargin += statusBarHeight } profileCloseButton.updateLayoutParams<ViewGroup.MarginLayoutParams> { topMargin += statusBarHeight }
profileMenuButton.updateLayoutParams<ViewGroup.MarginLayoutParams> { topMargin += statusBarHeight } profileMenuButton.updateLayoutParams<ViewGroup.MarginLayoutParams> { topMargin += statusBarHeight }
profileButtonContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> { topMargin += statusBarHeight } profileButtonContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> { topMargin += statusBarHeight }
profileBannerImage.setOnLongClickListener { profileBannerImage.setOnLongClickListener {
ImageViewDialog.newInstance( ImageViewDialog.newInstance(
this@ProfileActivity, context,
user.name + " [Banner]", getString(R.string.banner, user.name),
user.bannerImage user.bannerImage
) )
} }
mMaxScrollSize = profileAppBar.totalScrollRange mMaxScrollSize = profileAppBar.totalScrollRange
profileAppBar.addOnOffsetChangedListener(this@ProfileActivity) profileAppBar.addOnOffsetChangedListener(context)
profileFollowerCount.text = followers.toString() profileFollowerCount.text = (respond.data.followerPage?.pageInfo?.total ?: 0).toString()
profileFollowerCountContainer.setOnClickListener { profileFollowerCountContainer.setOnClickListener {
ContextCompat.startActivity( ContextCompat.startActivity(
this@ProfileActivity, context,
Intent(this@ProfileActivity, FollowActivity::class.java) Intent(context, FollowActivity::class.java)
.putExtra("title", getString(R.string.followers)) .putExtra("title", getString(R.string.followers))
.putExtra("userId", user.id), .putExtra("userId", user.id),
null null
) )
} }
profileFollowingCount.text = (respond.data.followingPage?.pageInfo?.total ?: 0).toString()
profileFollowingCount.text = following.toString()
profileFollowingCountContainer.setOnClickListener { profileFollowingCountContainer.setOnClickListener {
ContextCompat.startActivity( ContextCompat.startActivity(
this@ProfileActivity, context,
Intent(this@ProfileActivity, FollowActivity::class.java) Intent(context, FollowActivity::class.java)
.putExtra("title", "Following") .putExtra("title", "Following")
.putExtra("userId", user.id), .putExtra("userId", user.id),
null null
@ -247,8 +218,8 @@ class ProfileActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedListene
profileAnimeCount.text = user.statistics.anime.count.toString() profileAnimeCount.text = user.statistics.anime.count.toString()
profileAnimeCountContainer.setOnClickListener { profileAnimeCountContainer.setOnClickListener {
ContextCompat.startActivity( ContextCompat.startActivity(
this@ProfileActivity, context,
Intent(this@ProfileActivity, ListActivity::class.java) Intent(context, ListActivity::class.java)
.putExtra("anime", true) .putExtra("anime", true)
.putExtra("userId", user.id) .putExtra("userId", user.id)
.putExtra("username", user.name), .putExtra("username", user.name),
@ -259,8 +230,8 @@ class ProfileActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedListene
profileMangaCount.text = user.statistics.manga.count.toString() profileMangaCount.text = user.statistics.manga.count.toString()
profileMangaCountContainer.setOnClickListener { profileMangaCountContainer.setOnClickListener {
ContextCompat.startActivity( ContextCompat.startActivity(
this@ProfileActivity, context,
Intent(this@ProfileActivity, ListActivity::class.java) Intent(context, ListActivity::class.java)
.putExtra("anime", false) .putExtra("anime", false)
.putExtra("userId", user.id) .putExtra("userId", user.id)
.putExtra("username", user.name), .putExtra("username", user.name),

View file

@ -2,16 +2,6 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_view_following"
android:title="@string/view_following"
app:showAsAction="never" />
<item
android:id="@+id/action_view_followers"
android:title="@string/view_followers"
app:showAsAction="never" />
<item <item
android:id="@+id/action_view_on_anilist" android:id="@+id/action_view_on_anilist"
android:title="@string/view_on_anilist" android:title="@string/view_on_anilist"

View file

@ -960,4 +960,7 @@ Non quae tempore quo provident laudantium qui illo dolor vel quia dolor et exerc
<string name="failed_ext_install_conflict">Failed to install extension due to conflict</string> <string name="failed_ext_install_conflict">Failed to install extension due to conflict</string>
<string name="reading">READING</string> <string name="reading">READING</string>
<string name="watching">WATCHING</string> <string name="watching">WATCHING</string>
<string name="avatar">%1$s\ [Avatar]</string>
<string name="cover">%1$s\ [Cover]</string>
<string name="banner">%1$s\ [Banner]</string>
</resources> </resources>