Commit Graph

7 Commits

Author SHA1 Message Date
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
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 94693cb5a5 Fix NPE on volume change by not unbinding the controls in the Volume Level Indicator too soon 2018-07-04 20:54:12 +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
Martijn Brekhof e0f99c93c4 Fixed NPE in the VolumeControllerDialog (#553)
The applicationObserver was never unregistered resulting in a memory leak
and even worse, crashes when destroyed dialogs still got called through
the applicationOnVolumeChanged callback.

Also changed the view resource identifiers used by the controller dialog
as it used the same resource identifiers as the now playing panel.
2018-06-09 18:47:09 +01: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