Merge pull request #534 from Bnyro/master

missing translations + color fix
This commit is contained in:
Bnyro 2022-06-17 16:52:55 +02:00 committed by GitHub
commit e9b74607d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 11 deletions

View File

@ -113,15 +113,30 @@ class DownloadService : Service() {
"mux" -> { "mux" -> {
audioDir = File(tempDir, "$videoId-audio") audioDir = File(tempDir, "$videoId-audio")
videoDir = File(tempDir, "$videoId-video") videoDir = File(tempDir, "$videoId-video")
downloadId = downloadManagerRequest("Video", "Downloading", videoUrl, videoDir) downloadId = downloadManagerRequest(
getString(R.string.video),
getString(R.string.downloading),
videoUrl,
videoDir
)
} }
"video" -> { "video" -> {
videoDir = File(libretubeDir, "$videoId-video") videoDir = File(libretubeDir, "$videoId-video")
downloadId = downloadManagerRequest("Video", "Downloading", videoUrl, videoDir) downloadId = downloadManagerRequest(
getString(R.string.video),
getString(R.string.downloading),
videoUrl,
videoDir
)
} }
"audio" -> { "audio" -> {
audioDir = File(libretubeDir, "$videoId-audio") audioDir = File(libretubeDir, "$videoId-audio")
downloadId = downloadManagerRequest("Audio", "Downloading", audioUrl, audioDir) downloadId = downloadManagerRequest(
getString(R.string.audio),
getString(R.string.downloading),
audioUrl,
audioDir
)
} }
} }
} catch (e: IllegalArgumentException) { } catch (e: IllegalArgumentException) {
@ -136,7 +151,12 @@ class DownloadService : Service() {
// Checking if the received broadcast is for our enqueued download by matching download id // Checking if the received broadcast is for our enqueued download by matching download id
if (downloadId == id) { if (downloadId == id) {
if (downloadType == "mux") { if (downloadType == "mux") {
downloadManagerRequest("Audio", "Downloading", audioUrl, audioDir) downloadManagerRequest(
getString(R.string.video),
getString(R.string.downloading),
audioUrl,
audioDir
)
} else { } else {
downloadSucceededNotification() downloadSucceededNotification()
onDestroy() onDestroy()
@ -178,7 +198,7 @@ class DownloadService : Service() {
NotificationCompat.Builder(this@DownloadService, "download_service") NotificationCompat.Builder(this@DownloadService, "download_service")
.setSmallIcon(R.drawable.ic_download) .setSmallIcon(R.drawable.ic_download)
.setContentTitle("LibreTube") .setContentTitle("LibreTube")
.setContentText("Downloading") .setContentText(getString(R.string.downloading))
.setPriority(NotificationCompat.PRIORITY_LOW) .setPriority(NotificationCompat.PRIORITY_LOW)
.setOngoing(true) .setOngoing(true)
.setOnlyAlertOnce(true) .setOnlyAlertOnce(true)
@ -192,7 +212,7 @@ class DownloadService : Service() {
val builder = NotificationCompat.Builder(this@DownloadService, "download_service") val builder = NotificationCompat.Builder(this@DownloadService, "download_service")
.setSmallIcon(R.drawable.ic_download) .setSmallIcon(R.drawable.ic_download)
.setContentTitle(resources.getString(R.string.downloadfailed)) .setContentTitle(resources.getString(R.string.downloadfailed))
.setContentText("failure") .setContentText(getString(R.string.fail))
.setPriority(NotificationCompat.PRIORITY_HIGH) .setPriority(NotificationCompat.PRIORITY_HIGH)
with(NotificationManagerCompat.from(this@DownloadService)) { with(NotificationManagerCompat.from(this@DownloadService)) {
// notificationId is a unique int for each notification that you must define // notificationId is a unique int for each notification that you must define
@ -205,7 +225,7 @@ class DownloadService : Service() {
val builder = NotificationCompat.Builder(this@DownloadService, "download_service") val builder = NotificationCompat.Builder(this@DownloadService, "download_service")
.setSmallIcon(R.drawable.ic_download) .setSmallIcon(R.drawable.ic_download)
.setContentTitle(resources.getString(R.string.success)) .setContentTitle(resources.getString(R.string.success))
.setContentText("success") .setContentText(getString(R.string.fail))
.setPriority(NotificationCompat.PRIORITY_HIGH) .setPriority(NotificationCompat.PRIORITY_HIGH)
with(NotificationManagerCompat.from(this@DownloadService)) { with(NotificationManagerCompat.from(this@DownloadService)) {
// notificationId is a unique int for each notification that you must define // notificationId is a unique int for each notification that you must define

View File

@ -71,7 +71,7 @@ class DownloadDialog : DialogFragment() {
} }
} }
var vidName = arrayListOf<String>() var vidName = arrayListOf<String>()
vidName.add("No video") vidName.add(getString(R.string.no_video))
var vidUrl = arrayListOf<String>() var vidUrl = arrayListOf<String>()
vidUrl.add("") vidUrl.add("")
for (vid in streams.videoStreams!!) { for (vid in streams.videoStreams!!) {
@ -80,7 +80,7 @@ class DownloadDialog : DialogFragment() {
vidUrl.add(vid.url!!) vidUrl.add(vid.url!!)
} }
var audioName = arrayListOf<String>() var audioName = arrayListOf<String>()
audioName.add("No audio") audioName.add(getString(R.string.no_audio))
var audioUrl = arrayListOf<String>() var audioUrl = arrayListOf<String>()
audioUrl.add("") audioUrl.add("")
for (audio in streams.audioStreams!!) { for (audio in streams.audioStreams!!) {

View File

@ -36,6 +36,6 @@
android:backgroundTint="?attr/colorOnPrimary" android:backgroundTint="?attr/colorOnPrimary"
android:text="@string/unsubscribe" android:text="@string/unsubscribe"
android:textSize="11dp" android:textSize="11dp"
android:textColor="@android:color/white" android:textColor="?android:attr/textColorPrimary"
app:cornerRadius="20dp" /> app:cornerRadius="20dp" />
</RelativeLayout> </RelativeLayout>

View File

@ -83,7 +83,7 @@
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="11sp" android:textSize="11sp"
android:drawableLeft="@drawable/ic_bell_small" android:drawableLeft="@drawable/ic_bell_small"
android:drawableTint="@android:color/white" /> android:drawableTint="?android:attr/textColorPrimary" />
</LinearLayout> </LinearLayout>

View File

@ -184,5 +184,10 @@
<string name="buffering_goal">Preloading</string> <string name="buffering_goal">Preloading</string>
<string name="buffering_goal_summary">Max. amount of seconds of video to buffer.</string> <string name="buffering_goal_summary">Max. amount of seconds of video to buffer.</string>
<string name="playerVideoFormat">Video format for player</string> <string name="playerVideoFormat">Video format for player</string>
<string name="no_audio">No audio</string>
<string name="no_video">No video</string>
<string name="audio">Audio</string>
<string name="video">Video</string>
<string name="downloading">Downloading</string>
<string name="player_autoplay">Autoplay</string> <string name="player_autoplay">Autoplay</string>
</resources> </resources>