From 75499c1f96f65a8190bb6df8cb7546caacfb386a Mon Sep 17 00:00:00 2001 From: kotvertolet Date: Tue, 4 Aug 2020 21:56:03 +0300 Subject: [PATCH] release 1.3.3' --- app/build.gradle | 13 +++-- .../kotvertolet/youtubeaudioplayer/App.java | 5 ++ .../activities/splash/SplashActivity.java | 7 ++- .../data/PlaylistWithSongs.kt | 16 ++++++ .../youtube/videos/list/ContentDetails.kt | 38 ++++++++++++ .../data/models/youtube/videos/list/High.kt | 22 +++++++ .../data/models/youtube/videos/list/Id.kt | 27 +++++++++ .../youtube/videos/list/JsonMemberDefault.kt | 22 +++++++ .../models/youtube/videos/list/Localized.kt | 18 ++++++ .../data/models/youtube/videos/list/Maxres.kt | 22 +++++++ .../data/models/youtube/videos/list/Medium.kt | 22 +++++++ .../models/youtube/videos/list/PageInfo.kt | 18 ++++++ .../youtube/videos/list/RegionRestriction.kt | 14 +++++ .../models/youtube/videos/list/ResourceId.kt | 18 ++++++ .../models/youtube/videos/list/Snippet.kt | 54 ++++++++++++++++++ .../models/youtube/videos/list/Standard.kt | 22 +++++++ .../models/youtube/videos/list/Statistics.kt | 30 ++++++++++ .../models/youtube/videos/list/Thumbnails.kt | 30 ++++++++++ .../youtube/videos/list/VideoDataItem.kt | 34 +++++++++++ .../videos/list/YoutubeVideoListResponse.kt | 30 ++++++++++ .../models/youtubeVideoInfo/ContentDetails.kt | 34 +++++++++++ .../tasks/AudioStreamExtractionAsyncTask.java | 4 ++ .../utilities/AudioStreamsUtils.java | 4 +- .../utilities/YoutubeApiKeysProvider.java | 14 +++++ .../YoutubeRecommendationsFetchUtils.java | 13 ++++- .../utilities/common/Constants.java | 3 - .../drawable/drawable-hdpi/ic_download.png | Bin 0 -> 199 bytes .../drawable-hdpi/ic_download_done.png | Bin 0 -> 218 bytes .../drawable/drawable-mdpi/ic_download.png | Bin 0 -> 163 bytes .../drawable-mdpi/ic_download_done.png | Bin 0 -> 182 bytes .../drawable/drawable-xhdpi/ic_download.png | Bin 0 -> 187 bytes .../drawable-xhdpi/ic_download_done.png | Bin 0 -> 304 bytes .../drawable/drawable-xxhdpi/ic_download.png | Bin 0 -> 261 bytes .../drawable-xxhdpi/ic_download_done.png | Bin 0 -> 450 bytes .../drawable/drawable-xxxhdpi/ic_download.png | Bin 0 -> 263 bytes .../drawable-xxxhdpi/ic_download_done.png | Bin 0 -> 575 bytes app/src/main/res/drawable/ic_download.png | Bin 0 -> 199 bytes .../main/res/drawable/ic_download_done.png | Bin 0 -> 218 bytes app/src/main/res/drawable/ripple.xml | 2 +- .../layout_playlist_creation_dialog.xml | 14 ----- .../res/layout/layout_recommendation_item.xml | 25 -------- .../main/res/layout/layout_search_item.xml | 4 +- .../main/res/layout/layout_sliding_player.xml | 27 ++++----- app/src/main/res/values-v23/styles.xml | 14 ----- app/src/main/res/values/strings.xml | 12 ++-- app/src/main/res/values/styles.xml | 2 +- build.gradle | 2 +- 47 files changed, 541 insertions(+), 95 deletions(-) create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/PlaylistWithSongs.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/ContentDetails.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/High.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Id.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/JsonMemberDefault.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Localized.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Maxres.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Medium.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/PageInfo.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/RegionRestriction.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/ResourceId.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Snippet.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Standard.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Statistics.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Thumbnails.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/VideoDataItem.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/YoutubeVideoListResponse.kt create mode 100644 app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtubeVideoInfo/ContentDetails.kt create mode 100644 app/src/main/res/drawable/drawable-hdpi/ic_download.png create mode 100644 app/src/main/res/drawable/drawable-hdpi/ic_download_done.png create mode 100644 app/src/main/res/drawable/drawable-mdpi/ic_download.png create mode 100644 app/src/main/res/drawable/drawable-mdpi/ic_download_done.png create mode 100644 app/src/main/res/drawable/drawable-xhdpi/ic_download.png create mode 100644 app/src/main/res/drawable/drawable-xhdpi/ic_download_done.png create mode 100644 app/src/main/res/drawable/drawable-xxhdpi/ic_download.png create mode 100644 app/src/main/res/drawable/drawable-xxhdpi/ic_download_done.png create mode 100644 app/src/main/res/drawable/drawable-xxxhdpi/ic_download.png create mode 100644 app/src/main/res/drawable/drawable-xxxhdpi/ic_download_done.png create mode 100644 app/src/main/res/drawable/ic_download.png create mode 100644 app/src/main/res/drawable/ic_download_done.png delete mode 100644 app/src/main/res/values-v23/styles.xml diff --git a/app/build.gradle b/app/build.gradle index 44565fa..47f694f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "com.github.kotvertolet.youtubeaudioplayer" minSdkVersion 19 targetSdkVersion 29 - versionCode 3 - versionName "1.1.2" + versionCode 4 + versionName "1.1.3" multiDexEnabled true vectorDrawables.useSupportLibrary = true } @@ -39,12 +39,12 @@ dependencies { // Core implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'androidx.preference:preference:1.1.0' + implementation 'androidx.preference:preference:1.1.1' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.vectordrawable:vectordrawable:1.1.0' // Support - implementation 'com.google.android.material:material:1.2.0-alpha05' + implementation 'com.google.android.material:material:1.3.0-alpha02' // Retrofit implementation "com.squareup.retrofit2:retrofit:2.7.2" @@ -86,6 +86,9 @@ dependencies { // Multidex implementation 'com.android.support:multidex:1.0.3' + // Ripple for API <21 + //implementation 'com.balysv:material-ripple:1.0.2' + // YoutubeJExtractor - implementation 'com.github.kotvertolet:youtube-jextractor:0.2.5' + implementation 'com.github.kotvertolet:youtube-jextractor:0.3.1' } \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/App.java b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/App.java index 0468c88..24b1ff8 100644 --- a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/App.java +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/App.java @@ -93,6 +93,11 @@ public void onCreate() { cachingTasksManager = new CachingTasksManager(); } + @Override + public void onTerminate() { + super.onTerminate(); + } + public DownloadNotificationHelper getDownloadNotificationHelper() { if (downloadNotificationHelper == null) { downloadNotificationHelper = diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/activities/splash/SplashActivity.java b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/activities/splash/SplashActivity.java index b7e3949..b392a21 100644 --- a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/activities/splash/SplashActivity.java +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/activities/splash/SplashActivity.java @@ -41,16 +41,17 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { utils = new CommonUtils(); sharedPreferences = getSharedPreferences(APP_PREFERENCES, Context.MODE_PRIVATE); presenter = new SplashActivityPresenterImpl(this); - } - @Override - protected void onPostResume() { boolean noRecommendations = sharedPreferences.getBoolean(Constants.PREFERENCE_NO_RECOMMENDATIONS, false); if (noRecommendations) { presenter.loadRecents(new HashMap<>()); } else { presenter.loadYoutubeRecommendations(); } + } + + @Override + protected void onPostResume() { super.onPostResume(); } diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/PlaylistWithSongs.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/PlaylistWithSongs.kt new file mode 100644 index 0000000..c9600cc --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/PlaylistWithSongs.kt @@ -0,0 +1,16 @@ +package com.github.kotvertolet.youtubeaudioplayer.data + +import com.github.kotvertolet.youtubeaudioplayer.db.dto.PlaylistDto +import com.github.kotvertolet.youtubeaudioplayer.db.dto.YoutubeSongDto + +class PlaylistWithSongs { + var playlist: PlaylistDto? = null + var songs: List? = null + + constructor() + constructor(playlist: PlaylistDto?, songs: List?) { + this.playlist = playlist + this.songs = songs + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/ContentDetails.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/ContentDetails.kt new file mode 100644 index 0000000..f876d64 --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/ContentDetails.kt @@ -0,0 +1,38 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class ContentDetails { + @SerializedName("duration") + var duration: String? = null + + @SerializedName("licensedContent") + var isLicensedContent = false + + @SerializedName("caption") + var caption: String? = null + + @SerializedName("definition") + var definition: String? = null + + @SerializedName("regionRestriction") + var regionRestriction: RegionRestriction? = null + + @SerializedName("projection") + var projection: String? = null + + @SerializedName("dimension") + var dimension: String? = null + + override fun toString(): String { + return "ContentDetails{" + + "duration = '" + duration + '\'' + + ",licensedContent = '" + isLicensedContent + '\'' + + ",caption = '" + caption + '\'' + + ",definition = '" + definition + '\'' + + ",regionRestriction = '" + regionRestriction + '\'' + + ",projection = '" + projection + '\'' + + ",dimension = '" + dimension + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/High.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/High.kt new file mode 100644 index 0000000..d8c1359 --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/High.kt @@ -0,0 +1,22 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class High { + @SerializedName("width") + var width = 0 + + @SerializedName("url") + var url: String? = null + + @SerializedName("height") + var height = 0 + + override fun toString(): String { + return "High{" + + "width = '" + width + '\'' + + ",url = '" + url + '\'' + + ",height = '" + height + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Id.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Id.kt new file mode 100644 index 0000000..9392c21 --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Id.kt @@ -0,0 +1,27 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class Id { + @SerializedName("kind") + var kind: String? = null + + @SerializedName("videoId") + var videoId: String + + constructor(videoId: String) { + this.videoId = videoId + } + + constructor(kind: String?, videoId: String) { + this.kind = kind + this.videoId = videoId + } + + override fun toString(): String { + return "Id{" + + "kind = '" + kind + '\'' + + ",videoId = '" + videoId + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/JsonMemberDefault.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/JsonMemberDefault.kt new file mode 100644 index 0000000..3f30b6e --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/JsonMemberDefault.kt @@ -0,0 +1,22 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class JsonMemberDefault { + @SerializedName("width") + var width = 0 + + @SerializedName("url") + var url: String? = null + + @SerializedName("height") + var height = 0 + + override fun toString(): String { + return "JsonMemberDefault{" + + "width = '" + width + '\'' + + ",url = '" + url + '\'' + + ",height = '" + height + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Localized.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Localized.kt new file mode 100644 index 0000000..8d5de80 --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Localized.kt @@ -0,0 +1,18 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class Localized { + @SerializedName("description") + var description: String? = null + + @SerializedName("title") + var title: String? = null + + override fun toString(): String { + return "Localized{" + + "description = '" + description + '\'' + + ",title = '" + title + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Maxres.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Maxres.kt new file mode 100644 index 0000000..3df8fd0 --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Maxres.kt @@ -0,0 +1,22 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class Maxres { + @SerializedName("width") + var width = 0 + + @SerializedName("url") + var url: String? = null + + @SerializedName("height") + var height = 0 + + override fun toString(): String { + return "Maxres{" + + "width = '" + width + '\'' + + ",url = '" + url + '\'' + + ",height = '" + height + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Medium.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Medium.kt new file mode 100644 index 0000000..6ea34c0 --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Medium.kt @@ -0,0 +1,22 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class Medium { + @SerializedName("width") + var width = 0 + + @SerializedName("url") + var url: String? = null + + @SerializedName("height") + var height = 0 + + override fun toString(): String { + return "Medium{" + + "width = '" + width + '\'' + + ",url = '" + url + '\'' + + ",height = '" + height + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/PageInfo.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/PageInfo.kt new file mode 100644 index 0000000..1585128 --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/PageInfo.kt @@ -0,0 +1,18 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class PageInfo { + @SerializedName("totalResults") + var totalResults = 0 + + @SerializedName("resultsPerPage") + var resultsPerPage = 0 + + override fun toString(): String { + return "PageInfo{" + + "totalResults = '" + totalResults + '\'' + + ",resultsPerPage = '" + resultsPerPage + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/RegionRestriction.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/RegionRestriction.kt new file mode 100644 index 0000000..815fba5 --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/RegionRestriction.kt @@ -0,0 +1,14 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class RegionRestriction { + @SerializedName("allowed") + var allowed: List? = null + + override fun toString(): String { + return "RegionRestriction{" + + "allowed = '" + allowed + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/ResourceId.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/ResourceId.kt new file mode 100644 index 0000000..13e7c51 --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/ResourceId.kt @@ -0,0 +1,18 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class ResourceId { + @SerializedName("kind") + var kind: String? = null + + @SerializedName("videoId") + var videoId: String? = null + + override fun toString(): String { + return "ResourceId{" + + "kind = '" + kind + '\'' + + ",videoId = '" + videoId + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Snippet.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Snippet.kt new file mode 100644 index 0000000..dc263d7 --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Snippet.kt @@ -0,0 +1,54 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class Snippet { + @SerializedName("publishedAt") + var publishedAt: String? = null + + @SerializedName("localized") + var localized: Localized? = null + + @SerializedName("description") + var description: String? = null + + @SerializedName("title") + var title: String? = null + + @SerializedName("thumbnails") + var thumbnails: Thumbnails? = null + + @SerializedName("channelId") + var channelId: String? = null + + @SerializedName("categoryId") + var categoryId: String? = null + + @SerializedName("channelTitle") + var channelTitle: String? = null + + @SerializedName("tags") + var tags: List? = null + + @SerializedName("liveBroadcastContent") + var liveBroadcastContent: String? = null + + //TODO: Only for playlist + @SerializedName("resourceId") + var resourceId: ResourceId? = null + + override fun toString(): String { + return "Snippet{" + + "publishedAt = '" + publishedAt + '\'' + + ",localized = '" + localized + '\'' + + ",description = '" + description + '\'' + + ",title = '" + title + '\'' + + ",thumbnails = '" + thumbnails + '\'' + + ",channelId = '" + channelId + '\'' + + ",categoryId = '" + categoryId + '\'' + + ",channelTitle = '" + channelTitle + '\'' + + ",tags = '" + tags + '\'' + + ",liveBroadcastContent = '" + liveBroadcastContent + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Standard.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Standard.kt new file mode 100644 index 0000000..608501b --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Standard.kt @@ -0,0 +1,22 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class Standard { + @SerializedName("width") + var width = 0 + + @SerializedName("url") + var url: String? = null + + @SerializedName("height") + var height = 0 + + override fun toString(): String { + return "Standard{" + + "width = '" + width + '\'' + + ",url = '" + url + '\'' + + ",height = '" + height + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Statistics.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Statistics.kt new file mode 100644 index 0000000..ee02094 --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Statistics.kt @@ -0,0 +1,30 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class Statistics { + @SerializedName("dislikeCount") + var dislikeCount: String? = null + + @SerializedName("likeCount") + var likeCount: String? = null + + @SerializedName("viewCount") + var viewCount: String? = null + + @SerializedName("favoriteCount") + var favoriteCount: String? = null + + @SerializedName("commentCount") + var commentCount: String? = null + + override fun toString(): String { + return "Statistics{" + + ",dislikeCount = '" + dislikeCount + '\'' + + ",likeCount = '" + likeCount + '\'' + + ",viewCount = '" + viewCount + '\'' + + ",favoriteCount = '" + favoriteCount + '\'' + + ",commentCount = '" + commentCount + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Thumbnails.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Thumbnails.kt new file mode 100644 index 0000000..f28ea15 --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/Thumbnails.kt @@ -0,0 +1,30 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class Thumbnails { + @SerializedName("standard") + var standard: Standard? = null + + @SerializedName("default") + var jsonMemberDefault: JsonMemberDefault? = null + + @SerializedName("high") + var high: High? = null + + @SerializedName("maxres") + var maxres: Maxres? = null + + @SerializedName("medium") + var medium: Medium? = null + + override fun toString(): String { + return "Thumbnails{" + + "standard = '" + standard + '\'' + + ",default = '" + jsonMemberDefault + '\'' + + ",high = '" + high + '\'' + + ",maxres = '" + maxres + '\'' + + ",medium = '" + medium + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/VideoDataItem.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/VideoDataItem.kt new file mode 100644 index 0000000..a181a51 --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/VideoDataItem.kt @@ -0,0 +1,34 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class VideoDataItem { + @SerializedName("snippet") + var snippet: Snippet? = null + + @SerializedName("kind") + var kind: String? = null + + @SerializedName("etag") + var etag: String? = null + + @SerializedName("id") + var id: String? = null + + @SerializedName("contentDetails") + var contentDetails: ContentDetails? = null + + @SerializedName("statistics") + var statistics: Statistics? = null + + + override fun toString(): String { + return "VideoDataItem{" + + "snippet = '" + snippet + '\'' + + ",kind = '" + kind + '\'' + + ",etag = '" + etag + '\'' + + ",id = '" + id + '\'' + + ",contentDetails = '" + contentDetails + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/YoutubeVideoListResponse.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/YoutubeVideoListResponse.kt new file mode 100644 index 0000000..39a25d1 --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtube/videos/list/YoutubeVideoListResponse.kt @@ -0,0 +1,30 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list + +import com.google.gson.annotations.SerializedName + +class YoutubeVideoListResponse { + + @SerializedName("nextPageToken") + var nextPageToken: String? = null + + @SerializedName("kind") + var kind: String? = null + + @SerializedName("pageInfo") + var pageInfo: PageInfo? = null + + @SerializedName("etag") + var etag: String? = null + + @SerializedName("items") + var items: List? = null + + override fun toString(): String { + return "YoutubeVideoListResponse{" + + "kind = '" + kind + '\'' + + ",pageInfo = '" + pageInfo + '\'' + + ",etag = '" + etag + '\'' + + ",items = '" + items + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtubeVideoInfo/ContentDetails.kt b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtubeVideoInfo/ContentDetails.kt new file mode 100644 index 0000000..3cd0093 --- /dev/null +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/data/models/youtubeVideoInfo/ContentDetails.kt @@ -0,0 +1,34 @@ +package com.github.kotvertolet.youtubeaudioplayer.data.models.youtubeVideoInfo + +import com.google.gson.annotations.SerializedName + +class ContentDetails { + @SerializedName("duration") + var duration: String? = null + + @SerializedName("licensedContent") + var isLicensedContent = false + + @SerializedName("caption") + var caption: String? = null + + @SerializedName("definition") + var definition: String? = null + + @SerializedName("projection") + var projection: String? = null + + @SerializedName("dimension") + var dimension: String? = null + + override fun toString(): String { + return "ContentDetails{" + + "duration = '" + duration + '\'' + + ",licensedContent = '" + isLicensedContent + '\'' + + ",caption = '" + caption + '\'' + + ",definition = '" + definition + '\'' + + ",projection = '" + projection + '\'' + + ",dimension = '" + dimension + '\'' + + "}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/tasks/AudioStreamExtractionAsyncTask.java b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/tasks/AudioStreamExtractionAsyncTask.java index 6f4d0d2..25beb6d 100644 --- a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/tasks/AudioStreamExtractionAsyncTask.java +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/tasks/AudioStreamExtractionAsyncTask.java @@ -1,6 +1,7 @@ package com.github.kotvertolet.youtubeaudioplayer.tasks; import android.os.AsyncTask; +import android.util.Log; import com.github.kotvertolet.youtubeaudioplayer.App; import com.github.kotvertolet.youtubeaudioplayer.activities.main.MainActivity; @@ -10,6 +11,7 @@ import com.github.kotvertolet.youtubeaudioplayer.custom.exceptions.UserFriendlyException; import com.github.kotvertolet.youtubeaudioplayer.db.dto.YoutubeSongDto; import com.github.kotvertolet.youtubeaudioplayer.utilities.AudioStreamsUtils; +import com.github.kotvertolet.youtubejextractor.models.AdaptiveAudioStream; import com.github.kotvertolet.youtubejextractor.models.StreamItem; import com.github.kotvertolet.youtubejextractor.models.youtube.videoData.YoutubeVideoData; @@ -17,6 +19,7 @@ public class AudioStreamExtractionAsyncTask extends AsyncTask> { + private final static String TAG = AudioStreamExtractionAsyncTask.class.getSimpleName(); private WeakReference presenter; private WeakReference view; private AudioStreamsUtils audioStreamsUtils; @@ -44,6 +47,7 @@ protected void onPreExecute() { protected AsyncTaskResult doInBackground(String... params) { AsyncTaskResult taskResult; try { + Log.i(TAG, "Extracting data for video id: " + params[0]); YoutubeVideoData youtubeVideoData = audioStreamsUtils.extractYoutubeVideoData(params[0]); StreamItem streamItem = audioStreamsUtils.getAudioStreamForVideo(youtubeVideoData, ((MainActivity) view.get())); model.setStreamUrl(streamItem.getUrl()); diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/AudioStreamsUtils.java b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/AudioStreamsUtils.java index 0c7dd62..57be03a 100644 --- a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/AudioStreamsUtils.java +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/AudioStreamsUtils.java @@ -33,10 +33,10 @@ public YoutubeVideoData extractYoutubeVideoData(String videoId) throws UserFrien } // TODO: Do this in a good way catch (ExtractionException e) { - throw new UserFriendlyException(R.string.generic_error_message, + throw new UserFriendlyException(R.string.audio_extraction_failed_error_message, e.getMessage()); } catch (YoutubeRequestException e) { - throw new UserFriendlyException(R.string.generic_error_message, + throw new UserFriendlyException(R.string.youtube_request_failed_error_message, e.getMessage()); } return youtubeVideoData; diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/YoutubeApiKeysProvider.java b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/YoutubeApiKeysProvider.java index c3415ae..3c3d164 100644 --- a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/YoutubeApiKeysProvider.java +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/YoutubeApiKeysProvider.java @@ -1,6 +1,7 @@ package com.github.kotvertolet.youtubeaudioplayer.utilities; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -11,10 +12,23 @@ public class YoutubeApiKeysProvider { private Iterator iter; private YoutubeApiKeysProvider() { + youtubeApiKeys.add("AIzaSyA1dZ5u9JC9j8HpzBVNw8BwrNLDTDkqS3I"); + youtubeApiKeys.add("AIzaSyAUA1FFr5YKMcy_zjSDdGZFfIlKugxVgSM"); + youtubeApiKeys.add("AIzaSyAAXQD3_VR0dnLSHSYKOWUBHss9m27oBcc"); + youtubeApiKeys.add("AIzaSyCuCljT7hV44ZIoqXfilkztwdq1ZomhLFw"); + youtubeApiKeys.add("AIzaSyBnNjcvvkAKbifj3Yw2nmrzMJUALoNHxXM"); + youtubeApiKeys.add("AIzaSyBlOh7WHHYbelElphSoUAvCahpjo_zQom0"); + youtubeApiKeys.add("AIzaSyBp_5QruvEa4PiIWb788N-5_GuSCW_j7pc"); + youtubeApiKeys.add("AIzaSyDpTO_uR7-11s1FF9xQoru7f1i-M6dZiME"); + youtubeApiKeys.add("AIzaSyDFdPe9ROdCxClxT1cPQXSyYh705Z9N6FU"); + youtubeApiKeys.add("AIzaSyCHxTxxmay9TD7izuLBQYrOGSrupura_tQ"); + youtubeApiKeys.add("AIzaSyABcQuDwbl-3g-TxTgm4KBLACqpTAvGMg8"); + youtubeApiKeys.add("AIzaSyAhqowApJizByAN-iXRJLIeXV21U_F1Fnk"); if (youtubeApiKeys.size() == 0) { throw new Error("Add youtube data api keys first!"); } iter = youtubeApiKeys.iterator(); + Collections.shuffle(youtubeApiKeys); } public static YoutubeApiKeysProvider getInstance() { diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/YoutubeRecommendationsFetchUtils.java b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/YoutubeRecommendationsFetchUtils.java index d24cf17..9979467 100644 --- a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/YoutubeRecommendationsFetchUtils.java +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/YoutubeRecommendationsFetchUtils.java @@ -6,6 +6,7 @@ import com.github.kotvertolet.youtubeaudioplayer.App; import com.github.kotvertolet.youtubeaudioplayer.activities.splash.SplashActivityContract; +import com.github.kotvertolet.youtubeaudioplayer.custom.exceptions.UserFriendlyRuntimeException; import com.github.kotvertolet.youtubeaudioplayer.custom.exceptions.VideoIsDeletedException; import com.github.kotvertolet.youtubeaudioplayer.data.dataSource.RemoteDataSource; import com.github.kotvertolet.youtubeaudioplayer.data.models.youtube.videos.list.Snippet; @@ -48,11 +49,17 @@ public YoutubeRecommendationsFetchUtils(CommonUtils commonUtils, SplashActivityC @SuppressLint("CheckResult") public void fetchYoutubeRecommendations() { Maybe topTracks = - remoteDataSource.getTopTracksPlaylist().subscribeOn(Schedulers.newThread()); + remoteDataSource.getTopTracksPlaylist().subscribeOn(Schedulers.newThread()).doOnError(error -> { + throw new Exception(error); + }); Maybe mostViewed = - remoteDataSource.getMostViewedPlaylist().subscribeOn(Schedulers.newThread()); + remoteDataSource.getMostViewedPlaylist().subscribeOn(Schedulers.newThread()).doOnError(error -> { + throw new Exception(error); + }); Maybe newMusicThisWeek = - remoteDataSource.getNewMusicThisWeekPlaylist().subscribeOn(Schedulers.newThread()); + remoteDataSource.getNewMusicThisWeekPlaylist().subscribeOn(Schedulers.newThread()).doOnError(error -> { + throw new Exception(error); + }); Maybe.zip(topTracks, mostViewed, newMusicThisWeek, (topTracksResponse, mostViewedResponse, newMusicResponse) -> { HashMap> rawRecommendations = new HashMap<>(); diff --git a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/common/Constants.java b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/common/Constants.java index 49ce7dd..0f2d212 100644 --- a/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/common/Constants.java +++ b/app/src/main/java/com/github/kotvertolet/youtubeaudioplayer/utilities/common/Constants.java @@ -2,9 +2,6 @@ public class Constants { - //TODO: Put Youtube Data API v3 key here - //public final static String YOUTUBE_API_KEY = "AIzaSyBnNjcvvkAKbifj3Yw2nmrzMJUALoNHxXM"; - public static final String APP_NAME = "Youtube audio player"; public static final int PLAYBACK_PROGRESS_CHANGED = 5; public static final int PLAYER_ERROR = 6; diff --git a/app/src/main/res/drawable/drawable-hdpi/ic_download.png b/app/src/main/res/drawable/drawable-hdpi/ic_download.png new file mode 100644 index 0000000000000000000000000000000000000000..fa3ebbb31013c4b0710249bda570dc6907f89c98 GIT binary patch literal 199 zcmeAS@N?(olHy`uVBq!ia0vp^W+2SL0wmRZ7KH(+K2I0Nkch)?FYe}TFyLuPbW376 z)pJlo?yPcZ^WudL4T}87nO^?OR<7M-I>5VN zSGv-x+Pqecz(p>M;SU(JI7^xBN~X5I(&E2*)#%EBpV^XG4Bw*~qz?ElcvjfUb;wkU z|k0wldT1B8K8mZytjh{y4_Q*ZMgP~c#YJsK$U z)~(q1m-m)lF^^vy&zFBx;@>#sNTW$[{bH;=%sZG7QZ>uQBcw?@Ce|ClF7G156^ z#Rt_}Q9HRs{l8sYa>)1&$3+cMLFMTJXY2PZ*sH$V@BeR?lj;@>g(qYZ*L3k@0BvRP MboFyt=akR{0D4_J0ssI2 literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable/drawable-mdpi/ic_download_done.png b/app/src/main/res/drawable/drawable-mdpi/ic_download_done.png new file mode 100644 index 0000000000000000000000000000000000000000..08073a2a6dce34c3c57ba728240d4c9b31f519c9 GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k1|%Oc%$NbBYCT;XLn;{Go;MV1Fko;FR0-h{ zn$RY^<^h9@0;5b#TVCX@f+aFPnTqtCy9DvVUH^W!ib5RScf4elF{r5}E*wu0R6- literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable/drawable-xhdpi/ic_download_done.png b/app/src/main/res/drawable/drawable-xhdpi/ic_download_done.png new file mode 100644 index 0000000000000000000000000000000000000000..2339c0bf16e704b0a777a7e3c9d5531b0a510f40 GIT binary patch literal 304 zcmV-00nh%4P)IsdXBUJ^aMRZgMdI00mE<+!URGH7!WWZp?4YzLLj#78*sp#%eeQR+5h(h zpU*@@M5K%f6N`gK08*$NPl}P_QkWc)No zp0wzm<4Iq@f-8%H6FwQ5h{)lg0tG2ZK_Vg|du0PUE_qut;+EY20000wE~K=l?3?( zGdMK-S2&PeVl4v{nd9l=7*fHQBylW3q=!jSRb_$47PHi3l>`%oTW(u>v!t(@t;!9V zJy}SEMLFBJwR6>j3&&D;GRpgW8CV!3IGof3H#NT7KbyJZy7o@HnimIlhFeGN^F5VT@o&a8c7027j!s^099ZJR31yKy14VEd-{KK aWAi^1&nHZeEnWw7CxfS}pUXO@geCxTuwFg@ literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable/drawable-xxhdpi/ic_download_done.png b/app/src/main/res/drawable/drawable-xxhdpi/ic_download_done.png new file mode 100644 index 0000000000000000000000000000000000000000..b631a00088b192f8793e8e9c721cd133cd7f325d GIT binary patch literal 450 zcmV;z0X_bSP)m=(edlr3EaGus#)?oguD&H&p zIqNikR=;N@(%Q)yu)G+c#_vjPXVtQ0IaWy9wl6I3NXm)z2G)5erPRi)ezQWQwUkx$ zte(IIZ=^IxIkw)z8n1MwLZ4Z@w2HYvX-AfjKdl)m%dtwcgRDSlhgJZd_7W<~vD{MH zffb3TMa%NE20z=k;$n$Lz${M-la)x@wHR2Uj@z*~n5P~v%hTAhcvxi9A`lS~5fNdJ soc0vv6s9nRDNJDs6A=*+5fKrQ4-@T7x~OO3+yDRo07*qoM6N<$g37tT1ONa4 literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable/drawable-xxxhdpi/ic_download.png b/app/src/main/res/drawable/drawable-xxxhdpi/ic_download.png new file mode 100644 index 0000000000000000000000000000000000000000..f9bfb5edba7fdff1e63a71c0dfaab6ae5dc2a9a9 GIT binary patch literal 263 zcmeAS@N?(olHy`uVBq!ia0vp^6F``W8A#63;L-+CoB=)|u0Z-f7!+45O$Kt9OM?7@ z8U8o4yxP?RDjWv+R;i913rU`GJA70J0Yf7HdZ(Wfyo{Xm^Fh6({ z_nPtA>pxZT^|vw>_nO_(IRD_a*ip%vc=Os1g?FzWTps**Qn22_*r1(DN<1H4T7bql vcxeelge1npOP|+Xm)v7s>gTe~DWM4f1o3xI literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable/drawable-xxxhdpi/ic_download_done.png b/app/src/main/res/drawable/drawable-xxxhdpi/ic_download_done.png new file mode 100644 index 0000000000000000000000000000000000000000..52fe8f69907ddd3cb364be0d13278919d7c32afa GIT binary patch literal 575 zcmeAS@N?(olHy`uVBq!ia0vp^6F``Q1xWh(YZ)^zFtK^MIEGX(zP-elel=0T;bVHa ztAV$mt6-;+qmPRKhYANvi%^%qp%>LH5(Y;#lsgm-97$3V>)x2N%tvc(%f=6OcmLn5 ze!O??eRm5#k4Y+?5R}Dv*~h(e$NBv4PM&hYPb+<n!&;B2AjaGHus}W8=sWkcGlSLi_P>!sxl9B ztJ++Bm`_%HNy3yt@tDafP z>ptX>esalW@x1gd-(QBOBU)|dN1rZk)cs|8_{O@=bGo;EXwj29F2BQ7Jbp&kwGHj! zC5FZyY-j(pT|D{4#fHjrZh2FLO3!V+=QfY!{L4qGu{kDl)%UMxD)n=p*m-S}jat;> zlr7qxDf3h=8o!Fjwe)ZLsMQ%}Dd(ydb@J1UjMn79ltm`}ozpf0RX+0&nW=F$dC_;} zdFq~Dwyd{le^l@KetqXOkTH)EL}s3_$z0_6Ii*wVro5|~k^iiWgEoI>5VN zSGv-x+Pqecz(p>M;SU(JI7^xBN~X5I(&E2*)#%EBpV^XG4Bw*~qz?ElcvjfUb;wkU z \ No newline at end of file + tools:targetApi="lollipop" /> \ No newline at end of file diff --git a/app/src/main/res/layout/layout_playlist_creation_dialog.xml b/app/src/main/res/layout/layout_playlist_creation_dialog.xml index 889590e..0829c79 100644 --- a/app/src/main/res/layout/layout_playlist_creation_dialog.xml +++ b/app/src/main/res/layout/layout_playlist_creation_dialog.xml @@ -15,22 +15,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Playlist name" /> - - - - - - - - - - - - - -