Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compose Multiplatform #89

Open
wants to merge 59 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
487261f
refactor core module to multiplatform
DatL4g Mar 29, 2024
58908fb
multiplatform core module
DatL4g Mar 29, 2024
1d38e02
fix old android targets
DatL4g Mar 29, 2024
2f65c32
prepare calendar multiplatform
DatL4g Mar 29, 2024
392641f
calendar multiplatform compatible
DatL4g Mar 29, 2024
afa6178
rating multiplatform compatible
DatL4g Mar 30, 2024
5393ed2
option multiplatform compatible
DatL4g Mar 30, 2024
50dcb48
list multiplatform compatible
DatL4g Mar 30, 2024
83dde05
multiplatform landscape check
DatL4g Mar 30, 2024
8e11b75
prepare snapshot release
DatL4g Mar 30, 2024
75d6893
fix snapshot release
DatL4g Mar 30, 2024
0cd7fa2
added release workflow
DatL4g Mar 30, 2024
da08075
api core library
DatL4g Mar 30, 2024
8ecc373
make states fully serializable
DatL4g Mar 30, 2024
14e7852
added missing java serialization
DatL4g Mar 30, 2024
981caa0
skip workflows
DatL4g Mar 30, 2024
3da43ed
fix calendar module
DatL4g Mar 30, 2024
4efdbde
fix calendar module
DatL4g Mar 30, 2024
879f669
fix calendar resources
DatL4g Mar 30, 2024
87bb4a0
fix calendar arrow size
DatL4g Mar 30, 2024
ba08232
added default selection for rating
DatL4g Apr 3, 2024
a8ba838
fix resources
DatL4g Apr 3, 2024
b795aa9
added possibility to deselect rating and rating of 0 is valid
DatL4g Apr 4, 2024
47a5cca
migrate state module
DatL4g Apr 4, 2024
8d3262e
migrate input module
DatL4g Apr 4, 2024
adeb1c0
migrate info module
DatL4g Apr 4, 2024
6f30cb1
migrate color module
DatL4g Apr 4, 2024
446bdd0
migrate emoji module
DatL4g Apr 11, 2024
37bc03c
migrate emoji module
DatL4g Apr 11, 2024
2a6a658
migrate date_time module
DatL4g Apr 11, 2024
dcc5d95
migrate date_time module
DatL4g Apr 11, 2024
7b2940a
migrate date_time module
DatL4g Apr 11, 2024
0d1f94e
migrate duration module
DatL4g Apr 12, 2024
38d3372
migrate clock module
DatL4g Apr 12, 2024
1d5bfa7
added missing configuration
DatL4g Apr 12, 2024
b29bc84
changed readme as core module is not required to add manually anymore
DatL4g Apr 12, 2024
02dbb78
added wasm target
DatL4g Apr 12, 2024
a6a90ff
added missing wasm implementations
DatL4g Apr 12, 2024
5f185b5
chore(deps): ⬆️ Upgraded Compose versions
maicol07 Apr 15, 2024
fb7d802
refactor: Moved dependency management from buildSrc to Version Catalog
maicol07 Apr 16, 2024
1c81161
Merge pull request #1 from maicol07/main
DatL4g Apr 16, 2024
da9f1f1
updated compose
DatL4g Apr 17, 2024
3886da0
ignore some fields from java serialization
DatL4g Apr 18, 2024
8c34770
roll back compose version
DatL4g Apr 18, 2024
e53bb5f
update to latest compose version
DatL4g Apr 29, 2024
cee7dbe
update to latest compose version
DatL4g Apr 30, 2024
90b23af
option invoke click listener
DatL4g Apr 30, 2024
01e57b0
option icon size
DatL4g May 12, 2024
b022d95
rating body max width
DatL4g May 12, 2024
dd2451a
revert sizing
DatL4g May 12, 2024
f16d2d3
revert LocalDate calculations and fix visual error
DatL4g May 13, 2024
dce4cd0
removed unused file
DatL4g May 13, 2024
f21cd3d
apply system locale on jvm
DatL4g May 14, 2024
24de041
added missing localization
DatL4g May 14, 2024
27692e6
added body for option
DatL4g May 14, 2024
ed2ba8c
added missing body dependency injection
DatL4g May 14, 2024
d2848f5
updated compose
DatL4g May 17, 2024
01f3361
updated dependencies
DatL4g May 22, 2024
3518cc7
fix crash on android
DatL4g May 31, 2024
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
Prev Previous commit
Next Next commit
migrate state module
  • Loading branch information
