Fix pull-to-refresh spinner position and header margins

This commit is contained in:
sanjeok77
2026-03-07 06:59:10 +09:00
parent 6715388234
commit c332af4c28
8 changed files with 327 additions and 164 deletions
@@ -7,6 +7,7 @@ import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
@@ -110,8 +111,9 @@ class NotificationService @Inject constructor(
.setContentText(deals.first().title)
.setSmallIcon(android.R.drawable.ic_menu_send)
.setContentIntent(pendingIntent)
.setAutoCancel(true)
.build()
.setAutoCancel(true)
.setNumber(deals.size) // 뱃지 숫자 설정
.build()
} else {
NotificationCompat.Builder(context, CHANNEL_NORMAL)
.setContentTitle(context.getString(R.string.notification_new_deal))
@@ -134,29 +136,55 @@ class NotificationService @Inject constructor(
*/
fun showKeywordMatchNotification(deals: List<HotDeal>) {
if (!hasNotificationPermission()) return
val intent = Intent(context, MainActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
}
val pendingIntent = PendingIntent.getActivity(
context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val notification = NotificationCompat.Builder(context, CHANNEL_URGENT)
.setContentTitle(context.getString(R.string.notification_keyword_match))
.setContentText(deals.first().title)
.setSmallIcon(android.R.drawable.ic_menu_send)
.setContentIntent(pendingIntent)
if (deals.size == 1) {
// 단일 딜인 경우 해당 URL로 바로 이동
val deal = deals.first()
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(deal.url)).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
}
val pendingIntent = PendingIntent.getActivity(
context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val notification = NotificationCompat.Builder(context, CHANNEL_URGENT)
.setContentTitle(context.getString(R.string.notification_keyword_match))
.setContentText(deal.title)
.setSmallIcon(android.R.drawable.ic_menu_send)
.setContentIntent(pendingIntent)
.setAutoCancel(true)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setNumber(deals.size) // 뱃지 숫자 설정
.build()
notificationManager.notify(NOTIFICATION_ID_KEYWORD, notification)
} else {
// 여러 딜인 경우 메인 화면으로 이동
val intent = Intent(context, MainActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
}
val pendingIntent = PendingIntent.getActivity(
context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val notification = NotificationCompat.Builder(context, CHANNEL_URGENT)
.setContentTitle(context.getString(R.string.notification_keyword_match))
.setContentText("${deals.first().title}${deals.size - 1}")
.setSmallIcon(android.R.drawable.ic_menu_send)
.setContentIntent(pendingIntent)
.setAutoCancel(true)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setStyle(
NotificationCompat.BigTextStyle()
.bigText(deals.take(5).joinToString("\n") { "${it.title}" })
)
.setNumber(deals.size) // 뱃지 숫자 설정
.build()
notificationManager.notify(NOTIFICATION_ID_KEYWORD, notification)
notificationManager.notify(NOTIFICATION_ID_KEYWORD, notification)
}
}
/**