Compose Updated, Dialog and Windows Exe Not working fix, Icons Added.

This commit is contained in:
shabinder 2021-09-26 03:26:04 +05:30
parent 45ff63a8bf
commit d4076be165
10 changed files with 123 additions and 82 deletions

View File

@ -22,9 +22,9 @@ import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo
object Versions {
// App's Version (To be bumped at each update)
const val versionName = "3.3.0"
const val versionName = "3.3.1"
const val versionCode = 24
const val versionCode = 25
// Kotlin
const val kotlinVersion = "1.5.21"
@ -122,7 +122,7 @@ object JetBrains {
object Compose {
// __LATEST_COMPOSE_RELEASE_VERSION__
private const val VERSION = "1.0.0-alpha2"
private const val VERSION = "1.0.0-alpha3"
const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION"
}
}

View File

@ -16,8 +16,6 @@
package com.shabinder.common.uikit.utils
import android.util.Log
import androidx.compose.animation.core.TweenSpec
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.runtime.getValue
@ -26,7 +24,6 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
@ -70,10 +67,10 @@ fun Modifier.verticalGradientScrim(
}
var height by remember { mutableStateOf(fixedHeight ?: 1f) }
val scrimHeight by animateFloatAsState(
// Whenever the target value changes, new animation
// will start to the new target value
targetValue = height,
animationSpec = tween(durationMillis = 1500)
// Whenever the target value changes, new animation
// will start to the new target value
targetValue = height,
animationSpec = tween(durationMillis = 1500)
)
val brush = remember(color, numStops, startYPercentage, endYPercentage, scrimHeight) {
Brush.verticalGradient(

View File

@ -3,6 +3,9 @@ package com.shabinder.common.uikit
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.painter.BitmapPainter
import androidx.compose.ui.res.loadImageBitmap
import androidx.compose.ui.res.useResource
@OptIn(ExperimentalAnimationApi::class)
@Composable
@ -12,7 +15,11 @@ actual fun Dialog(
content: @Composable () -> Unit
) {
AnimatedVisibility(isVisible) {
androidx.compose.ui.window.Dialog(onDismiss) {
androidx.compose.ui.window.Dialog(
onDismiss,
title = "SpotiFlyer",
icon = BitmapPainter(useResource("drawable/spotiflyer.png", ::loadImageBitmap))
) {
content()
}
}

View File

@ -54,7 +54,10 @@ interface FileManager {
fun createDirectory(dirPath: String)
suspend fun cacheImage(image: Any, path: String) // in Android = ImageBitmap, Desktop = BufferedImage
suspend fun cacheImage(
image: Any,
path: String
) // in Android = ImageBitmap, Desktop = BufferedImage
suspend fun loadImage(url: String, reqWidth: Int = 150, reqHeight: Int = 150): Picture
@ -74,13 +77,15 @@ interface FileManager {
* */
fun FileManager.createDirectories() {
try {
createDirectory(defaultDir())
createDirectory(imageCacheDir())
createDirectory(defaultDir() + "Tracks/")
createDirectory(defaultDir() + "Albums/")
createDirectory(defaultDir() + "Playlists/")
createDirectory(defaultDir() + "YT_Downloads/")
} catch (ignored: Exception) {}
if (defaultDir() != "null") {
createDirectory(defaultDir())
createDirectory(imageCacheDir())
createDirectory(defaultDir() + "Tracks/")
createDirectory(defaultDir() + "Albums/")
createDirectory(defaultDir() + "Playlists/")
createDirectory(defaultDir() + "YT_Downloads/")
}
} catch (ignored: Exception) { }
}
fun FileManager.finalOutputDir(
@ -98,7 +103,8 @@ fun FileManager.finalOutputDir(
/*DIR Specific Operation End*/
fun getNameURL(url: String): String {
return url.substring(url.lastIndexOf('/', url.lastIndexOf('/') - 1) + 1, url.length).replace('/', '_')
return url.substring(url.lastIndexOf('/', url.lastIndexOf('/') - 1) + 1, url.length)
.replace('/', '_')
}
suspend fun downloadFile(url: String): Flow<DownloadResult> {

View File

@ -22,7 +22,7 @@ internal class DesktopAnalyticsManager(
val config: Config = Config(COUNTLY_CONFIG.SERVER_URL, COUNTLY_CONFIG.APP_KEY).apply {
eventsBufferSize = 2
loggingLevel = LoggingLevel.DEBUG
loggingLevel = LoggingLevel.ERROR
setDeviceIdStrategy(DeviceIdStrategy.UUID)
enableFeatures(*featuresSet)
setRequiresConsent(true)

View File

@ -83,7 +83,7 @@ compose.desktop {
iconFile.set(iconsRoot.resolve("spotiflyer.ico"))
// Wondering what the heck is this? See : https://wixtoolset.org/documentation/manual/v3/howtos/general/generate_guids.html
// https://www.guidgen.com/
upgradeUuid = "9f9e966b-7eef-42c7-a49c-5194b17fabd0"
upgradeUuid = "3c4caf0c-ae83-457e-85cc-f8e535fb58e2"
menuGroup = packageName
}
linux {

View File

@ -20,10 +20,11 @@ import androidx.compose.material.Surface
import androidx.compose.ui.Modifier
import androidx.compose.ui.awt.ComposeWindow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.painter.BitmapPainter
import androidx.compose.ui.res.loadImageBitmap
import androidx.compose.ui.res.useResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import androidx.compose.ui.window.rememberWindowState
import androidx.compose.ui.window.*
import com.arkivanov.decompose.ComponentContext
import com.arkivanov.decompose.DefaultComponentContext
import com.arkivanov.decompose.ExperimentalDecomposeApi
@ -44,6 +45,7 @@ import com.shabinder.common.models.Actions
import com.shabinder.common.providers.FetchPlatformQueryResult
import com.shabinder.common.root.SpotiFlyerRoot
import com.shabinder.common.translations.Strings
import com.shabinder.common.uikit.SpotiFlyerLogo
import com.shabinder.common.uikit.configurations.SpotiFlyerColors
import com.shabinder.common.uikit.configurations.SpotiFlyerShapes
import com.shabinder.common.uikit.configurations.SpotiFlyerTypography
@ -65,40 +67,34 @@ private lateinit var appWindow: ComposeWindow
@OptIn(ExperimentalDecomposeApi::class)
fun main() {
val lifecycle = LifecycleRegistry()
val rootComponent = spotiFlyerRoot(DefaultComponentContext(lifecycle))
application {
val windowState = rememberWindowState(width = 450.dp, height = 800.dp)
val windowState = WindowState(size = WindowSize(450.dp, 800.dp))
singleWindowApplication(
title = "SpotiFlyer",
state = windowState,
icon = BitmapPainter(useResource("drawable/spotiflyer.png", ::loadImageBitmap))
) {
LifecycleController(lifecycle, windowState)
Window(
title = "SpotiFlyer",
state = windowState,
onCloseRequest = ::exitApplication
Surface(
modifier = Modifier.fillMaxSize(),
color = Color.Black,
contentColor = colorOffWhite
) {
appWindow = window
Surface(
modifier = Modifier.fillMaxSize(),
color = Color.Black,
contentColor = colorOffWhite
DesktopMaterialTheme(
colors = SpotiFlyerColors,
typography = SpotiFlyerTypography,
shapes = SpotiFlyerShapes
) {
DesktopMaterialTheme(
colors = SpotiFlyerColors,
typography = SpotiFlyerTypography,
shapes = SpotiFlyerShapes
) {
val root: SpotiFlyerRoot = SpotiFlyerRootContent(rootComponent)
showToast = root.callBacks::showToast
val root: SpotiFlyerRoot = SpotiFlyerRootContent(rootComponent)
showToast = root.callBacks::showToast
// FFmpeg WARNING
try {
FFmpeg.atPath().addArgument("-version").execute()
} catch (e: Exception) {
if (e is JaffreeException) Actions.instance.showPopUpMessage("WARNING!\nFFmpeg not found at path")
}
// FFmpeg WARNING
try {
FFmpeg.atPath().addArgument("-version").execute()
} catch (e: Exception) {
if (e is JaffreeException) Actions.instance.showPopUpMessage("WARNING!\nFFmpeg not found at path")
}
}
}

View File

@ -14,34 +14,63 @@
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<vector android:height="150dp" android:viewportHeight="512"
android:viewportWidth="512" android:width="150dp"
xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:pathData="M256,256m-256,0a256,256 0,1 1,512 0a256,256 0,1 1,-512 0">
<aapt:attr name="android:fillColor">
<gradient android:endX="437.019" android:endY="74.981"
android:startX="74.981" android:startY="437.019" android:type="linear">
<item android:color="#FF736BFD" android:offset="0"/>
<item android:color="#FFF54187" android:offset="1"/>
</gradient>
</aapt:attr>
</path>
<path android:fillColor="#FF000000" android:pathData="M377,356.7c-68.9,-45.4 -155.6,-56.4 -257.6,-32.7c-20.5,4.8 -13.6,35.8 7.3,31.2C290.7,317 351.6,386 368.2,386C384,386 390.2,365.4 377,356.7z"/>
<path android:fillColor="#FF000000" android:pathData="M112.1,275.1C203.9,253.4 308.1,266 384,308c18.5,10.2 34,-17.8 15.5,-28c-82.7,-45.7 -195.6,-59.5 -294.7,-36C84.2,248.8 91.5,280 112.1,275.1L112.1,275.1z"/>
<path android:fillColor="#FF000000" android:pathData="M100,191.9c96.6,-29.6 232.2,-13.4 308.7,36.9c17.6,11.5 35.3,-15.1 17.6,-26.7c-84.9,-55.8 -229.2,-73.3 -335.6,-40.8C70.4,167.5 79.9,198.1 100,191.9L100,191.9z"/>
<path android:pathData="M507.8,438.2c-1.6,97.2 -141.9,97.1 -143.5,0C365.9,341 506.2,341 507.8,438.2z">
<aapt:attr name="android:fillColor">
<gradient android:endX="384.197" android:endY="490.009"
android:startX="487.832" android:startY="386.374" android:type="linear">
<item android:color="#FF736BFD" android:offset="0"/>
<item android:color="#FFF54187" android:offset="1"/>
</gradient>
</aapt:attr>
</path>
<path android:fillColor="#FF000000"
android:pathData="M486.8,456.8c-0.6,-2.4 -6.9,-1 -8.5,-1.4c11.5,-82 -82.4,-86.7 -87.1,-22.2c0.3,1.8 -1,6.7 2.2,6.6c0,0 8.6,0 8.6,0c3.1,0.1 2,-4.7 2.2,-6.6c0.1,-23.3 35,-23.3 35.2,0c0,0 0,6.9 0,6.9c-0.1,2.8 4.4,2.8 4.3,0c5,-35.2 -43.8,-40.1 -43.8,-4.7h-4.3c-1.6,-53.7 77.2,-55.9 78.4,-2.2c0,0 0,24.4 0,24.4c-0.1,2.9 3.8,2.1 5.6,2.2l-20.7,21l-20.7,-21c1.8,-0.1 5.6,0.7 5.6,-2.2c0,0 0,-8.8 0,-8.8c0,-2.8 -4.4,-2.8 -4.3,0c0,0 0,6.6 0,6.6c-2.2,0.2 -11.3,-1.3 -8,3.7c0,0 25.9,26.3 25.9,26.3c0.8,0.9 2.2,0.9 3.1,0C460.6,484.4 489.4,458.3 486.8,456.8z"
android:strokeColor="#000" android:strokeWidth=".75"/>
<path android:fillColor="#00000000"
android:pathData="M510,437.5c-1.7,96.2 -142.1,96.2 -143.8,0C367.9,341.3 508.4,341.3 510,437.5z"
android:strokeColor="#000" android:strokeWidth="6"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:gravity="center"
android:viewportWidth="108"
android:viewportHeight="108">
<group android:scaleX="0.10546875"
android:scaleY="0.10546875"
android:translateX="27"
android:translateY="27">
<path
android:pathData="M256,256m-256,0a256,256 0,1 1,512 0a256,256 0,1 1,-512 0">
<aapt:attr name="android:fillColor">
<gradient
android:startY="437.0193"
android:startX="74.9807"
android:endY="74.9807"
android:endX="437.0193"
android:type="linear">
<item android:offset="0" android:color="#FF736BFD"/>
<item android:offset="1" android:color="#FFF54187"/>
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FF000000"
android:pathData="M377,356.7c-68.9,-45.4 -155.6,-56.4 -257.6,-32.7c-20.5,4.8 -13.6,35.8 7.3,31.2C290.7,317 351.6,386 368.2,386C384,386 390.2,365.4 377,356.7z"/>
<path
android:fillColor="#FF000000"
android:pathData="M112.1,275.1C203.9,253.4 308.1,266 384,308c18.5,10.2 34,-17.8 15.5,-28c-82.7,-45.7 -195.6,-59.5 -294.7,-36C84.2,248.8 91.5,280 112.1,275.1L112.1,275.1z"/>
<path
android:fillColor="#FF000000"
android:pathData="M100,191.9c96.6,-29.6 232.2,-13.4 308.7,36.9c17.6,11.5 35.3,-15.1 17.6,-26.7c-84.9,-55.8 -229.2,-73.3 -335.6,-40.8C70.4,167.5 79.9,198.1 100,191.9L100,191.9z"/>
<path
android:pathData="M507.8,438.2c-1.6,97.2 -141.9,97.1 -143.5,0C365.9,341 506.2,341 507.8,438.2z">
<aapt:attr name="android:fillColor">
<gradient
android:startY="386.3741"
android:startX="487.8323"
android:endY="490.009"
android:endX="384.1974"
android:type="linear">
<item android:offset="0" android:color="#FF736BFD"/>
<item android:offset="1" android:color="#FFF54187"/>
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FF000000"
android:pathData="M486.8,456.8c-0.6,-2.4 -6.9,-1 -8.5,-1.4c11.5,-82 -82.4,-86.7 -87.1,-22.2c0.3,1.8 -1,6.7 2.2,6.6c0,0 8.6,0 8.6,0c3.1,0.1 2,-4.7 2.2,-6.6c0.1,-23.3 35,-23.3 35.2,0c0,0 0,6.9 0,6.9c-0.1,2.8 4.4,2.8 4.3,0c5,-35.2 -43.8,-40.1 -43.8,-4.7h-4.3c-1.6,-53.7 77.2,-55.9 78.4,-2.2c0,0 0,24.4 0,24.4c-0.1,2.9 3.8,2.1 5.6,2.2l-20.7,21l-20.7,-21c1.8,-0.1 5.6,0.7 5.6,-2.2c0,0 0,-8.8 0,-8.8c0,-2.8 -4.4,-2.8 -4.3,0c0,0 0,6.6 0,6.6c-2.2,0.2 -11.3,-1.3 -8,3.7c0,0 25.9,26.3 25.9,26.3c0.8,0.9 2.2,0.9 3.1,0C460.6,484.4 489.4,458.3 486.8,456.8z"
android:strokeWidth="0.75"
android:strokeColor="#000000"/>
<path
android:pathData="M510,437.5c-1.7,96.2 -142.1,96.2 -143.8,0C367.9,341.3 508.4,341.3 510,437.5z"
android:strokeWidth="6"
android:fillColor="#00000000"
android:strokeColor="#000000"/>
</group>
</vector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

View File

@ -0,0 +1,6 @@
- File size less than 100 KB,
- Crash Fixes when App Went in Background
- Offloaded Many CPU Intensive tasks from Main Thread
- Notification Handling Improved, Now Exits Gracefully
- Some translations Added.
- ImageVectors Caching Implemented Expect some performance gain