Skip to content

Commit

Permalink
Haze update!
Browse files Browse the repository at this point in the history
  • Loading branch information
jakepurple13 committed Nov 1, 2023
1 parent 89723a0 commit 788264f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
Expand Down Expand Up @@ -325,7 +326,9 @@ abstract class BaseMainActivity : AppCompatActivity() {
null,
)
},
modifier = Modifier.verticalScroll(rememberScrollState())
modifier = Modifier
.fillMaxHeight()
.verticalScroll(rememberScrollState())
) {
NavigationRailItem(
imageVector = Icons.Default.History,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.rememberTopAppBarState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
Expand All @@ -46,12 +45,10 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -79,7 +76,6 @@ import com.programmersbox.uiviews.utils.navigateToDetails
import com.programmersbox.uiviews.utils.showSourceChooser
import com.programmersbox.uiviews.utils.topBounds
import dev.chrisbanes.haze.haze
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.launch
import org.koin.compose.koinInject

Expand Down Expand Up @@ -109,7 +105,6 @@ fun RecentView(
if (recentVm.sourceList.isEmpty() && source != null && isConnected && recentVm.count != 1) recentVm.reset(context)
}

val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState())
val showButton by remember { derivedStateOf { state.firstVisibleItemIndex > 0 } }

val sourceList = recentVm.sources
Expand All @@ -130,12 +125,6 @@ fun RecentView(
}
}

LaunchedEffect(state) {
snapshotFlow { state.firstVisibleItemScrollOffset }
.filter { it == 0 }
.collect { scrollBehavior.state.contentOffset = 0f }
}

var showSourceChooser by showSourceChooser()

OtakuScaffold(
Expand Down Expand Up @@ -175,7 +164,6 @@ fun RecentView(
}
}
},
scrollBehavior = scrollBehavior,
colors = TopAppBarDefaults.topAppBarColors(containerColor = Color.Transparent)
)
}
Expand All @@ -188,7 +176,6 @@ fun RecentView(
) {
Crossfade(
targetState = isConnected,
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
label = ""
) { connected ->
when (connected) {
Expand Down Expand Up @@ -237,7 +224,9 @@ fun RecentView(
PullRefreshIndicator(
refreshing = recentVm.isRefreshing,
state = pull,
modifier = Modifier.align(Alignment.TopCenter),
modifier = Modifier
.padding(top = p.calculateTopPadding())
.align(Alignment.TopCenter),
backgroundColor = MaterialTheme.colorScheme.background,
contentColor = MaterialTheme.colorScheme.onBackground,
scale = true
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ easylauncher = "6.2.0"
firebaseCrashlyticsGradle = "2.9.9"
googleServices = "4.4.0"
gradle = "8.3.0-alpha10"
haze = "0.1.0"
haze = "0.2.0"
kamelImage = "0.8.2"
kotlin = "1.9.10"
latestAboutLibsRelease = "10.8.3"
Expand Down

0 comments on commit 788264f

Please sign in to comment.