mirror of
https://github.com/Michatec/Radio.git
synced 2026-01-31 07:20:40 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a74e64e87 | ||
|
|
efa03f7529 | ||
|
|
0a56971fa2 | ||
|
|
5ecbede8b5 | ||
|
|
f99b1fc54b | ||
|
|
c2b28fd6ec | ||
|
|
b8fedbf832 | ||
|
|
890c91d4e3 | ||
|
|
41785d03f0 | ||
|
|
0c1f59d98d | ||
|
|
43adf31b6d | ||
|
|
4bb8df555c | ||
|
|
a649daf387 | ||
|
|
ed098aa8a7 |
91
.github/workflows/gradle-publish.yml
vendored
Normal file
91
.github/workflows/gradle-publish.yml
vendored
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||||
|
name: Build and publish APK
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'b*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
ANDROID_HOME: /usr/local/lib/android/sdk/
|
||||||
|
APK_PATH: app/build/outputs/apk/release/Radio-release-unsigned.apk
|
||||||
|
APKSIGNER: /usr/local/lib/android/sdk/build-tools/34.0.0/apksigner
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup JDK
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: 17
|
||||||
|
distribution: adopt
|
||||||
|
cache: gradle
|
||||||
|
|
||||||
|
- name: Cache Android SDK
|
||||||
|
#id: cache-android-sdk
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ${{ env.ANDROID_HOME }}
|
||||||
|
key: ${{ runner.os }}-android-sdk
|
||||||
|
|
||||||
|
- name: Setup Android SDK
|
||||||
|
## It is not necessary to check for cache hit as it
|
||||||
|
## will not download Android SDK again
|
||||||
|
#if: steps.cache-android-sdk.outputs.cache-hit != 'true'
|
||||||
|
uses: android-actions/setup-android@v3
|
||||||
|
with:
|
||||||
|
packages: ''
|
||||||
|
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x ./gradlew
|
||||||
|
|
||||||
|
- name: Build unsigned APK
|
||||||
|
run: ./gradlew --no-daemon assembleRelease
|
||||||
|
|
||||||
|
- name: Check APK path
|
||||||
|
run: ls -R app/build/outputs/apk
|
||||||
|
|
||||||
|
- name: Sign APK
|
||||||
|
env:
|
||||||
|
SIGN_CERT: ${{ secrets.SIGN_CERT }}
|
||||||
|
SIGN_KEY: ${{ secrets.SIGN_KEY }}
|
||||||
|
run: |
|
||||||
|
echo "$SIGN_CERT" | base64 -d > cert.der
|
||||||
|
echo "$SIGN_KEY" | base64 -d > key.der
|
||||||
|
mv ${{ env.APK_PATH }} app-release.apk
|
||||||
|
${{ env.APKSIGNER }} sign --key key.der --cert cert.der app-release.apk
|
||||||
|
rm cert.der key.der
|
||||||
|
|
||||||
|
- name: Zipalign APK
|
||||||
|
run: |
|
||||||
|
/usr/local/lib/android/sdk/build-tools/34.0.0/zipalign -v -p 4 app-release.apk app-release-aligned.apk
|
||||||
|
mv app-release-aligned.apk app-release.apk
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: app-release
|
||||||
|
path: app-release.apk
|
||||||
|
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Download artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: app-release
|
||||||
|
path: app-release.apk
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
uses: ncipollo/release-action@v1
|
||||||
|
with:
|
||||||
|
artifacts: "app-release.apk"
|
||||||
|
draft: true
|
||||||
@@ -9,11 +9,12 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId 'com.michatec.radio'
|
applicationId 'com.michatec.radio'
|
||||||
minSdk 28
|
minSdk 28
|
||||||
|
//noinspection OldTargetApi
|
||||||
targetSdk 35
|
targetSdk 35
|
||||||
versionCode 129
|
versionCode 13
|
||||||
versionName '12.9'
|
versionName '130'
|
||||||
resourceConfigurations += ['en', 'de', 'el', 'nl', 'pl', 'ru','uk', 'ja', 'da', 'fr']
|
resourceConfigurations += ['en', 'de', 'el', 'nl', 'pl', 'ru','uk', 'ja', 'da', 'fr']
|
||||||
setProperty('archivesBaseName', 'Radio_' + versionName)
|
setProperty('archivesBaseName', 'Radio')
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
@@ -48,7 +49,7 @@ dependencies {
|
|||||||
|
|
||||||
// Google Stuff //
|
// Google Stuff //
|
||||||
implementation 'com.google.android.material:material:1.12.0'
|
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 //
|
// AndroidX Stuff //
|
||||||
implementation 'androidx.activity:activity-ktx:1.10.1'
|
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.ActivityResultLauncher
|
||||||
import androidx.activity.result.PickVisualMediaRequest
|
import androidx.activity.result.PickVisualMediaRequest
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
|
import androidx.annotation.OptIn
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
@@ -40,6 +41,7 @@ import androidx.lifecycle.ViewModelProvider
|
|||||||
import androidx.media3.common.MediaItem
|
import androidx.media3.common.MediaItem
|
||||||
import androidx.media3.common.PlaybackException
|
import androidx.media3.common.PlaybackException
|
||||||
import androidx.media3.common.Player
|
import androidx.media3.common.Player
|
||||||
|
import androidx.media3.common.util.UnstableApi
|
||||||
import androidx.media3.session.MediaController
|
import androidx.media3.session.MediaController
|
||||||
import androidx.media3.session.SessionResult
|
import androidx.media3.session.SessionResult
|
||||||
import androidx.media3.session.SessionToken
|
import androidx.media3.session.SessionToken
|
||||||
@@ -395,6 +397,7 @@ class PlayerFragment : Fragment(),
|
|||||||
|
|
||||||
|
|
||||||
/* Initializes the MediaController - handles connection to PlayerService under the hood */
|
/* Initializes the MediaController - handles connection to PlayerService under the hood */
|
||||||
|
@OptIn(UnstableApi::class)
|
||||||
private fun initializeController() {
|
private fun initializeController() {
|
||||||
controllerFuture = MediaController.Builder(
|
controllerFuture = MediaController.Builder(
|
||||||
activity as Context,
|
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
|
* Custom AnalyticsListener that enables AudioFX equalizer integration
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ import com.michatec.radio.helpers.PreferencesHelper.initPreferences
|
|||||||
*/
|
*/
|
||||||
class Radio : Application() {
|
class Radio : Application() {
|
||||||
|
|
||||||
/* Define log tag */
|
|
||||||
private val TAG: String = Radio::class.java.simpleName
|
|
||||||
|
|
||||||
/* Implements onCreate */
|
/* Implements onCreate */
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
|
|||||||
@@ -62,20 +62,7 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
|
|||||||
(activity as AppCompatActivity).supportActionBar?.show()
|
(activity as AppCompatActivity).supportActionBar?.show()
|
||||||
(activity as AppCompatActivity).supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
(activity as AppCompatActivity).supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
(activity as AppCompatActivity).supportActionBar?.title = getString(R.string.fragment_settings_title)
|
(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)
|
(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 */
|
/* Overrides onCreatePreferences from PreferenceFragmentCompat */
|
||||||
|
|||||||
@@ -296,6 +296,7 @@ class CollectionAdapter(
|
|||||||
|
|
||||||
|
|
||||||
/* Shows / hides the edit view for a station */
|
/* Shows / hides the edit view for a station */
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
private fun toggleEditViews(position: Int, stationUuid: String) {
|
private fun toggleEditViews(position: Int, stationUuid: String) {
|
||||||
when (stationUuid) {
|
when (stationUuid) {
|
||||||
// CASE: this station's edit view is already expanded
|
// 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 */
|
/* Main class variables */
|
||||||
private lateinit var dialog: AlertDialog
|
private lateinit var dialog: AlertDialog
|
||||||
private lateinit var stationSearchResultList: RecyclerView
|
private lateinit var stationSearchResultList: RecyclerView
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ class ErrorDialog {
|
|||||||
// get views
|
// get views
|
||||||
val inflater: LayoutInflater = LayoutInflater.from(context)
|
val inflater: LayoutInflater = LayoutInflater.from(context)
|
||||||
val view: View = inflater.inflate(R.layout.dialog_generic_with_details, null)
|
val view: View = inflater.inflate(R.layout.dialog_generic_with_details, null)
|
||||||
val errorMessageView: TextView = view.findViewById(R.id.dialog_message) as TextView
|
val errorMessageView: TextView = view.findViewById(R.id.dialog_message)
|
||||||
val errorDetailsLinkView: TextView = view.findViewById(R.id.dialog_details_link) as TextView
|
val errorDetailsLinkView: TextView = view.findViewById(R.id.dialog_details_link)
|
||||||
val errorDetailsView: TextView = view.findViewById(R.id.dialog_details) as TextView
|
val errorDetailsView: TextView = view.findViewById(R.id.dialog_details)
|
||||||
|
|
||||||
// set dialog view
|
// set dialog view
|
||||||
builder.setView(view)
|
builder.setView(view)
|
||||||
|
|||||||
@@ -15,7 +15,9 @@
|
|||||||
package com.michatec.radio.helpers
|
package com.michatec.radio.helpers
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import androidx.annotation.OptIn
|
||||||
import androidx.media3.common.Metadata
|
import androidx.media3.common.Metadata
|
||||||
|
import androidx.media3.common.util.UnstableApi
|
||||||
import androidx.media3.extractor.metadata.icy.IcyHeaders
|
import androidx.media3.extractor.metadata.icy.IcyHeaders
|
||||||
import androidx.media3.extractor.metadata.icy.IcyInfo
|
import androidx.media3.extractor.metadata.icy.IcyInfo
|
||||||
import com.michatec.radio.Keys
|
import com.michatec.radio.Keys
|
||||||
@@ -33,6 +35,7 @@ object AudioHelper {
|
|||||||
|
|
||||||
|
|
||||||
/* Extract audio stream metadata */
|
/* Extract audio stream metadata */
|
||||||
|
@OptIn(UnstableApi::class)
|
||||||
fun getMetadataString(metadata: Metadata): String {
|
fun getMetadataString(metadata: Metadata): String {
|
||||||
var metadataString = String()
|
var metadataString = String()
|
||||||
for (i in 0 until metadata.length()) {
|
for (i in 0 until metadata.length()) {
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ object ShortcutHelper {
|
|||||||
): IconCompat {
|
): IconCompat {
|
||||||
val stationImageBitmap: Bitmap =
|
val stationImageBitmap: Bitmap =
|
||||||
ImageHelper.getScaledStationImage(context, stationImage.toUri(), 192)
|
ImageHelper.getScaledStationImage(context, stationImage.toUri(), 192)
|
||||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
IconCompat.createWithAdaptiveBitmap(
|
return IconCompat.createWithAdaptiveBitmap(
|
||||||
ImageHelper.createSquareImage(
|
ImageHelper.createSquareImage(
|
||||||
context,
|
context,
|
||||||
stationImageBitmap,
|
stationImageBitmap,
|
||||||
@@ -83,17 +83,5 @@ object ShortcutHelper {
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
} else {
|
|
||||||
IconCompat.createWithAdaptiveBitmap(
|
|
||||||
ImageHelper.createSquareImage(
|
|
||||||
context,
|
|
||||||
stationImageBitmap,
|
|
||||||
stationImageColor,
|
|
||||||
192,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -209,7 +209,6 @@ class SearchResultAdapter(
|
|||||||
// stop radio playback when one is active
|
// stop radio playback when one is active
|
||||||
val audioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
val audioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
val audioAttributes = AudioAttributes.Builder()
|
val audioAttributes = AudioAttributes.Builder()
|
||||||
.setUsage(AudioAttributes.USAGE_MEDIA)
|
.setUsage(AudioAttributes.USAGE_MEDIA)
|
||||||
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
|
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
|
||||||
@@ -220,11 +219,6 @@ class SearchResultAdapter(
|
|||||||
.build()
|
.build()
|
||||||
|
|
||||||
audioManager.requestAudioFocus(focusRequest)
|
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_preview_playback_started">Было запущено воспроизведение предварительного просмотра.</string>
|
||||||
<string name="toastmessage_restored">Станции были успешно восстановлены.</string>
|
<string name="toastmessage_restored">Станции были успешно восстановлены.</string>
|
||||||
<string name="toastmessage_save_m3u">Сохранение радиостанций как M3U…</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_created">Ярлык создан.</string>
|
||||||
<string name="toastmessage_shortcut_not_created">Ярлык не создан. Устройство не позволяет создавать ярлыки.</string>
|
<string name="toastmessage_shortcut_not_created">Ярлык не создан. Устройство не позволяет создавать ярлыки.</string>
|
||||||
<string name="toastmessage_sleep_timer_unable_to_start">Пожалуйста, запустите сперва воспроизведение.</string>
|
<string name="toastmessage_sleep_timer_unable_to_start">Пожалуйста, запустите сперва воспроизведение.</string>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- App Name -->
|
<!-- App Name -->
|
||||||
<string name="app_version_name" translatable="false">\"Purple\"</string>
|
<string name="app_version_name" translatable="false">\"Blue\"</string>
|
||||||
|
|
||||||
<!-- Accessibility Descriptions -->
|
<!-- Accessibility Descriptions -->
|
||||||
<string name="descr_app_icon">App icon depicting an old radio</string>
|
<string name="descr_app_icon">App icon depicting an old radio</string>
|
||||||
|
|||||||
@@ -17,4 +17,6 @@
|
|||||||
<locale android:name="tr" />
|
<locale android:name="tr" />
|
||||||
<locale android:name="uk" />
|
<locale android:name="uk" />
|
||||||
<locale android:name="zh-rCN" />
|
<locale android:name="zh-rCN" />
|
||||||
|
<locale android:name="da" />
|
||||||
|
<locale android:name="ja" />
|
||||||
</locale-config>
|
</locale-config>
|
||||||
@@ -7,5 +7,5 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.register('clean', Delete) {
|
tasks.register('clean', Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.buildDir()
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user