From cc3cdd8166390caff8e71e7ee71aad90db64e867 Mon Sep 17 00:00:00 2001 From: Lucas Pinheiro Date: Mon, 25 Oct 2021 11:18:11 -0300 Subject: [PATCH] Update 2.5.2 - Fixed #56 --- on_audio_query/CHANGELOG.md | 14 ++++++++++++++ on_audio_query/README.md | 4 ++-- on_audio_query/README.pt-BR.md | 4 ++-- .../on_audio_query/query/helper/OnAudioHelper.kt | 15 ++++++++++++++- on_audio_query/pubspec.yaml | 2 +- 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/on_audio_query/CHANGELOG.md b/on_audio_query/CHANGELOG.md index 18f8df03..7e616f19 100644 --- a/on_audio_query/CHANGELOG.md +++ b/on_audio_query/CHANGELOG.md @@ -1,3 +1,17 @@ +## [2.5.2] - [10.25.2021] +### Fixes +#### Android +- **[Fixed]** wrong value returning from: - [#56](https://github.com/LucasPJS/on_audio_query/issues/56) + - `[is_music]`. + - `[is_alarm]`. + - `[is_notification]`. + - `[is_ringtone]`. + - `[is_podcast]`. + - `[is_audiobook]`. + +### Documentation +- Updated `README` documentation. + ## [2.5.1] - [10.19.2021] ### Fixes #### Dart diff --git a/on_audio_query/README.md b/on_audio_query/README.md index 8c9af391..f6f591e9 100644 --- a/on_audio_query/README.md +++ b/on_audio_query/README.md @@ -35,7 +35,7 @@ NOTE: Feel free to help with readme translations | Methods | Android | IOS | Web | -|--------------|-----------------|-----------------|-----------------| +|-------|:----------:|:----------:|:----------:| | `querySongs` | `✔️` | `✔️` | `✔️` |
| `queryAlbums` | `✔️` | `✔️` | `✔️` |
| `queryArtists` | `✔️` | `✔️` | `✔️` |
@@ -63,7 +63,7 @@ NOTE: Feel free to help with readme translations Add the following code to your `pubspec.yaml`: ```yaml dependencies: - on_audio_query: ^2.5.1 + on_audio_query: ^2.5.2 ``` ### Request Permission: diff --git a/on_audio_query/README.pt-BR.md b/on_audio_query/README.pt-BR.md index a809da52..e4f4b944 100644 --- a/on_audio_query/README.pt-BR.md +++ b/on_audio_query/README.pt-BR.md @@ -35,7 +35,7 @@ NOTE: Fique à vontade para ajudar nas traduções | Methods | Android | IOS | Web | -|--------------|-----------------|-----------------|-----------------| +|-------|:----------:|:----------:|:----------:| | `querySongs` | `✔️` | `✔️` | `✔️` |
| `queryAlbums` | `✔️` | `✔️` | `✔️` |
| `queryArtists` | `✔️` | `✔️` | `✔️` |
@@ -63,7 +63,7 @@ NOTE: Fique à vontade para ajudar nas traduções Adicione o seguinte codigo para seu `pubspec.yaml`: ```yaml dependencies: - on_audio_query: ^2.5.1 + on_audio_query: ^2.5.2 ``` #### Solicitar Permissões: diff --git a/on_audio_query/android/src/main/kotlin/com/lucasjosino/on_audio_query/query/helper/OnAudioHelper.kt b/on_audio_query/android/src/main/kotlin/com/lucasjosino/on_audio_query/query/helper/OnAudioHelper.kt index 454f418c..0584b93b 100644 --- a/on_audio_query/android/src/main/kotlin/com/lucasjosino/on_audio_query/query/helper/OnAudioHelper.kt +++ b/on_audio_query/android/src/main/kotlin/com/lucasjosino/on_audio_query/query/helper/OnAudioHelper.kt @@ -32,6 +32,7 @@ class OnAudioHelper { //This method will separate [String] from [Int] fun loadSongItem(itemProperty: String, cursor: Cursor): Any? { return when (itemProperty) { + // Int "_id", "album_id", "artist_id" -> { @@ -48,6 +49,18 @@ class OnAudioHelper { "date_modified", "duration", "track" -> cursor.getInt(cursor.getColumnIndex(itemProperty)) + // Boolean + "is_alarm", + "is_audiobook", + "is_music", + "is_notification", + "is_podcast", + "is_ringtone" -> { + val value = cursor.getString(cursor.getColumnIndex(itemProperty)) + if (value == "0") return false + return true + } + // String else -> cursor.getString(cursor.getColumnIndex(itemProperty)) } } @@ -55,7 +68,7 @@ class OnAudioHelper { //This method will separate [String] from [Int] fun loadAlbumItem(itemProperty: String, cursor: Cursor): Any? { return when (itemProperty) { - "_id", + "_id", "artist_id" -> { // The [album] id from Android >= 30/R is a [Long] instead of [Int]. if (Build.VERSION.SDK_INT >= 30) { diff --git a/on_audio_query/pubspec.yaml b/on_audio_query/pubspec.yaml index a5057881..c33b53a6 100644 --- a/on_audio_query/pubspec.yaml +++ b/on_audio_query/pubspec.yaml @@ -1,6 +1,6 @@ name: on_audio_query description: Flutter Plugin used to query audios/songs infos [title, artist, album, etc..] from device storage. -version: 2.5.1 +version: 2.5.2 homepage: https://github.com/LucasPJS/on_audio_query/tree/main/on_audio_query # pub.dev: https://pub.dev/packages/on_audio_query # ========