Skip to content

Commit

Permalink
Refactor & optimize HomeTab.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
Iliyan Germanov committed Nov 27, 2021
1 parent fc1bf85 commit 32ba7a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
6 changes: 1 addition & 5 deletions app/src/main/java/com/ivy/wallet/ui/home/HomeHeader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.lerp
import com.ivy.wallet.Constants
import com.ivy.wallet.R
import com.ivy.wallet.base.*
Expand Down Expand Up @@ -80,9 +79,7 @@ internal fun HomeHeader(
if (percentExpanded < 0.5f) {
TransactionsDividerLine(
modifier = Modifier.alpha(1f - percentExpanded),
paddingHorizontal = lerp(
24.dp, 0.dp, (1f - percentExpanded).coerceIn(0f, 1f)
)
paddingHorizontal = 0.dp
)
}
}
Expand Down Expand Up @@ -134,7 +131,6 @@ private fun HeaderStickyRow(
shortenBigNumbers = true
)
}

}

Spacer(Modifier.weight(1f))
Expand Down
11 changes: 4 additions & 7 deletions app/src/main/java/com/ivy/wallet/ui/home/HomeTab.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import com.google.accompanist.insets.navigationBarsPadding
import com.google.accompanist.insets.statusBarsPadding
import com.google.accompanist.insets.systemBarsPadding
import com.ivy.wallet.Constants
import com.ivy.wallet.base.horizontalSwipeListener
import com.ivy.wallet.base.onScreenStart
Expand Down Expand Up @@ -181,8 +180,7 @@ private fun BoxWithConstraintsScope.UI(
Column(
modifier = Modifier
.fillMaxSize()
.statusBarsPadding()
.navigationBarsPadding()
.systemBarsPadding()
.verticalSwipeListener(
sensitivity = Constants.SWIPE_DOWN_THRESHOLD_OPEN_MORE_MENU,
onSwipeDown = {
Expand Down Expand Up @@ -226,7 +224,7 @@ private fun BoxWithConstraintsScope.UI(
onSelectPreviousMonth = onSelectPreviousMonth
)

HomeTransactionsLazyColumn(
HomeLazyColumn(
hideBalanceRowState = hideBalanceRowState,
currency = currencyCode,
balance = balance,
Expand Down Expand Up @@ -321,7 +319,7 @@ private fun BoxWithConstraintsScope.UI(

@ExperimentalAnimationApi
@Composable
fun HomeTransactionsLazyColumn(
fun HomeLazyColumn(
hideBalanceRowState: MutableState<Boolean>,
currency: String,
balance: Double,
Expand Down Expand Up @@ -388,7 +386,6 @@ fun HomeTransactionsLazyColumn(
.nestedScroll(nestedScrollConnection),
state = listState
) {

item {
CashFlowInfo(
period = period,
Expand Down

0 comments on commit 32ba7a4

Please sign in to comment.