parent
36c74ddd35
commit
17005c3e91
@ -0,0 +1 @@
|
||||
/build
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
plugins {
|
||||
id 'nowinandroid.android.application'
|
||||
id 'nowinandroid.android.application.compose'
|
||||
}
|
||||
|
||||
android {
|
||||
defaultConfig {
|
||||
applicationId "com.google.samples.apps.niacatalog"
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += '/META-INF/{AL2.0,LGPL2.1}'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':core-ui')
|
||||
|
||||
implementation libs.androidx.activity.compose
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright 2022 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.google.samples.apps.niacatalog">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.NiACatalog">
|
||||
<activity
|
||||
android:name="com.google.samples.apps.niacatalog.NiaCatalogActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.NiACatalog">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.samples.apps.niacatalog
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.core.view.WindowCompat
|
||||
import com.google.samples.apps.niacatalog.ui.NiaCatalog
|
||||
|
||||
class NiaCatalogActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
|
||||
setContent { NiaCatalog() }
|
||||
}
|
||||
}
|
@ -0,0 +1,607 @@
|
||||
/*
|
||||
* Copyright 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.samples.apps.niacatalog.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.add
|
||||
import androidx.compose.foundation.layout.asPaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.systemBars
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.google.samples.apps.nowinandroid.core.ui.component.NiaDropdownMenuButton
|
||||
import com.google.samples.apps.nowinandroid.core.ui.component.NiaFilledButton
|
||||
import com.google.samples.apps.nowinandroid.core.ui.component.NiaFilterChip
|
||||
import com.google.samples.apps.nowinandroid.core.ui.component.NiaNavigationBar
|
||||
import com.google.samples.apps.nowinandroid.core.ui.component.NiaNavigationBarItem
|
||||
import com.google.samples.apps.nowinandroid.core.ui.component.NiaOutlinedButton
|
||||
import com.google.samples.apps.nowinandroid.core.ui.component.NiaTab
|
||||
import com.google.samples.apps.nowinandroid.core.ui.component.NiaTabRow
|
||||
import com.google.samples.apps.nowinandroid.core.ui.component.NiaTextButton
|
||||
import com.google.samples.apps.nowinandroid.core.ui.component.NiaToggleButton
|
||||
import com.google.samples.apps.nowinandroid.core.ui.component.NiaTopicTag
|
||||
import com.google.samples.apps.nowinandroid.core.ui.component.NiaViewToggleButton
|
||||
import com.google.samples.apps.nowinandroid.core.ui.icon.NiaIcons
|
||||
import com.google.samples.apps.nowinandroid.core.ui.theme.NiaTheme
|
||||
|
||||
/**
|
||||
* Now in Android component catalog.
|
||||
*/
|
||||
@Composable
|
||||
fun NiaCatalog() {
|
||||
NiaTheme {
|
||||
Surface {
|
||||
val contentPadding = WindowInsets
|
||||
.systemBars
|
||||
.add(WindowInsets(left = 16.dp, top = 16.dp, right = 16.dp, bottom = 16.dp))
|
||||
.asPaddingValues()
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentPadding = contentPadding,
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||
) {
|
||||
item {
|
||||
Text(
|
||||
text = "NiA Catalog",
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
)
|
||||
}
|
||||
item { Text("Buttons", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(onClick = {}) {
|
||||
Text(text = "Enabled")
|
||||
}
|
||||
NiaOutlinedButton(onClick = {}) {
|
||||
Text(text = "Enabled")
|
||||
}
|
||||
NiaTextButton(onClick = {}) {
|
||||
Text(text = "Enabled")
|
||||
}
|
||||
}
|
||||
}
|
||||
item { Text("Disabled buttons", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
enabled = false
|
||||
) {
|
||||
Text(text = "Disabled")
|
||||
}
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
enabled = false
|
||||
) {
|
||||
Text(text = "Disabled")
|
||||
}
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
enabled = false
|
||||
) {
|
||||
Text(text = "Disabled")
|
||||
}
|
||||
}
|
||||
}
|
||||
item { Text("Buttons with leading icons", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
text = { Text(text = "Enabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
text = { Text(text = "Enabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
text = { Text(text = "Enabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
item { Text("Disabled buttons with leading icons", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
text = { Text(text = "Disabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
text = { Text(text = "Disabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
text = { Text(text = "Disabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
item { Text("Buttons with trailing icons", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
text = { Text(text = "Enabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
text = { Text(text = "Enabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
text = { Text(text = "Enabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
item { Text("Disabled buttons with trailing icons", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
text = { Text(text = "Disabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
text = { Text(text = "Disabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
text = { Text(text = "Disabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
item { Text("Small buttons", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
small = true
|
||||
) {
|
||||
Text(text = "Enabled")
|
||||
}
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
small = true
|
||||
) {
|
||||
Text(text = "Enabled")
|
||||
}
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
small = true
|
||||
) {
|
||||
Text(text = "Enabled")
|
||||
}
|
||||
}
|
||||
}
|
||||
item { Text("Disabled small buttons", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true
|
||||
) {
|
||||
Text(text = "Disabled")
|
||||
}
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true
|
||||
) {
|
||||
Text(text = "Disabled")
|
||||
}
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true
|
||||
) {
|
||||
Text(text = "Disabled")
|
||||
}
|
||||
}
|
||||
}
|
||||
item { Text("Small buttons with leading icons", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
small = true,
|
||||
text = { Text(text = "Enabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
small = true,
|
||||
text = { Text(text = "Enabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
small = true,
|
||||
text = { Text(text = "Enabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
item {
|
||||
Text(
|
||||
"Disabled small buttons with leading icons",
|
||||
Modifier.padding(top = 16.dp)
|
||||
)
|
||||
}
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true,
|
||||
text = { Text(text = "Disabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true,
|
||||
text = { Text(text = "Disabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true,
|
||||
text = { Text(text = "Disabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
item { Text("Small buttons with trailing icons", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
small = true,
|
||||
text = { Text(text = "Enabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
small = true,
|
||||
text = { Text(text = "Enabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
small = true,
|
||||
text = { Text(text = "Enabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
item {
|
||||
Text(
|
||||
"Disabled small buttons with trailing icons",
|
||||
Modifier.padding(top = 16.dp)
|
||||
)
|
||||
}
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true,
|
||||
text = { Text(text = "Disabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true,
|
||||
text = { Text(text = "Disabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true,
|
||||
text = { Text(text = "Disabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
item { Text("Dropdown menu", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
NiaDropdownMenuButton(
|
||||
text = { Text("Newest first") },
|
||||
items = listOf("Item 1", "Item 2", "Item 3"),
|
||||
onItemClick = {},
|
||||
itemText = { item -> Text(item) }
|
||||
)
|
||||
}
|
||||
item { Text("Chips", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
var firstChecked by remember { mutableStateOf(false) }
|
||||
NiaFilterChip(
|
||||
checked = firstChecked,
|
||||
onCheckedChange = { checked -> firstChecked = checked },
|
||||
text = { Text(text = "Enabled".uppercase()) }
|
||||
)
|
||||
var secondChecked by remember { mutableStateOf(true) }
|
||||
NiaFilterChip(
|
||||
checked = secondChecked,
|
||||
onCheckedChange = { checked -> secondChecked = checked },
|
||||
text = { Text(text = "Enabled".uppercase()) }
|
||||
)
|
||||
var thirdChecked by remember { mutableStateOf(true) }
|
||||
NiaFilterChip(
|
||||
checked = thirdChecked,
|
||||
onCheckedChange = { checked -> thirdChecked = checked },
|
||||
enabled = false,
|
||||
text = { Text(text = "Disabled".uppercase()) }
|
||||
)
|
||||
}
|
||||
}
|
||||
item { Text("Toggle buttons", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
var firstChecked by remember { mutableStateOf(false) }
|
||||
NiaToggleButton(
|
||||
checked = firstChecked,
|
||||
onCheckedChange = { checked -> firstChecked = checked },
|
||||
icon = {
|
||||
Icon(
|
||||
painter = painterResource(id = NiaIcons.BookmarkBorder),
|
||||
contentDescription = null
|
||||
)
|
||||
},
|
||||
checkedIcon = {
|
||||
Icon(
|
||||
painter = painterResource(id = NiaIcons.Bookmark),
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
)
|
||||
var secondChecked by remember { mutableStateOf(true) }
|
||||
NiaToggleButton(
|
||||
checked = secondChecked,
|
||||
onCheckedChange = { checked -> secondChecked = checked },
|
||||
icon = {
|
||||
Icon(
|
||||
painter = painterResource(id = NiaIcons.BookmarkBorder),
|
||||
contentDescription = null
|
||||
)
|
||||
},
|
||||
checkedIcon = {
|
||||
Icon(
|
||||
painter = painterResource(id = NiaIcons.Bookmark),
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
)
|
||||
var thirdChecked by remember { mutableStateOf(false) }
|
||||
NiaToggleButton(
|
||||
checked = thirdChecked,
|
||||
onCheckedChange = { checked -> thirdChecked = checked },
|
||||
icon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
},
|
||||
checkedIcon = {
|
||||
Icon(imageVector = NiaIcons.Check, contentDescription = null)
|
||||
}
|
||||
)
|
||||
var fourthChecked by remember { mutableStateOf(true) }
|
||||
NiaToggleButton(
|
||||
checked = fourthChecked,
|
||||
onCheckedChange = { checked -> fourthChecked = checked },
|
||||
icon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
},
|
||||
checkedIcon = {
|
||||
Icon(imageVector = NiaIcons.Check, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
item { Text("View toggle", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
var firstExpanded by remember { mutableStateOf(false) }
|
||||
NiaViewToggleButton(
|
||||
expanded = firstExpanded,
|
||||
onExpandedChange = { expanded -> firstExpanded = expanded },
|
||||
compactText = { Text(text = "Compact view") },
|
||||
expandedText = { Text(text = "Expanded view") }
|
||||
)
|
||||
var secondExpanded by remember { mutableStateOf(true) }
|
||||
NiaViewToggleButton(
|
||||
expanded = secondExpanded,
|
||||
onExpandedChange = { expanded -> secondExpanded = expanded },
|
||||
compactText = { Text(text = "Compact view") },
|
||||
expandedText = { Text(text = "Expanded view") }
|
||||
)
|
||||
}
|
||||
}
|
||||
item { Text("Tags", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
var firstFollowed by remember { mutableStateOf(false) }
|
||||
NiaTopicTag(
|
||||
followed = firstFollowed,
|
||||
onFollowClick = { firstFollowed = true },
|
||||
onUnfollowClick = { firstFollowed = false },
|
||||
onBrowseClick = {},
|
||||
text = { Text(text = "Topic".uppercase()) },
|
||||
followText = { Text(text = "Follow") },
|
||||
unFollowText = { Text(text = "Unfollow") },
|
||||
browseText = { Text(text = "Browse topic") }
|
||||
)
|
||||
var secondFollowed by remember { mutableStateOf(true) }
|
||||
NiaTopicTag(
|
||||
followed = secondFollowed,
|
||||
onFollowClick = { secondFollowed = true },
|
||||
onUnfollowClick = { secondFollowed = false },
|
||||
onBrowseClick = {},
|
||||
text = { Text(text = "Topic".uppercase()) },
|
||||
followText = { Text(text = "Follow") },
|
||||
unFollowText = { Text(text = "Unfollow") },
|
||||
browseText = { Text(text = "Browse topic") }
|
||||
)
|
||||
}
|
||||
}
|
||||
item { Text("Tabs", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
var selectedTabIndex by remember { mutableStateOf(0) }
|
||||
val titles = listOf("Topics", "People")
|
||||
NiaTabRow(selectedTabIndex = selectedTabIndex) {
|
||||
titles.forEachIndexed { index, title ->
|
||||
NiaTab(
|
||||
selected = selectedTabIndex == index,
|
||||
onClick = { selectedTabIndex = index },
|
||||
text = { Text(text = title) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
item { Text("Navigation", Modifier.padding(top = 16.dp)) }
|
||||
item {
|
||||
var selectedItem by remember { mutableStateOf(0) }
|
||||
val items = listOf("For you", "Episodes", "Saved", "Interests")
|
||||
val icons = listOf(
|
||||
NiaIcons.UpcomingBorder,
|
||||
NiaIcons.MenuBookBorder,
|
||||
NiaIcons.BookmarksBorder
|
||||
)
|
||||
val selectedIcons = listOf(
|
||||
NiaIcons.Upcoming,
|
||||
NiaIcons.MenuBook,
|
||||
NiaIcons.Bookmarks
|
||||
)
|
||||
val tagIcon = NiaIcons.Tag
|
||||
NiaNavigationBar {
|
||||
items.forEachIndexed { index, item ->
|
||||
NiaNavigationBarItem(
|
||||
icon = {
|
||||
if (index == 3) {
|
||||
Icon(imageVector = tagIcon, contentDescription = null)
|
||||
} else {
|
||||
Icon(
|
||||
painter = painterResource(id = icons[index]),
|
||||
contentDescription = item
|
||||
)
|
||||
}
|
||||
},
|
||||
selectedIcon = {
|
||||
if (index == 3) {
|
||||
Icon(imageVector = tagIcon, contentDescription = null)
|
||||
} else {
|
||||
Icon(
|
||||
painter = painterResource(id = selectedIcons[index]),
|
||||
contentDescription = item
|
||||
)
|
||||
}
|
||||
},
|
||||
label = { Text(item) },
|
||||
selected = selectedItem == index,
|
||||
onClick = { selectedItem = index }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:pathData="M0,0h108v108h-108z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
</vector>
|
@ -0,0 +1,13 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:pathData="M65.08,84.13C64.01,84.13 63.13,83.26 63.13,82.18C63.13,81.11 64,80.24 65.08,80.24C66.15,80.24 67.02,81.11 67.02,82.18C67.02,83.26 66.15,84.13 65.08,84.13ZM43.6,84.13C42.53,84.13 41.65,83.26 41.65,82.18C41.65,81.11 42.52,80.24 43.6,80.24C44.66,80.24 45.54,81.11 45.54,82.18C45.54,83.26 44.67,84.13 43.6,84.13ZM65.77,72.44L69.66,65.73C69.88,65.35 69.74,64.85 69.36,64.63C68.97,64.41 68.48,64.54 68.25,64.93L64.32,71.73C61.31,70.36 57.94,69.59 54.33,69.59C50.73,69.59 47.35,70.36 44.34,71.73L40.41,64.93C40.19,64.54 39.69,64.41 39.31,64.63C38.92,64.85 38.79,65.35 39.01,65.73L42.89,72.44C36.22,76.07 31.67,82.81 31,90.77H77.67C77,82.8 72.44,76.06 65.77,72.44Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M46.57,35H46.57C46.1,35 45.72,35.38 45.72,35.85L45.72,43.15H44.19C43.35,43.15 42.67,43.83 42.67,44.68C42.67,45.52 43.35,46.2 44.19,46.2H45.72V43.15H47.42C48.17,43.15 48.78,42.54 48.78,41.79L48.78,37.72H49.97C50.43,37.72 50.81,37.34 50.81,36.87V35.85C50.81,35.38 50.43,35 49.97,35H47.42H46.57ZM46.57,54.35H46.57H47.42H49.97C50.43,54.35 50.81,53.97 50.81,53.5V52.48C50.81,52.02 50.43,51.64 49.97,51.64H48.78L48.78,47.56C48.78,46.81 48.17,46.2 47.42,46.2H45.72L45.72,53.5C45.72,53.97 46.1,54.35 46.57,54.35ZM61.54,35H61.54C62.01,35 62.39,35.38 62.39,35.85V43.15H63.92C64.76,43.15 65.44,43.83 65.44,44.68C65.44,45.52 64.76,46.2 63.92,46.2H62.39V43.15H60.69C59.94,43.15 59.33,42.54 59.33,41.79V37.72H58.15C57.68,37.72 57.3,37.34 57.3,36.87V35.85C57.3,35.38 57.68,35 58.15,35H60.69H61.54ZM61.54,54.35H61.54H60.69H58.15C57.68,54.35 57.3,53.97 57.3,53.5V52.48C57.3,52.02 57.68,51.64 58.15,51.64H59.33V47.56C59.33,46.81 59.94,46.2 60.69,46.2H62.39V53.5C62.39,53.97 62.01,54.35 61.54,54.35Z"
|
||||
android:fillColor="#000000"
|
||||
android:fillType="evenOdd"/>
|
||||
</vector>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright 2022 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<string name="app_name">NiA Catalog</string>
|
||||
</resources>
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright 2022 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<style name="Theme.NiACatalog" parent="android:Theme.Material.Light.NoActionBar" />
|
||||
</resources>
|
@ -1,571 +0,0 @@
|
||||
/*
|
||||
* Copyright 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.samples.apps.nowinandroid.core.ui.component
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.add
|
||||
import androidx.compose.foundation.layout.asPaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.systemBars
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.google.samples.apps.nowinandroid.core.ui.icon.NiaIcons
|
||||
|
||||
/**
|
||||
* Now in Android component catalog.
|
||||
*/
|
||||
@Composable
|
||||
fun NiaComponentCatalog() {
|
||||
val contentPadding = WindowInsets
|
||||
.systemBars
|
||||
.add(WindowInsets(left = 16.dp, top = 16.dp, right = 16.dp, bottom = 16.dp))
|
||||
.asPaddingValues()
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentPadding = contentPadding,
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||
) {
|
||||
// Buttons
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(onClick = {}) {
|
||||
Text(text = "Enabled")
|
||||
}
|
||||
NiaOutlinedButton(onClick = {}) {
|
||||
Text(text = "Enabled")
|
||||
}
|
||||
NiaTextButton(onClick = {}) {
|
||||
Text(text = "Enabled")
|
||||
}
|
||||
}
|
||||
}
|
||||
// Disabled buttons
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
enabled = false
|
||||
) {
|
||||
Text(text = "Disabled")
|
||||
}
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
enabled = false
|
||||
) {
|
||||
Text(text = "Disabled")
|
||||
}
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
enabled = false
|
||||
) {
|
||||
Text(text = "Disabled")
|
||||
}
|
||||
}
|
||||
}
|
||||
// Buttons with leading icons
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
text = { Text(text = "Enabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
text = { Text(text = "Enabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
text = { Text(text = "Enabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
// Disabled buttons with leading icons
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
text = { Text(text = "Disabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
text = { Text(text = "Disabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
text = { Text(text = "Disabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
// Buttons with trailing icons
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
text = { Text(text = "Enabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
text = { Text(text = "Enabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
text = { Text(text = "Enabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
// Disabled buttons with trailing icons
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
text = { Text(text = "Disabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
text = { Text(text = "Disabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
text = { Text(text = "Disabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
// Small buttons
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
small = true
|
||||
) {
|
||||
Text(text = "Enabled")
|
||||
}
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
small = true
|
||||
) {
|
||||
Text(text = "Enabled")
|
||||
}
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
small = true
|
||||
) {
|
||||
Text(text = "Enabled")
|
||||
}
|
||||
}
|
||||
}
|
||||
// Disabled small buttons
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true
|
||||
) {
|
||||
Text(text = "Disabled")
|
||||
}
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true
|
||||
) {
|
||||
Text(text = "Disabled")
|
||||
}
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true
|
||||
) {
|
||||
Text(text = "Disabled")
|
||||
}
|
||||
}
|
||||
}
|
||||
// Small buttons with leading icons
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
small = true,
|
||||
text = { Text(text = "Enabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
small = true,
|
||||
text = { Text(text = "Enabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
small = true,
|
||||
text = { Text(text = "Enabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
// Disabled small buttons with leading icons
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true,
|
||||
text = { Text(text = "Disabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true,
|
||||
text = { Text(text = "Disabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true,
|
||||
text = { Text(text = "Disabled") },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
// Small buttons with trailing icons
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
small = true,
|
||||
text = { Text(text = "Enabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
small = true,
|
||||
text = { Text(text = "Enabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
small = true,
|
||||
text = { Text(text = "Enabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
// Disabled small buttons with trailing icons
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
NiaFilledButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true,
|
||||
text = { Text(text = "Disabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaOutlinedButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true,
|
||||
text = { Text(text = "Disabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
NiaTextButton(
|
||||
onClick = {},
|
||||
enabled = false,
|
||||
small = true,
|
||||
text = { Text(text = "Disabled") },
|
||||
trailingIcon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
// Dropdown menu
|
||||
item {
|
||||
NiaDropdownMenuButton(
|
||||
text = { Text("Newest first") },
|
||||
items = listOf("Item 1", "Item 2", "Item 3"),
|
||||
onItemClick = {},
|
||||
itemText = { item -> Text(item) }
|
||||
)
|
||||
}
|
||||
// Chips
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
var firstChecked by remember { mutableStateOf(false) }
|
||||
NiaFilterChip(
|
||||
checked = firstChecked,
|
||||
onCheckedChange = { checked -> firstChecked = checked },
|
||||
text = { Text(text = "Enabled".uppercase()) }
|
||||
)
|
||||
var secondChecked by remember { mutableStateOf(true) }
|
||||
NiaFilterChip(
|
||||
checked = secondChecked,
|
||||
onCheckedChange = { checked -> secondChecked = checked },
|
||||
text = { Text(text = "Enabled".uppercase()) }
|
||||
)
|
||||
var thirdChecked by remember { mutableStateOf(true) }
|
||||
NiaFilterChip(
|
||||
checked = thirdChecked,
|
||||
onCheckedChange = { checked -> thirdChecked = checked },
|
||||
enabled = false,
|
||||
text = { Text(text = "Disabled".uppercase()) }
|
||||
)
|
||||
}
|
||||
}
|
||||
// Toggle buttons
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
var firstChecked by remember { mutableStateOf(false) }
|
||||
NiaToggleButton(
|
||||
checked = firstChecked,
|
||||
onCheckedChange = { checked -> firstChecked = checked },
|
||||
icon = {
|
||||
Icon(
|
||||
painter = painterResource(id = NiaIcons.BookmarkBorder),
|
||||
contentDescription = null
|
||||
)
|
||||
},
|
||||
checkedIcon = {
|
||||
Icon(
|
||||
painter = painterResource(id = NiaIcons.Bookmark),
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
)
|
||||
var secondChecked by remember { mutableStateOf(true) }
|
||||
NiaToggleButton(
|
||||
checked = secondChecked,
|
||||
onCheckedChange = { checked -> secondChecked = checked },
|
||||
icon = {
|
||||
Icon(
|
||||
painter = painterResource(id = NiaIcons.BookmarkBorder),
|
||||
contentDescription = null
|
||||
)
|
||||
},
|
||||
checkedIcon = {
|
||||
Icon(
|
||||
painter = painterResource(id = NiaIcons.Bookmark),
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
)
|
||||
var thirdChecked by remember { mutableStateOf(false) }
|
||||
NiaToggleButton(
|
||||
checked = thirdChecked,
|
||||
onCheckedChange = { checked -> thirdChecked = checked },
|
||||
icon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
},
|
||||
checkedIcon = {
|
||||
Icon(imageVector = NiaIcons.Check, contentDescription = null)
|
||||
}
|
||||
)
|
||||
var fourthChecked by remember { mutableStateOf(true) }
|
||||
NiaToggleButton(
|
||||
checked = fourthChecked,
|
||||
onCheckedChange = { checked -> fourthChecked = checked },
|
||||
icon = {
|
||||
Icon(imageVector = NiaIcons.Add, contentDescription = null)
|
||||
},
|
||||
checkedIcon = {
|
||||
Icon(imageVector = NiaIcons.Check, contentDescription = null)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
// View toggle
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
var firstExpanded by remember { mutableStateOf(false) }
|
||||
NiaViewToggleButton(
|
||||
expanded = firstExpanded,
|
||||
onExpandedChange = { expanded -> firstExpanded = expanded },
|
||||
compactText = { Text(text = "Compact view") },
|
||||
expandedText = { Text(text = "Expanded view") }
|
||||
)
|
||||
var secondExpanded by remember { mutableStateOf(true) }
|
||||
NiaViewToggleButton(
|
||||
expanded = secondExpanded,
|
||||
onExpandedChange = { expanded -> secondExpanded = expanded },
|
||||
compactText = { Text(text = "Compact view") },
|
||||
expandedText = { Text(text = "Expanded view") }
|
||||
)
|
||||
}
|
||||
}
|
||||
// Tags
|
||||
item {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
var firstFollowed by remember { mutableStateOf(false) }
|
||||
NiaTopicTag(
|
||||
followed = firstFollowed,
|
||||
onFollowClick = { firstFollowed = true },
|
||||
onUnfollowClick = { firstFollowed = false },
|
||||
onBrowseClick = {},
|
||||
text = { Text(text = "Topic".uppercase()) },
|
||||
followText = { Text(text = "Follow") },
|
||||
unFollowText = { Text(text = "Unfollow") },
|
||||
browseText = { Text(text = "Browse topic") }
|
||||
)
|
||||
var secondFollowed by remember { mutableStateOf(true) }
|
||||
NiaTopicTag(
|
||||
followed = secondFollowed,
|
||||
onFollowClick = { secondFollowed = true },
|
||||
onUnfollowClick = { secondFollowed = false },
|
||||
onBrowseClick = {},
|
||||
text = { Text(text = "Topic".uppercase()) },
|
||||
followText = { Text(text = "Follow") },
|
||||
unFollowText = { Text(text = "Unfollow") },
|
||||
browseText = { Text(text = "Browse topic") }
|
||||
)
|
||||
}
|
||||
}
|
||||
// Tabs
|
||||
item {
|
||||
var selectedTabIndex by remember { mutableStateOf(0) }
|
||||
val titles = listOf("Topics", "People")
|
||||
NiaTabRow(selectedTabIndex = selectedTabIndex) {
|
||||
titles.forEachIndexed { index, title ->
|
||||
NiaTab(
|
||||
selected = selectedTabIndex == index,
|
||||
onClick = { selectedTabIndex = index },
|
||||
text = { Text(text = title) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Navigation
|
||||
item {
|
||||
var selectedItem by remember { mutableStateOf(0) }
|
||||
val items = listOf("For you", "Episodes", "Saved", "Interests")
|
||||
val icons = listOf(
|
||||
NiaIcons.UpcomingBorder,
|
||||
NiaIcons.MenuBookBorder,
|
||||
NiaIcons.BookmarksBorder
|
||||
)
|
||||
val selectedIcons = listOf(
|
||||
NiaIcons.Upcoming,
|
||||
NiaIcons.MenuBook,
|
||||
NiaIcons.Bookmarks
|
||||
)
|
||||
val tagIcon = NiaIcons.Tag
|
||||
NiaNavigationBar {
|
||||
items.forEachIndexed { index, item ->
|
||||
NiaNavigationBarItem(
|
||||
icon = {
|
||||
if (index == 3) {
|
||||
Icon(imageVector = tagIcon, contentDescription = null)
|
||||
} else {
|
||||
Icon(
|
||||
painter = painterResource(id = icons[index]),
|
||||
contentDescription = item
|
||||
)
|
||||
}
|
||||
},
|
||||
selectedIcon = {
|
||||
if (index == 3) {
|
||||
Icon(imageVector = tagIcon, contentDescription = null)
|
||||
} else {
|
||||
Icon(
|
||||
painter = painterResource(id = selectedIcons[index]),
|
||||
contentDescription = item
|
||||
)
|
||||
}
|
||||
},
|
||||
label = { Text(item) },
|
||||
selected = selectedItem == index,
|
||||
onClick = { selectedItem = index }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue