Skip to content

Commit

Permalink
Address most warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
wingio committed Aug 28, 2024
1 parent 08819f4 commit f46e71d
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.materiiapps.gloom.service
import android.app.Service
import android.content.Intent
import android.content.pm.PackageInstaller
import android.os.Build
import android.os.IBinder
import com.materiiapps.gloom.Res
import com.materiiapps.gloom.domain.manager.ToastManager
Expand All @@ -26,8 +27,12 @@ class InstallService : Service(), KoinComponent {
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
when (val statusCode = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)) {
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
val confirmationIntent = intent.getParcelableExtra<Intent>(Intent.EXTRA_INTENT)!!
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)

@Suppress("DEPRECATION")
val confirmationIntent = when {
Build.VERSION.SDK_INT < 34 -> intent.getParcelableExtra<Intent>(Intent.EXTRA_INTENT)!!
else -> intent.getParcelableExtra(Intent.EXTRA_INTENT, Intent::class.java)!!
}.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)

startActivity(confirmationIntent)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.materiiapps.gloom.ui.components

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.runtime.Composable
Expand All @@ -15,7 +15,7 @@ fun BackButton() {

if (nav?.canPop == true) {
IconButton(onClick = { nav.pop() }) {
Icon(Icons.Filled.ArrowBack, stringResource(Res.strings.action_back))
Icon(Icons.AutoMirrored.Filled.ArrowBack, stringResource(Res.strings.action_back))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Divider
import androidx.compose.material3.DividerDefaults
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ProvideTextStyle
import androidx.compose.runtime.Composable
Expand All @@ -28,7 +28,7 @@ fun DividerWithLabel(
contentAlignment = Alignment.Center,
modifier = modifier
) {
Divider(
HorizontalDivider(
thickness = thickness,
color = color
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.materiiapps.gloom.ui.components

import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.dp

@Composable
fun ThinDivider() = Divider(
color = MaterialTheme.colorScheme.onSurface.copy(0.1f),
fun ThinDivider() = HorizontalDivider(
thickness = 0.5.dp,
color = MaterialTheme.colorScheme.onSurface.copy(0.1f)
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INVISIBLE_REFERENCE")

package com.materiiapps.gloom.ui.components.bottomsheet

import androidx.compose.foundation.layout.ColumnScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ChevronRight
import androidx.compose.material.icons.filled.LocalOffer
import androidx.compose.material.icons.outlined.LocalOffer
import androidx.compose.material3.Divider
import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -52,6 +51,7 @@ import com.materiiapps.gloom.Res
import com.materiiapps.gloom.api.dto.user.User
import com.materiiapps.gloom.gql.fragment.NewReleaseItemFragment
import com.materiiapps.gloom.ui.components.Avatar
import com.materiiapps.gloom.ui.components.ThinDivider
import com.materiiapps.gloom.ui.icons.Commit
import com.materiiapps.gloom.ui.icons.Custom
import com.materiiapps.gloom.ui.screens.release.ReleaseScreen
Expand Down Expand Up @@ -219,10 +219,7 @@ fun ReleaseCard(
}
}

Divider(
color = MaterialTheme.colorScheme.onSurface.copy(0.1f),
thickness = 0.5.dp,
)
ThinDivider()

Row(
horizontalArrangement = Arrangement.spacedBy(10.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.paging.compose.itemKey
import cafe.adriel.voyager.core.screen.Screen
import com.apollographql.apollo.api.Query
import com.materiiapps.gloom.ui.components.RefreshIndicator
import com.materiiapps.gloom.ui.components.ThinDivider
import com.materiiapps.gloom.ui.components.toolbar.LargeToolbar
import com.materiiapps.gloom.ui.screens.list.viewmodel.BaseListViewModel
import dev.icerock.moko.resources.StringResource
Expand Down Expand Up @@ -74,10 +75,7 @@ abstract class BaseListScreen<I : Any, D : Query.Data?, VM : BaseListViewModel<I
val item = items[index]
if (item != null) {
Item(item)
Divider(
color = MaterialTheme.colorScheme.onSurface.copy(0.1f),
thickness = 0.5.dp,
)
ThinDivider()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.InsertDriveFile
import androidx.compose.material.icons.filled.Download
import androidx.compose.material.icons.outlined.Android
import androidx.compose.material.icons.outlined.Archive
import androidx.compose.material.icons.outlined.FolderZip
import androidx.compose.material.icons.outlined.InsertDriveFile
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalContentColor
Expand All @@ -33,8 +33,8 @@ import androidx.compose.ui.unit.sp
import com.materiiapps.gloom.Res
import com.materiiapps.gloom.domain.manager.DialogManager
import com.materiiapps.gloom.domain.manager.DialogState
import com.materiiapps.gloom.ui.utils.getFileSizeString
import com.materiiapps.gloom.ui.screens.release.dialog.ReleaseAssetDownloadDialog
import com.materiiapps.gloom.ui.utils.getFileSizeString
import dev.icerock.moko.resources.compose.stringResource
import org.koin.compose.koinInject

Expand Down Expand Up @@ -70,7 +70,7 @@ fun ReleaseAsset(
"tar",
"gz" -> Icons.Outlined.FolderZip

else -> Icons.Outlined.InsertDriveFile
else -> Icons.AutoMirrored.Outlined.InsertDriveFile
}

Row(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.VerticalDivider
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -132,11 +133,10 @@ fun IssueOrPRItem(
.height(23.dp)
.padding(horizontal = 3.dp)
) {
Divider(
VerticalDivider(
color = MaterialTheme.colorScheme.primary.copy(alpha = 0.5f),
modifier = Modifier
.height(18.dp)
.width(1.dp)
thickness = 1.dp,
modifier = Modifier.height(18.dp)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import com.materiiapps.gloom.Res
import com.materiiapps.gloom.ui.components.LargeSegmentedButton
import com.materiiapps.gloom.ui.components.LargeSegmentedButtonRow
import com.materiiapps.gloom.ui.components.RefreshIndicator
import com.materiiapps.gloom.ui.components.ThinDivider
import com.materiiapps.gloom.ui.icons.Balance
import com.materiiapps.gloom.ui.icons.Custom
import com.materiiapps.gloom.ui.icons.Fork
Expand Down Expand Up @@ -145,10 +146,7 @@ class DetailsTab(
}
}

Divider(
color = MaterialTheme.colorScheme.onSurface.copy(0.1f),
thickness = 0.5.dp,
)
ThinDivider()
}

Box(
Expand Down Expand Up @@ -188,10 +186,7 @@ class DetailsTab(
}
}

Divider(
color = MaterialTheme.colorScheme.onSurface.copy(0.1f),
thickness = 0.5.dp,
)
ThinDivider()

if (!(details.readme?.contentHTML).isNullOrBlank()) {
Text(
Expand All @@ -214,19 +209,13 @@ class DetailsTab(
}

repoDetails.contributors.let {
if (it.nodes?.isNotEmpty() == true) Divider(
color = MaterialTheme.colorScheme.onSurface.copy(0.1f),
thickness = 0.5.dp,
)
if (it.nodes?.isNotEmpty() == true) ThinDivider()

ContributorsRow(contributors = it)
}

repoDetails.languages?.languages?.let {
if (it.edges?.isNotEmpty() == true) Divider(
color = MaterialTheme.colorScheme.onSurface.copy(0.1f),
thickness = 0.5.dp,
)
if (it.edges?.isNotEmpty() == true) ThinDivider()
LanguageMakeup(it)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.pullrefresh.pullRefresh
import androidx.compose.material.pullrefresh.rememberPullRefreshState
import androidx.compose.material3.Divider
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
Expand All @@ -23,6 +22,7 @@ import cafe.adriel.voyager.navigator.tab.TabOptions
import com.benasher44.uuid.uuid4
import com.materiiapps.gloom.Res
import com.materiiapps.gloom.ui.components.RefreshIndicator
import com.materiiapps.gloom.ui.components.ThinDivider
import com.materiiapps.gloom.ui.screens.repo.viewmodel.RepoIssuesViewModel
import com.materiiapps.gloom.ui.screens.repo.component.IssueItem
import dev.icerock.moko.resources.compose.stringResource
Expand Down Expand Up @@ -66,10 +66,7 @@ class IssuesTab(
items[index]?.let { issue ->
Column {
IssueItem(issue)
Divider(
color = MaterialTheme.colorScheme.onSurface.copy(0.1f),
thickness = 0.5.dp,
)
ThinDivider()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import cafe.adriel.voyager.navigator.tab.TabOptions
import com.benasher44.uuid.uuid4
import com.materiiapps.gloom.Res
import com.materiiapps.gloom.ui.components.RefreshIndicator
import com.materiiapps.gloom.ui.components.ThinDivider
import com.materiiapps.gloom.ui.screens.repo.viewmodel.RepoPullRequestsViewModel
import com.materiiapps.gloom.ui.screens.repo.component.PullRequestItem
import dev.icerock.moko.resources.compose.stringResource
Expand Down Expand Up @@ -66,10 +67,7 @@ class PullRequestTab(
items[index]?.let { pullRequest ->
Column {
PullRequestItem(pullRequest)
Divider(
color = MaterialTheme.colorScheme.onSurface.copy(0.1f),
thickness = 0.5.dp,
)
ThinDivider()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ enum class RootTab(val tab: Tab) {
PROFILE(ProfileTab())
}

tailrec fun Navigator.navigate(screen: Screen) {
fun Navigator.navigate(screen: Screen) {
return if (parent == null && items.firstOrNull { it.key == screen.key } == null) try {
push(screen)
} catch (_: Throwable) {
Expand Down

0 comments on commit f46e71d

Please sign in to comment.