mirror of
https://github.com/Michatec/Radio.git
synced 2026-04-01 07:56:27 +02:00
Compare commits
1 Commits
f96bdc6f07
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d270574365 |
@@ -27,28 +27,6 @@ class ThemeSelectionDialog(private var themeSelectionDialogListener: ThemeSelect
|
|||||||
private lateinit var dialog: AlertDialog
|
private lateinit var dialog: AlertDialog
|
||||||
|
|
||||||
|
|
||||||
/* Update radio buttons to reflect current theme */
|
|
||||||
private fun updateRadioButtons(
|
|
||||||
context: Context,
|
|
||||||
radioFollowSystem: RadioButton,
|
|
||||||
radioLight: RadioButton,
|
|
||||||
radioDark: RadioButton
|
|
||||||
) {
|
|
||||||
val currentTheme = AppThemeHelper.getCurrentTheme(context)
|
|
||||||
when (currentTheme) {
|
|
||||||
context.getString(R.string.pref_theme_selection_mode_device_default) -> {
|
|
||||||
radioFollowSystem.isChecked = true
|
|
||||||
}
|
|
||||||
context.getString(R.string.pref_theme_selection_mode_light) -> {
|
|
||||||
radioLight.isChecked = true
|
|
||||||
}
|
|
||||||
context.getString(R.string.pref_theme_selection_mode_dark) -> {
|
|
||||||
radioDark.isChecked = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Construct and show dialog */
|
/* Construct and show dialog */
|
||||||
fun show(context: Context) {
|
fun show(context: Context) {
|
||||||
// prepare dialog builder
|
// prepare dialog builder
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ object BackupHelper {
|
|||||||
Snackbar.make(view, R.string.toastmessage_restored, Snackbar.LENGTH_LONG).show()
|
Snackbar.make(view, R.string.toastmessage_restored, Snackbar.LENGTH_LONG).show()
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||||
// bypass "ZipException" for Android 14 or above applications when zip file names contain ".." or start with "/"
|
// bypass "ZipException" for Android 14 or above applications when zip file names contain "." or start with "/"
|
||||||
dalvik.system.ZipPathValidator.clearCallback()
|
dalvik.system.ZipPathValidator.clearCallback()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ object CollectionHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Returns the children stations under under root (simple media library structure: root > stations) */
|
/* Returns the children stations under root (simple media library structure: root > stations) */
|
||||||
fun getChildren(context: Context, collection: Collection): List<MediaItem> {
|
fun getChildren(context: Context, collection: Collection): List<MediaItem> {
|
||||||
val mediaItems: MutableList<MediaItem> = mutableListOf()
|
val mediaItems: MutableList<MediaItem> = mutableListOf()
|
||||||
collection.stations.forEach { station ->
|
collection.stations.forEach { station ->
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ object DateTimeHelper {
|
|||||||
|
|
||||||
|
|
||||||
/* Main class variables */
|
/* Main class variables */
|
||||||
private const val pattern: String = "EEE, dd MMM yyyy HH:mm:ss Z"
|
private const val PATTERN: String = "EEE, dd MMM yyyy HH:mm:ss Z"
|
||||||
private val dateFormat: SimpleDateFormat = SimpleDateFormat(pattern, Locale.ENGLISH)
|
private val dateFormat: SimpleDateFormat = SimpleDateFormat(PATTERN, Locale.ENGLISH)
|
||||||
|
|
||||||
|
|
||||||
/* Converts RFC 2822 string representation of a date to DATE */
|
/* Converts RFC 2822 string representation of a date to DATE */
|
||||||
fun convertFromRfc2822(dateString: String): Date {
|
fun convertFromRfc2822(dateString: String): Date {
|
||||||
val date: Date = try {
|
val date: Date = try {
|
||||||
// parse date string using standard pattern
|
// parse date string using standard PATTERN
|
||||||
dateFormat.parse((dateString)) ?: Keys.DEFAULT_DATE
|
dateFormat.parse((dateString)) ?: Keys.DEFAULT_DATE
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.w(TAG, "Unable to parse. Trying an alternative Date format. $e")
|
Log.w(TAG, "Unable to parse. Trying an alternative Date format. $e")
|
||||||
@@ -37,7 +37,7 @@ object DateTimeHelper {
|
|||||||
|
|
||||||
/* Converts a DATE to its RFC 2822 string representation */
|
/* Converts a DATE to its RFC 2822 string representation */
|
||||||
fun convertToRfc2822(date: Date): String {
|
fun convertToRfc2822(date: Date): String {
|
||||||
val dateFormat = SimpleDateFormat(pattern, Locale.ENGLISH)
|
val dateFormat = SimpleDateFormat(PATTERN, Locale.ENGLISH)
|
||||||
return dateFormat.format(date)
|
return dateFormat.format(date)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ object DownloadHelper {
|
|||||||
private fun determineAllowedNetworkTypes(type: Int, ignoreWifiRestriction: Boolean): Int {
|
private fun determineAllowedNetworkTypes(type: Int, ignoreWifiRestriction: Boolean): Int {
|
||||||
var allowedNetworkTypes: Int =
|
var allowedNetworkTypes: Int =
|
||||||
(DownloadManager.Request.NETWORK_WIFI or DownloadManager.Request.NETWORK_MOBILE)
|
(DownloadManager.Request.NETWORK_WIFI or DownloadManager.Request.NETWORK_MOBILE)
|
||||||
// restrict download of audio files to WiFi if necessary
|
// restrict download of audio files to Wi-Fi if necessary
|
||||||
if (type == Keys.FILE_TYPE_AUDIO) {
|
if (type == Keys.FILE_TYPE_AUDIO) {
|
||||||
if (!ignoreWifiRestriction && !PreferencesHelper.downloadOverMobile()) {
|
if (!ignoreWifiRestriction && !PreferencesHelper.downloadOverMobile()) {
|
||||||
allowedNetworkTypes = DownloadManager.Request.NETWORK_WIFI
|
allowedNetworkTypes = DownloadManager.Request.NETWORK_WIFI
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ object NetworkHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Creates a http connection from given url string */
|
/* Creates an http connection from given url string */
|
||||||
private fun createConnection(urlString: String, redirectCount: Int = 0): HttpURLConnection? {
|
private fun createConnection(urlString: String, redirectCount: Int = 0): HttpURLConnection? {
|
||||||
var connection: HttpURLConnection? = null
|
var connection: HttpURLConnection? = null
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user