mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 19:32:16 +00:00
Clean up
This commit is contained in:
parent
b8366061d4
commit
132a60ff3f
@ -1,8 +1,6 @@
|
||||
package com.machiav3lli.fdroid.network
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.view.View
|
||||
import com.machiav3lli.fdroid.database.entity.Repository
|
||||
import com.machiav3lli.fdroid.entity.Screenshot
|
||||
import com.machiav3lli.fdroid.utility.extension.text.nullIfEmpty
|
||||
@ -10,8 +8,6 @@ import okhttp3.Cache
|
||||
import okhttp3.Call
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import java.io.File
|
||||
import kotlin.math.min
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
object CoilDownloader {
|
||||
private const val HOST_ICON = "icon"
|
||||
@ -110,39 +106,6 @@ object CoilDownloader {
|
||||
.build()
|
||||
}
|
||||
|
||||
fun createIconUri(
|
||||
view: View,
|
||||
packageName: String,
|
||||
icon: String,
|
||||
metadataIcon: String,
|
||||
repository: Repository,
|
||||
): Uri {
|
||||
val size = (view.layoutParams.let { min(it.width, it.height) } /
|
||||
view.resources.displayMetrics.density).roundToInt()
|
||||
return createIconUri(view.context, packageName, icon, metadataIcon, size, repository)
|
||||
}
|
||||
|
||||
private fun createIconUri(
|
||||
context: Context, packageName: String, icon: String, metadataIcon: String,
|
||||
targetSizeDp: Int, repository: Repository,
|
||||
): Uri {
|
||||
return Uri.Builder().scheme("https").authority(HOST_ICON)
|
||||
.appendQueryParameter(QUERY_ADDRESS, repository.address)
|
||||
.appendQueryParameter(QUERY_AUTHENTICATION, repository.authentication)
|
||||
.appendQueryParameter(QUERY_PACKAGE_NAME, packageName)
|
||||
.appendQueryParameter(QUERY_ICON, icon)
|
||||
.appendQueryParameter(QUERY_METADATA_ICON, metadataIcon)
|
||||
.apply {
|
||||
if (repository.version >= 11) {
|
||||
val displayDpi = context.resources.displayMetrics.densityDpi
|
||||
val requiredDpi = displayDpi * targetSizeDp / 48
|
||||
val iconDpi = supportedDpis.find { it >= requiredDpi } ?: supportedDpis.last()
|
||||
appendQueryParameter(QUERY_DPI, iconDpi.toString())
|
||||
}
|
||||
}
|
||||
.build()
|
||||
}
|
||||
|
||||
fun createIconUri(
|
||||
packageName: String, icon: String, metadataIcon: String,
|
||||
address: String?, auth: String?
|
||||
|
@ -136,7 +136,7 @@ class SyncService : ConnectionService<SyncService.Binder>() {
|
||||
return removed || currentTask != null
|
||||
}
|
||||
|
||||
fun setUpdateNotificationBlocker(fragment: Fragment?) {
|
||||
fun setUpdateNotificationBlocker(fragment: Fragment?) { // TODO should the notification be canceled on opening a specific page?
|
||||
updateNotificationBlockerFragment = fragment?.let(::WeakReference)
|
||||
if (fragment != null) {
|
||||
notificationManager.cancel(NOTIFICATION_ID_UPDATES)
|
||||
|
@ -1,6 +1,10 @@
|
||||
package com.machiav3lli.fdroid.ui.compose.components
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.requiredSize
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
|
@ -8,7 +8,12 @@ import androidx.compose.foundation.layout.wrapContentWidth
|
||||
import androidx.compose.foundation.lazy.LazyRow
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.SideEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
|
||||
<string name="action_failed">Action failed</string>
|
||||
<string name="add_repository">Add repository</string>
|
||||
<string name="address">Address</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user