diff --git a/app/build.gradle.kts b/app/build.gradle.kts index fd95e24e1..f3c3965f0 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -27,7 +27,7 @@ android { defaultConfig { applicationId = "at.techbee.jtx" buildConfigField("long", "buildTime", "${System.currentTimeMillis()}L") - minSdk = 23 + minSdk = 24 targetSdk = 35 versionCode = 210000004 versionName = "2.10.00-beta01" // keep -release as a suffix also for release, build flavor adds the suffix e.g. .gplay (e.g. 1.00.00-rc0.gplay) diff --git a/app/src/main/java/at/techbee/jtx/ui/detail/DetailScreenContent.kt b/app/src/main/java/at/techbee/jtx/ui/detail/DetailScreenContent.kt index 0927bdbbc..c0aafeea5 100644 --- a/app/src/main/java/at/techbee/jtx/ui/detail/DetailScreenContent.kt +++ b/app/src/main/java/at/techbee/jtx/ui/detail/DetailScreenContent.kt @@ -9,6 +9,7 @@ package at.techbee.jtx.ui.detail import android.media.MediaPlayer +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -55,15 +56,12 @@ import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.AnnotatedString -import androidx.compose.ui.text.TextRange import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontStyle 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.text.input.TextFieldValue -import androidx.compose.ui.text.input.getTextBeforeSelection import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextDirection import androidx.compose.ui.tooling.preview.Preview @@ -96,9 +94,9 @@ import at.techbee.jtx.ui.detail.models.DetailsScreenSection import at.techbee.jtx.ui.reusable.elements.ProgressElement import at.techbee.jtx.ui.settings.DropdownSettingOption import at.techbee.jtx.util.DateTimeUtils -import com.arnyminerz.markdowntext.MarkdownText +import com.colintheshots.twain.MarkdownEditor +import com.colintheshots.twain.MarkdownText import kotlinx.coroutines.delay -import org.apache.commons.lang3.StringUtils import kotlin.time.Duration import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds @@ -416,15 +414,15 @@ fun DetailScreenContent( markdown = description.text.trim(), modifier = Modifier .fillMaxWidth() - .padding(8.dp), + .padding(8.dp) + .clickable(onClick = { + if (collection?.readonly == false) + isEditMode.value = true + }), style = TextStyle( textDirection = TextDirection.Content, fontFamily = LocalTextStyle.current.fontFamily ), - onClick = { - if (collection?.readonly == false) - isEditMode.value = true - } ) else Text( @@ -466,18 +464,18 @@ fun DetailScreenContent( } if(description.text.isNotEmpty() || detailSettings.detailSetting[DetailSettingsOption.ENABLE_DESCRIPTION] == true || showAllOptions) { - OutlinedTextField( - value = description, + MarkdownEditor( + value = description.text, onValueChange = { - +/* // START Create bulletpoint if previous line started with a bulletpoint val enteredCharIndex = - StringUtils.indexOfDifference(it.text, description.text) + StringUtils.indexOfDifference(it, description.text) val enteredCharIsReturn = enteredCharIndex >= 0 - && it.text.substring(enteredCharIndex) + && it.substring(enteredCharIndex) .startsWith(System.lineSeparator()) - && it.text.length > description.text.length // excludes backspace! + && it.length > description.text.length // excludes backspace! val before = it.getTextBeforeSelection(Int.MAX_VALUE) val after = @@ -496,7 +494,7 @@ fun DetailScreenContent( } description = - if (description.text != it.text && (nextLineStartWith != null) && enteredCharIsReturn) + if (description.text != it && (nextLineStartWith != null) && enteredCharIsReturn) TextFieldValue( annotatedString = before.plus( AnnotatedString( @@ -509,16 +507,21 @@ fun DetailScreenContent( it // END Create bulletpoint if previous line started with a bulletpoint - iCalObject.description = it.text.ifEmpty { null } + + */ + description = description.copy(it) + iCalObject.description = it.ifEmpty { null } changeState.value = DetailViewModel.DetailChangeState.CHANGEUNSAVED }, - label = { Text(stringResource(id = R.string.description)) }, + hint = R.string.description, + /* keyboardOptions = KeyboardOptions( capitalization = KeyboardCapitalization.Sentences, keyboardType = KeyboardType.Text, imeAction = ImeAction.Default ), minLines = 3, + */ modifier = Modifier .fillMaxWidth() .padding(8.dp) diff --git a/app/src/main/java/at/techbee/jtx/ui/list/ListCard.kt b/app/src/main/java/at/techbee/jtx/ui/list/ListCard.kt index 7b2b5a5b3..eed3f6811 100644 --- a/app/src/main/java/at/techbee/jtx/ui/list/ListCard.kt +++ b/app/src/main/java/at/techbee/jtx/ui/list/ListCard.kt @@ -77,7 +77,7 @@ import at.techbee.jtx.ui.settings.DropdownSettingOption import at.techbee.jtx.ui.theme.Typography import at.techbee.jtx.ui.theme.jtxCardBorderStrokeWidth import at.techbee.jtx.ui.theme.jtxCardCornerShape -import com.arnyminerz.markdowntext.MarkdownText +import com.colintheshots.twain.MarkdownText import sh.calvin.reorderable.ReorderableColumn @@ -145,7 +145,7 @@ fun ListCard( MarkdownText( markdown = iCalObject.description?.trim() ?: "", maxLines = 6, - overflow = TextOverflow.Ellipsis, + //overflow = TextOverflow.Ellipsis, modifier = Modifier.fillMaxWidth() ) else diff --git a/app/src/main/java/at/techbee/jtx/ui/list/ListCardGrid.kt b/app/src/main/java/at/techbee/jtx/ui/list/ListCardGrid.kt index 4de485e92..ddecc6979 100644 --- a/app/src/main/java/at/techbee/jtx/ui/list/ListCardGrid.kt +++ b/app/src/main/java/at/techbee/jtx/ui/list/ListCardGrid.kt @@ -40,7 +40,7 @@ import at.techbee.jtx.database.locals.StoredCategory import at.techbee.jtx.database.views.ICal4List import at.techbee.jtx.ui.reusable.elements.AudioPlaybackElement import at.techbee.jtx.ui.theme.jtxCardBorderStrokeWidth -import com.arnyminerz.markdowntext.MarkdownText +import com.colintheshots.twain.MarkdownText @Composable @@ -125,7 +125,7 @@ fun ListCardGrid( MarkdownText( markdown = iCalObject.description?.trim() ?: "", maxLines = 3, - overflow = TextOverflow.Ellipsis, + //overflow = TextOverflow.Ellipsis, modifier = Modifier .fillMaxWidth() .padding(end = 8.dp) diff --git a/app/src/main/java/at/techbee/jtx/ui/list/ListCardKanban.kt b/app/src/main/java/at/techbee/jtx/ui/list/ListCardKanban.kt index 02f907623..d54cdd12d 100644 --- a/app/src/main/java/at/techbee/jtx/ui/list/ListCardKanban.kt +++ b/app/src/main/java/at/techbee/jtx/ui/list/ListCardKanban.kt @@ -37,7 +37,7 @@ import at.techbee.jtx.database.locals.StoredCategory import at.techbee.jtx.database.views.ICal4List import at.techbee.jtx.ui.reusable.elements.AudioPlaybackElement import at.techbee.jtx.ui.theme.jtxCardBorderStrokeWidth -import com.arnyminerz.markdowntext.MarkdownText +import com.colintheshots.twain.MarkdownText @Composable @@ -95,7 +95,7 @@ fun ListCardKanban( MarkdownText( markdown = iCalObject.description?.trim() ?: "", maxLines = 4, - overflow = TextOverflow.Ellipsis + //overflow = TextOverflow.Ellipsis ) else Text( diff --git a/app/src/main/java/at/techbee/jtx/ui/reusable/dialogs/Jtx20009ReleaseInfoDialog.kt b/app/src/main/java/at/techbee/jtx/ui/reusable/dialogs/Jtx20009ReleaseInfoDialog.kt index 1b3b8612b..57ebc7612 100644 --- a/app/src/main/java/at/techbee/jtx/ui/reusable/dialogs/Jtx20009ReleaseInfoDialog.kt +++ b/app/src/main/java/at/techbee/jtx/ui/reusable/dialogs/Jtx20009ReleaseInfoDialog.kt @@ -22,7 +22,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import at.techbee.jtx.R -import com.arnyminerz.markdowntext.MarkdownText +import com.colintheshots.twain.MarkdownText @Composable diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index de9804613..78a654032 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -42,6 +42,7 @@ playServicesLocation = "21.3.0" playServicesMaps = "19.0.0" profileinstaller = "1.4.1" reorderable = "2.4.0" +twain = "0.3.2" uiTextGoogleFonts = "1.7.6" room = "2.6.1" volley = "1.2.1" @@ -107,6 +108,7 @@ room-base = { module = "androidx.room:room-ktx", version.ref = "room" } room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" } room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" } room-testing = { module = "androidx.room:room-testing", version.ref = "room" } +twain = { module = "com.colintheshots:twain", version.ref = "twain" } volley = { module = "com.android.volley:volley", version.ref = "volley" } # gplay and managed build variants