Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d78bcc141 | ||
|
|
19ad9aa2ca | ||
|
|
a08ffffceb | ||
|
|
4b5db5dde3 | ||
|
|
e81ff35b5f | ||
|
|
15d4edec39 | ||
|
|
7359b96045 | ||
|
|
41e29eeb06 | ||
|
|
24c8e30a83 | ||
|
|
a017d99150 |
No files matched your search
@@ -24,8 +24,8 @@ android {
|
|||||||
applicationId = "com.hotdeal.alarm"
|
applicationId = "com.hotdeal.alarm"
|
||||||
minSdk = 31
|
minSdk = 31
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 35
|
versionCode = 36
|
||||||
versionName = "0.3.5"
|
versionName = "0.3.6"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables {
|
vectorDrawables {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.hotdeal.alarm.presentation.deallist
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.compose.animation.*
|
import androidx.compose.animation.*
|
||||||
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.horizontalScroll
|
import androidx.compose.foundation.horizontalScroll
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
@@ -44,9 +45,9 @@ import kotlinx.coroutines.launch
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* One UI 9 & Material 3 Expressive Compact Deal Feed Screen
|
* One UI 9 & Material 3 Expressive Compact Deal Feed Screen
|
||||||
* 온디맨드 검색(In-AppBar Search)과 스크롤 반응형 상단바로 화면 시야 및 컨텐츠 노출 수를 극대화한 화면
|
* 온디맨드 검색(In-AppBar Search)과 실시간 신규 핫딜 자동 상단 동기화 화면
|
||||||
*/
|
*/
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun DealListScreen(
|
fun DealListScreen(
|
||||||
viewModel: MainViewModel,
|
viewModel: MainViewModel,
|
||||||
@@ -70,6 +71,17 @@ fun DealListScreen(
|
|||||||
derivedStateOf { listState.firstVisibleItemIndex > 3 }
|
derivedStateOf { listState.firstVisibleItemIndex > 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 신규 수집 핫딜 자동 상단 노출 상태
|
||||||
|
var previousTopDealId by remember { mutableStateOf<String?>(null) }
|
||||||
|
var hasNewUnseenDeals by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
// 사용자가 최상단으로 올라오면 새 핫딜 배너 숨김
|
||||||
|
LaunchedEffect(listState.firstVisibleItemIndex) {
|
||||||
|
if (listState.firstVisibleItemIndex == 0) {
|
||||||
|
hasNewUnseenDeals = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LaunchedEffect(isRefreshingByVm) {
|
LaunchedEffect(isRefreshingByVm) {
|
||||||
if (!isRefreshingByVm) {
|
if (!isRefreshingByVm) {
|
||||||
pullToRefreshState.endRefresh()
|
pullToRefreshState.endRefresh()
|
||||||
@@ -98,7 +110,6 @@ fun DealListScreen(
|
|||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {
|
title = {
|
||||||
if (isSearchActive) {
|
if (isSearchActive) {
|
||||||
// 검색 모드일 때의 인라인 검색 텍스트 필드
|
|
||||||
TextField(
|
TextField(
|
||||||
value = searchText,
|
value = searchText,
|
||||||
onValueChange = { searchText = it },
|
onValueChange = { searchText = it },
|
||||||
@@ -124,7 +135,6 @@ fun DealListScreen(
|
|||||||
.focusRequester(searchFocusRequester)
|
.focusRequester(searchFocusRequester)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// 기본 상단 타이틀
|
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
@@ -179,7 +189,6 @@ fun DealListScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 1. 검색 버튼 (누르면 검색 모드로 전환)
|
|
||||||
IconButton(onClick = { isSearchActive = true }) {
|
IconButton(onClick = { isSearchActive = true }) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Outlined.Search,
|
imageVector = Icons.Outlined.Search,
|
||||||
@@ -188,7 +197,6 @@ fun DealListScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 새로고침 버튼
|
|
||||||
IconButton(onClick = { viewModel.refresh() }) {
|
IconButton(onClick = { viewModel.refresh() }) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Outlined.Refresh,
|
imageVector = Icons.Outlined.Refresh,
|
||||||
@@ -348,6 +356,25 @@ fun DealListScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 신규 파싱 핫딜 실시간 최상단 자동 노출 감지
|
||||||
|
LaunchedEffect(filteredDeals.firstOrNull()?.id) {
|
||||||
|
val currentTop = filteredDeals.firstOrNull()
|
||||||
|
if (currentTop != null) {
|
||||||
|
if (previousTopDealId != null && previousTopDealId != currentTop.id) {
|
||||||
|
// 신규 핫딜 감지
|
||||||
|
if (listState.firstVisibleItemIndex <= 1) {
|
||||||
|
// 사용자가 상단에 머물고 있으면 즉시 최상단(0)으로 부드럽게 스크롤하여 새 핫딜 바로 노출!
|
||||||
|
listState.animateScrollToItem(0)
|
||||||
|
hasNewUnseenDeals = false
|
||||||
|
} else {
|
||||||
|
// 사용자가 아래 글을 읽고 있는 경우 배너 표시
|
||||||
|
hasNewUnseenDeals = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
previousTopDealId = currentTop.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (filteredDeals.isEmpty()) {
|
if (filteredDeals.isEmpty()) {
|
||||||
if (state.deals.isEmpty()) {
|
if (state.deals.isEmpty()) {
|
||||||
NoDealsState(onRefresh = { viewModel.refresh() })
|
NoDealsState(onRefresh = { viewModel.refresh() })
|
||||||
@@ -367,6 +394,7 @@ fun DealListScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Box(modifier = Modifier.fillMaxSize()) {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
state = listState,
|
state = listState,
|
||||||
@@ -379,6 +407,7 @@ fun DealListScreen(
|
|||||||
) { deal ->
|
) { deal ->
|
||||||
DealItem(
|
DealItem(
|
||||||
deal = deal,
|
deal = deal,
|
||||||
|
modifier = Modifier.animateItemPlacement(),
|
||||||
onClick = {
|
onClick = {
|
||||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(deal.url))
|
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(deal.url))
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
@@ -393,6 +422,51 @@ fun DealListScreen(
|
|||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 새 핫딜 도착 시 상단 플로팅 칩 알림 (아래 스크롤 중일 때)
|
||||||
|
androidx.compose.animation.AnimatedVisibility(
|
||||||
|
visible = hasNewUnseenDeals,
|
||||||
|
enter = fadeIn() + expandVertically(),
|
||||||
|
exit = fadeOut() + shrinkVertically(),
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.TopCenter)
|
||||||
|
.padding(top = 8.dp)
|
||||||
|
.zIndex(10f)
|
||||||
|
) {
|
||||||
|
Surface(
|
||||||
|
shape = CornerRadius.shapePill,
|
||||||
|
color = MaterialTheme.colorScheme.primary,
|
||||||
|
shadowElevation = 6.dp,
|
||||||
|
modifier = Modifier.elasticPressClickable {
|
||||||
|
scope.launch {
|
||||||
|
listState.animateScrollToItem(0)
|
||||||
|
hasNewUnseenDeals = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||||
|
modifier = Modifier.padding(horizontal = 14.dp, vertical = 6.dp)
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.ArrowUpward,
|
||||||
|
contentDescription = null,
|
||||||
|
tint = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
modifier = Modifier.size(13.dp)
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = "새로운 핫딜 도착 (터치하여 보기)",
|
||||||
|
style = MaterialTheme.typography.labelSmall.copy(
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
fontSize = 11.5.sp
|
||||||
|
),
|
||||||
|
color = MaterialTheme.colorScheme.onPrimary
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"version": "0.3.5",
|
"version": "0.3.6",
|
||||||
"versionCode": 35,
|
"versionCode": 36,
|
||||||
"updateUrl": "https://git.webpluss.net/sanjeok77/hotdeal_alarm/releases/download/v0.3.5/app-release.apk",
|
"updateUrl": "https://git.webpluss.net/sanjeok77/hotdeal_alarm/releases/download/v0.3.6/app-release.apk",
|
||||||
"changelog": [
|
"changelog": [
|
||||||
"사이트 및 키워드 순서 조절을 터치 드래그 앤 드롭(Drag & Drop) 방식으로 전면 업그레이드",
|
"사이트 및 키워드 순서 조절을 터치 드래그 앤 드롭(Drag & Drop) 방식으로 전면 업그레이드",
|
||||||
"앱 내 업데이트 시 다운로드 완료 후 설치 화면으로 안 넘어가는 버그 수정",
|
"앱 내 업데이트 시 다운로드 완료 후 설치 화면으로 안 넘어가는 버그 수정",
|
||||||
|
|||||||
Reference in new issue
Block a user