Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/Build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
Expand Down
7 changes: 2 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:8.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.21"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20"
}
}

task clean(type: Delete) {
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Nov 30 20:29:02 CAT 2021
#Thu Nov 30 21:59:47 CAT 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
28 changes: 14 additions & 14 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ plugins {
}

android {
compileSdk 33
compileSdk 34

defaultConfig {
applicationId "tech.devscast.validable_sample"
minSdk 21
targetSdk 33
targetSdk 34
versionCode 1
versionName "1.0"

Expand All @@ -27,17 +27,17 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '11'
jvmTarget = '17'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion "1.3.2"
kotlinCompilerExtensionVersion "1.5.5"
}
packagingOptions {
resources {
Expand All @@ -50,20 +50,20 @@ android {
dependencies {

implementation project(":validable")
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.10.0'

implementation platform('androidx.compose:compose-bom:2022.10.00')

implementation "androidx.compose.ui:ui"
implementation "androidx.activity:activity-compose:1.6.1"
implementation "androidx.activity:activity-compose:1.8.1"
implementation "androidx.compose.material:material"
implementation "androidx.compose.ui:ui-tooling-preview"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.3.1"
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.5.4"
debugImplementation "androidx.compose.ui:ui-tooling"
}
2 changes: 1 addition & 1 deletion sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:supportsRtl="true"
android:theme="@style/Theme.Validable">
<activity
android:name=".MainActivity"
android:name="tech.devscast.validable.sample.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Validable.NoActionBar">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package tech.devscast.validable_sample
package tech.devscast.validable.sample

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import tech.devscast.validable_sample.ui.screens.InputScreen
import tech.devscast.validable_sample.ui.theme.ValidableTheme
import tech.devscast.validable.sample.ui.screens.InputScreen
import tech.devscast.validable.sample.ui.theme.ValidableTheme

class MainActivity : ComponentActivity() {
@ExperimentalAnimationApi
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tech.devscast.validable_sample.ui.screens
package tech.devscast.validable.sample.ui.screens

import android.widget.Toast
import androidx.compose.animation.AnimatedVisibility
Expand All @@ -22,25 +22,23 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import tech.devscast.validable.EmailValidable
import tech.devscast.validable.NotEmptyValidable
import tech.devscast.validable.delegates.validableEmail
import tech.devscast.validable.withValidable

@ExperimentalAnimationApi
@Composable
fun InputScreen() {

val context = LocalContext.current

val emailField by validableEmail()
val emailField = remember { EmailValidable() }
val nameField = remember { NotEmptyValidable() }

Column(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.padding(24.dp)
) {

TextField(
value = emailField.value,
onValueChange = { emailField.value = it },
Expand All @@ -67,7 +65,6 @@ fun InputScreen() {
Spacer(modifier = Modifier.height(16.dp))

Button(onClick = {

withValidable(emailField, nameField) {
Toast.makeText(context, "All fields are valid", Toast.LENGTH_SHORT).show()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tech.devscast.validable_sample.ui.theme
package tech.devscast.validable.sample.ui.theme

import androidx.compose.ui.graphics.Color

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tech.devscast.validable_sample.ui.theme
package tech.devscast.validable.sample.ui.theme

import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Shapes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tech.devscast.validable_sample.ui.theme
package tech.devscast.validable.sample.ui.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.MaterialTheme
Expand Down Expand Up @@ -28,7 +28,7 @@ private val LightColorPalette = lightColors(
)

@Composable
fun ValidableTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable() () -> Unit) {
fun ValidableTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
val colors = if (darkTheme) {
DarkColorPalette
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tech.devscast.validable_sample.ui.theme
package tech.devscast.validable.sample.ui.theme

import androidx.compose.material.Typography
import androidx.compose.ui.text.TextStyle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tech.devscast.validable_sample
package tech.devscast.validable.sample

import org.junit.Assert.assertEquals
import org.junit.Test
Expand Down
20 changes: 10 additions & 10 deletions validable/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ plugins {
}

android {
compileSdk 33
compileSdk 34

defaultConfig {
minSdk 21
targetSdk 33
targetSdk 34

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand All @@ -24,17 +24,17 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '11'
jvmTarget = '17'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion "1.3.2"
kotlinCompilerExtensionVersion "1.5.5"
}
packagingOptions {
resources {
Expand All @@ -45,11 +45,11 @@ android {
}

dependencies {
implementation 'androidx.core:core-ktx:1.9.0'
implementation("androidx.core:core-ktx:1.12.0")
implementation platform('androidx.compose:compose-bom:2022.10.00')
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation "androidx.compose.ui:ui"
testImplementation 'junit:junit:4.13.2'
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.compose.ui:ui")
testImplementation("junit:junit:4.13.2")
}

afterEvaluate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package tech.devscast.validable.delegates

import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import tech.devscast.validable.EmailValidable
import tech.devscast.validable.NotEmptyValidable
import kotlin.properties.ReadOnlyProperty

@Deprecated("Use remember { NotEmptyValidable() } instead")
@Composable
fun validableNotEmpty(): ReadOnlyProperty<Any?, NotEmptyValidable> {
val instance = remember {
Expand All @@ -15,3 +17,15 @@ fun validableNotEmpty(): ReadOnlyProperty<Any?, NotEmptyValidable> {
instance
}
}

@Deprecated("Use remember { EmailValidable() } instead")
@Composable
fun validableEmail(): ReadOnlyProperty<Any?, EmailValidable> {
val instance = remember {
EmailValidable()
}

return ReadOnlyProperty { _, _ ->
instance
}
}

This file was deleted.