Commit Graph

23 Commits

Author SHA1 Message Date
Francesco Bonazzi 5f0ca05eeb Added support for Prime Videos shared from the official Amazon app 2020-05-16 20:47:31 +02:00
DoomMortal ebae33755c AndroidX migration
Migration to AndroidX
- Update to API level 29
- Update Java sourcecode and xml import statements
- Upgrade Butterknife Version 10 AndroidX support
- Set Java 8 compile options due Butterknife needs it
2020-04-26 19:13:07 +02:00
Francesco Bonazzi 37ef130a7c Share local files - part 2 (#693)
* Local media files (image, audio, video) can now be shared with Kore. Added token to HttpApp to improve security.

* Added 'Queue on Kodi' share option. 'Play on Kodi' skips the playlist while 'Queue on Kodi' puts the media link at the end of the playlist
2019-12-16 18:37:46 +00:00
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
Jay Linski 8e0176e326 Support sharing SoundCloud tracks (#671) 2019-09-07 12:28:51 +01:00
Martijn Brekhof cdbdd98d6a Implemented showing playlists even when not playing (#618)
Implemented showing a music/video/picture playlist in PlaylistFragment even
when playback has stopped but the playlist is still available on Kodi.
The playlist is now only cleared if the Playlist.OnClear event is received
from Kodi.

As the pictures playlist does not support moving/removing items this has
been disabled for the pictures playlist only.

Added a new package org.xbmc.kore.host.actions to hold all Callable's that
we use to handle complex interactions with Kodi that use multiple JSON RPC
calls.

Fixed issue in HostConnectionObserver in method notifySomethingIsPlaying
where hostState.lastGetItemResult.label might not be set.

Reduced calling (force)refreshPlaylist considerably as it should now be
handled by the playlist observer.
2019-03-30 11:08:58 +00:00
Synced Synapse b824930d8e Tweak periodic checking Kodi version 2019-02-08 22:30:48 +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 f985f4132d Fix back button not exiting the app when on the remote activity
Hitting the back button in the remote activity was being ignored, thus preventing exiting the app. This issue was inadvertidely introduced in d11dbe6853
2018-07-20 14:36:10 +02:00
Martijn Brekhof d11dbe6853 Fixes a possible race condition and starting multiple instances (#559)
The onDestroyView method is used to unregister the application observer
from the dialog. However the parent got called first which destroys the
view of the dialog. This could lead to Null Pointer Exceptions when
the listener tries to update the UI of the dialog right after it was
destroyed.

The VolumeControllerDialogFragmentListener was created twice as creation
was triggered on both the down and up event of the volume keys. This has
been changed to only trigger on down events.
2018-06-22 11:05:38 +01:00
Synced Synapse 75f8326fe4 Simplify sharing intent handling
Redesign ApiFuture to be more generic and independent of other classes
2018-04-24 13:36:35 +02:00
Martijn Brekhof 2ed968456a Upgraded butterknife to 8.8.1 (#524)
Refactored MusicListFragment and PVRListFragment to use AbstractTabsFragment
Fixed scrolling in a nested scroll view using espresso
Fixed issue with setting and checking Kodi major version
2018-04-05 18:22:20 +01:00
Synced Synapse db81d44e62 Simplify hardware volume key handling
There's no need to have so many classes to handle the hardware volume keys. This PR simplifies it, without duplicating any more code than was already duplicated.
2018-02-06 11:45:12 +01:00
Mon Zafra 1e9160c733 Refactored share logic to show a notification when an item is added to the playlist (#473)
- added method to HostConnection that returns a Future object instead of
  taking a callback.
- added logic for handling null Handlers in HostConnection methods
- added method to HostManager to run a function that takes a HostConnection
  in a background thread where the Future API results above can be
  synchronously composed.
- replaced chain of callbacks in RemoteActivity with a sequence of
  future gets in OpenSharedUrl.
2018-01-26 14:03:30 +00:00
Synced Synapse d0fb6f28b7 Fix lint errors/warnings 2017-12-25 12:57:26 +00: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
Mon Zafra 8f6541e956 Handles the case where both v and list params are present in the url (#475) 2017-10-24 19:24:37 +01:00
Mon Zafra 41a433c985 Added handler for shared playlists from the YouTube app (#472)
- also fixed missing "/play/" segment in Vimeo plugin url
2017-10-17 19:56:19 +01:00
Tamás Varga 108fb88b9f Use hardware volume keys from anywhere inside Kore (#453)
* Allow the RemoteActivity and BaseMediaActivity to show a volume controller dialog when hardware volume keys are pressed
** The dialog handles the key events and makes callbacks to the activities to handle showing the dialog itself

* Minor improvements
** Make HighlightButton render in the IDE GUI Editor
** Minor code cleanup
** set currentActivePlayerId = -1; on playerOnStop in BaseMediaActivity to be more consistent

resolves xbmc/Kore#235
2017-10-08 19:48:00 +01: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
Joel Hedlund 7a2ed7704a Add support for sharing SVTplay urls to "Play on Kodi". (#343)
* Add support for sharing SVTplay urls to "Play on Kodi".
SVTplay is a free streaming service provided by the Swedish national television SVT.
This feature requires the svtplay video plugin on Kodi.
* Fix SVTplay share always playing first episode of series.
2017-01-30 19:06:14 +00:00
Mon Zafra 6e347b6b36 Materialized dialogs and preferences (#330)
* Changed platform AlertDialogs and preference.* to support lib counterparts
- added dependencies: support/preference-v7 for PreferenceFragmentCompat
  and Preference subclasses, support/preference-v14 for the
  MultiSelectListPreference
- simplified some AlertDialog.Builder calls and added non-null annotations
  to DialogFragment#onCreateDialog(Bundle) overrides to shut the IDE up
- UIUtils: changed static member avatarColorsIdx to local var because it's
  only used in one place and the value isn't cached
- layout/dialog_send_text: removed view vertical margins as they take
  way too much space for nothing.
- strings: shortened english preference titles
- themes: added PrefTheme and changed preference title font size to medium
  from large
- preferences: changed CheckBoxPreference to SwitchPreferenceCompat. these
  don't have the same issue described in #233 (tested in kitkat).

* Changed platform PreferenceManager in RemoteActivity to support pref

* Fixed M permissions

* Split prefs into 2 groups as per material design guidelines

* Changed prefs theme to v14.material

* Moved container padding to individual prefs; removed pref-v7 dependency
- this makes the item dividers touch the screen edges which i think looks
  better
- don't need to require preference-v7 because preference-v14 already
  does

* Moved PrefTheme attributes *{Start,End} to v17 override

* Fixed crash caused by rotating twice while a dialog is active

* Changed wording as suggested
2017-01-04 08:37:13 +00:00
Martijn Brekhof b8fbf4e190 Refactored org.xbmc.kore.ui package into separate packages 2016-12-29 18:27:40 +00:00