Skip to content

Commit

Permalink
Update dependency androidx.compose.ui:ui to v2024.09.00
Browse files Browse the repository at this point in the history
Updated Compose BOM to version 2024
.09.00 and removed deprecated `outlinedTextFieldColors` usages.
Added some IDE files.
  • Loading branch information
youndon committed Sep 9, 2024
1 parent 758f219 commit 710191b
Show file tree
Hide file tree
Showing 41 changed files with 541 additions and 262 deletions.
123 changes: 123 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
namespace = "city.zouitel.jetnote"
defaultConfig {
applicationId = "city.zouitel.jetnote"
versionCode = libs.versions.code.v.get().toInt()
versionName = libs.versions.name.v.get()
versionCode = libs.versions.code.version.get().toInt()
versionName = libs.versions.name.version.get()
}

buildTypes {
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
alias(libs.plugins.dependencyanalysis) apply false
alias(libs.plugins.licenses) apply false
alias(libs.plugins.enigma) apply false
alias(libs.plugins.composeCompiler) apply false
}

buildscript {
Expand Down
2 changes: 1 addition & 1 deletion common/systemDesign/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
plugins {
alias(libs.plugins.cityzouitel.androidLibrary)
alias(libs.plugins.cityzouitel.androidCompose)
alias(libs.plugins.cityzouitel.androidNavigation)
alias(libs.plugins.cityzouitel.composeVoyager)
}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package city.zouitel.systemDesign


object CommonConstants {
const val APP_VERSION = "5.9.4"
const val APP_VERSION = "6.0.0"
const val APP_NAME = "JetNote"
const val NONE = "unspecified"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
package city.zouitel.systemDesign

import android.net.Uri
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.content.MediaType
import androidx.compose.foundation.content.contentReceiver
import androidx.compose.foundation.content.hasMediaType
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.input.KeyboardActionHandler
import androidx.compose.foundation.text.input.TextFieldState
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.TextUnitType
import androidx.compose.ui.unit.dp

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun CommonTextField(
state: TextFieldState,
receiver: (Uri) -> Unit,
modifier: Modifier,
placeholder: String = "...",
textSize: TextUnit = TextUnit(19f, TextUnitType.Sp),
textColor: Color = Color.LightGray,
imeAction: ImeAction = ImeAction.Default,
keyboardAction: KeyboardActionHandler = KeyboardActionHandler { }
) {
Box(
modifier = Modifier.padding(7.dp)
) {
Text(
modifier = Modifier.padding(10.dp),
text = if (state.text.isEmpty()) placeholder else "",
color = Color.Gray,
fontSize = textSize,
)

BasicTextField(
state = state,
modifier = modifier
.padding(10.dp)
.background(Color.Transparent)
.contentReceiver { content ->
if(content.hasMediaType(MediaType.Image)) {
val data = content.clipEntry.clipData
for (index in 0 until data.itemCount) {
val item = data.getItemAt(index)
receiver.invoke(item.uri)
}
}
content
},
textStyle = TextStyle(
fontSize = textSize,
fontWeight = FontWeight.Normal,
fontFamily = FontFamily.Default,
color = textColor
),
keyboardOptions = KeyboardOptions(
capitalization = KeyboardCapitalization.Sentences,
autoCorrectEnabled = false,
keyboardType = KeyboardType.Text,
imeAction = imeAction
),
onKeyboardAction = keyboardAction
)
}
}

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun CommonTextField(
value: String = "",
onValueChange: (String) -> Unit = {},
receiver: (Uri) -> Unit,
modifier: Modifier,
placeholder: String = "...",
textSize: TextUnit = TextUnit(19f, TextUnitType.Sp),
textColor: Color = Color.LightGray,
imeAction: ImeAction = ImeAction.Default,
keyboardActions: KeyboardActions = KeyboardActions { }
) {
Box(
modifier = Modifier.padding(7.dp)
) {
Text(
modifier = Modifier.padding(10.dp),
text = if (value.isEmpty()) placeholder else "",
color = Color.Gray,
fontSize = textSize,
)

BasicTextField(
value = value,
onValueChange = onValueChange,
modifier = modifier
.padding(10.dp)
.background(Color.Transparent)
.contentReceiver { content ->
if(content.hasMediaType(MediaType.Image)) {
val data = content.clipEntry.clipData
for (index in 0 until data.itemCount) {
val item = data.getItemAt(index)
receiver.invoke(item.uri)
}
}
content
},
textStyle = TextStyle(
fontSize = textSize,
fontWeight = FontWeight.Normal,
fontFamily = FontFamily.Default,
color = textColor
),
keyboardOptions = KeyboardOptions(
capitalization = KeyboardCapitalization.Sentences,
autoCorrectEnabled = false,
keyboardType = KeyboardType.Text,
imeAction = imeAction
),
keyboardActions = keyboardActions
)
}
}
Loading

0 comments on commit 710191b

Please sign in to comment.