Commit Graph

39 Commits

Author SHA1 Message Date
Synced Synapse 7dfd982643 Tweak connection threads
This PR fixes some issues with connections and threading. Specifically, the  change in #618 introduced threading in `HostConnection`, which had some issues. To fix them, the following changes were made:
- A specific TCP listener thread is used and manually started, instead of using one of the threads in the pool. The TCP listener thread is a long lived thread that should always be running (as long as the connection is through TCP), blocked listening on the TCP socket, so it shouldn't be managed in a pool, where, theoretically, it can be paused and reused. 
- Changed the number of threads to 5. We shouldn't need more than this, otherwise we can overwhelm some Kodi hardware.
- Had to sprinkle some `synchronized` to avoid race conditions. For instance, through a TCP connection, as soon as Kore is opened (on the remote screen) it will call at least `GetActivePlayers`, `GetProperties`, `Ping`. If the TCP socket isn't set up yet, each of these calls would create a socket (and a TCP listener thread), so we would open 3 or more sockets when we should just open 1. A `synchronized` in `executeThroughTcp` prevents this. The others prevent similar issues.

Aditionally:
- Tweaked the playlist fetching code, so that it happens exclusively in `HostConnectionObserver` and when PlaylistFragment is notified of changes, it already gets the playlist data. This somewhat simplifies the code, and makes it more consistent with the Player Observer code;
- Change `EventServerConnection` to accept a Handler on which to post the result of the connection, so that the caller can control on which thread the result is called;
- Calls to the various `RegisterObserver` loose the reply immediately parameter, as it was always true.
2019-09-28 22:10:04 +02:00
Synced Synapse 87a18cfe51 Don't sync TV Shows that have no episodes
After a library clean operation on Kodi, if a TV Show that was previously present is absent it is still returned in a call to `VideoLibrary.GetTVShows` with 0 episodes. Kore shouldn't consider these TV Shows, as they have no episodes.
2019-06-20 19:32:34 +02:00
Synced Synapse c7fef43deb Fix ANR in service launch
Some ANRs are reported on Google Play. This is an atempt to remove them, by making sure that `startForeground` is always called when the service starts.
2019-05-14 22:06:34 +02:00
Synced Synapse 46d4b5ffe1 Use standard media style notifications
Use the standard media style notifications instead of the custom one
2019-03-21 19:54:01 +01:00
Dan Pasanen 456ac6a107 Use a ChooserTargetService to direct a shared url to a specific host (#572)
* This gives the user a choice of their hosts to share a url to.
* Sadly the youtube app doesn't appear to support this. It wants to
  use some sort of crappy "Message on Youtube" thing rather than using
  standard android stuff (go figure). It does, however, work from a
  chrome browser of the youtube video, or likely any other supported
  share.
2018-09-14 16:47:51 +01:00
Synced Synapse c96b59c9e7 Change skip forward/backward notification icons 2018-04-15 16:09:42 +01:00
Adrian 7c18df20cf Add setting to use skip steps instead of seeking (#152)
closes #147
2018-04-15 15:39:06 +01:00
Synced Synapse 38e8a7a376 Improve ongoing notification presentation for PVR channels and unknown sources 2018-03-12 09:39:44 +01:00
Synced Synapse cda70ce109 Prevent the refresh animation from appearing in a sylent sync
When a silent sync is running the refresh animation shouldn't appear and this wasn't being repected in some situations. For instance, when not connected to Kodi, starting from a TV Show details, selecting one episode or season and hitting back, the animation would appear. This PR makes sure that it is only shown if it isn't silent.
2018-02-26 20:35:33 +01:00
Synced Synapse 246693a7cc Change the source of AlbumGenres table to support Kodi v18
As detailed in https://github.com/xbmc/xbmc/pull/13051, Kodi v18 changes the way album genres are handled, as the genre (by which i mean `genreId`) ceases to be available at the album level, being only available at the songs level.
This impacts Kore because `GetAlbums` and `GetAlbumDetails` won't return the `genreId` tag, from which the local AlbumGenres table was populated.

This PR changes the source of the local AlbumGenres table to be the `genreId` returned at the song level (by `GetSongs`), to make it somewhat more consistent with the way Kodi will handle things from now on.
2018-02-22 20:57:37 +01:00
Synced Synapse 3077653dd9 Fix notifications to work with Android Oreo
Whan the background service is launcher, it is launched on the foreground and a notification is always shown.
The service stays on while something is playing. It stops itself on a connection error, quitting Kodi or 5 seconds after stopping
Make the Pause Phone Calls preference dependent on the Show Notification preference, as we always need to show a notification when the service is running
2017-12-24 17:49:40 +00:00
Martijn Brekhof cb430aa20d Implemented a slideup panel with media controls and info (#320)
* The slideup panel is only displayed when something is
         playing. It starts collapsed showing the media poster
         and title of what is currently playing.

       * Media controls implemented are volume, progress, shuffle,
         repeat and play/pause for all items. Next and previous are only
         available when a music item is playing.

       * In collapsed mode the panel will display the mute button only
         if Kodi is muted. The mute button in expanded mode is always
         visible.

       * Panel is enabled by default. Users can disable the panel
         in Settings

       * Implemented listening to Player.OnPropertyChanged notifications
         to update shuffle and repeat button states.
2017-07-13 19:10:49 +01:00
Martijn Brekhof 1cb77876be Implemented testing actionbar state (#382)
* Added JSON datafiles for TV shows and music videos
   * Implemented instrumentations tests for MoviesActivity, MusicActivity,
     TVShowActivity, and AddonsActivity.
   * Moved RestoreSearchQueryViewPagerTest to music package as it uses
     the MusicActivity
   * Moved RestoreSearchQueryListFragmentTest to movies packages as it
     uses the MoviesActivity
   * Added scripts to get JSON data for music videos, addons, and TV shows
   * Added sequence diagram for BaseMediaActivity to clarify new setup
   * Refactored BaseMediaActivity to comply with diagram
   * Refactored SyncMusicVideos and SyncTVShows so we can use the same code
     for adding test data as we use for adding real data.
   * Removed unused StringBuffer and synchronize block in MockTcpServer
2017-04-29 16:08:15 +01:00
Adrian fe3c8a1b50 Fix typo (Itent -> Intent) (#377) 2017-04-02 18:42:59 +01:00
Synced Synapse 11f453c22f Bring the notification service to the foreground when a notification is shown, to avoid having it killed, which happens if it stays in the background 2017-03-24 18:18:10 +00:00
Martijn Brekhof fcd1730784 Fixes NPE in ConnectionObserversManagerService.onDestroy (#372) 2017-03-15 18:49:38 +00:00
tomerf d5f8ee4d49 Added option to sort by last played (#340) 2017-01-30 19:03:16 +00:00
Martijn Brekhof b8fbf4e190 Refactored org.xbmc.kore.ui package into separate packages 2016-12-29 18:27:40 +00:00
Martijn Brekhof b01e3c8ddc Fixes reported crashes caused by a NullPointerException (#325)
Multiple NullPointerExceptions have been reported in Google Play (dev).
Probably caused by calling onTaskRemoved more than once.
2016-12-19 18:57:08 +00:00
Martijn Brekhof 11b8d12b31 Implemented sorting on disc number in AlbumDetailsFragment (#310) 2016-11-08 19:57:05 +00:00
Martijn Brekhof eedd1e99b4 Implemented showing artist names in song lists (#281)
* Song lists for artist, album, and overall now shows the artist name for each individual song
* Added display artist column to songs table. This required a DB upgrade and users should
  do a refresh for music items to be able to see the display artist in the song lists.
2016-10-20 19:26:43 +01:00
Martijn Brekhof dadabd09c5 Implemented recursion fix for movies and tv shows (#283)
This applies the fix for issue #219 Incomplete libraries for movies and
TV shows.
For music items this was already fixed in PR #236
See commit 7330f85241
2016-09-26 18:31:22 +01:00
Martijn Brekhof 080b5809f3 Unittest/mediaprovider (#251)
Implemented integration tests for music items
2016-09-23 19:08:22 +01:00
Synced Synapse 466996f34e Merge pull request #250 from poisdeux/issue/#7
Fixed issue showing songs without an album or artist
2016-07-06 17:06:51 +01:00
Martijn Brekhof 21389b1e9e Fixed issue showing songs without an album or artist 2016-06-30 21:13:49 +02:00
George Kankava 079cf4e759 squid:S1155 - Collection.isEmpty() should be used to test for emptiness 2016-06-29 14:17:39 +04:00
Synced Synapse 6dcf412140 Update android sdk to v23
Deal with Android 6 permission system
Update gradle version
2016-05-25 17:18:25 +01:00
Synced Synapse e65b4536d7 Refactor Notification and PauseCall services: Create a single connection observer service that manages the notification and call pause/play. 2016-05-20 19:24:34 +01:00
Synced Synapse faab6b8163 Merge branch 'call_notifications' of https://github.com/tomerf/Kore into tomerf-call_notifications 2016-05-20 10:24:58 +01:00
Martijn Brekhof 7330f85241 Fixed issue with recursing music items
Using Kodi's JSON RPC, Kodi may return less items than requested, even
if there are more items available. The old method of determining if
more items are available by checking if the amount of items returned
equals the amount requested does not work in these cases. Therefore,
we now use the returned List.LimitsReturned to determine if there are
more items available. If List.LimitsReturned.end equals
List.LimitesReturned.total we assume we retrieved all items.
2016-05-10 15:08:38 +02:00
Tomer Froumin e67516559d Changed PauseCallService from BroadcastReceiver to PhoneStateListener 2016-02-05 17:43:12 +02:00
Tomer Froumin 2e7ac6af80 Added support for pausing when phone in call 2016-01-30 17:32:00 +02:00
Martijn Brekhof 69b1a9fcd4 Merge branch 'master' into librarysyncservicebounded 2015-10-06 20:15:17 +02:00
Synced Synapse 499ab11f40 Decrease tv shows number limit on library sync service. 2015-09-25 19:21:42 +01:00
Martijn Brekhof 499e54f2cf Improved keeping user informed on sync progress
Implemented binding to LibrarySyncService to check if there are items currently
syncing or queued to sync. This makes it possible to inform user of background
sync processes.

Created two abstract classes to reduce code duplication and check if
LibrarySyncService has any items queued which are currently being displayed.

Fixed issue with SwipeRefreshLayout from appcompat library, which does not
always show the refresh animation when refresh is set to true.
2015-09-02 12:04:17 +02:00
Synced Synapse 5509c99243 Workaround for issue #78: https://github.com/xbmc/Kore/issues/78 2015-05-25 22:37:32 +01:00
Synced Synapse bd0a5121a4 Fix Null pointer exception reported on Google Play 2015-04-13 22:51:00 +01:00
DanhDroid dfcb6d7d4d fix up typo on ApiCallback.onSucess() 2015-03-16 11:33:40 -07:00
Synced Synapse ed584fb9b7 Changed namespace/appid to org.xbmc.kore 2015-03-09 21:35:18 +00:00