mirror of
https://github.com/Michatec/Radio.git
synced 2026-01-31 07:20:40 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a74e64e87 | ||
|
|
efa03f7529 | ||
|
|
0a56971fa2 | ||
|
|
5ecbede8b5 |
2
.github/workflows/gradle-publish.yml
vendored
2
.github/workflows/gradle-publish.yml
vendored
@@ -3,7 +3,7 @@ name: Build and publish APK
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
- 'b*'
|
||||
|
||||
env:
|
||||
ANDROID_HOME: /usr/local/lib/android/sdk/
|
||||
|
||||
@@ -9,9 +9,10 @@ android {
|
||||
defaultConfig {
|
||||
applicationId 'com.michatec.radio'
|
||||
minSdk 28
|
||||
//noinspection OldTargetApi
|
||||
targetSdk 35
|
||||
versionCode 129
|
||||
versionName '12.9'
|
||||
versionCode 13
|
||||
versionName '130'
|
||||
resourceConfigurations += ['en', 'de', 'el', 'nl', 'pl', 'ru','uk', 'ja', 'da', 'fr']
|
||||
setProperty('archivesBaseName', 'Radio')
|
||||
}
|
||||
@@ -48,7 +49,7 @@ dependencies {
|
||||
|
||||
// Google Stuff //
|
||||
implementation 'com.google.android.material:material:1.12.0'
|
||||
implementation 'com.google.code.gson:gson:2.10.1'
|
||||
implementation 'com.google.code.gson:gson:2.13.1'
|
||||
|
||||
// AndroidX Stuff //
|
||||
implementation 'androidx.activity:activity-ktx:1.10.1'
|
||||
|
||||
@@ -32,6 +32,7 @@ import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.PickVisualMediaRequest
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.annotation.OptIn
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.net.toUri
|
||||
@@ -40,6 +41,7 @@ import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.media3.common.MediaItem
|
||||
import androidx.media3.common.PlaybackException
|
||||
import androidx.media3.common.Player
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import androidx.media3.session.MediaController
|
||||
import androidx.media3.session.SessionResult
|
||||
import androidx.media3.session.SessionToken
|
||||
@@ -395,6 +397,7 @@ class PlayerFragment : Fragment(),
|
||||
|
||||
|
||||
/* Initializes the MediaController - handles connection to PlayerService under the hood */
|
||||
@OptIn(UnstableApi::class)
|
||||
private fun initializeController() {
|
||||
controllerFuture = MediaController.Builder(
|
||||
activity as Context,
|
||||
|
||||
@@ -636,22 +636,6 @@ class PlayerService : MediaLibraryService() {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Defines the listener for changes in shared preferences
|
||||
*/
|
||||
private val sharedPreferenceChangeListener =
|
||||
SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
|
||||
when (key) {
|
||||
Keys.PREF_LARGE_BUFFER_SIZE -> {
|
||||
bufferSizeMultiplier = PreferencesHelper.loadBufferSizeMultiplier()
|
||||
if (!player.isPlaying && !player.isLoading) {
|
||||
initializePlayer()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Custom AnalyticsListener that enables AudioFX equalizer integration
|
||||
*/
|
||||
|
||||
@@ -25,8 +25,6 @@ import com.michatec.radio.helpers.PreferencesHelper.initPreferences
|
||||
*/
|
||||
class Radio : Application() {
|
||||
|
||||
/* Define log tag */
|
||||
private val TAG: String = Radio::class.java.simpleName
|
||||
|
||||
/* Implements onCreate */
|
||||
override fun onCreate() {
|
||||
|
||||
@@ -62,20 +62,7 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
|
||||
(activity as AppCompatActivity).supportActionBar?.show()
|
||||
(activity as AppCompatActivity).supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
(activity as AppCompatActivity).supportActionBar?.title = getString(R.string.fragment_settings_title)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// above Android Oreo
|
||||
(activity as AppCompatActivity).window.navigationBarColor = getColor(requireContext(), android.R.attr.colorBackground)
|
||||
} else {
|
||||
val nightMode = AppCompatDelegate.getDefaultNightMode()
|
||||
if (nightMode == AppCompatDelegate.MODE_NIGHT_YES) {
|
||||
// night mode is active, set navigation bar color to a suitable color for night mode
|
||||
(activity as AppCompatActivity).window.navigationBarColor = getColor(requireContext(), android.R.attr.colorBackground)
|
||||
} else {
|
||||
// night mode is not active, set navigation bar color to a suitable color for day mode
|
||||
(activity as AppCompatActivity).window.navigationBarColor = ContextCompat.getColor(requireContext(), android.R.color.black)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Overrides onCreatePreferences from PreferenceFragmentCompat */
|
||||
|
||||
@@ -296,6 +296,7 @@ class CollectionAdapter(
|
||||
|
||||
|
||||
/* Shows / hides the edit view for a station */
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private fun toggleEditViews(position: Int, stationUuid: String) {
|
||||
when (stationUuid) {
|
||||
// CASE: this station's edit view is already expanded
|
||||
|
||||
@@ -42,10 +42,6 @@ class AddStationDialog (
|
||||
}
|
||||
|
||||
|
||||
/* Define log tag */
|
||||
private val TAG = AddStationDialog::class.java.simpleName
|
||||
|
||||
|
||||
/* Main class variables */
|
||||
private lateinit var dialog: AlertDialog
|
||||
private lateinit var stationSearchResultList: RecyclerView
|
||||
|
||||
@@ -46,9 +46,9 @@ class ErrorDialog {
|
||||
// get views
|
||||
val inflater: LayoutInflater = LayoutInflater.from(context)
|
||||
val view: View = inflater.inflate(R.layout.dialog_generic_with_details, null)
|
||||
val errorMessageView: TextView = view.findViewById(R.id.dialog_message) as TextView
|
||||
val errorDetailsLinkView: TextView = view.findViewById(R.id.dialog_details_link) as TextView
|
||||
val errorDetailsView: TextView = view.findViewById(R.id.dialog_details) as TextView
|
||||
val errorMessageView: TextView = view.findViewById(R.id.dialog_message)
|
||||
val errorDetailsLinkView: TextView = view.findViewById(R.id.dialog_details_link)
|
||||
val errorDetailsView: TextView = view.findViewById(R.id.dialog_details)
|
||||
|
||||
// set dialog view
|
||||
builder.setView(view)
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
package com.michatec.radio.helpers
|
||||
|
||||
import android.util.Log
|
||||
import androidx.annotation.OptIn
|
||||
import androidx.media3.common.Metadata
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import androidx.media3.extractor.metadata.icy.IcyHeaders
|
||||
import androidx.media3.extractor.metadata.icy.IcyInfo
|
||||
import com.michatec.radio.Keys
|
||||
@@ -33,6 +35,7 @@ object AudioHelper {
|
||||
|
||||
|
||||
/* Extract audio stream metadata */
|
||||
@OptIn(UnstableApi::class)
|
||||
fun getMetadataString(metadata: Metadata): String {
|
||||
var metadataString = String()
|
||||
for (i in 0 until metadata.length()) {
|
||||
|
||||
@@ -73,8 +73,8 @@ object ShortcutHelper {
|
||||
): IconCompat {
|
||||
val stationImageBitmap: Bitmap =
|
||||
ImageHelper.getScaledStationImage(context, stationImage.toUri(), 192)
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
IconCompat.createWithAdaptiveBitmap(
|
||||
|
||||
return IconCompat.createWithAdaptiveBitmap(
|
||||
ImageHelper.createSquareImage(
|
||||
context,
|
||||
stationImageBitmap,
|
||||
@@ -83,17 +83,5 @@ object ShortcutHelper {
|
||||
true
|
||||
)
|
||||
)
|
||||
} else {
|
||||
IconCompat.createWithAdaptiveBitmap(
|
||||
ImageHelper.createSquareImage(
|
||||
context,
|
||||
stationImageBitmap,
|
||||
stationImageColor,
|
||||
192,
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -209,7 +209,6 @@ class SearchResultAdapter(
|
||||
// stop radio playback when one is active
|
||||
val audioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val audioAttributes = AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_MEDIA)
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
|
||||
@@ -220,11 +219,6 @@ class SearchResultAdapter(
|
||||
.build()
|
||||
|
||||
audioManager.requestAudioFocus(focusRequest)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
// For older versions where AudioFocusRequest is not available
|
||||
audioManager.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
<string name="toastmessage_preview_playback_started">Было запущено воспроизведение предварительного просмотра.</string>
|
||||
<string name="toastmessage_restored">Станции были успешно восстановлены.</string>
|
||||
<string name="toastmessage_save_m3u">Сохранение радиостанций как M3U…</string>
|
||||
<string name="toastmessage_save_pls">Сохранение радиостанций в формате PLS...</string>
|
||||
<string name="toastmessage_save_pls">Сохранение радиостанций в формате PLS</string>
|
||||
<string name="toastmessage_shortcut_created">Ярлык создан.</string>
|
||||
<string name="toastmessage_shortcut_not_created">Ярлык не создан. Устройство не позволяет создавать ярлыки.</string>
|
||||
<string name="toastmessage_sleep_timer_unable_to_start">Пожалуйста, запустите сперва воспроизведение.</string>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- App Name -->
|
||||
<string name="app_version_name" translatable="false">\"Purple\"</string>
|
||||
<string name="app_version_name" translatable="false">\"Blue\"</string>
|
||||
|
||||
<!-- Accessibility Descriptions -->
|
||||
<string name="descr_app_icon">App icon depicting an old radio</string>
|
||||
|
||||
@@ -17,4 +17,6 @@
|
||||
<locale android:name="tr" />
|
||||
<locale android:name="uk" />
|
||||
<locale android:name="zh-rCN" />
|
||||
<locale android:name="da" />
|
||||
<locale android:name="ja" />
|
||||
</locale-config>
|
||||
@@ -7,5 +7,5 @@ plugins {
|
||||
}
|
||||
|
||||
tasks.register('clean', Delete) {
|
||||
delete rootProject.buildDir
|
||||
delete rootProject.buildDir()
|
||||
}
|
||||
Reference in New Issue
Block a user