Skip to content

Commit

Permalink
Merge pull request #43 from what3words/staging
Browse files Browse the repository at this point in the history
2.0.1
  • Loading branch information
mani-apps authored Jun 17, 2024
2 parents e83190f + 2d1d785 commit 28f45b5
Show file tree
Hide file tree
Showing 33 changed files with 2,994 additions and 507 deletions.
8 changes: 7 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ jobs:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "design-library/build.gradle" }}
- run:
name: Snapshot Release Check
command: |
echo -e "\nIS_SNAPSHOT_RELEASE=$( [[ "${CIRCLE_BRANCH}" =~ ^epic.* ]] && echo true || echo false )" >> gradle.properties
- run:
name: Inject Maven signing key
command: |
Expand All @@ -85,4 +89,6 @@ workflows:
- build-test-sonar
filters:
branches:
only: /^(beta)\/.*/
only:
- staging
- /^epic.*/
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,27 @@ through [![Maven Central](https://img.shields.io/maven-central/v/com.what3words/
implementation 'com.what3words:w3w-android-design-library:2.0.0'
```

#### Snapshots
We deploy snapshot versions of the library to [Sonatype's snapshot repository](https://s01.oss.sonatype.org/content/repositories/snapshots/). These snapshots are generated after every merge to an Epic branch, providing an easy way to test the latest unreleased changes and upcoming updates without waiting for the next official version release.

To use snapshot versions in your project, add the snapshot repository to your Gradle script:

```
repositories {
maven {
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
}
}
```
Then, update your dependencies to use the snapshot version:

```
dependencies {
implementation 'com.what3words:w3w-android-design-library:2.0.0-SNAPSHOT'
}
```
The latest snapshot versions are available [here](https://s01.oss.sonatype.org/content/repositories/snapshots/com/what3words/w3w-android-design-library/).

# Design library components

### [What3wordsAddressListItem](https://github.com/what3words/w3w-android-design-library/blob/main/design-library/src/main/java/com/what3words/design/library/ui/components/What3wordsAddressListItem.kt)
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ buildscript {
dependency_analysis_version = "1.20.0"
navigation_compose_version = "2.6.0"
accompanist_version = "0.28.0"
lottie_version = "6.1.0"
core_ktx_version = "1.7.0"
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.3'
Expand Down
21 changes: 0 additions & 21 deletions design-library-usage-sample/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +0,0 @@
# 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
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import com.what3words.design.library.sample.ui.DesignLibraryApp
import com.what3words.design.library.ui.theme.LocalSurfaceVariationsColors
import com.what3words.design.library.ui.theme.LocalW3WColorScheme
import com.what3words.design.library.ui.theme.W3WTheme
import com.what3words.design.library.ui.theme.darkSurfaceVariationsColors
import com.what3words.design.library.ui.theme.darkW3WColors
import com.what3words.design.library.ui.theme.lightSurfaceVariationsColors
import com.what3words.design.library.ui.theme.lightW3WColors
import com.what3words.design.library.ui.theme.m3DarkSurfaceVariationsColors
import com.what3words.design.library.ui.theme.m3DarkW3WSchemeColors
import com.what3words.design.library.ui.theme.m3LightSurfaceVariationsColors
import com.what3words.design.library.ui.theme.m3LightW3WSchemeColors

@OptIn(ExperimentalMaterial3Api::class)
class MainActivity : ComponentActivity() {
Expand Down Expand Up @@ -58,8 +58,8 @@ class MainActivity : ComponentActivity() {
when {
selectedTheme == MainActivityViewModel.Theme.Material && selectedColours == MainActivityViewModel.Colours.Day -> {
CompositionLocalProvider(
LocalSurfaceVariationsColors provides lightSurfaceVariationsColors,
LocalW3WColorScheme provides lightW3WColors
LocalSurfaceVariationsColors provides m3LightSurfaceVariationsColors,
LocalW3WColorScheme provides m3LightW3WSchemeColors
) {
MaterialTheme(colorScheme = lightColorScheme()) {
mainScreen()
Expand All @@ -69,8 +69,8 @@ class MainActivity : ComponentActivity() {

selectedTheme == MainActivityViewModel.Theme.Material && selectedColours == MainActivityViewModel.Colours.Night -> {
CompositionLocalProvider(
LocalSurfaceVariationsColors provides darkSurfaceVariationsColors,
LocalW3WColorScheme provides darkW3WColors
LocalSurfaceVariationsColors provides m3DarkSurfaceVariationsColors,
LocalW3WColorScheme provides m3DarkW3WSchemeColors
) {
MaterialTheme(colorScheme = darkColorScheme()) {
mainScreen()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ import com.what3words.design.library.sample.ui.screens.ColorPaletteScreen
import com.what3words.design.library.sample.ui.screens.HomeScreen
import com.what3words.design.library.sample.ui.screens.IconButtonScreen
import com.what3words.design.library.sample.ui.screens.ListItemScreen
import com.what3words.design.library.sample.ui.screens.VoiceAnimationScreen
import com.what3words.design.library.sample.ui.screens.What3wordsAddressListItemScreen
import com.what3words.design.library.sample.ui.screens.What3wordsAddressScreen
import com.what3words.design.library.sample.ui.screens.What3wordsSearchBarScreen
import com.what3words.design.library.ui.theme.surfaceVariationsColors


Expand Down Expand Up @@ -125,6 +127,14 @@ fun DesignLibraryApp(
onTitleChanged.invoke("List Items")
ListItemScreen()
}
composable(NavScreen.VoiceAnimationScreen.route) {
onTitleChanged.invoke("Voice Recognition Animation")
VoiceAnimationScreen()
}
composable(NavScreen.What3WordsSearchBarScreen.route) {
onTitleChanged.invoke("What3Words SearchBar")
What3wordsSearchBarScreen()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ sealed class NavScreen(val route: String) {
object ListItemScreen : NavScreen("ListItemScreen")
object ButtonScreen : NavScreen("ButtonScreen")
object IconButtonScreen : NavScreen("IconButtonScreen")
object VoiceAnimationScreen : NavScreen("VoiceAnimationScreen")
object What3WordsSearchBarScreen : NavScreen("What3WordsSearchBarScreen")
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,54 @@
package com.what3words.design.library.sample.ui.screens

import android.widget.Toast
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.DocumentScanner
import androidx.compose.material.icons.filled.KeyboardArrowRight
import androidx.compose.material.icons.filled.Menu
import androidx.compose.material.icons.filled.Search
import androidx.compose.material.icons.filled.SettingsVoice
import androidx.compose.material.icons.outlined.Person
import androidx.compose.material3.Button
import androidx.compose.material3.FilledIconButton
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.ListItem
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import com.what3words.design.library.sample.ui.NavScreen
import com.what3words.design.library.ui.components.VoiceAnimation
import com.what3words.design.library.ui.components.VoiceAnimationState
import com.what3words.design.library.ui.components.What3wordsSearchBar
import com.what3words.design.library.ui.components.What3wordsAddress
import com.what3words.design.library.ui.components.What3wordsAddressListItem
import com.what3words.design.library.ui.theme.w3wColorScheme
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlin.random.Random

@Composable
fun HomeScreen(navController: NavController, modifier: Modifier = Modifier) {
Expand Down Expand Up @@ -157,6 +179,102 @@ fun HomeScreen(navController: NavController, modifier: Modifier = Modifier) {
)
}
)
Text(
text = "Voice Recognition Component >",
modifier = Modifier
.padding(16.dp)
.clickable {
navController.navigate(NavScreen.VoiceAnimationScreen.route)
},
style = MaterialTheme.typography.titleMedium
)
val context = LocalContext.current
val state: MutableState<VoiceAnimationState> =
remember { mutableStateOf(VoiceAnimationState.Idle) }

LaunchedEffect(Unit) {
while (this.isActive) {
delay(200)
state.value =
VoiceAnimationState.Active(Random.nextFloat().coerceIn(0f, 1f))
}
}

VoiceAnimation(
modifier = Modifier
.fillMaxWidth(.5f)
.aspectRatio(1f)
.align(Alignment.CenterHorizontally),
state = state.value,
activeOnClick = {
Toast.makeText(context, "Active clicked", Toast.LENGTH_SHORT).show()
},
inactiveOnClick = {
Toast.makeText(context, "Inactive clicked", Toast.LENGTH_SHORT).show()
}
)

Text(
text = "Search bar >",
modifier = Modifier
.padding(16.dp)
.clickable {
navController.navigate(NavScreen.What3WordsSearchBarScreen.route)
},
style = MaterialTheme.typography.titleMedium
)

What3wordsSearchBar(
modifier = Modifier
.padding(4.dp),
trailingActions = {
IconButton(
onClick = {
navController.navigate(NavScreen.What3WordsSearchBarScreen.route)
}) {
Icon(
imageVector = Icons.Filled.Menu,
contentDescription = "",
tint = MaterialTheme.colorScheme.onSurfaceVariant
)
}
},
leadingActions = {
IconButton(
onClick = {
navController.navigate(NavScreen.What3WordsSearchBarScreen.route)
}) {
Icon(
imageVector = Icons.Default.SettingsVoice,
contentDescription = "",
tint = MaterialTheme.colorScheme.onPrimaryContainer,
)
}
IconButton(
onClick = {
navController.navigate(NavScreen.What3WordsSearchBarScreen.route)
}) {
Icon(
imageVector = Icons.Default.DocumentScanner,
contentDescription = "",
tint = MaterialTheme.colorScheme.onPrimaryContainer,
)
}
},
content = {
Spacer(modifier = Modifier.size(8.dp))
Icon(
imageVector = Icons.Filled.Search,
contentDescription = "",
tint = MaterialTheme.colorScheme.onSurfaceVariant
)
Spacer(modifier = Modifier.size(4.dp))
Text(text = "Search")
},
onContentClick = {
navController.navigate(NavScreen.What3WordsSearchBarScreen.route)
}
)
}
}

Expand Down
Loading

0 comments on commit 28f45b5

Please sign in to comment.