Skip to content

Commit

Permalink
Add just color theme
Browse files Browse the repository at this point in the history
  • Loading branch information
masato1230 committed Jun 5, 2022
1 parent 7bf2ab1 commit 298d8d3
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import androidx.compose.ui.graphics.Color

val Purple200 = Color(0xFFBB86FC)
val Purple500 = Color(0xFF6200EE)
val Purple700 = Color(0xFF3700B3)
val QiitaGreen = Color(0xFF55C500)
val Teal200 = Color(0xFF03DAC5)
21 changes: 3 additions & 18 deletions app/src/main/java/com/jp_funda/qiitaclient/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,20 @@ import androidx.compose.runtime.Composable

private val DarkColorPalette = darkColors(
primary = Purple200,
primaryVariant = Purple700,
primaryVariant = QiitaGreen,
secondary = Teal200
)

private val LightColorPalette = lightColors(
primary = Purple500,
primaryVariant = Purple700,
primaryVariant = QiitaGreen,
secondary = Teal200

/* Other default colors to override
background = Color.White,
surface = Color.White,
onPrimary = Color.White,
onSecondary = Color.Black,
onBackground = Color.Black,
onSurface = Color.Black,
*/
)

@Composable
fun QiitaClientTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
val colors = if (darkTheme) {
DarkColorPalette
} else {
LightColorPalette
}

MaterialTheme(
colors = colors,
colors = DarkColorPalette,
typography = Typography,
shapes = Shapes,
content = content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.jp_funda.qiitaclient.ui.theme.Purple700
import com.jp_funda.qiitaclient.ui.theme.QiitaGreen

@Composable
fun SearchView(
Expand All @@ -34,8 +35,8 @@ fun SearchView(
onValueChange = { value ->
textFieldState.value = value
},
modifier = Modifier
.fillMaxWidth(),
modifier = Modifier.fillMaxWidth(),
shape = RectangleShape,
textStyle = TextStyle(color = Color.White, fontSize = 18.sp),
leadingIcon = {
Icon(
Expand Down Expand Up @@ -67,7 +68,7 @@ fun SearchView(
singleLine = true,
colors = TextFieldDefaults.textFieldColors(
cursorColor = Color.White,
backgroundColor = Purple700,
backgroundColor = QiitaGreen,
leadingIconColor = Color.White,
trailingIconColor = Color.White,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,28 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.input.TextFieldValue
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavController
import com.jp_funda.qiitaclient.ui.theme.QiitaGreen
import com.jp_funda.qiitaclient.view.component.SearchView
import java.net.URLEncoder
import java.nio.charset.StandardCharsets

@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
@Composable
fun SearchScreen(navController: NavController, searchViewModel: SearchViewModel = viewModel()) {
Scaffold {

LaunchedEffect(Unit) {
searchViewModel.searchArticles("kotlin")
}

Scaffold(backgroundColor = QiitaGreen, contentColor = Color.White) {
Column {
val textFieldState = remember { mutableStateOf(TextFieldValue("")) }
SearchView(textFieldState = textFieldState) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="qiita_green">#55c500</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<resources>

<style name="Theme.QiitaClient" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:statusBarColor">@color/purple_700</item>
<item name="android:statusBarColor">@color/qiita_green</item>
<item name="android:navigationBarColor">@color/qiita_green</item>
</style>
</resources>

0 comments on commit 298d8d3

Please sign in to comment.