Skip to content

Commit d270574

Browse files
committed
refactor(helpers): minor code cleanup and documentation fixes
1 parent f96bdc6 commit d270574

6 files changed

Lines changed: 8 additions & 30 deletions

File tree

app/src/main/java/com/michatec/radio/dialogs/ThemeSelectionDialog.kt

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,6 @@ class ThemeSelectionDialog(private var themeSelectionDialogListener: ThemeSelect
2727
private lateinit var dialog: AlertDialog
2828

2929

30-
/* Update radio buttons to reflect current theme */
31-
private fun updateRadioButtons(
32-
context: Context,
33-
radioFollowSystem: RadioButton,
34-
radioLight: RadioButton,
35-
radioDark: RadioButton
36-
) {
37-
val currentTheme = AppThemeHelper.getCurrentTheme(context)
38-
when (currentTheme) {
39-
context.getString(R.string.pref_theme_selection_mode_device_default) -> {
40-
radioFollowSystem.isChecked = true
41-
}
42-
context.getString(R.string.pref_theme_selection_mode_light) -> {
43-
radioLight.isChecked = true
44-
}
45-
context.getString(R.string.pref_theme_selection_mode_dark) -> {
46-
radioDark.isChecked = true
47-
}
48-
}
49-
}
50-
51-
5230
/* Construct and show dialog */
5331
fun show(context: Context) {
5432
// prepare dialog builder

app/src/main/java/com/michatec/radio/helpers/BackupHelper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ object BackupHelper {
5353
Snackbar.make(view, R.string.toastmessage_restored, Snackbar.LENGTH_LONG).show()
5454

5555
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
56-
// bypass "ZipException" for Android 14 or above applications when zip file names contain ".." or start with "/"
56+
// bypass "ZipException" for Android 14 or above applications when zip file names contain "." or start with "/"
5757
dalvik.system.ZipPathValidator.clearCallback()
5858
}
5959

app/src/main/java/com/michatec/radio/helpers/CollectionHelper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ object CollectionHelper {
299299
}
300300

301301

302-
/* Returns the children stations under under root (simple media library structure: root > stations) */
302+
/* Returns the children stations under root (simple media library structure: root > stations) */
303303
fun getChildren(context: Context, collection: Collection): List<MediaItem> {
304304
val mediaItems: MutableList<MediaItem> = mutableListOf()
305305
collection.stations.forEach { station ->

app/src/main/java/com/michatec/radio/helpers/DateTimeHelper.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ object DateTimeHelper {
1717

1818

1919
/* Main class variables */
20-
private const val pattern: String = "EEE, dd MMM yyyy HH:mm:ss Z"
21-
private val dateFormat: SimpleDateFormat = SimpleDateFormat(pattern, Locale.ENGLISH)
20+
private const val PATTERN: String = "EEE, dd MMM yyyy HH:mm:ss Z"
21+
private val dateFormat: SimpleDateFormat = SimpleDateFormat(PATTERN, Locale.ENGLISH)
2222

2323

2424
/* Converts RFC 2822 string representation of a date to DATE */
2525
fun convertFromRfc2822(dateString: String): Date {
2626
val date: Date = try {
27-
// parse date string using standard pattern
27+
// parse date string using standard PATTERN
2828
dateFormat.parse((dateString)) ?: Keys.DEFAULT_DATE
2929
} catch (e: Exception) {
3030
Log.w(TAG, "Unable to parse. Trying an alternative Date format. $e")
@@ -37,7 +37,7 @@ object DateTimeHelper {
3737

3838
/* Converts a DATE to its RFC 2822 string representation */
3939
fun convertToRfc2822(date: Date): String {
40-
val dateFormat = SimpleDateFormat(pattern, Locale.ENGLISH)
40+
val dateFormat = SimpleDateFormat(PATTERN, Locale.ENGLISH)
4141
return dateFormat.format(date)
4242
}
4343

app/src/main/java/com/michatec/radio/helpers/DownloadHelper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ object DownloadHelper {
370370
private fun determineAllowedNetworkTypes(type: Int, ignoreWifiRestriction: Boolean): Int {
371371
var allowedNetworkTypes: Int =
372372
(DownloadManager.Request.NETWORK_WIFI or DownloadManager.Request.NETWORK_MOBILE)
373-
// restrict download of audio files to WiFi if necessary
373+
// restrict download of audio files to Wi-Fi if necessary
374374
if (type == Keys.FILE_TYPE_AUDIO) {
375375
if (!ignoreWifiRestriction && !PreferencesHelper.downloadOverMobile()) {
376376
allowedNetworkTypes = DownloadManager.Request.NETWORK_WIFI

app/src/main/java/com/michatec/radio/helpers/NetworkHelper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ object NetworkHelper {
115115
}
116116

117117

118-
/* Creates a http connection from given url string */
118+
/* Creates an http connection from given url string */
119119
private fun createConnection(urlString: String, redirectCount: Int = 0): HttpURLConnection? {
120120
var connection: HttpURLConnection? = null
121121

0 commit comments

Comments
 (0)