DatL4g committed Apr 4, 2024
commit 47a5cca1df8252bf41681085d08226105d5c6f50
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ internal class RatingState(
private fun isRatingValid(): Boolean = if (config.ratingZeroValid) {
true
} else {
rating != null
rating != null && (rating ?: 0) > 0
}

private fun isFeedbackValid(): Boolean =
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ include(
//":date_time",
//":color",
":option",
//":state",
":state",
//":input",
//":emoji",
":list",
Expand Down
68 changes: 49 additions & 19 deletions state/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,27 +1,57 @@
/*
* Copyright (C) 2022-2024. Maximilian Keppeler (https://www.maxkeppeler.com)
*
* 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.
*/
import com.vanniktech.maven.publish.SonatypeHost

plugins {
id(Plugins.CUSTOM_LIBRARY_MODULE.id)
alias(libs.plugins.android.library)
alias(libs.plugins.compose)
alias(libs.plugins.multiplatform)
alias(libs.plugins.serialization)
alias(libs.plugins.publish)
`maven-publish`
}

android {
namespace = Modules.STATE.namespace
compileSdk = 34

defaultConfig {
minSdk = 21
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

mavenPublishing {
publishToMavenCentral()
signAllPublications()
kotlin {
androidTarget {
publishAllLibraryVariants()
}
jvm()

iosX64()
iosArm64()
iosSimulatorArm64()

macosX64()
macosArm64()

js(IR) {
browser()
binaries.executable()
}

applyDefaultHierarchyTemplate()

sourceSets {
commonMain.dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
implementation(compose.components.resources)

implementation(libs.serialization)

api(project(":core"))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.unit.dp
import com.maxkeppeker.sheets.core.models.base.Header
import com.maxkeppeker.sheets.core.views.base.FrameBase
import com.maxkeppeler.sheets.state.models.StateConfig
import com.maxkeppeler.sheets.state.models.StateSelection
import com.maxkeppeler.sheets.state.views.StateComponent
import com.maxkeppeler.sheets.core.R as RC

/**
* State dialog for the use-case to display various states.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,18 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.unit.dp
import com.maxkeppeker.sheets.core.utils.TestTags
import com.maxkeppeker.sheets.core.utils.testTags
import com.maxkeppeler.sheets.state.R
import com.maxkeppeler.sheets.state.models.ProgressIndicator
import com.maxkeppeler.sheets.core.R as RC

@Composable
internal fun CircularProgressIndicator(
indicator: ProgressIndicator.Circular,
) {
val circularIndicatorModifier = Modifier
.padding(24.dp)
.width(dimensionResource(id = R.dimen.scd_state_dialog_indicator_width))
.width(64.dp)
.aspectRatio(1f)

indicator.customProgressIndicator?.invoke(indicator.value!!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.unit.dp
import com.maxkeppeker.sheets.core.utils.TestTags
import com.maxkeppeker.sheets.core.utils.testTags
import com.maxkeppeler.sheets.state.models.ProgressIndicator
import com.maxkeppeler.sheets.core.R as RC

@Composable
internal fun LinearProgressIndicator(
Expand All @@ -47,9 +46,9 @@ internal fun LinearProgressIndicator(
)
}
LinearProgressIndicator(
progress = progress,
progress = { progress },
modifier = linearIndicatorModifier
.testTags(TestTags.STATE_LOADING_LINEAR, progress)
.testTags(TestTags.STATE_LOADING_LINEAR, progress),
)
} ?: run {
LinearProgressIndicator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.unit.dp
import com.maxkeppeker.sheets.core.utils.TestTags
import com.maxkeppeler.sheets.state.models.State
import com.maxkeppeler.sheets.state.models.StateConfig
import com.maxkeppeler.sheets.core.R as RC

/**
* The failure state component.
Expand All @@ -43,7 +42,7 @@ internal fun StateFailureComponent(
modifier = Modifier
.testTag(TestTags.STATE_FAILURE)
.padding(vertical = 16.dp)
.size(dimensionResource(id = RC.dimen.scd_size_350)),
.size(56.dp),
imageVector = config.icons.Error,
contentDescription = null,
tint = Color.Red
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.unit.dp
import com.maxkeppeker.sheets.core.utils.TestTags
import com.maxkeppeler.sheets.state.models.State
import com.maxkeppeler.sheets.state.models.StateConfig
import com.maxkeppeler.sheets.core.R as RC

/**
* The success state component.
Expand All @@ -43,7 +42,7 @@ internal fun StateSuccessComponent(
modifier = Modifier
.testTag(TestTags.STATE_SUCCESS)
.padding(vertical = 16.dp)
.size(dimensionResource(id = RC.dimen.scd_size_350)),
.size(56.dp),
imageVector = config.icons.Check,
contentDescription = null,
tint = Color.Green
Expand Down
5 changes: 0 additions & 5 deletions state/src/main/res/values/dimens.xml

This file was deleted.