Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed May 31, 2023
1 parent 1c43098 commit 51018f6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 31 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ android {

applicationVariants.configureEach { variant ->
def copyArtifactList = tasks.register("copy${variant.name.capitalize()}ArtifactList", Copy) {
dependsOn "licensee${variant.name.capitalize()}"
dependsOn tasks.named("licensee${variant.name.capitalize()}")
from project.extensions.getByType(ReportingExtension).file("licensee/${variant.name}/artifacts.json")
into layout.buildDirectory.dir("generated/dependencyAssets/")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ private val iconPackIntents = listOf(
Intent("android.intent.action.MAIN").addCategory("com.anddoes.launcher.THEME")
)

class PreferenceViewModel(private val app: Application) : AndroidViewModel(app),
PreferenceInteractor {
class PreferenceViewModel(private val app: Application) : AndroidViewModel(app), PreferenceInteractor {

private val themedIconPackIntents =
listOf(Intent(app.getString(R.string.icon_packs_intent_name)))
private val themedIconPackIntents = listOf(Intent(app.getString(R.string.icon_packs_intent_name)))
override val iconPacks = flow {
val pm = app.packageManager
val iconPacks = iconPackIntents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,35 +100,34 @@ fun NoticePage(index: Int) {
label = ossLibrary?.name ?: stringResource(id = R.string.loading)
) {
Crossfade(targetState = data, label = "") { it ->
if (it != null) {
val uriHandler = LocalUriHandler.current
val layoutResult = remember { mutableStateOf<TextLayoutResult?>(null) }
val pressIndicator = Modifier.pointerInput(Unit) {
detectTapGestures { pos ->
layoutResult.value?.let { layoutResult ->
val position = layoutResult.getOffsetForPosition(pos)
val annotation =
it.notice.getStringAnnotations(position, position).firstOrNull()
if (annotation?.tag == "URL") {
uriHandler.openUri(annotation.item)
}
it ?: return@Crossfade
val uriHandler = LocalUriHandler.current
val layoutResult = remember { mutableStateOf<TextLayoutResult?>(null) }
val pressIndicator = Modifier.pointerInput(Unit) {
detectTapGestures { pos ->
layoutResult.value?.let { layoutResult ->
val position = layoutResult.getOffsetForPosition(pos)
val annotation =
it.notice.getStringAnnotations(position, position).firstOrNull()
if (annotation?.tag == "URL") {
uriHandler.openUri(annotation.item)
}
}
}

Text(
modifier = Modifier
.fillMaxWidth()
.padding(start = 16.dp, end = 16.dp, top = 8.dp, bottom = 16.dp)
.then(pressIndicator),
text = it.notice,
fontFamily = FontFamily.Monospace,
fontSize = 14.sp,
onTextLayout = {
layoutResult.value = it
}
)
}

Text(
modifier = Modifier
.fillMaxWidth()
.padding(start = 16.dp, end = 16.dp, top = 8.dp, bottom = 16.dp)
.then(pressIndicator),
text = it.notice,
fontFamily = FontFamily.Monospace,
fontSize = 14.sp,
onTextLayout = {
layoutResult.value = it
}
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ data class OssLibrary(
val artifactId: String,
val version: String,
val name: String,
val scm: Scm? = null,
val spdxLicenses: List<License>? = null,
val unknownLicenses: List<License>? = null,
val scm: Scm? = null,
) {
@Serializable
data class License(
Expand Down

0 comments on commit 51018f6

Please sign in to comment.