commit
59784de727
17 changed files with 99 additions and 40 deletions
|
@ -15,7 +15,7 @@ android {
|
|||
targetSdk 34
|
||||
versionCode((System.currentTimeMillis() / 60000).toInteger())
|
||||
versionName "3.0.0"
|
||||
versionCode 220000000
|
||||
versionCode 300000000
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
|
||||
|
|
|
@ -283,6 +283,9 @@ class AnimeFragment : Fragment() {
|
|||
binding.root.requestApplyInsets()
|
||||
binding.root.requestLayout()
|
||||
}
|
||||
if (this::animePageAdapter.isInitialized && _binding != null) {
|
||||
animePageAdapter.updateNotificationCount()
|
||||
}
|
||||
super.onResume()
|
||||
}
|
||||
}
|
|
@ -215,6 +215,14 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
|||
}
|
||||
}
|
||||
|
||||
fun updateNotificationCount() {
|
||||
if (this::binding.isInitialized) {
|
||||
binding.animeNotificationCount.visibility =
|
||||
if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
|
||||
binding.animeNotificationCount.text = Anilist.unreadNotificationCount.toString()
|
||||
}
|
||||
}
|
||||
|
||||
inner class AnimePageViewHolder(val binding: ItemAnimePageBinding) :
|
||||
RecyclerView.ViewHolder(binding.root)
|
||||
}
|
||||
|
|
|
@ -258,6 +258,9 @@ class MangaFragment : Fragment() {
|
|||
binding.root.requestApplyInsets()
|
||||
binding.root.requestLayout()
|
||||
}
|
||||
if (this::mangaPageAdapter.isInitialized && _binding != null) {
|
||||
mangaPageAdapter.updateNotificationCount()
|
||||
}
|
||||
super.onResume()
|
||||
}
|
||||
|
||||
|
|
|
@ -200,6 +200,14 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
|||
}
|
||||
}
|
||||
|
||||
fun updateNotificationCount() {
|
||||
if (this::binding.isInitialized) {
|
||||
binding.mangaNotificationCount.visibility =
|
||||
if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
|
||||
binding.mangaNotificationCount.text = Anilist.unreadNotificationCount.toString()
|
||||
}
|
||||
}
|
||||
|
||||
inner class MangaPageViewHolder(val binding: ItemMangaPageBinding) :
|
||||
RecyclerView.ViewHolder(binding.root)
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ class CommentsFragment : Fragment() {
|
|||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
binding = FragmentCommentsBinding.inflate(inflater, container, false)
|
||||
binding.commentsLayout.isNestedScrollingEnabled = true
|
||||
return binding.root
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,10 @@ import java.util.concurrent.TimeUnit
|
|||
|
||||
class AlarmManagerScheduler(private val context: Context) : TaskScheduler {
|
||||
override fun scheduleRepeatingTask(taskType: TaskType, interval: Long) {
|
||||
if (interval < TimeUnit.MINUTES.toMillis(15)) {
|
||||
cancelTask(taskType)
|
||||
return
|
||||
}
|
||||
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
val intent = when (taskType) {
|
||||
TaskType.COMMENT_NOTIFICATION -> Intent(
|
||||
|
|
|
@ -10,6 +10,10 @@ import ani.dantotsu.notifications.subscription.SubscriptionNotificationWorker
|
|||
|
||||
class WorkManagerScheduler(private val context: Context) : TaskScheduler {
|
||||
override fun scheduleRepeatingTask(taskType: TaskType, interval: Long) {
|
||||
if (interval < PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS) {
|
||||
cancelTask(taskType)
|
||||
return
|
||||
}
|
||||
val constraints = Constraints.Builder()
|
||||
.setRequiredNetworkType(androidx.work.NetworkType.CONNECTED)
|
||||
.build()
|
||||
|
|
|
@ -129,6 +129,7 @@ class NotificationActivity : AppCompatActivity() {
|
|||
)
|
||||
newNotifications += notification
|
||||
}
|
||||
newNotifications.sortByDescending { it.createdAt }
|
||||
}
|
||||
|
||||
notificationList += newNotifications
|
||||
|
|
|
@ -2,6 +2,8 @@ package ani.dantotsu.profile.activity
|
|||
|
||||
import android.util.TypedValue
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.blurImage
|
||||
import ani.dantotsu.connections.anilist.api.Notification
|
||||
|
@ -37,17 +39,25 @@ class NotificationItem(
|
|||
?: notification.user?.avatar?.medium else notification.media?.bannerImage
|
||||
?: notification.media?.coverImage?.large
|
||||
blurImage(binding.notificationBannerImage, cover)
|
||||
|
||||
val defaultHeight = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
170f,
|
||||
153f,
|
||||
binding.root.context.resources.displayMetrics
|
||||
).toInt()
|
||||
|
||||
val userHeight = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
90f,
|
||||
binding.root.context.resources.displayMetrics
|
||||
).toInt()
|
||||
|
||||
val textMarginStart = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
125f,
|
||||
binding.root.context.resources.displayMetrics
|
||||
).toInt()
|
||||
|
||||
if (user) {
|
||||
binding.notificationCover.visibility = View.GONE
|
||||
binding.notificationCoverUser.visibility = View.VISIBLE
|
||||
|
@ -60,12 +70,16 @@ class NotificationItem(
|
|||
binding.notificationCoverUser.loadImage(notification.user?.avatar?.large)
|
||||
}
|
||||
binding.notificationBannerImage.layoutParams.height = userHeight
|
||||
binding.notificationGradiant.layoutParams.height = userHeight
|
||||
(binding.notificationTextContainer.layoutParams as ViewGroup.MarginLayoutParams).marginStart = userHeight
|
||||
} else {
|
||||
binding.notificationCover.visibility = View.VISIBLE
|
||||
binding.notificationCoverUser.visibility = View.VISIBLE
|
||||
binding.notificationCoverUserContainer.visibility = View.GONE
|
||||
binding.notificationCover.loadImage(notification.media?.coverImage?.large)
|
||||
binding.notificationBannerImage.layoutParams.height = defaultHeight
|
||||
binding.notificationGradiant.layoutParams.height = defaultHeight
|
||||
(binding.notificationTextContainer.layoutParams as ViewGroup.MarginLayoutParams).marginStart = textMarginStart
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.core.widget.NestedScrollView 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"
|
||||
android:id="@+id/commentsLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:colorBackground">
|
||||
android:background="?android:colorBackground"
|
||||
android:fillViewport="true">
|
||||
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
|
@ -82,4 +83,4 @@
|
|||
</LinearLayout>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</FrameLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
|
|
@ -94,14 +94,14 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="18dp"
|
||||
android:layout_marginEnd="18dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginEnd="18dp"
|
||||
android:background="?android:colorBackground"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:text="@string/lorem_ipsum"
|
||||
android:textAlignment="center"
|
||||
tools:visibility="gone"
|
||||
android:background="?android:colorBackground"
|
||||
android:textSize="12sp" />
|
||||
android:textSize="12sp"
|
||||
tools:visibility="gone" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/activityBannerContainer"
|
||||
|
@ -114,13 +114,13 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:backgroundTint="?attr/colorSurface"
|
||||
app:strokeColor="@color/transparent"
|
||||
app:cardCornerRadius="24dp">
|
||||
app:cardCornerRadius="24dp"
|
||||
app:strokeColor="@color/transparent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/activityBannerImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="169dp"
|
||||
android:layout_height="152dp"
|
||||
android:scaleType="centerCrop"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic" />
|
||||
|
@ -128,8 +128,8 @@
|
|||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="170dp"
|
||||
app:srcCompat="@drawable/linear_gradient_nav_inv"
|
||||
android:layout_height="153dp"
|
||||
app:srcCompat="@drawable/linear_gradient_nav"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
|
||||
|
@ -138,14 +138,16 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:backgroundTint="@color/bg_white"
|
||||
app:cardCornerRadius="16dp">
|
||||
app:cardCornerRadius="16dp"
|
||||
app:strokeColor="@color/transparent">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/activityCover"
|
||||
android:layout_width="102dp"
|
||||
android:layout_height="154dp"
|
||||
android:layout_width="108dp"
|
||||
android:layout_height="160dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
app:srcCompat="@drawable/ic_round_add_circle_24"
|
||||
|
@ -161,15 +163,15 @@
|
|||
android:layout_marginStart="128dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/activityMediaName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:textColor="@color/bg_opp"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:maxLines="2"
|
||||
android:text="@string/anime"
|
||||
android:textSize="16sp"
|
||||
|
@ -181,9 +183,12 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:alpha="0.66"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:textColor="@color/bg_opp"
|
||||
android:maxLines="2"
|
||||
android:text="@string/slogan"
|
||||
android:textColor="@color/bg_opp"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
@ -224,7 +229,8 @@
|
|||
android:id="@+id/activityReplies"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
android:layout_marginStart="16dp"/>
|
||||
android:layout_marginStart="16dp"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
|
@ -318,6 +318,7 @@
|
|||
android:paddingStart="16dp"
|
||||
android:visibility="visible"
|
||||
tools:ignore="RtlSymmetry"
|
||||
android:nestedScrollingEnabled="false"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -18,7 +18,7 @@
|
|||
<ImageView
|
||||
android:id="@+id/profileBannerImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="89dp"
|
||||
android:scaleType="centerCrop"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
|
|
@ -19,14 +19,15 @@
|
|||
<ImageView
|
||||
android:id="@+id/notificationBannerImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="170dp"
|
||||
android:layout_height="153dp"
|
||||
android:scaleType="centerCrop"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/notificationGradiant"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="153dp"
|
||||
app:srcCompat="@drawable/linear_gradient_nav"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
|
@ -35,18 +36,19 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_margin="16dp"
|
||||
android:backgroundTint="@color/transparent"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:strokeColor="@color/transparent">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/notificationCover"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="144dp"
|
||||
android:layout_gravity="center"
|
||||
app:srcCompat="@drawable/ic_round_add_circle_24"
|
||||
android:layout_width="108dp"
|
||||
android:layout_height="160dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:shapeAppearanceOverlay="@style/roundedImageView"
|
||||
tools:ignore="ContentDescription,ImageContrastCheck"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic"
|
||||
tools:tint="@color/transparent" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
@ -74,11 +76,14 @@
|
|||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/notificationTextContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|bottom"
|
||||
android:layout_marginStart="125dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:padding="8dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
|
@ -86,7 +91,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:maxLines="3"
|
||||
android:textSize="14dp"
|
||||
android:transitionName="mediaTitle"
|
||||
|
@ -98,11 +103,11 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:alpha="0.66"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:text="Wed,06 March 2024, 7:00PM"
|
||||
android:textSize="10sp"
|
||||
tools:ignore="HardcodedText" />
|
||||
tools:ignore="HardcodedText,SmallSp" />
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<color name="nav_bg">#1C1C1C</color>
|
||||
<color name="nav_bg_inv">#001C1C1C</color>
|
||||
<color name="nav_tab">#40ffffff</color>
|
||||
<color name="gradiant_bg_start">#AA1C1C1C</color>
|
||||
<color name="gradiant_bg_end">#20000000</color>
|
||||
<color name="gradiant_bg_end">#AA1C1C1C</color>
|
||||
<color name="gradiant_bg_start">#434343</color>
|
||||
<color name="nav_tab_disabled">#40ffffff</color>
|
||||
<color name="transparent">#00000000</color>
|
||||
<color name="nav_status">#80000000</color>
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
<color name="bg_black_50" alpha="128">#80000000</color>
|
||||
<color name="nav_bg">#fff</color>
|
||||
<color name="nav_bg_inv">#00BFAEAE</color>
|
||||
<color name="nav_tab">#40000000</color>
|
||||
<color name="gradiant_bg_start">#88989898</color>
|
||||
<color name="gradiant_bg_end">#00FFFFFF</color>
|
||||
<color name="gradiant_bg_start">#ACACAC</color>
|
||||
<color name="gradiant_bg_end">#00BFAEAE</color>
|
||||
<color name="nav_tab_disabled">#19000000</color>
|
||||
<color name="nav_tab">#40000000</color>
|
||||
<color name="transparent">#00000000</color>
|
||||
<color name="button_icon">#A9FFFFFF</color>
|
||||
<color name="nav_status">#80FFFFFF</color>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue