mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-25 02:14:32 +01:00
Internationalization
This commit is contained in:
parent
00b8c55e6e
commit
3d28343017
@ -62,6 +62,7 @@ import com.shabinder.common.models.methods
|
||||
import com.shabinder.common.root.SpotiFlyerRoot
|
||||
import com.shabinder.common.root.SpotiFlyerRoot.Analytics
|
||||
import com.shabinder.common.root.callbacks.SpotiFlyerRootCallBacks
|
||||
import com.shabinder.common.translations.Strings
|
||||
import com.shabinder.common.uikit.*
|
||||
import com.shabinder.spotiflyer.service.ForegroundService
|
||||
import com.shabinder.spotiflyer.ui.AnalyticsDialog
|
||||
@ -286,7 +287,7 @@ class MainActivity : ComponentActivity() {
|
||||
override fun shareApp() {
|
||||
val sendIntent: Intent = Intent().apply {
|
||||
action = Intent.ACTION_SEND
|
||||
putExtra(Intent.EXTRA_TEXT, "Hey, checkout this excellent Music Downloader http://github.com/Shabinder/SpotiFlyer")
|
||||
putExtra(Intent.EXTRA_TEXT, Strings.shareMessage())
|
||||
type = "text/plain"
|
||||
}
|
||||
|
||||
@ -376,7 +377,7 @@ class MainActivity : ComponentActivity() {
|
||||
.setTheme(StorageChooser.Theme(applicationContext).apply {
|
||||
scheme = applicationContext.resources.getIntArray(R.array.default_dark)
|
||||
})
|
||||
.setDialogTitle("Set Download Directory")
|
||||
.setDialogTitle(Strings.setDownloadDirectory())
|
||||
.allowCustomPath(true)
|
||||
.setType(StorageChooser.DIRECTORY_CHOOSER)
|
||||
.build()
|
||||
@ -388,13 +389,9 @@ class MainActivity : ComponentActivity() {
|
||||
if (f.canWrite()) {
|
||||
// hell yeah :)
|
||||
preferenceManager.setDownloadDirectory(path)
|
||||
showPopUpMessage(
|
||||
"Download Directory Set to:\n${dir.defaultDir()} "
|
||||
)
|
||||
showPopUpMessage(Strings.downloadDirectorySetTo("\n${dir.defaultDir()}"))
|
||||
}else{
|
||||
showPopUpMessage(
|
||||
"NO WRITE ACCESS on \n$path ,\nReverting Back to Previous"
|
||||
)
|
||||
showPopUpMessage(Strings.noWriteAccess("\n$path "))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ class ForegroundService : LifecycleService() {
|
||||
messageList = messageList.getEmpty().apply {
|
||||
set(index = 0, Message(Strings.cleaningAndExiting(),DownloadStatus.NotDownloaded))
|
||||
}
|
||||
downloadService.value.close()
|
||||
downloadService.getOrNull()?.close()
|
||||
downloadService.reset()
|
||||
updateNotification()
|
||||
cleanFiles(File(dir.defaultDir()))
|
||||
|
@ -3,7 +3,6 @@ package com.shabinder.spotiflyer.ui
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.ExperimentalAnimationApi
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
@ -18,7 +17,6 @@ import androidx.compose.material.OutlinedButton
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.TextButton
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.rounded.Close
|
||||
import androidx.compose.material.icons.rounded.Insights
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
@ -28,6 +26,7 @@ import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
import com.shabinder.common.translations.Strings
|
||||
import com.shabinder.common.uikit.SpotiFlyerShapes
|
||||
import com.shabinder.common.uikit.SpotiFlyerTypography
|
||||
import com.shabinder.common.uikit.colorPrimary
|
||||
@ -45,9 +44,9 @@ fun AnalyticsDialog(
|
||||
onDismissRequest = dismissDialog,
|
||||
title = {
|
||||
Row(verticalAlignment = Alignment.CenterVertically,horizontalArrangement = Arrangement.SpaceEvenly) {
|
||||
Icon(Icons.Rounded.Insights,"Analytics", Modifier.size(42.dp))
|
||||
Icon(Icons.Rounded.Insights,Strings.analytics(), Modifier.size(42.dp))
|
||||
Spacer(Modifier.padding(horizontal = 8.dp))
|
||||
Text("Grant Analytics",style = SpotiFlyerTypography.h5,textAlign = TextAlign.Center)
|
||||
Text(Strings.grantAnalytics(),style = SpotiFlyerTypography.h5,textAlign = TextAlign.Center)
|
||||
}
|
||||
},
|
||||
backgroundColor = Color.DarkGray,
|
||||
@ -61,7 +60,7 @@ fun AnalyticsDialog(
|
||||
shape = SpotiFlyerShapes.medium,
|
||||
colors = ButtonDefaults.buttonColors(backgroundColor = Color(0xFF303030))
|
||||
) {
|
||||
Text("Nope",color = colorPrimary,fontSize = 18.sp,textAlign = TextAlign.Center)
|
||||
Text(Strings.no(),color = colorPrimary,fontSize = 18.sp,textAlign = TextAlign.Center)
|
||||
}
|
||||
Spacer(Modifier.padding(vertical = 4.dp))
|
||||
TextButton(
|
||||
@ -74,12 +73,12 @@ fun AnalyticsDialog(
|
||||
.padding(horizontal = 8.dp),
|
||||
shape = SpotiFlyerShapes.medium
|
||||
) {
|
||||
Text("Sure",color = Color.Black,fontSize = 18.sp,textAlign = TextAlign.Center)
|
||||
Text(Strings.yes(),color = Color.Black,fontSize = 18.sp,textAlign = TextAlign.Center)
|
||||
}
|
||||
}
|
||||
},
|
||||
text = {
|
||||
Text("Your Data is Anonymized and will never be shared with any 3rd party service",style = SpotiFlyerTypography.body2,textAlign = TextAlign.Center)
|
||||
Text(Strings.analyticsDescription(),style = SpotiFlyerTypography.body2,textAlign = TextAlign.Center)
|
||||
},
|
||||
properties = DialogProperties(dismissOnBackPress = false,dismissOnClickOutside = false)
|
||||
)
|
||||
|
@ -16,20 +16,34 @@
|
||||
|
||||
package com.shabinder.spotiflyer.ui
|
||||
|
||||
import androidx.compose.animation.*
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.ExperimentalAnimationApi
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.AlertDialog
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.rounded.CloudOff
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.shabinder.common.translations.Strings
|
||||
import com.shabinder.common.uikit.SpotiFlyerShapes
|
||||
import com.shabinder.common.uikit.SpotiFlyerTypography
|
||||
import com.shabinder.common.uikit.colorOffWhite
|
||||
@ -62,7 +76,7 @@ fun NetworkDialog(
|
||||
Icon(Icons.Rounded.SyncProblem,"Check Network Connection Again")
|
||||
}
|
||||
*/},
|
||||
title = { Text("No Internet Connection!",
|
||||
title = { Text(Strings.noInternetConnection(),
|
||||
style = SpotiFlyerTypography.h5,
|
||||
textAlign = TextAlign.Center) },
|
||||
backgroundColor = Color.DarkGray,
|
||||
@ -72,11 +86,12 @@ fun NetworkDialog(
|
||||
Row(verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.fillMaxWidth().padding(vertical = 6.dp)
|
||||
) {
|
||||
Image(Icons.Rounded.CloudOff,"No Internet.",Modifier.size(42.dp),colorFilter = ColorFilter.tint(
|
||||
Image(Icons.Rounded.CloudOff,
|
||||
Strings.noInternetConnection(),Modifier.size(42.dp),colorFilter = ColorFilter.tint(
|
||||
colorOffWhite))
|
||||
Spacer(modifier = Modifier.padding(start = 16.dp))
|
||||
Text(
|
||||
text = "Please Check Your Network Connection.",
|
||||
text = Strings.checkInternetConnection(),
|
||||
style = SpotiFlyerTypography.subtitle1
|
||||
)
|
||||
}
|
||||
|
@ -8,13 +8,11 @@ import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.AlertDialog
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.TextButton
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.rounded.Insights
|
||||
import androidx.compose.material.icons.rounded.SdStorage
|
||||
import androidx.compose.material.icons.rounded.SystemSecurityUpdate
|
||||
import androidx.compose.runtime.Composable
|
||||
@ -30,7 +28,7 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
import com.shabinder.common.translations.Strings
|
||||
import com.shabinder.common.uikit.SpotiFlyerShapes
|
||||
import com.shabinder.common.uikit.SpotiFlyerTypography
|
||||
import com.shabinder.common.uikit.colorPrimary
|
||||
@ -64,9 +62,9 @@ fun PermissionDialog(
|
||||
.background(colorPrimary, shape = SpotiFlyerShapes.medium)
|
||||
.padding(horizontal = 8.dp),
|
||||
){
|
||||
Text("Grant Permissions",color = Color.Black,fontSize = 18.sp,textAlign = TextAlign.Center)
|
||||
Text(Strings.grantPermissions(),color = Color.Black,fontSize = 18.sp,textAlign = TextAlign.Center)
|
||||
}
|
||||
},title = { Text("Required Permissions:",style = SpotiFlyerTypography.h5,textAlign = TextAlign.Center) },
|
||||
},title = { Text(Strings.requiredPermissions(),style = SpotiFlyerTypography.h5,textAlign = TextAlign.Center) },
|
||||
backgroundColor = Color.DarkGray,
|
||||
text = {
|
||||
Column{
|
||||
@ -74,15 +72,15 @@ fun PermissionDialog(
|
||||
Row(verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.fillMaxWidth().padding(vertical = 6.dp)
|
||||
) {
|
||||
Icon(Icons.Rounded.SdStorage,"Storage Permission.")
|
||||
Icon(Icons.Rounded.SdStorage,Strings.storagePermission())
|
||||
Spacer(modifier = Modifier.padding(start = 16.dp))
|
||||
Column {
|
||||
Text(
|
||||
text = "Storage Permission.",
|
||||
text = Strings.storagePermission(),
|
||||
style = SpotiFlyerTypography.h6.copy(fontWeight = FontWeight.SemiBold)
|
||||
)
|
||||
Text(
|
||||
text = "To download your favourite songs to this device.",
|
||||
text = Strings.storagePermissionReason(),
|
||||
style = SpotiFlyerTypography.subtitle2,
|
||||
)
|
||||
}
|
||||
@ -91,15 +89,15 @@ fun PermissionDialog(
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 6.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Icon(Icons.Rounded.SystemSecurityUpdate,"Allow Background Running")
|
||||
Icon(Icons.Rounded.SystemSecurityUpdate,Strings.backgroundRunning())
|
||||
Spacer(modifier = Modifier.padding(start = 16.dp))
|
||||
Column {
|
||||
Text(
|
||||
text = "Background Running.",
|
||||
text = Strings.backgroundRunning(),
|
||||
style = SpotiFlyerTypography.h6.copy(fontWeight = FontWeight.SemiBold)
|
||||
)
|
||||
Text(
|
||||
text = "To download all songs in background without any System Interruptions",
|
||||
text = Strings.backgroundRunningReason(),
|
||||
style = SpotiFlyerTypography.subtitle2,
|
||||
)
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ class AutoClear<T : Any?>(
|
||||
|
||||
val value: T get() = _value.requireNotNull()
|
||||
|
||||
fun getOrNull(): T? = _value
|
||||
|
||||
private val observer: LifecycleAutoInitializer<T?> by lazy {
|
||||
when(trigger) {
|
||||
TRIGGER.ON_CREATE -> LifecycleCreateAndDestroyObserver(initializer)
|
||||
|
@ -27,6 +27,21 @@ exit = Exit
|
||||
downloading = Downloading
|
||||
processing = Processing
|
||||
queued = Queued
|
||||
setDownloadDirectory = Set Download Directory
|
||||
downloadDirectorySetTo = Download Directory Set to: {0}
|
||||
noWriteAccess = NO WRITE ACCESS on: {0} , Reverting Back to Previous
|
||||
shareMessage = Hey, checkout this excellent Music Downloader http://github.com/Shabinder/SpotiFlyer
|
||||
grantAnalytics = Grant Analytics
|
||||
noInternetConnection = No Internet Connection!
|
||||
checkInternetConnection = Please Check Your Network Connection.
|
||||
grantPermissions = Grant Permissions
|
||||
requiredPermissions = Required Permissions:
|
||||
storagePermission = Storage Permission.
|
||||
storagePermissionReason = To download your favourite songs to this device.
|
||||
backgroundRunning = Background Running.
|
||||
backgroundRunningReason = To download all songs in background without any System Interruptions.
|
||||
no = Nope
|
||||
yes = Sure
|
||||
|
||||
acraNotificationTitle = OOPS, SpotiFlyer Crashed
|
||||
acraNotificationText = Please Send Crash Report to App Developers, So this unfortunate event may not happen again.
|
||||
@ -55,7 +70,6 @@ unknownError = Unknown Error
|
||||
noMatchFound = NO Match Found!
|
||||
noLinkFound = No Downloadable link found
|
||||
linkNotValid = Entered Link is NOT Valid!
|
||||
checkInternetConnection = Check Your Internet Connection
|
||||
featureUnImplemented = Feature not yet implemented.
|
||||
|
||||
minute = min
|
||||
@ -72,4 +86,4 @@ madeWith = Made with
|
||||
love = Love
|
||||
inIndia = in India
|
||||
open = Open
|
||||
byDeveloperName = by: Shabinder Singh
|
||||
byDeveloperName = by: Shabinder Singh
|
||||
|
Loading…
Reference in New Issue
Block a user