fix(v1.8.0): IMPL_06 Resolve ClickableText deprecation warning
- Replace deprecated ClickableText with modern Text + LinkAnnotation API - Update imports: remove ClickableText, add LinkAnnotation & withLink - Use TextLinkStyles for styled clickable links in changelog - Maintain URL click functionality without deprecated API - Update CHANGELOG.md with missing IMPL_04 & IMPL_06 feature details - Update CHANGELOG.de.md with matching German translations - Add Backup Settings Progress improvements to changelog - Add Post-Update Changelog Dialog documentation - Verify all 23 v1.8.0 features documented in changelog Resolves deprecation warning in Kotlin/Compose build. ClickableText is deprecated in favor of Text with LinkAnnotation for link handling. Migration maintains full functionality while using modern Compose APIs. Changelogs updated to include all major features from feature branch: IMPL_04 Backup Progress UI improvements and IMPL_06 Post-Update Changelog, marking v1.8.0 feature-complete with comprehensive documentation. Build: BUILD SUCCESSFUL - 0 Lint errors + 0 Deprecation warnings
This commit is contained in:
@@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.text.ClickableText
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
@@ -27,10 +26,12 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.LinkAnnotation
|
||||
import androidx.compose.ui.text.SpanStyle
|
||||
import androidx.compose.ui.text.buildAnnotatedString
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.text.withLink
|
||||
import androidx.compose.ui.text.withStyle
|
||||
import androidx.compose.ui.unit.dp
|
||||
import dev.dettmer.simplenotes.BuildConfig
|
||||
@@ -107,19 +108,19 @@ fun UpdateChangelogSheet() {
|
||||
lines.forEachIndexed { index, line ->
|
||||
if (line.startsWith("http://") || line.startsWith("https://")) {
|
||||
// Make URLs clickable
|
||||
pushStringAnnotation(
|
||||
tag = "URL",
|
||||
annotation = line.trim()
|
||||
)
|
||||
withStyle(
|
||||
style = SpanStyle(
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
textDecoration = TextDecoration.Underline
|
||||
withLink(
|
||||
LinkAnnotation.Url(
|
||||
url = line.trim(),
|
||||
styles = androidx.compose.ui.text.TextLinkStyles(
|
||||
style = SpanStyle(
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
textDecoration = TextDecoration.Underline
|
||||
)
|
||||
)
|
||||
)
|
||||
) {
|
||||
append(line)
|
||||
}
|
||||
pop()
|
||||
} else {
|
||||
append(line)
|
||||
}
|
||||
@@ -127,19 +128,12 @@ fun UpdateChangelogSheet() {
|
||||
}
|
||||
}
|
||||
|
||||
ClickableText(
|
||||
Text(
|
||||
text = annotatedText,
|
||||
style = MaterialTheme.typography.bodyMedium.copy(
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
),
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
onClick = { offset ->
|
||||
annotatedText.getStringAnnotations(tag = "URL", start = offset, end = offset)
|
||||
.firstOrNull()?.let { annotation ->
|
||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(annotation.item))
|
||||
context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(24.dp))
|
||||
|
||||
Reference in New Issue
Block a user