From cdfa3f8fcefa760f06fbc82ebc52fa9bb56b7316 Mon Sep 17 00:00:00 2001 From: Davide Depau Date: Sun, 2 Sep 2018 00:26:38 +0200 Subject: [PATCH] Make more strings translatable --- .../eu/depau/etchdroid/services/UsbWriteService.kt | 14 +++++++------- app/src/main/res/values/strings.xml | 6 ++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/depau/etchdroid/services/UsbWriteService.kt b/app/src/main/java/eu/depau/etchdroid/services/UsbWriteService.kt index 5964d9c..e92ab22 100644 --- a/app/src/main/java/eu/depau/etchdroid/services/UsbWriteService.kt +++ b/app/src/main/java/eu/depau/etchdroid/services/UsbWriteService.kt @@ -55,16 +55,16 @@ abstract class UsbWriteService(name: String) : IntentService(name) { val resultChannel = NotificationChannel( WRITE_RESULT_CHANNEL_ID, - "USB write result notifications", + getString(R.string.result_channel_name), NotificationManager.IMPORTANCE_DEFAULT ) - resultChannel.description = "Used to display the result of a finished write operation" + resultChannel.description = getString(R.string.result_channel_desc) // Register the channel with the system; you can't change the importance // or other notification behaviors after this val notificationManager = getSystemService(NotificationManager::class.java) notificationManager!!.createNotificationChannel(statusChannel) - notificationManager!!.createNotificationChannel(resultChannel) + notificationManager.createNotificationChannel(resultChannel) } notifyChanRegistered = true } @@ -98,13 +98,13 @@ abstract class UsbWriteService(name: String) : IntentService(name) { val dt = System.currentTimeMillis() - startTime if (!success) - b.setContentTitle("Write failed") - .setContentText("$usbDevice may have been unplugged while writing.") + b.setContentTitle(getString(R.string.write_failed)) + .setContentText(getString(R.string.error_notif_content_text, usbDevice)) .setSubText(dt.toHRTime()) else { val speed = max(bytes.toDouble() / dt.toDouble() * 1000, 0.0).toHRSize() + "/s" - b.setContentTitle("Write finished") - .setContentText("$filename successfully written to $usbDevice") + b.setContentTitle(getString(R.string.write_finished)) + .setContentText(getString(R.string.success_notif_content_text, filename, usbDevice)) .setSubText("${dt.toHRTime()} • ${bytes.toHRSize()} • $speed") } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7edca19..ef488c9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -101,4 +101,10 @@ Cancel MPL-2.0 DMG file selector + Used to display the result of a finished write operation + USB write result notifications + Write failed + Write finished + %1$s may have been unplugged while writing. + %1$s successfully written to %2$s