Skip to content

Commit

Permalink
πŸ’„ fix #31 (ui update)
Browse files Browse the repository at this point in the history
  • Loading branch information
theapache64 committed Mar 14, 2021
1 parent 916ee25 commit e6c82e7
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.theapache64.stackzy.ui.feature.appdetail

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
Expand All @@ -9,6 +10,7 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.imageResource
import androidx.compose.ui.res.svgResource
Expand All @@ -21,6 +23,8 @@ import com.theapache64.stackzy.ui.common.LoadingAnimation
import com.theapache64.stackzy.util.R


private val GRADIENT_HEIGHT = 50.dp

@Composable
fun AppDetailScreen(
viewModel: AppDetailViewModel,
Expand Down Expand Up @@ -81,43 +85,73 @@ fun AppDetailScreen(
LoadingAnimation(message)
} else if (_report != null) {

// Decompile and analysis done
TabRow(
selectedTabIndex = selectedTabIndex,
backgroundColor = Color.Transparent,
contentColor = MaterialTheme.colors.primary,
modifier = Modifier
.fillMaxWidth()
Box(
modifier = Modifier.fillMaxSize()
) {
// Tabs
AppDetailViewModel.TABS.forEachIndexed { index, title ->
Tab(
selected = index == selectedTabIndex,
onClick = {
viewModel.onTabClicked(index)
},
text = { Text(text = title) }
Column {
// Decompile and analysis done
TabRow(
selectedTabIndex = selectedTabIndex,
backgroundColor = Color.Transparent,
contentColor = MaterialTheme.colors.primary,
modifier = Modifier
.fillMaxWidth()
) {
// Tabs
AppDetailViewModel.TABS.forEachIndexed { index, title ->
Tab(
selected = index == selectedTabIndex,
onClick = {
viewModel.onTabClicked(index)
},
text = { Text(text = title) }
)
}
}

Spacer(
modifier = Modifier.height(10.dp)
)
}
}

Spacer(
modifier = Modifier.height(10.dp)
)
if (selectedTabIndex == 0) {
// Libraries Tab
Libraries(_report, onLibrarySelected)
} else {
// More Info tab
MoreInfo(_report)
}
}

if (selectedTabIndex == 0) {
// Libraries Tab
Libraries(_report, onLibrarySelected)
} else {
// More Info tab
MoreInfo(_report)
// Bottom gradient
Box(
modifier = Modifier
.fillMaxWidth()
.height(GRADIENT_HEIGHT)
.align(Alignment.BottomCenter)
.background(
brush = Brush.verticalGradient(
colors = listOf(
Color.Transparent,
com.theapache64.stackzy.ui.theme.R.color.BigStone
)
)
)
)
}

}
}
}
}

@Composable
fun GradientMargin() {
Spacer(
modifier = Modifier
.height(GRADIENT_HEIGHT)
)
}

@Composable
private fun PlayStoreIcon(onClicked: () -> Unit) {
IconButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ fun Libraries(
modifier = Modifier.height(10.dp)
)
}

item {
// Gradient margin
GradientMargin()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ fun MoreInfo(
modifier: Modifier = Modifier
) {
LazyColumn(
modifier = modifier.fillMaxWidth()
modifier = modifier
.fillMaxWidth()
) {
item {
BuildGradleGroovy(
Expand All @@ -57,6 +58,10 @@ fun MoreInfo(
)
}
}

item {
GradientMargin()
}
}
}

Expand Down

0 comments on commit e6c82e7

Please sign in to comment.