diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index fc0721be49..8408d9ff25 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -120,7 +120,7 @@
android:parentActivityName=".MainActivity" >
diff --git a/app/src/main/java/ani/dantotsu/home/AnimeFragment.kt b/app/src/main/java/ani/dantotsu/home/AnimeFragment.kt
index f3baeb3f4d..2e11054161 100644
--- a/app/src/main/java/ani/dantotsu/home/AnimeFragment.kt
+++ b/app/src/main/java/ani/dantotsu/home/AnimeFragment.kt
@@ -283,7 +283,6 @@ class AnimeFragment : Fragment() {
binding.root.requestApplyInsets()
binding.root.requestLayout()
}
-
super.onResume()
}
}
\ No newline at end of file
diff --git a/app/src/main/java/ani/dantotsu/home/AnimePageAdapter.kt b/app/src/main/java/ani/dantotsu/home/AnimePageAdapter.kt
index 295b49b27e..fc480ae342 100644
--- a/app/src/main/java/ani/dantotsu/home/AnimePageAdapter.kt
+++ b/app/src/main/java/ani/dantotsu/home/AnimePageAdapter.kt
@@ -94,6 +94,8 @@ class AnimePageAdapter : RecyclerView.Adapter 0) View.VISIBLE else View.GONE
+ binding.animeNotificationCount.text = Anilist.unreadNotificationCount.toString()
listOf(
binding.animePreviousSeason,
diff --git a/app/src/main/java/ani/dantotsu/home/HomeFragment.kt b/app/src/main/java/ani/dantotsu/home/HomeFragment.kt
index 775f436e99..e0a2dc1461 100644
--- a/app/src/main/java/ani/dantotsu/home/HomeFragment.kt
+++ b/app/src/main/java/ani/dantotsu/home/HomeFragment.kt
@@ -79,8 +79,8 @@ class HomeFragment : Fragment() {
if (!(PrefManager.getVal(PrefName.BannerAnimations) as Boolean)) binding.homeUserBg.pause()
binding.homeUserBg.loadImage(Anilist.bg)
binding.homeUserDataProgressBar.visibility = View.GONE
-
- binding.homeNotificationDot.visibility = if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
+ binding.homeNotificationCount.visibility = if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
+ binding.homeNotificationCount.text = Anilist.unreadNotificationCount.toString()
binding.homeAnimeList.setOnClickListener {
ContextCompat.startActivity(
@@ -360,11 +360,12 @@ class HomeFragment : Fragment() {
}
}
}
-
override fun onResume() {
if (!model.loaded) Refresh.activity[1]!!.postValue(true)
- if (_binding != null)
- binding.homeNotificationDot.visibility = if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
+ if (_binding != null) {
+ binding.homeNotificationCount.visibility = if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
+ binding.homeNotificationCount.text = Anilist.unreadNotificationCount.toString()
+ }
super.onResume()
}
}
\ No newline at end of file
diff --git a/app/src/main/java/ani/dantotsu/home/MangaPageAdapter.kt b/app/src/main/java/ani/dantotsu/home/MangaPageAdapter.kt
index 6cedbb8071..1f71426020 100644
--- a/app/src/main/java/ani/dantotsu/home/MangaPageAdapter.kt
+++ b/app/src/main/java/ani/dantotsu/home/MangaPageAdapter.kt
@@ -74,7 +74,8 @@ class MangaPageAdapter : RecyclerView.Adapter 0) View.VISIBLE else View.GONE
+ binding.mangaNotificationCount.text = Anilist.unreadNotificationCount.toString()
binding.mangaSearchBar.hint = "MANGA"
binding.mangaSearchBarText.setOnClickListener {
ContextCompat.startActivity(
diff --git a/app/src/main/java/ani/dantotsu/media/manga/MangaChapterAdapter.kt b/app/src/main/java/ani/dantotsu/media/manga/MangaChapterAdapter.kt
index a2cf40b7fe..d19aa0117b 100644
--- a/app/src/main/java/ani/dantotsu/media/manga/MangaChapterAdapter.kt
+++ b/app/src/main/java/ani/dantotsu/media/manga/MangaChapterAdapter.kt
@@ -369,7 +369,7 @@ class MangaChapterAdapter(
}
1L -> "1 day ago"
in 2..6 -> "$daysDifference days ago"
- else -> SimpleDateFormat("dd MMM yyyy", Locale.ENGLISH).format(targetDate)
+ else -> SimpleDateFormat("dd MMM yyyy", Locale.getDefault()).format(targetDate)
}
}
diff --git a/app/src/main/java/ani/dantotsu/profile/ActivityActivity.kt b/app/src/main/java/ani/dantotsu/profile/ActivityActivity.kt
index 30b2f68521..47d2ad6755 100644
--- a/app/src/main/java/ani/dantotsu/profile/ActivityActivity.kt
+++ b/app/src/main/java/ani/dantotsu/profile/ActivityActivity.kt
@@ -1,48 +1,29 @@
package ani.dantotsu.profile
+import android.annotation.SuppressLint
import android.os.Bundle
import android.view.ViewGroup
-import android.view.Window
-import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
-import androidx.core.content.ContextCompat
import androidx.core.view.updateLayoutParams
-import ani.dantotsu.R
-import ani.dantotsu.databinding.ActivityActivityBinding
+import ani.dantotsu.databinding.ActivityFollowBinding
import ani.dantotsu.initActivity
-import ani.dantotsu.settings.saving.PrefManager
-import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.statusBarHeight
import ani.dantotsu.themes.ThemeManager
-
class ActivityActivity : AppCompatActivity() {
- private lateinit var binding: ActivityActivityBinding
+ private lateinit var binding: ActivityFollowBinding
+ @SuppressLint("SetTextI18n")
override fun onCreate(savedInstanceState: Bundle?) {
- val immersiveMode = PrefManager.getVal(PrefName.ImmersiveMode)
- if (immersiveMode) {
- requestWindowFeature(Window.FEATURE_NO_TITLE)
- }
super.onCreate(savedInstanceState)
ThemeManager(this).applyTheme()
initActivity(this)
- binding = ActivityActivityBinding.inflate(layoutInflater)
- if (!immersiveMode) {
- this.window.statusBarColor =
- ContextCompat.getColor(this, R.color.nav_bg_inv)
- binding.root.fitsSystemWindows = true
-
- } else {
- binding.root.fitsSystemWindows = false
- window.setFlags(
- WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN
- )
- binding.listTitle.updateLayoutParams {
- topMargin = statusBarHeight
- }
- }
+ binding = ActivityFollowBinding.inflate(layoutInflater)
setContentView(binding.root)
+
+ binding.listTitle.text = "Activity"
+ binding.listToolbar.updateLayoutParams { topMargin = statusBarHeight }
+ binding.followerGrid.visibility = ViewGroup.GONE
+ binding.followerList.visibility = ViewGroup.GONE
}
}
\ No newline at end of file
diff --git a/app/src/main/java/ani/dantotsu/profile/FollowActivity.kt b/app/src/main/java/ani/dantotsu/profile/FollowActivity.kt
index 0c52811850..9cb1b61289 100644
--- a/app/src/main/java/ani/dantotsu/profile/FollowActivity.kt
+++ b/app/src/main/java/ani/dantotsu/profile/FollowActivity.kt
@@ -2,23 +2,17 @@ package ani.dantotsu.profile
import android.content.Intent
import android.os.Bundle
-import android.view.ViewGroup
import android.view.ViewGroup.MarginLayoutParams
-import android.view.Window
-import android.view.WindowManager
import android.widget.ImageButton
import androidx.appcompat.app.AppCompatActivity
-import androidx.core.content.ContextCompat
import androidx.core.view.updateLayoutParams
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
-import ani.dantotsu.R
import ani.dantotsu.connections.anilist.Anilist
import ani.dantotsu.connections.anilist.api.User
import ani.dantotsu.databinding.ActivityFollowBinding
import ani.dantotsu.initActivity
-import ani.dantotsu.navBarHeight
import ani.dantotsu.settings.saving.PrefManager
import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.statusBarHeight
@@ -36,31 +30,11 @@ class FollowActivity : AppCompatActivity(){
private lateinit var selected: ImageButton
override fun onCreate(savedInstanceState: Bundle?) {
- val immersiveMode = PrefManager.getVal(PrefName.ImmersiveMode)
- if (immersiveMode) {
- requestWindowFeature(Window.FEATURE_NO_TITLE)
- }
super.onCreate(savedInstanceState)
ThemeManager(this).applyTheme()
initActivity(this)
binding = ActivityFollowBinding.inflate(layoutInflater)
-
- if (!immersiveMode) {
- this.window.statusBarColor =
- ContextCompat.getColor(this, R.color.nav_bg_inv)
- binding.root.fitsSystemWindows = true
-
- } else {
- binding.root.fitsSystemWindows = false
- window.setFlags(
- WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN
- )
- binding.listTitle.updateLayoutParams {
- topMargin = statusBarHeight
- }
- }
-
+ binding.listToolbar.updateLayoutParams { topMargin = statusBarHeight }
setContentView(binding.root)
val layoutType = PrefManager.getVal(PrefName.FollowerLayout)
selected = getSelected(layoutType)
diff --git a/app/src/main/java/ani/dantotsu/profile/FollowerItem.kt b/app/src/main/java/ani/dantotsu/profile/FollowerItem.kt
index 518e61649c..378a1b8264 100644
--- a/app/src/main/java/ani/dantotsu/profile/FollowerItem.kt
+++ b/app/src/main/java/ani/dantotsu/profile/FollowerItem.kt
@@ -1,10 +1,17 @@
package ani.dantotsu.profile
+import android.app.Activity
+import android.content.Context
import android.view.View
import ani.dantotsu.R
import ani.dantotsu.databinding.ItemFollowerBinding
import ani.dantotsu.loadImage
+import com.bumptech.glide.Glide
+import com.bumptech.glide.load.engine.DiskCacheStrategy
+import com.bumptech.glide.load.model.GlideUrl
+import com.bumptech.glide.request.RequestOptions
import com.xwray.groupie.viewbinding.BindableItem
+import jp.wasabeef.glide.transformations.BlurTransformation
class FollowerItem(
private val id: Int,
@@ -18,9 +25,16 @@ class FollowerItem(
override fun bind(viewBinding: ItemFollowerBinding, position: Int) {
binding = viewBinding
binding.profileUserName.text = name
+ val context = binding.profileBannerImage.context
avatar?.let { binding.profileUserAvatar.loadImage(it) }
if (banner != null) {
binding.profileBannerImage.loadImage(banner)
+ if (!(context as Activity).isDestroyed)
+ Glide.with(context as Context)
+ .load(GlideUrl(banner))
+ .diskCacheStrategy(DiskCacheStrategy.ALL).override(400)
+ .apply(RequestOptions.bitmapTransform(BlurTransformation(2, 6)))
+ .into(binding.profileBannerImage)
} else {
binding.profileBannerImage.setImageResource(R.drawable.linear_gradient_bg)
}
diff --git a/app/src/main/java/ani/dantotsu/notifications/NotificationActivity.kt b/app/src/main/java/ani/dantotsu/profile/activity/NotificationActivity.kt
similarity index 64%
rename from app/src/main/java/ani/dantotsu/notifications/NotificationActivity.kt
rename to app/src/main/java/ani/dantotsu/profile/activity/NotificationActivity.kt
index 2c4f5e60c4..a7ff26dc03 100644
--- a/app/src/main/java/ani/dantotsu/notifications/NotificationActivity.kt
+++ b/app/src/main/java/ani/dantotsu/profile/activity/NotificationActivity.kt
@@ -1,64 +1,43 @@
-package ani.dantotsu.notifications
+package ani.dantotsu.profile.activity
+import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import android.view.ViewGroup
-import android.view.Window
-import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.updateLayoutParams
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
-import ani.dantotsu.R
import ani.dantotsu.connections.anilist.Anilist
import ani.dantotsu.connections.anilist.api.Notification
-import ani.dantotsu.databinding.ActivityNotificationBinding
+import ani.dantotsu.databinding.ActivityFollowBinding
import ani.dantotsu.initActivity
import ani.dantotsu.media.MediaDetailsActivity
import ani.dantotsu.profile.ProfileActivity
-import ani.dantotsu.profile.activity.NotificationItem
-import ani.dantotsu.settings.saving.PrefManager
-import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.statusBarHeight
import ani.dantotsu.themes.ThemeManager
import com.xwray.groupie.GroupieAdapter
import kotlinx.coroutines.launch
class NotificationActivity : AppCompatActivity() {
- private lateinit var binding: ActivityNotificationBinding
+ private lateinit var binding: ActivityFollowBinding
private var adapter: GroupieAdapter = GroupieAdapter()
private var notificationList: List = emptyList()
+ @SuppressLint("SetTextI18n")
override fun onCreate(savedInstanceState: Bundle?) {
- val immersiveMode = PrefManager.getVal(PrefName.ImmersiveMode)
- if (immersiveMode) {
- requestWindowFeature(Window.FEATURE_NO_TITLE)
- }
super.onCreate(savedInstanceState)
ThemeManager(this).applyTheme()
initActivity(this)
- binding = ActivityNotificationBinding.inflate(layoutInflater)
- if (!immersiveMode) {
- this.window.statusBarColor =
- ContextCompat.getColor(this, R.color.nav_bg_inv)
- binding.root.fitsSystemWindows = true
-
- } else {
- binding.root.fitsSystemWindows = false
- window.setFlags(
- WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN
- )
- binding.listTitle.updateLayoutParams {
- topMargin = statusBarHeight
- }
- }
+ binding = ActivityFollowBinding.inflate(layoutInflater)
setContentView(binding.root)
-
- binding.notificationList.adapter = adapter
- binding.notificationList.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
-
+ binding.listTitle.text = "Notifications"
+ binding.listToolbar.updateLayoutParams { topMargin = statusBarHeight }
+ binding.listRecyclerView.adapter = adapter
+ binding.listRecyclerView.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
+ binding.followerGrid.visibility = ViewGroup.GONE
+ binding.followerList.visibility = ViewGroup.GONE
binding.listBack.setOnClickListener {
onBackPressed()
}
diff --git a/app/src/main/java/ani/dantotsu/profile/activity/NotificationItem.kt b/app/src/main/java/ani/dantotsu/profile/activity/NotificationItem.kt
index 1559be4540..31290be398 100644
--- a/app/src/main/java/ani/dantotsu/profile/activity/NotificationItem.kt
+++ b/app/src/main/java/ani/dantotsu/profile/activity/NotificationItem.kt
@@ -1,13 +1,27 @@
package ani.dantotsu.profile.activity
+import android.app.Activity
+import android.content.Context
+import android.content.res.Resources
+import android.util.TypedValue
import android.view.View
+import android.view.ViewGroup
+import androidx.core.view.updateLayoutParams
import ani.dantotsu.R
import ani.dantotsu.connections.anilist.api.Notification
import ani.dantotsu.connections.anilist.api.NotificationType
import ani.dantotsu.databinding.ItemNotificationBinding
import ani.dantotsu.loadImage
-import ani.dantotsu.notifications.NotificationActivity
+import ani.dantotsu.navBarHeight
+import ani.dantotsu.settings.saving.PrefManager
+import ani.dantotsu.settings.saving.PrefName
+import ani.dantotsu.statusBarHeight
+import com.bumptech.glide.Glide
+import com.bumptech.glide.load.engine.DiskCacheStrategy
+import com.bumptech.glide.load.model.GlideUrl
+import com.bumptech.glide.request.RequestOptions
import com.xwray.groupie.viewbinding.BindableItem
+import jp.wasabeef.glide.transformations.BlurTransformation
class NotificationItem(
private val notification: Notification,
@@ -29,107 +43,133 @@ class NotificationItem(
return ItemNotificationBinding.bind(view)
}
+ private fun image(user: Boolean = false) {
+ val context = binding.notificationBannerImage.context
+ val cover = if (user) notification.user?.bannerImage else notification.media?.bannerImage
+ if (cover != null) {
+ if (!(context as Activity).isDestroyed)
+ Glide.with(context as Context)
+ .load(GlideUrl(cover))
+ .diskCacheStrategy(DiskCacheStrategy.ALL).override(400)
+ .apply(RequestOptions.bitmapTransform(BlurTransformation(2, 6)))
+ .into(binding.notificationBannerImage)
+ } else {
+ binding.notificationBannerImage.setImageResource(R.drawable.linear_gradient_bg)
+ }
+ if (user) {
+ binding.notificationCover.visibility = View.GONE
+ binding.notificationCoverUserContainer.visibility = View.VISIBLE
+ binding.notificationCoverUser.loadImage(notification.user?.avatar?.large)
+ val height = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 80f, context.resources.displayMetrics).toInt()
+ binding.notificationBannerImage.layoutParams.height = height
+ binding.notificationBannerGradient.layoutParams.height = height
+ } else{
+ binding.notificationCoverUser.visibility = View.VISIBLE
+ binding.notificationCoverUserContainer.visibility = View.GONE
+ binding.notificationCover.loadImage(notification.media?.coverImage?.large)
+ }
+ }
+
private fun setBinding() {
val notificationType: NotificationType =
NotificationType.valueOf(notification.notificationType)
binding.notificationText.text = NotificationItemBuilder.getContent(notification)
binding.notificationDate.text = NotificationItemBuilder.getDateTime(notification.createdAt)
binding.root.setOnClickListener { clickCallback(id, clickType) }
-
+
when (notificationType) {
NotificationType.ACTIVITY_MESSAGE -> {
binding.notificationCover.loadImage(notification.user?.avatar?.large)
- binding.notificationBannerImage.loadImage(notification.user?.bannerImage)
+ image(true)
clickType = NotificationActivity.Companion.NotificationClickType.USER
id = notification.user?.id ?: 0
}
NotificationType.ACTIVITY_REPLY -> {
binding.notificationCover.loadImage(notification.user?.avatar?.large)
- binding.notificationBannerImage.loadImage(notification.user?.bannerImage)
+ image(true)
clickType = NotificationActivity.Companion.NotificationClickType.USER
id = notification.user?.id ?: 0
}
NotificationType.FOLLOWING -> {
binding.notificationCover.loadImage(notification.user?.avatar?.large)
- binding.notificationBannerImage.loadImage(notification.user?.bannerImage)
+ image(true)
clickType = NotificationActivity.Companion.NotificationClickType.USER
id = notification.user?.id ?: 0
}
NotificationType.ACTIVITY_MENTION -> {
binding.notificationCover.loadImage(notification.user?.avatar?.large)
- binding.notificationBannerImage.loadImage(notification.user?.bannerImage)
+ image(true)
clickType = NotificationActivity.Companion.NotificationClickType.USER
id = notification.user?.id ?: 0
}
NotificationType.THREAD_COMMENT_MENTION -> {
binding.notificationCover.loadImage(notification.user?.avatar?.large)
- binding.notificationBannerImage.loadImage(notification.user?.bannerImage)
+ image(true)
clickType = NotificationActivity.Companion.NotificationClickType.USER
id = notification.user?.id ?: 0
}
NotificationType.THREAD_SUBSCRIBED -> {
binding.notificationCover.loadImage(notification.user?.avatar?.large)
- binding.notificationBannerImage.loadImage(notification.user?.bannerImage)
+ image(true)
clickType = NotificationActivity.Companion.NotificationClickType.USER
id = notification.user?.id ?: 0
}
NotificationType.THREAD_COMMENT_REPLY -> {
binding.notificationCover.loadImage(notification.user?.avatar?.large)
- binding.notificationBannerImage.loadImage(notification.user?.bannerImage)
+ image(true)
clickType = NotificationActivity.Companion.NotificationClickType.USER
id = notification.user?.id ?: 0
}
NotificationType.AIRING -> {
binding.notificationCover.loadImage(notification.media?.coverImage?.large)
- binding.notificationBannerImage.loadImage(notification.media?.bannerImage)
+ image()
clickType = NotificationActivity.Companion.NotificationClickType.MEDIA
id = notification.media?.id ?: 0
}
NotificationType.ACTIVITY_LIKE -> {
- binding.notificationCover.loadImage(notification.user?.avatar?.large)
- binding.notificationBannerImage.loadImage(notification.user?.bannerImage)
+ image(true)
clickType = NotificationActivity.Companion.NotificationClickType.USER
id = notification.user?.id ?: 0
}
NotificationType.ACTIVITY_REPLY_LIKE -> {
binding.notificationCover.loadImage(notification.user?.avatar?.large)
- binding.notificationBannerImage.loadImage(notification.user?.bannerImage)
+ image(true)
clickType = NotificationActivity.Companion.NotificationClickType.USER
id = notification.user?.id ?: 0
}
NotificationType.THREAD_LIKE -> {
binding.notificationCover.loadImage(notification.user?.avatar?.large)
- binding.notificationBannerImage.loadImage(notification.user?.bannerImage)
+ image(true)
clickType = NotificationActivity.Companion.NotificationClickType.USER
id = notification.user?.id ?: 0
}
NotificationType.THREAD_COMMENT_LIKE -> {
binding.notificationCover.loadImage(notification.user?.avatar?.large)
- binding.notificationBannerImage.loadImage(notification.user?.bannerImage)
+ image(true)
clickType = NotificationActivity.Companion.NotificationClickType.USER
id = notification.user?.id ?: 0
}
NotificationType.ACTIVITY_REPLY_SUBSCRIBED -> {
binding.notificationCover.loadImage(notification.user?.avatar?.large)
- binding.notificationBannerImage.loadImage(notification.user?.bannerImage)
+ image(true)
clickType = NotificationActivity.Companion.NotificationClickType.USER
id = notification.user?.id ?: 0
}
NotificationType.RELATED_MEDIA_ADDITION -> {
binding.notificationCover.loadImage(notification.media?.coverImage?.large)
- binding.notificationBannerImage.loadImage(notification.media?.bannerImage)
+ image()
clickType = NotificationActivity.Companion.NotificationClickType.MEDIA
id = notification.media?.id ?: 0
}
NotificationType.MEDIA_DATA_CHANGE -> {
binding.notificationCover.loadImage(notification.media?.coverImage?.large)
- binding.notificationBannerImage.loadImage(notification.media?.bannerImage)
+ image()
clickType = NotificationActivity.Companion.NotificationClickType.MEDIA
id = notification.media?.id ?: 0
}
NotificationType.MEDIA_MERGE -> {
binding.notificationCover.loadImage(notification.media?.coverImage?.large)
- binding.notificationBannerImage.loadImage(notification.media?.bannerImage)
+ image()
clickType = NotificationActivity.Companion.NotificationClickType.MEDIA
id = notification.media?.id ?: 0
}
diff --git a/app/src/main/java/ani/dantotsu/profile/activity/NotificationItemBuilder.kt b/app/src/main/java/ani/dantotsu/profile/activity/NotificationItemBuilder.kt
index 8491109165..c894f65a60 100644
--- a/app/src/main/java/ani/dantotsu/profile/activity/NotificationItemBuilder.kt
+++ b/app/src/main/java/ani/dantotsu/profile/activity/NotificationItemBuilder.kt
@@ -138,11 +138,33 @@ interface NotificationItemBuilder {
}
}
- fun getDateTime(time: Int): String {
- val date = Date(time * 1000L)
- val sdf = SimpleDateFormat("dd/MM/yyyy hh:mm a", Locale.getDefault())
- return sdf.format(date)
- }
+ fun getDateTime(timestamp: Int): String {
+
+ val targetDate = Date(timestamp * 1000L)
+
+ if (targetDate < Date(946684800000L)) { // January 1, 2000 (who want dates before that?)
+ return ""
+ }
+
+ val currentDate = Date()
+ val difference = currentDate.time - targetDate.time
+
+ return when (val daysDifference = difference / (1000 * 60 * 60 * 24)) {
+ 0L -> {
+ val hoursDifference = difference / (1000 * 60 * 60)
+ val minutesDifference = (difference / (1000 * 60)) % 60
+
+ when {
+ hoursDifference > 0 -> "$hoursDifference hour${if (hoursDifference > 1) "s" else ""} ago"
+ minutesDifference > 0 -> "$minutesDifference minute${if (minutesDifference > 1) "s" else ""} ago"
+ else -> "Just now"
+ }
+ }
+ 1L -> "1 day ago"
+ in 2..6 -> "$daysDifference days ago"
+ else -> SimpleDateFormat("dd MMM yyyy", Locale.getDefault()).format(targetDate)
+ }
+ }
}
}
\ No newline at end of file
diff --git a/app/src/main/java/ani/dantotsu/settings/SettingsDialogFragment.kt b/app/src/main/java/ani/dantotsu/settings/SettingsDialogFragment.kt
index 5692e0477e..8a1c9be418 100644
--- a/app/src/main/java/ani/dantotsu/settings/SettingsDialogFragment.kt
+++ b/app/src/main/java/ani/dantotsu/settings/SettingsDialogFragment.kt
@@ -23,10 +23,8 @@ import ani.dantotsu.home.MangaFragment
import ani.dantotsu.home.NoInternet
import ani.dantotsu.incognitoNotification
import ani.dantotsu.loadImage
-import ani.dantotsu.notifications.NotificationActivity
+import ani.dantotsu.profile.activity.NotificationActivity
import ani.dantotsu.offline.OfflineFragment
-import ani.dantotsu.openLinkInBrowser
-import ani.dantotsu.others.imagesearch.ImageSearchActivity
import ani.dantotsu.setSafeOnClickListener
import ani.dantotsu.settings.saving.PrefManager
import ani.dantotsu.settings.saving.PrefName
@@ -79,31 +77,31 @@ class SettingsDialogFragment : BottomSheetDialogFragment() {
Anilist.loginIntent(requireActivity())
}
}
+ binding.settingsNotificationCount.visibility = if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
+ binding.settingsNotificationCount.text = Anilist.unreadNotificationCount.toString()
binding.settingsUserAvatar.setOnClickListener{
ContextCompat.startActivity(
requireContext(), Intent(requireContext(), ProfileActivity::class.java)
.putExtra("userId", Anilist.userid), null
)
}
- binding.settingsIncognito.isChecked =
- PrefManager.getVal(PrefName.Incognito)
+ binding.settingsIncognito.isChecked = PrefManager.getVal(PrefName.Incognito)
binding.settingsIncognito.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.Incognito, isChecked)
incognitoNotification(requireContext())
}
+
binding.settingsExtensionSettings.setSafeOnClickListener {
startActivity(Intent(activity, ExtensionsActivity::class.java))
dismiss()
}
+
binding.settingsSettings.setSafeOnClickListener {
startActivity(Intent(activity, SettingsActivity::class.java))
dismiss()
}
- binding.settingsAnilistSettings.setOnClickListener {
- openLinkInBrowser("https://anilist.co/settings/lists")
- dismiss()
- }
+
binding.settingsNotification.setOnClickListener {
startActivity(Intent(activity, NotificationActivity::class.java))
dismiss()
diff --git a/app/src/main/res/drawable/notification_circle.xml b/app/src/main/res/drawable/notification_circle.xml
index fe33dad218..d864d738bf 100644
--- a/app/src/main/res/drawable/notification_circle.xml
+++ b/app/src/main/res/drawable/notification_circle.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/app/src/main/res/layout/activity_follow.xml b/app/src/main/res/layout/activity_follow.xml
index 60df0bc272..ce25a26220 100644
--- a/app/src/main/res/layout/activity_follow.xml
+++ b/app/src/main/res/layout/activity_follow.xml
@@ -15,6 +15,7 @@
android:visibility="gone" />
diff --git a/app/src/main/res/layout/activity_notification.xml b/app/src/main/res/layout/activity_notification.xml
deleted file mode 100644
index 047efd0094..0000000000
--- a/app/src/main/res/layout/activity_notification.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_profile.xml b/app/src/main/res/layout/activity_profile.xml
index 56aa08e2c8..8c077fe8db 100644
--- a/app/src/main/res/layout/activity_profile.xml
+++ b/app/src/main/res/layout/activity_profile.xml
@@ -67,6 +67,7 @@
android:layout_height="82dp"
android:layout_gravity="center"
android:backgroundTint="@color/transparent"
+ app:strokeColor="@color/transparent"
app:cardCornerRadius="64dp">
-
+ android:layout_height="match_parent"
+ android:background="@drawable/bottom_sheet_background">
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ android:layout_gravity="bottom"
+ android:orientation="horizontal"
+ android:padding="16dp">
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
-
+ android:layout_height="wrap_content">
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_height="match_parent"
+ android:layout_marginEnd="58dp"
+ android:orientation="vertical">
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml
index a26958f048..31cea2748e 100644
--- a/app/src/main/res/layout/fragment_home.xml
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -157,12 +157,20 @@
-
-
+
diff --git a/app/src/main/res/layout/item_activity.xml b/app/src/main/res/layout/item_activity.xml
index 5040444888..1349501ded 100644
--- a/app/src/main/res/layout/item_activity.xml
+++ b/app/src/main/res/layout/item_activity.xml
@@ -85,17 +85,19 @@
-
+
-
+
-
+ android:layout_marginTop="4dp"
+ android:backgroundTint="@color/nav_bg_inv"
+ app:cardCornerRadius="26dp">
-
+
+
+
+
+
+ app:cardCornerRadius="24dp">
-
+
-
+
-
+ android:layout_marginTop="4dp"
+ android:backgroundTint="@color/nav_bg_inv"
+ app:cardCornerRadius="26dp">
+
+
-
+
+
+
+
diff --git a/app/src/main/res/layout/item_media_compact.xml b/app/src/main/res/layout/item_media_compact.xml
index a3bae4b1b2..34b5fbe74c 100644
--- a/app/src/main/res/layout/item_media_compact.xml
+++ b/app/src/main/res/layout/item_media_compact.xml
@@ -94,9 +94,11 @@
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginBottom="4dp"
+ android:layout_marginStart="24dp"
+ android:layout_marginEnd="24dp"
android:gravity="center"
- android:orientation="horizontal"
android:visibility="gone"
+ android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
+ tools:text="Relation" />
diff --git a/app/src/main/res/layout/item_media_large.xml b/app/src/main/res/layout/item_media_large.xml
index a7205c81d5..4c57323cd8 100644
--- a/app/src/main/res/layout/item_media_large.xml
+++ b/app/src/main/res/layout/item_media_large.xml
@@ -9,7 +9,6 @@
app:cardBackgroundColor="@color/nav_bg"
app:cardCornerRadius="28dp">
-
-
+
+
+
+
+
+ android:maxLines="2"
+ android:textSize="14dp"
+ android:transitionName="mediaTitle"
+ tools:ignore="SpUsage"
+ tools:text="@string/slogan" />