Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
Expand All @@ -35,14 +34,11 @@ import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import arrow.core.raise.ensure
import com.hippo.ehviewer.R
import com.hippo.ehviewer.Settings
import com.hippo.ehviewer.client.EhTagDatabase
import com.hippo.ehviewer.client.EhUtils
import com.hippo.ehviewer.client.data.GalleryInfo.Companion.S_LANG_TAGS
import com.hippo.ehviewer.collectAsState
import com.hippo.ehviewer.ui.tools.DialogState
import com.hippo.ehviewer.ui.tools.DropdownFilterChip
import com.hippo.ehviewer.ui.tools.thenIf
import com.hippo.ehviewer.util.toIntOrDefault
import kotlinx.coroutines.launch

Expand Down Expand Up @@ -72,7 +68,6 @@ fun SearchFilter(
) = Column(modifier) {
val scope = rememberCoroutineScope()
val context = LocalContext.current
val animateItems by Settings.animateItems.collectAsState()
fun isCategoryChecked(bit: Int) = category and bit != 0
val categories = remember(category) { categoryTable.sortedBy { !isCategoryChecked(it.first) } }
LazyRow(
Expand All @@ -87,7 +82,7 @@ fun SearchFilter(
selected = isCategoryChecked(it.first),
onClick = { onCategoryChange(category xor it.first) },
label = { Text(text = stringResource(id = it.second)) },
modifier = Modifier.thenIf(animateItems) { animateItem() },
modifier = Modifier.animateItem(),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ import com.hippo.ehviewer.ui.tools.HapticFeedbackType
import com.hippo.ehviewer.ui.tools.asyncState
import com.hippo.ehviewer.ui.tools.rememberHapticFeedback
import com.hippo.ehviewer.ui.tools.rememberInVM
import com.hippo.ehviewer.ui.tools.thenIf
import com.hippo.ehviewer.util.mapToLongArray
import com.hippo.ehviewer.util.takeAndClear
import com.jamal.composeprefs3.ui.ifTrueThen
Expand All @@ -143,7 +142,6 @@ fun AnimatedVisibilityScope.DownloadsScreen(navigator: DestinationsNavigator) =
var invalidateKey by rememberSaveable { mutableStateOf(false) }
var searchBarExpanded by rememberSaveable { mutableStateOf(false) }
var searchBarOffsetY by remember { mutableIntStateOf(0) }
val animateItems by Settings.animateItems.collectAsState()

var fabExpanded by remember { mutableStateOf(false) }
var fabHidden by remember { mutableStateOf(false) }
Expand Down Expand Up @@ -364,7 +362,6 @@ fun AnimatedVisibilityScope.DownloadsScreen(navigator: DestinationsNavigator) =
reorderableLabelState,
id,
enabled = editEnable,
animateItemModifier = Modifier.thenIf(animateItems) { animateItem() },
) { isDragging ->
SwipeToDismissBox(
state = dismissState,
Expand Down Expand Up @@ -560,7 +557,7 @@ fun AnimatedVisibilityScope.DownloadsScreen(navigator: DestinationsNavigator) =
onClick = ::onItemClick.partially1(info),
onLongClick = { navigate(info.galleryInfo.asDst()) },
info = info,
modifier = Modifier.thenIf(animateItems) { animateItem() },
modifier = Modifier.animateItem(),
showLanguage = false,
)
}
Expand All @@ -575,7 +572,7 @@ fun AnimatedVisibilityScope.DownloadsScreen(navigator: DestinationsNavigator) =
val checked = info.gid in checkedInfoMap
CheckableItem(
checked = checked,
modifier = Modifier.thenIf(animateItems) { animateItem() },
modifier = Modifier.animateItem(),
) { interactionSource ->
DownloadCard(
onClick = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ import com.hippo.ehviewer.ui.tools.EmptyWindowInsets
import com.hippo.ehviewer.ui.tools.asyncState
import com.hippo.ehviewer.ui.tools.foldToLoadResult
import com.hippo.ehviewer.ui.tools.rememberInVM
import com.hippo.ehviewer.ui.tools.thenIf
import com.hippo.ehviewer.util.mapToLongArray
import com.hippo.ehviewer.util.takeAndClear
import com.ramcosta.composedestinations.annotation.Destination
Expand All @@ -105,7 +104,6 @@ fun AnimatedVisibilityScope.FavouritesScreen(navigator: DestinationsNavigator) =
// Immutables
val localFavName = stringResource(R.string.local_favorites)
val cloudFavName = stringResource(R.string.cloud_favorites)
val animateItems by Settings.animateItems.collectAsState()
val hasSignedIn by Settings.hasSignedIn.collectAsState()

// Meta State
Expand Down Expand Up @@ -284,7 +282,7 @@ fun AnimatedVisibilityScope.FavouritesScreen(navigator: DestinationsNavigator) =
val checked = info.gid in checkedInfoMap
CheckableItem(
checked = checked,
modifier = Modifier.thenIf(animateItems) { animateItem() },
modifier = Modifier.animateItem(),
) { interactionSource ->
GalleryInfoListItem(
onClick = {
Expand Down Expand Up @@ -313,7 +311,7 @@ fun AnimatedVisibilityScope.FavouritesScreen(navigator: DestinationsNavigator) =
val checked = info.gid in checkedInfoMap
CheckableItem(
checked = checked,
modifier = Modifier.thenIf(animateItems) { animateItem() },
modifier = Modifier.animateItem(),
) { interactionSource ->
GalleryInfoGridItem(
onClick = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ import com.hippo.ehviewer.ui.tools.animateFloatMergePredictiveBackAsState
import com.hippo.ehviewer.ui.tools.normalizeSpan
import com.hippo.ehviewer.ui.tools.rememberBBCodeTextToolbar
import com.hippo.ehviewer.ui.tools.snackBarPadding
import com.hippo.ehviewer.ui.tools.thenIf
import com.hippo.ehviewer.ui.tools.toBBCode
import com.hippo.ehviewer.ui.tools.updateSpan
import com.hippo.ehviewer.util.ReadableTime
Expand Down Expand Up @@ -173,7 +172,6 @@ fun AnimatedVisibilityScope.GalleryCommentsScreen(gid: Long, navigator: Destinat
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior()
var commenting by rememberSaveable { mutableStateOf(false) }
val animationProgress by animateFloatMergePredictiveBackAsState(enable = commenting) { commenting = false }
val animateItems by Settings.animateItems.collectAsState()

val galleryDetail = remember { detailCache[gid]!! }
val userCommentBackField = remember { mutableStateOf(TextFieldValue()) }
Expand Down Expand Up @@ -390,7 +388,7 @@ fun AnimatedVisibilityScope.GalleryCommentsScreen(gid: Long, navigator: Destinat
}()

GalleryCommentCard(
modifier = Modifier.thenIf(animateItems) { animateItem() },
modifier = Modifier.animateItem(),
comment = item,
onUserClick = {
navigate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ import com.hippo.ehviewer.ui.tools.foldToLoadResult
import com.hippo.ehviewer.ui.tools.rememberHapticFeedback
import com.hippo.ehviewer.ui.tools.rememberInVM
import com.hippo.ehviewer.ui.tools.rememberMutableStateInDataStore
import com.hippo.ehviewer.ui.tools.thenIf
import com.hippo.ehviewer.util.FavouriteStatusRouter
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.annotation.RootGraph
Expand Down Expand Up @@ -160,7 +159,6 @@ fun AnimatedVisibilityScope.GalleryListScreen(lub: ListUrlBuilder, navigator: De
var urlBuilder by rememberSaveable(lub) { mutableStateOf(lub) }
var searchBarExpanded by rememberSaveable { mutableStateOf(false) }
var searchBarOffsetY by remember { mutableIntStateOf(0) }
val animateItems by Settings.animateItems.collectAsState()

var category by rememberMutableStateInDataStore("SearchCategory") { EhUtils.ALL_CATEGORY }
var advancedSearchOption by rememberMutableStateInDataStore("AdvancedSearchOption") { AdvancedSearchOption() }
Expand Down Expand Up @@ -364,7 +362,6 @@ fun AnimatedVisibilityScope.GalleryListScreen(lub: ListUrlBuilder, navigator: De
ReorderableItem(
reorderableLazyListState,
item.id!!,
animateItemModifier = Modifier.thenIf(animateItems) { animateItem() },
) { isDragging ->
// Not using rememberSwipeToDismissBoxState to prevent LazyColumn from reusing it
// SQLite may reuse ROWIDs from previously deleted rows so they'll have the same key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import com.hippo.ehviewer.ui.main.plus
import com.hippo.ehviewer.ui.tools.Await
import com.hippo.ehviewer.ui.tools.FastScrollLazyColumn
import com.hippo.ehviewer.ui.tools.rememberInVM
import com.hippo.ehviewer.ui.tools.thenIf
import com.hippo.ehviewer.util.FavouriteStatusRouter
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.annotation.RootGraph
Expand All @@ -74,7 +73,6 @@ import kotlinx.coroutines.launch
fun AnimatedVisibilityScope.HistoryScreen(navigator: DestinationsNavigator) = Screen(navigator) {
val title = stringResource(id = R.string.history)
val hint = stringResource(R.string.search_bar_hint, title)
val animateItems by Settings.animateItems.collectAsState()

var searchBarExpanded by rememberSaveable { mutableStateOf(false) }
var searchBarOffsetY by remember { mutableIntStateOf(0) }
Expand Down Expand Up @@ -158,7 +156,7 @@ fun AnimatedVisibilityScope.HistoryScreen(navigator: DestinationsNavigator) = Sc
SwipeToDismissBox(
state = dismissState,
backgroundContent = {},
modifier = Modifier.thenIf(animateItems) { animateItem() },
modifier = Modifier.animateItem(),
enableDismissFromStartToEnd = false,
) {
GalleryInfoListItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ import com.hippo.ehviewer.R
import com.hippo.ehviewer.Settings
import com.hippo.ehviewer.client.EhTagDatabase
import com.hippo.ehviewer.client.data.TagNamespace
import com.hippo.ehviewer.collectAsState
import com.hippo.ehviewer.dao.Search
import com.hippo.ehviewer.dao.SearchDao
import com.hippo.ehviewer.ui.LocalNavDrawerState
Expand Down Expand Up @@ -120,7 +119,6 @@ fun SearchBarScreen(
val mSearchDatabase = searchDatabase.searchDao()
val scope = rememberCoroutineScope { Dispatchers.IO }
val context = LocalContext.current
val animateItems by Settings.animateItems.collectAsState()

class TagSuggestion(
override val hint: String?,
Expand Down Expand Up @@ -294,7 +292,7 @@ fun SearchBarScreen(
}
},
colors = ListItemDefaults.colors(containerColor = Color.Transparent),
modifier = Modifier.clickable { it.onClick() }.thenIf(animateItems) { animateItem() },
modifier = Modifier.clickable { it.onClick() }.animateItem(),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,6 @@ fun AdvancedScreen(navigator: DestinationsNavigator) {
title = stringResource(id = R.string.preload_thumb_aggressively),
value = Settings::preloadThumbAggressively,
)
var animateItems by Settings.animateItems.asMutableState()
SwitchPref(
checked = animateItems,
onMutate = { animateItems = !animateItems },
title = stringResource(id = R.string.animate_items),
summary = stringResource(id = R.string.animate_items_summary),
)
val exportFailed = stringResource(id = R.string.settings_advanced_export_data_failed)
LauncherPreference(
title = stringResource(id = R.string.settings_advanced_export_data),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,14 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.unit.dp
import com.hippo.ehviewer.R
import com.hippo.ehviewer.Settings
import com.hippo.ehviewer.client.EhFilter
import com.hippo.ehviewer.client.EhFilter.forget
import com.hippo.ehviewer.client.EhFilter.remember
import com.hippo.ehviewer.client.EhFilter.trigger
import com.hippo.ehviewer.collectAsState
import com.hippo.ehviewer.dao.Filter
import com.hippo.ehviewer.dao.FilterMode
import com.hippo.ehviewer.ui.Screen
import com.hippo.ehviewer.ui.tools.Await
import com.hippo.ehviewer.ui.tools.thenIf
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.annotation.RootGraph
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
Expand All @@ -79,7 +76,6 @@ fun AnimatedVisibilityScope.FilterScreen(navigator: DestinationsNavigator) = Scr
val allFilterMap = remember { async { EhFilter.filters.await().groupByToObserved { it.mode } } }
val textIsEmpty = stringResource(R.string.text_is_empty)
val labelExist = stringResource(R.string.label_text_exist)
val animateItems by Settings.animateItems.collectAsState()

fun addFilter() {
launch {
Expand Down Expand Up @@ -231,15 +227,15 @@ fun AnimatedVisibilityScope.FilterScreen(navigator: DestinationsNavigator) = Scr
item(key = filterMode) {
Text(
text = stringResource(id = title),
modifier = Modifier.padding(horizontal = 24.dp, vertical = 8.dp).thenIf(animateItems) { animateItem() },
modifier = Modifier.padding(horizontal = 24.dp, vertical = 8.dp).animateItem(),
color = MaterialTheme.colorScheme.tertiary,
style = MaterialTheme.typography.titleMedium,
)
}
items(filters, key = { requireNotNull(it.id) }) { filter ->
val filterCheckBoxRecomposeScope = currentRecomposeScope
Row(
modifier = Modifier.fillMaxWidth().thenIf(animateItems) { animateItem() }.clickable { filter.trigger { filterCheckBoxRecomposeScope.invalidate() } },
modifier = Modifier.fillMaxWidth().animateItem().clickable { filter.trigger { filterCheckBoxRecomposeScope.invalidate() } },
verticalAlignment = Alignment.CenterVertically,
) {
Checkbox(
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,6 @@
<string name="list_tile_thumb_size">詳細モードのサムネイルの大きさ</string>
<string name="account_name">アカウント</string>
<string name="preload_thumb_aggressively">サムネイルを積極的にプリロードする</string>
<string name="animate_items">リスト項目のアニメーション</string>
<string name="animate_items_summary">クラッシュやフレームドロップが発生する場合はこれを無効化してください</string>
<string name="auto_updates">自動で更新を確認する</string>
<string name="update_frequency_never">しない</string>
<string name="update_frequency_daily">毎日</string>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,6 @@
<string name="list_tile_thumb_size">详情模式下缩略图大小</string>
<string name="account_name">账户</string>
<string name="preload_thumb_aggressively">激进地预载缩略图</string>
<string name="animate_items">列表项目动画</string>
<string name="animate_items_summary">如遇崩溃/掉帧请尝试禁用此项</string>
<string name="auto_updates">自动检查更新</string>
<string name="update_frequency_never">从不</string>
<string name="update_frequency_daily">每天</string>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,6 @@
<string name="list_tile_thumb_size">詳情模式下縮圖大小</string>
<string name="account_name">帳號</string>
<string name="preload_thumb_aggressively">積極地預載入縮圖</string>
<string name="animate_items">列表項目動畫</string>
<string name="animate_items_summary">如遇崩潰/低幀率請嘗試停用此項</string>
<string name="auto_updates">自動檢查更新</string>
<string name="update_frequency_never">從不</string>
<string name="update_frequency_daily">每天</string>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,6 @@
<string name="list_tile_thumb_size">Thumb size in detail mode</string>
<string name="account_name">Account</string>
<string name="preload_thumb_aggressively">Preload thumbs aggressively</string>
<string name="animate_items">List item animations</string>
<string name="animate_items_summary">Try disabling this if you are facing crashes / frame drops</string>
<string name="auto_updates">Automatically check for updates</string>
<string name="update_frequency_never">Never</string>
<string name="update_frequency_daily">Daily</string>
Expand Down