-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added better library browsing for Android Auto #1322
Merged
Merged
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a3a58a2
Added better library browsing for Android Auto
ISO-B e4a3cc5
Added Android Auto browsing settings
ISO-B 8134ec8
Enchancements for Android Auto library
ISO-B eedcd18
Android Auto: Fixed and improved search
ISO-B b335fd3
Android Auto improvements
ISO-B 802c16c
Android Auto improvements. Icons, Start up
ISO-B b7c8e72
Android Auto: Podcast episodes show publish date
ISO-B f68f31c
Android Auto: Streamlined browsing settings to single option
ISO-B a08ae6f
Android Auto: Ensure that podcast are listed from newest to oldest
ISO-B 8caa088
Android Auto: Prevent crashing loop in case that app restarts while b…
ISO-B 1766111
Android Auto: Added comments to code
ISO-B 0da3045
Merge branch 'master' into feat_android_auto_browse
advplyr 8e6e0cf
Update loading library stats, filter non-audio items from search, pre…
advplyr 847bedb
Fix drawdown for paging with many of the same first letters, update s…
advplyr 0dc7813
Fix force reload when server changes
advplyr 9243e90
Android atuo Reset serverItemsInProgress
advplyr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
android/app/src/main/java/com/audiobookshelf/app/data/CollapsedSeries.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.audiobookshelf.app.data | ||
|
||
import android.content.Context | ||
import android.os.Bundle | ||
import android.support.v4.media.MediaDescriptionCompat | ||
import com.fasterxml.jackson.annotation.JsonIgnore | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
class CollapsedSeries( | ||
id:String, | ||
var libraryId:String?, | ||
var name:String, | ||
//var nameIgnorePrefix:String, | ||
var sequence:String?, | ||
var libraryItemIds:MutableList<String> | ||
) : LibraryItemWrapper(id) { | ||
@get:JsonIgnore | ||
val title get() = name | ||
@get:JsonIgnore | ||
val numBooks get() = libraryItemIds.size | ||
|
||
@JsonIgnore | ||
override fun getMediaDescription(progress:MediaProgressWrapper?, ctx: Context): MediaDescriptionCompat { | ||
val extras = Bundle() | ||
|
||
val mediaId = "__LIBRARY__${libraryId}__SERIE__${id}" | ||
return MediaDescriptionCompat.Builder() | ||
.setMediaId(mediaId) | ||
.setTitle(title) | ||
//.setIconUri(getCoverUri()) | ||
.setSubtitle("${numBooks} books") | ||
.setExtras(extras) | ||
.build() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
android/app/src/main/java/com/audiobookshelf/app/data/LibraryAuthorItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.audiobookshelf.app.data | ||
|
||
import android.content.Context | ||
import android.net.Uri | ||
import android.os.Bundle | ||
import android.support.v4.media.MediaDescriptionCompat | ||
import androidx.media.utils.MediaConstants | ||
import com.audiobookshelf.app.BuildConfig | ||
import com.audiobookshelf.app.R | ||
import com.audiobookshelf.app.device.DeviceManager | ||
import com.fasterxml.jackson.annotation.JsonIgnore | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
class LibraryAuthorItem( | ||
id:String, | ||
var libraryId:String, | ||
var name:String, | ||
var description:String?, | ||
var imagePath:String?, | ||
var addedAt:Long, | ||
var updatedAt:Long, | ||
var numBooks:Int?, | ||
var libraryItems:MutableList<LibraryItem>?, | ||
var series:MutableList<LibrarySeriesItem>? | ||
) : LibraryItemWrapper(id) { | ||
@get:JsonIgnore | ||
val title get() = name | ||
|
||
@get:JsonIgnore | ||
val bookCount get() = if (numBooks != null) numBooks else libraryItems!!.size | ||
|
||
@JsonIgnore | ||
fun getPortraitUri(): Uri { | ||
if (imagePath == null) { | ||
return Uri.parse("android.resource://${BuildConfig.APPLICATION_ID}/" + R.drawable.md_account_outline) | ||
} | ||
|
||
return Uri.parse("${DeviceManager.serverAddress}/api/authors/$id/image?token=${DeviceManager.token}") | ||
} | ||
|
||
@JsonIgnore | ||
fun getMediaDescription(progress:MediaProgressWrapper?, ctx: Context, groupTitle: String?): MediaDescriptionCompat { | ||
val extras = Bundle() | ||
if (groupTitle !== null) { | ||
extras.putString(MediaConstants.DESCRIPTION_EXTRAS_KEY_CONTENT_STYLE_GROUP_TITLE, groupTitle) | ||
} | ||
|
||
val mediaId = "__LIBRARY__${libraryId}__AUTHOR__${id}" | ||
return MediaDescriptionCompat.Builder() | ||
.setMediaId(mediaId) | ||
.setTitle(title) | ||
.setIconUri(getPortraitUri()) | ||
.setSubtitle("${bookCount} books") | ||
.setExtras(extras) | ||
.build() | ||
} | ||
|
||
@JsonIgnore | ||
override fun getMediaDescription(progress:MediaProgressWrapper?, ctx: Context): MediaDescriptionCompat { | ||
return getMediaDescription(progress, ctx, null) | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
android/app/src/main/java/com/audiobookshelf/app/data/LibraryCollection.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.audiobookshelf.app.data | ||
|
||
import android.content.Context | ||
import android.os.Bundle | ||
import android.support.v4.media.MediaDescriptionCompat | ||
import com.fasterxml.jackson.annotation.JsonIgnore | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
class LibraryCollection( | ||
id:String, | ||
var libraryId:String, | ||
var name:String, | ||
//var userId:String?, | ||
var description:String?, | ||
var books:MutableList<LibraryItem>?, | ||
) : LibraryItemWrapper(id) { | ||
@get:JsonIgnore | ||
val title get() = name | ||
|
||
@get:JsonIgnore | ||
val bookCount get() = if (books != null) books!!.size else 0 | ||
|
||
@get:JsonIgnore | ||
val audiobookCount get() = books?.filter { book -> (book.media as Book).getAudioTracks().isNotEmpty() }?.size ?: 0 | ||
|
||
@JsonIgnore | ||
override fun getMediaDescription(progress:MediaProgressWrapper?, ctx: Context): MediaDescriptionCompat { | ||
val extras = Bundle() | ||
|
||
val mediaId = "__LIBRARY__${libraryId}__COLLECTION__${id}" | ||
return MediaDescriptionCompat.Builder() | ||
.setMediaId(mediaId) | ||
.setTitle(title) | ||
//.setIconUri(getCoverUri()) | ||
.setSubtitle("${bookCount} books") | ||
.setExtras(extras) | ||
.build() | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't tell if this function is being used anywhere. I was looking because I was checking if
__SERIES__
was intentionally different than the mediaId used in the LibraryItem.getMediaDescription