Skip to content

Commit 8cea551

Browse files
committed
Add Sample, Change package name
1 parent 5be8e92 commit 8cea551

File tree

14 files changed

+66
-15
lines changed

14 files changed

+66
-15
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,38 @@
1010

1111
> Android Compose OTP View
1212
13-
Coming soon
13+
14+
![](demo.jpeg)
1415

1516
## Implementation
1617
```groovy
1718
implementation 'com.yogeshpaliyal:speld:0.0.1-alpha01'
1819
```
1920

21+
### Default / Solid Pin View
22+
```kotlin
23+
val text = remember { mutableStateOf("") }
24+
PinInput(value = text.value, obscureText = null) {
25+
text.value = it
26+
}
27+
```
28+
29+
### Bordered Pin View
30+
```kotlin
31+
val text = remember { mutableStateOf("") }
32+
PinInput(
33+
modifier = Modifier.border(
34+
BorderStroke(2.dp, Color.Red),
35+
shape = RoundedCornerShape(3.dp)
36+
), value = text.value,
37+
obscureText = "*",
38+
length = 6
39+
) {
40+
text.value = it
41+
}
42+
```
43+
44+
2045
## 🏗 Project Status
2146

2247
|![](https://i.giphy.com/media/CwfC5Pv6Rtp66h4coK/giphy.gif) |
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.yogeshpaliyal.composeotpview
1+
package com.yogeshpaliyal.speld
22

33
import androidx.test.platform.app.InstrumentationRegistry
44
import androidx.test.ext.junit.runners.AndroidJUnit4

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.yogeshpaliyal.composeotpview">
3+
package="com.yogeshpaliyal.speld">
44

55
<application
66
android:allowBackup="true"
@@ -10,7 +10,7 @@
1010
android:supportsRtl="true"
1111
android:theme="@style/Theme.AndroidComposeOTPView">
1212
<activity
13-
android:name=".MainActivity"
13+
android:name="com.yogeshpaliyal.speld.MainActivity"
1414
android:exported="true"
1515
android:label="@string/app_name"
1616
android:theme="@style/Theme.AndroidComposeOTPView.NoActionBar">

app/src/main/java/com/yogeshpaliyal/composeotpview/MainActivity.kt renamed to app/src/main/java/com/yogeshpaliyal/speld/MainActivity.kt

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
package com.yogeshpaliyal.composeotpview
1+
package com.yogeshpaliyal.speld
22

33
import android.os.Bundle
44
import androidx.activity.ComponentActivity
55
import androidx.activity.compose.setContent
6+
import androidx.compose.foundation.BorderStroke
7+
import androidx.compose.foundation.border
68
import androidx.compose.foundation.layout.Column
9+
import androidx.compose.foundation.layout.Spacer
710
import androidx.compose.foundation.layout.fillMaxSize
11+
import androidx.compose.foundation.layout.height
12+
import androidx.compose.foundation.shape.RoundedCornerShape
813
import androidx.compose.material.MaterialTheme
914
import androidx.compose.material.Surface
1015
import androidx.compose.runtime.mutableStateOf
1116
import androidx.compose.runtime.remember
1217
import androidx.compose.ui.Modifier
13-
import com.yogeshpaliyal.composeotpview.ui.theme.AndroidComposeOTPViewTheme
18+
import androidx.compose.ui.graphics.Color
19+
import androidx.compose.ui.unit.dp
20+
import com.yogeshpaliyal.speld.ui.theme.AndroidComposeOTPViewTheme
1421

1522
class MainActivity : ComponentActivity() {
1623
override fun onCreate(savedInstanceState: Bundle?) {
@@ -23,9 +30,28 @@ class MainActivity : ComponentActivity() {
2330

2431

2532
Column(modifier = Modifier.fillMaxSize()) {
33+
34+
Spacer(modifier = Modifier.height(20.dp))
35+
36+
// Solid PIN View
2637
PinInput(value = text.value, obscureText = null) {
2738
text.value = it
2839
}
40+
41+
Spacer(modifier = Modifier.height(20.dp))
42+
43+
// Bordered PIN View
44+
PinInput(
45+
modifier = Modifier.border(
46+
BorderStroke(2.dp, Color.Red),
47+
shape = RoundedCornerShape(3.dp)
48+
), value = text.value,
49+
obscureText = "*",
50+
length = 6
51+
) {
52+
text.value = it
53+
}
54+
2955
}
3056

3157

app/src/main/java/com/yogeshpaliyal/composeotpview/ui/theme/Color.kt renamed to app/src/main/java/com/yogeshpaliyal/speld/ui/theme/Color.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.yogeshpaliyal.composeotpview.ui.theme
1+
package com.yogeshpaliyal.speld.ui.theme
22

33
import androidx.compose.ui.graphics.Color
44

app/src/main/java/com/yogeshpaliyal/composeotpview/ui/theme/Shape.kt renamed to app/src/main/java/com/yogeshpaliyal/speld/ui/theme/Shape.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.yogeshpaliyal.composeotpview.ui.theme
1+
package com.yogeshpaliyal.speld.ui.theme
22

33
import androidx.compose.foundation.shape.RoundedCornerShape
44
import androidx.compose.material.Shapes

app/src/main/java/com/yogeshpaliyal/composeotpview/ui/theme/Theme.kt renamed to app/src/main/java/com/yogeshpaliyal/speld/ui/theme/Theme.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.yogeshpaliyal.composeotpview.ui.theme
1+
package com.yogeshpaliyal.speld.ui.theme
22

33
import androidx.compose.foundation.isSystemInDarkTheme
44
import androidx.compose.material.MaterialTheme

app/src/main/java/com/yogeshpaliyal/composeotpview/ui/theme/Type.kt renamed to app/src/main/java/com/yogeshpaliyal/speld/ui/theme/Type.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.yogeshpaliyal.composeotpview.ui.theme
1+
package com.yogeshpaliyal.speld.ui.theme
22

33
import androidx.compose.material.Typography
44
import androidx.compose.ui.text.TextStyle

speld/src/test/java/com/yogeshpaliyal/composeotpview/ExampleUnitTest.kt renamed to app/src/test/java/com/yogeshpaliyal/speld/ExampleUnitTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.yogeshpaliyal.composeotpview
1+
package com.yogeshpaliyal.speld
22

33
import org.junit.Test
44

demo.png

4.43 KB
Loading

0 commit comments

Comments
 (0)