Skip to content
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

Updates base to 1.2.58 #58

Merged
merged 328 commits into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
328 commits
Select commit Hold shift + click to select a range
9e82e70
1.2.7
ebr11 Jun 11, 2016
c402e19
WTV direct playback not reliable
ebr11 Jun 13, 2016
0454d69
Add upcoming recordings to LIve TV view
ebr11 Jun 13, 2016
14ae8e5
Overview on live TV playback
ebr11 Jun 13, 2016
613d90e
Check for null app in logoff loop
ebr11 Jun 13, 2016
caabcbf
Refresh rate switching
ebr11 Jun 13, 2016
1845a5b
1.2.8
ebr11 Jun 13, 2016
ab8dc62
Look for multiple of rate as well (25->50)
ebr11 Jun 14, 2016
6795d62
1.2.9
ebr11 Jun 14, 2016
ab75915
Update ApiClient
ebr11 Jun 20, 2016
148e59d
TotalRecordCount optimizations
ebr11 Jun 20, 2016
d1e5505
1.2.10
ebr11 Jun 20, 2016
aff2aee
Avoid npe on null video stream
ebr11 Jun 22, 2016
83ab196
New mute method
ebr11 Jun 22, 2016
6b542b9
1.2.11
ebr11 Jun 22, 2016
76fcfc7
Custom card colors
ebr11 Jun 24, 2016
6526e93
Update ApiClient
ebr11 Jun 24, 2016
f020470
1.2.12
ebr11 Jun 24, 2016
deccd5a
Update ApiClient
ebr11 Jun 26, 2016
20834d3
Reduce scope of new premieres
ebr11 Jun 26, 2016
44eb268
Align resumable query params
ebr11 Jun 26, 2016
e705155
1.2.14
ebr11 Jun 26, 2016
6c91e77
No VLC for HD on the stick
ebr11 Jun 27, 2016
ff60710
Cleanup
ebr11 Jun 27, 2016
1d6f597
Exclude 10-bit hevc from direct play
ebr11 Jun 27, 2016
0b9c202
Exclude hevc from VLC
ebr11 Jun 27, 2016
7cdaa48
Allow hevc in VLC on Shield
ebr11 Jun 27, 2016
c09cb7c
1.2.15
ebr11 Jun 27, 2016
07f5d31
NP okay with hevc too
ebr11 Jun 27, 2016
01592fb
Add media details
ebr11 Jun 28, 2016
f368745
Improve chapter default image
ebr11 Jun 28, 2016
7c05187
1.2.16
ebr11 Jun 28, 2016
6b16795
Only show playback method in debug
ebr11 Jun 29, 2016
59e4967
Adjust debug description
ebr11 Jun 29, 2016
1d12851
Update translations
ebr11 Jun 29, 2016
49d7dd8
1.2.17
ebr11 Jun 29, 2016
72aba38
Make premieres optional
ebr11 Jun 29, 2016
29b2fa3
1.2.18
ebr11 Jun 29, 2016
cf64d5e
Avoid continue watching flash on home screen
ebr11 Jun 30, 2016
ee82761
Info panel off by default
ebr11 Jun 30, 2016
c9eec69
1.2.19
ebr11 Jun 30, 2016
c5ef61b
Report stream indexes
ebr11 Jul 2, 2016
0ad4138
1.2.20
ebr11 Jul 2, 2016
f7fc7dc
Switch to latest end point everywhere
ebr11 Jul 5, 2016
f46ff48
Add separate option to bitstream DTS
ebr11 Jul 5, 2016
d5b7aca
Accept number characters on pw entry
ebr11 Jul 5, 2016
cbc633c
Default DTS to false
ebr11 Jul 5, 2016
2e5e872
1.2.21
ebr11 Jul 5, 2016
8242caa
Adjust sideline background
ebr11 Jul 6, 2016
0698d76
Fix title when folder empty
ebr11 Jul 6, 2016
a08a1ba
Don't allow ref frames < 2 in VLC
ebr11 Jul 6, 2016
5caedd7
Handle total record count properly
ebr11 Jul 6, 2016
cdb4f65
Only exclude hevc on FTV
ebr11 Jul 7, 2016
34befd1
Update comment
ebr11 Jul 7, 2016
94186dd
1.2.22
ebr11 Jul 7, 2016
c4b825a
Update ApiClient
ebr11 Jul 12, 2016
f72d4f0
Add new ref frames conditions
ebr11 Jul 12, 2016
ad7af1e
Allow HEVC on Fire 4k
ebr11 Jul 14, 2016
d72f0c0
1.2.23
ebr11 Jul 14, 2016
5d1842f
Test for specific HEVC support
ebr11 Jul 15, 2016
f828ced
1.2.24
ebr11 Jul 15, 2016
258615d
Misc
ebr11 Jul 18, 2016
5d0b537
Only exclude direct AC3 in VLC on Fire
ebr11 Jul 20, 2016
6a8191d
Attempt re-try on player errors
ebr11 Jul 20, 2016
fa49ba6
Add additional info when sending log
ebr11 Jul 20, 2016
ad904ee
Fix send logs button not showing properly
ebr11 Jul 20, 2016
779babf
1.2.25
ebr11 Jul 20, 2016
a02dced
Update ApiClient
ebr11 Jul 21, 2016
3fd169f
Close unused live stream
ebr11 Jul 21, 2016
e6da449
1.2.26
ebr11 Jul 21, 2016
82f2a7f
Remove season count for now
ebr11 Jul 22, 2016
caffa73
Respect server side bitrate setting for remote
ebr11 Jul 22, 2016
100039f
1.2.27
ebr11 Jul 22, 2016
e93cb60
Update ApiClient
Aug 2, 2016
1502a2f
1.2.28
Aug 4, 2016
17a5269
Remove redundant row
ebr11 Aug 15, 2016
e566964
Update ApiClient and adjust to changes
ebr11 Aug 15, 2016
4837efe
Fix launching song from search
ebr11 Aug 15, 2016
70d070f
Fix continue watching
ebr11 Aug 15, 2016
b3ea106
Try not adding Bob option
ebr11 Aug 15, 2016
f441295
1.2.29
ebr11 Aug 15, 2016
f536c99
Remove explicit deinterlacing
ebr11 Aug 16, 2016
acfec96
1.2.30
ebr11 Aug 16, 2016
eec6b51
Revert ApiClient updates
ebr11 Aug 18, 2016
ab44900
Only exclude deinterlacing on SD content
ebr11 Aug 18, 2016
64f52d8
1.2.31
ebr11 Aug 18, 2016
f86d46f
External player
ebr11 Aug 21, 2016
e8805f0
Ext player options
ebr11 Aug 21, 2016
2e25537
Respect external player from all avenues
ebr11 Aug 21, 2016
ac779a7
Handle all error conditions
ebr11 Aug 21, 2016
4b9aff7
No chapter jump with external
ebr11 Aug 21, 2016
be5cc7c
No resume with external player
ebr11 Aug 21, 2016
4dbd197
Remove duplicate manifest entry
ebr11 Aug 21, 2016
d61d9f3
1.2.32
ebr11 Aug 21, 2016
0d4393a
Fix external player for live TV from detail screen
ebr11 Aug 22, 2016
62f78d5
1.2.33
ebr11 Aug 22, 2016
0177db8
Fix crash on no album or child count
ebr11 Aug 22, 2016
93ddcf7
Update ApiClient (new server-side stream building)
ebr11 Aug 23, 2016
1a092a2
Add direct path for external option
ebr11 Aug 23, 2016
58f2cee
Proper mime type for direct path
ebr11 Aug 23, 2016
54fd3de
Warning for direct path option
ebr11 Aug 23, 2016
528f501
Message tweak
ebr11 Aug 23, 2016
778f8c1
Try to prepare an smb path for direct passing
ebr11 Aug 23, 2016
cc84d57
Set proper play method when passing path
ebr11 Aug 23, 2016
c42fc8f
1.2.36
ebr11 Aug 23, 2016
ac56a16
Fix play all series with external
ebr11 Aug 24, 2016
1743ea6
Update libvlc to 2.0.1
ebr11 Aug 24, 2016
0b3d388
1.2.37
ebr11 Aug 24, 2016
13ecfb5
Exclude virtual items from continue watching
ebr11 Aug 25, 2016
ccb9705
Fix bitstreaming
ebr11 Aug 25, 2016
b3ed127
Resume tracking for mx player
ebr11 Aug 25, 2016
d1dad24
1.2.38
ebr11 Aug 26, 2016
9cfe8b4
Don't show future/missing banner on seasons
ebr11 Aug 26, 2016
9aa0993
Revert VLC
ebr11 Aug 26, 2016
b76596e
1.2.39
ebr11 Aug 26, 2016
5cbf186
Client-side watched count/indicator
ebr11 Aug 27, 2016
a58e535
1.2.40
ebr11 Aug 27, 2016
e542513
Fix indicator not clearing
ebr11 Aug 27, 2016
1f08e8f
Client side progress bars
ebr11 Aug 28, 2016
e76a811
1.2.41
ebr11 Aug 28, 2016
fab6c97
Handle null codec
ebr11 Aug 29, 2016
feb15f2
Handle recordings as videos for external player
ebr11 Aug 29, 2016
60006fc
1.2.42
ebr11 Aug 29, 2016
f2fc171
Adjust VLC profile
ebr11 Aug 30, 2016
852d4ce
Add 'dts'
ebr11 Aug 30, 2016
f6a40eb
1.2.43
ebr11 Aug 30, 2016
254f8ed
Update ApiClient
ebr11 Aug 31, 2016
ec8a1b8
Fix retry on vlc error
ebr11 Aug 31, 2016
0eec465
Use proper player determination
ebr11 Aug 31, 2016
635135c
Don't set options
ebr11 Sep 1, 2016
aaf5159
1.2.44
ebr11 Sep 1, 2016
4b939c2
Limit h264 level to 41 on stick only
ebr11 Sep 8, 2016
0093c5c
Merge remote-tracking branch 'refs/remotes/origin/dev' into guide-paging
ebr11 Sep 8, 2016
ba69198
Groundwork for more intuitive paging in guide
ebr11 Sep 8, 2016
795657b
Detect can page back
ebr11 Sep 9, 2016
2b8afb1
Complete standard paging
ebr11 Sep 10, 2016
4c1fc6f
Select specific date
ebr11 Sep 10, 2016
d7a3e47
Fix filtering
ebr11 Sep 10, 2016
438de96
Reset guide to now button
ebr11 Sep 10, 2016
0a8355a
Merge remote-tracking branch 'refs/remotes/origin/guide-paging' into dev
ebr11 Sep 10, 2016
4f24169
Merge remote-tracking branch 'refs/remotes/origin/guide-paging' into dev
ebr11 Sep 10, 2016
9918955
1.2.45
ebr11 Sep 10, 2016
38fad6b
Fix ref in strings
ebr11 Sep 10, 2016
5a7b508
Update translations
ebr11 Sep 10, 2016
f62b9ab
Can't pull collections by parent
ebr11 Sep 10, 2016
9f3c40a
Custom date picker for guide
ebr11 Sep 12, 2016
4ff363f
Don't allow paging into past
ebr11 Sep 12, 2016
0e1a954
Try removing live TV stall recovery
ebr11 Sep 12, 2016
23dd78d
TV mode option
ebr11 Sep 12, 2016
0dea198
Start record/cancel from player
ebr11 Sep 12, 2016
8f4153b
1.2.46
ebr11 Sep 12, 2016
475013f
Avoid npe
ebr11 Sep 13, 2016
fada638
Remove log statement
ebr11 Sep 13, 2016
62a7be7
Quick channel selector
ebr11 Sep 13, 2016
b4e6f9f
More seamless channel switching
ebr11 Sep 13, 2016
52b2962
1.2.47
ebr11 Sep 14, 2016
3455919
Allow truehd in vlc
ebr11 Sep 14, 2016
615085a
Fix trueHD on Fire
ebr11 Sep 15, 2016
cd6e37c
Start new recordings layout
ebr11 Sep 15, 2016
a324768
Comment out rows that don't work yet
ebr11 Sep 15, 2016
1d7024b
1.2.48
ebr11 Sep 15, 2016
62d538e
Proper validation for recording
ebr11 Sep 17, 2016
ad6702c
Clear TV cache on re-login
ebr11 Sep 19, 2016
94e2165
Revise tv grid
ebr11 Sep 19, 2016
4b26271
Guard against skipping with stream not started yet
ebr11 Sep 19, 2016
937e231
Indicators on program details
ebr11 Sep 19, 2016
db871e0
Increase program cell width
ebr11 Sep 19, 2016
763830a
Adjust indicator colors
ebr11 Sep 19, 2016
85dfe6e
1.2.49
ebr11 Sep 19, 2016
714f868
Better info on episode and recording cards
ebr11 Sep 20, 2016
a48315c
Increase size of channel name to match guide
ebr11 Sep 20, 2016
14ebf03
Start schedule view
ebr11 Sep 20, 2016
b629df7
Initial timeshifting
ebr11 Sep 22, 2016
2600db2
Disable time shifting for now
ebr11 Sep 22, 2016
6799d41
Merge remote-tracking branch 'refs/remotes/origin/timeshift' into dev
ebr11 Sep 22, 2016
ad6e0b0
1.2.50
ebr11 Sep 22, 2016
0ab0648
Update ApiClient
ebr11 Sep 23, 2016
6779f35
Enable different recording types
ebr11 Sep 23, 2016
d19f1ed
New quick recording behavior
ebr11 Sep 26, 2016
ec8e80e
Browse series timers
ebr11 Sep 27, 2016
c838c04
Additional timer info
ebr11 Sep 27, 2016
6bc3b62
Refactor schedule row generation
ebr11 Sep 27, 2016
ae34ecd
Series timer details
ebr11 Sep 27, 2016
6f08080
No missing banner on live TV programs
ebr11 Sep 27, 2016
ca097d8
Respect manage recordings
ebr11 Sep 27, 2016
47fb71e
Easier padding entry
ebr11 Sep 27, 2016
3e6c23f
1.2.51
ebr11 Sep 27, 2016
e97f1ee
Add views to live TV library
ebr11 Sep 28, 2016
ed28c54
Detail row background
ebr11 Sep 28, 2016
7d9daa8
New layout
ebr11 Sep 29, 2016
ccd8ad3
Fix button behavior
ebr11 Sep 29, 2016
0843289
Adjustments for people
ebr11 Sep 29, 2016
a92fecd
Show seasons for series
ebr11 Sep 29, 2016
8ccc943
Expandable text view
ebr11 Sep 30, 2016
7daa708
More air on enhanced browse and grid
ebr11 Sep 30, 2016
e2628e3
Consistent focus indicator
ebr11 Sep 30, 2016
ff9af6c
List view update
ebr11 Sep 30, 2016
a3b874e
Update audio player
ebr11 Sep 30, 2016
b4a3497
Fix playlist loading title
ebr11 Sep 30, 2016
ba0e3b8
Centralize background gradient creation
ebr11 Sep 30, 2016
cd7e32b
Merge remote-tracking branch 'refs/remotes/origin/new-details' into dev
ebr11 Sep 30, 2016
ed25c70
1.2.52
ebr11 Sep 30, 2016
b80bfe6
A little more air above
ebr11 Oct 1, 2016
b1b67cf
Handle more button for episodes better
ebr11 Oct 1, 2016
1724c29
Delay button collapse slightly
ebr11 Oct 1, 2016
a02dd1a
And when toggling watched
ebr11 Oct 1, 2016
7924dee
1.2.53
ebr11 Oct 1, 2016
072b23c
Reduce chapter popup area
ebr11 Oct 2, 2016
15e720c
Add guest stars and chapters to episodes
ebr11 Oct 2, 2016
4276611
Fix scroll to current channel in quick changer
ebr11 Oct 2, 2016
8dbfeb2
Fix background on empty list
ebr11 Oct 2, 2016
69246bd
Fix more button visibility
ebr11 Oct 2, 2016
d2594fe
No eac3 with vlc
ebr11 Oct 3, 2016
2beb089
Better TV aspect handling
ebr11 Oct 3, 2016
bdaa563
Static height on next up
ebr11 Oct 3, 2016
293a0f2
Remove unused recording options
ebr11 Oct 3, 2016
27b0020
Fix display with no season/episode no
ebr11 Oct 3, 2016
fc39891
Update ApiClient
ebr11 Oct 3, 2016
bfb9aaf
1.2.54
ebr11 Oct 3, 2016
f0a11b2
Read and respect web app guide settings
ebr11 Oct 4, 2016
aa2bcc7
Modify guide options
ebr11 Oct 4, 2016
3525a05
1.2.55
ebr11 Oct 4, 2016
a44df93
Resize button images
ebr11 Oct 5, 2016
5cc702c
Darken details backdrop
ebr11 Oct 5, 2016
42d8de4
Resume pre-roll
ebr11 Oct 5, 2016
08760ae
Update ApiClent
ebr11 Oct 5, 2016
3bd6bfb
Listen for library changes
ebr11 Oct 5, 2016
87bc9f4
Re-fetch channels when prefs change.
ebr11 Oct 5, 2016
54de968
1.2.56
ebr11 Oct 5, 2016
64c0646
Adjust button image sizes
ebr11 Oct 6, 2016
e2d41b5
Layout adjustments
ebr11 Oct 6, 2016
102e9b3
Better resume label
ebr11 Oct 6, 2016
7ababbe
Fix new premieres height
ebr11 Oct 6, 2016
00ef3b2
Channel sorting on query
ebr11 Oct 6, 2016
4763444
No mpeg4 in exo
ebr11 Oct 6, 2016
6472c0e
1.2.57
ebr11 Oct 6, 2016
0aeb28b
Similar title change
ebr11 Oct 7, 2016
a65d673
Update translations
ebr11 Oct 7, 2016
2f95227
Adjust pre-roll values
ebr11 Oct 7, 2016
1e2bd63
Include pre-roll in resume display
ebr11 Oct 7, 2016
cad274b
Another pre-roll value
ebr11 Oct 7, 2016
950c3fa
1.2.58
ebr11 Oct 7, 2016
24b49f2
Merge remote-tracking branch 'upstream/master' into update-base
thornbill Feb 25, 2019
de03b60
Fix merge conflicts
thornbill Feb 25, 2019
5d28a9a
Remove apks and unused jars
thornbill Feb 25, 2019
ec40f1c
Remove old VLC jar
thornbill Feb 25, 2019
83befc4
Remove unused resources
thornbill Feb 25, 2019
d4d10c0
Remove expired activity and fix Jellyfin translation
thornbill Feb 25, 2019
b68d92d
Remove emby reference
thornbill Feb 25, 2019
9da73c1
Remove mediabrowser references
thornbill Feb 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ dependencies {
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:leanback-v17:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:palette-v7:28.0.0'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.squareup.picasso:picasso:2.3.2'
implementation 'com.github.bumptech.glide:glide:3.7.0'
Expand Down
Binary file modified app/libs/apiclient.jar
Binary file not shown.
Binary file not shown.
25 changes: 13 additions & 12 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,34 @@
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/Theme.Leanback" >
android:theme="@style/AppTheme">
<activity
android:name=".browsing.MainActivity"
android:label="@string/app_name"
android:logo="@drawable/app_icon"
android:screenOrientation="landscape" >
</activity>
android:screenOrientation="landscape" />
<activity
android:name=".startup.StartupActivity"
android:label="@string/app_name"
android:logo="@drawable/app_icon"
android:noHistory="true" >
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".startup.SelectUserActivity"
android:label="@string/title_activity_select_user" >
</activity>
android:label="@string/title_activity_select_user" />
<activity
android:name=".playback.PlaybackOverlayActivity"
android:label="PlaybackOverlayActivity" >
</activity>
android:label="PlaybackOverlayActivity" />
<activity android:name=".browsing.GenericFolderActivity" />
<activity android:name=".browsing.UserViewActivity" />
<activity android:name=".startup.SelectServerActivity" />
<activity android:name=".browsing.CollectionActivity" />
<activity android:name=".startup.ExpiredActivity" />
<activity android:name=".browsing.ByLetterActivity" />
<activity android:name=".browsing.ByGenreActivity" />
<activity android:name=".settings.SettingsActivity" />
Expand All @@ -66,9 +62,11 @@
<activity android:name=".livetv.LiveTvGuideActivity" />
<activity android:name=".browsing.GenericGridActivity" />
<activity android:name=".browsing.BrowseRecordingsActivity" />
<activity android:name=".browsing.BrowseScheduleActivity" />
<activity android:name=".details.PhotoPlayerActivity" />
<activity android:name=".details.ItemListActivity" />
<activity android:name=".playback.AudioNowPlayingActivity" />
<activity android:name=".playback.ExternalPlayerActivity" />
<activity
android:name=".startup.DpadPwActivity"
android:label="@string/title_activity_dpad_pw" >
Expand All @@ -83,9 +81,12 @@
<provider
android:authorities="org.jellyfin.androidtv.recommendations"
android:name=".integration.RecommendationContentProvider"
android:grantUriPermissions="true"
android:exported="true"
/>
android:grantUriPermissions="true" />

<activity
android:name=".details.ExpandedTextActivity"
android:label="@string/title_activity_expanded_text"></activity>
</application>

</manifest>
150 changes: 143 additions & 7 deletions app/src/main/java/org/jellyfin/androidtv/TvApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,23 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.media.AudioManager;
import android.os.Build;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.graphics.Palette;
import android.util.Log;

import org.jellyfin.androidtv.base.BaseActivity;
import org.jellyfin.androidtv.livetv.TvManager;
import org.jellyfin.androidtv.model.DisplayPriorityType;
import org.jellyfin.androidtv.playback.ExternalPlayerActivity;
import org.jellyfin.androidtv.playback.MediaManager;
import org.jellyfin.androidtv.playback.PlaybackController;
import org.jellyfin.androidtv.playback.PlaybackOverlayActivity;
Expand All @@ -38,10 +44,12 @@
import mediabrowser.apiinteraction.android.VolleyHttpClient;
import mediabrowser.apiinteraction.playback.PlaybackManager;
import mediabrowser.logging.ConsoleLogger;
import mediabrowser.model.configuration.ServerConfiguration;
import mediabrowser.model.dto.BaseItemDto;
import mediabrowser.model.dto.UserDto;
import mediabrowser.model.entities.DisplayPreferences;
import mediabrowser.model.logging.ILogger;
import mediabrowser.model.net.EndPointInfo;
import mediabrowser.model.system.SystemInfo;

/**
Expand All @@ -50,11 +58,15 @@


public class TvApp extends Application implements ActivityCompat.OnRequestPermissionsResultCallback {

public static String FEATURE_CODE = "androidtv";

public static final String CREDENTIALS_PATH = "org.jellyfin.androidtv.login.json";

public static final int LIVE_TV_GUIDE_OPTION_ID = 1000;
public static final int LIVE_TV_RECORDINGS_OPTION_ID = 2000;
public static final int VIDEO_QUEUE_OPTION_ID = 3000;
public static final int LIVE_TV_SCHEDULE_OPTION_ID = 4000;
public static final int LIVE_TV_SERIES_OPTION_ID = 5000;

private static final int SEARCH_PERMISSION = 0;

Expand All @@ -80,6 +92,10 @@ public class TvApp extends Application implements ActivityCompat.OnRequestPermis

private String lastDeletedItemId = "";

private ServerConfiguration serverConfiguration;

private int maxRemoteBitrate = -1;

private Calendar lastPlayback = Calendar.getInstance();
private Calendar lastMoviePlayback = Calendar.getInstance();
private Calendar lastTvPlayback = Calendar.getInstance();
Expand All @@ -91,7 +107,11 @@ public class TvApp extends Application implements ActivityCompat.OnRequestPermis

private boolean searchAllowed = Build.VERSION.SDK_INT < 23;

private GradientDrawable currentBackgroundGradient;

private boolean audioMuted;
private boolean playingIntros;
private DisplayPriorityType displayPriority = DisplayPriorityType.Movies;

private BaseActivity currentActivity;

Expand All @@ -104,13 +124,14 @@ public void onCreate() {
app = (TvApp)getApplicationContext();
audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
roboto = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf");
setCurrentBackgroundGradient(new int[] {ContextCompat.getColor(this, R.color.lb_default_brand_color_dark), ContextCompat.getColor(this, R.color.lb_default_brand_color)});

logger.Info("Application object created");

Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable ex) {
Log.e("MediaBrowserTv", "Uncaught exception is: ", ex);
Log.e(getString(R.string.app_name), "Uncaught exception is: ", ex);
ex.printStackTrace();
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(10);
Expand Down Expand Up @@ -148,6 +169,8 @@ public UserDto getCurrentUser() {

public void setCurrentUser(UserDto currentUser) {
this.currentUser = currentUser;
TvManager.clearCache();
this.displayPrefsCache = new HashMap<>();
}

public GsonJsonSerializer getSerializer() {
Expand All @@ -159,7 +182,7 @@ public void setSerializer(GsonJsonSerializer serializer) {
}

public ApiClient getApiClient() {
return connectionManager.GetApiClient(currentUser);
return currentUser != null ? connectionManager.GetApiClient(currentUser) : null;
}

public BaseItemDto getCurrentPlayingItem() {
Expand Down Expand Up @@ -188,7 +211,13 @@ public void setLoginApiClient(ApiClient loginApiClient) {

public void setAudioMuted(boolean value) {
audioMuted = value;
audioManager.setStreamMute(AudioManager.STREAM_MUSIC, audioMuted);
getLogger().Info("Setting mute state to: "+audioMuted);
if (Utils.is60()) {
audioManager.adjustVolume(audioMuted ? AudioManager.ADJUST_MUTE : AudioManager.ADJUST_UNMUTE, 0);

} else {
audioManager.setStreamMute(AudioManager.STREAM_MUSIC, audioMuted);
}
}

public boolean isAudioMuted() { return audioMuted; }
Expand Down Expand Up @@ -232,6 +261,30 @@ public void onError(Exception exception) {
logger.ErrorException("Unable to obtain system info.", exception);
}
});

//Also get server configuration and fill in max remote bitrate if we are remote
getApiClient().GetEndPointInfo(new Response<EndPointInfo>() {
@Override
public void onResponse(EndPointInfo response) {
if (!response.getIsInNetwork()) {
getApiClient().GetServerConfigurationAsync(new Response<ServerConfiguration>() {
@Override
public void onResponse(ServerConfiguration response) {
serverConfiguration = response;
maxRemoteBitrate = serverConfiguration.getRemoteClientBitrateLimit();
getLogger().Info("Server bitrate limit set to ", maxRemoteBitrate);
}

@Override
public void onError(Exception exception) {
getLogger().ErrorException("Unable to retrieve server configuration",exception);
}
});
} else {
getLogger().Info("** Local connection - no server bitrate limit");
}
}
});
}
}

Expand Down Expand Up @@ -327,6 +380,26 @@ public boolean getIsAutoLoginConfigured() {
return getPrefs().getString("pref_login_behavior", "0").equals("1") && getConfiguredAutoCredentials().getServerInfo().getId() != null;
}

public boolean useExternalPlayer(String itemType) {
switch (itemType) {
case "Movie":
case "Episode":
case "Video":
case "Series":
case "Recording":
return getPrefs().getBoolean("pref_video_use_external", false);
case "TvChannel":
case "Program":
return getPrefs().getBoolean("pref_live_tv_use_external", false);
default:
return false;
}
}

public Class getPlaybackActivityClass(String itemType) {
return useExternalPlayer(itemType) ? ExternalPlayerActivity.class : PlaybackOverlayActivity.class;
}

public Calendar getLastMoviePlayback() {
return lastMoviePlayback.after(lastPlayback) ? lastMoviePlayback : lastPlayback;
}
Expand All @@ -346,6 +419,16 @@ public void setLastMoviePlayback(Calendar lastMoviePlayback) {

public void setDirectStreamLiveTv(boolean value) { getPrefs().edit().putBoolean("pref_live_direct", value).commit(); }

public boolean useVlcForLiveTv() { return getPrefs().getBoolean("pref_enable_vlc_livetv", true); }

public int getResumePreroll() {
try {
return Integer.parseInt(getPrefs().getString("pref_resume_preroll","0")) * 1000;
} catch (Exception e) {
return 0;
}
}

public Calendar getLastTvPlayback() {
return lastTvPlayback.after(lastPlayback) ? lastTvPlayback : lastPlayback;
}
Expand Down Expand Up @@ -379,6 +462,10 @@ public void setLastUserInteraction(long lastUserInteraction) {
this.lastUserInteraction = lastUserInteraction;
}

public boolean canManageRecordings() {
return currentUser != null && currentUser.getPolicy().getEnableLiveTvManagement();
}

public PlaybackManager getPlaybackManager() {
return playbackManager;
}
Expand Down Expand Up @@ -461,17 +548,25 @@ public DisplayPreferences getCachedDisplayPrefs(String key) {
}

public void updateDisplayPrefs(DisplayPreferences preferences) {
updateDisplayPrefs("ATV", preferences);
}

public void updateDisplayPrefs(String app, DisplayPreferences preferences) {
displayPrefsCache.put(preferences.getId(), preferences);
getApiClient().UpdateDisplayPreferencesAsync(preferences, getCurrentUser().getId(), "ATV", new EmptyResponse());
getApiClient().UpdateDisplayPreferencesAsync(preferences, getCurrentUser().getId(), app, new EmptyResponse());
logger.Debug("Display prefs updated for "+preferences.getId()+" isFavorite: "+preferences.getCustomPrefs().get("FavoriteOnly"));
}

public void getDisplayPrefsAsync(final String key, final Response<DisplayPreferences> outerResponse) {
public void getDisplayPrefsAsync(String key, Response<DisplayPreferences> response) {
getDisplayPrefsAsync(key, "ATV", response);
}

public void getDisplayPrefsAsync(final String key, String app, final Response<DisplayPreferences> outerResponse) {
if (displayPrefsCache.containsKey(key)) {
logger.Debug("Display prefs loaded from cache "+key);
outerResponse.onResponse(displayPrefsCache.get(key));
} else {
getApiClient().GetDisplayPreferencesAsync(key, getCurrentUser().getId(), "ATV", new Response<DisplayPreferences>(){
getApiClient().GetDisplayPreferencesAsync(key, getCurrentUser().getId(), app, new Response<DisplayPreferences>(){
@Override
public void onResponse(DisplayPreferences response) {
if (response.getSortBy() == null) response.setSortBy("SortName");
Expand Down Expand Up @@ -559,4 +654,45 @@ public long getLastVideoQueueChange() {
public void setLastVideoQueueChange(long lastVideoQueueChange) {
this.lastVideoQueueChange = lastVideoQueueChange;
}

public boolean isPlayingIntros() {
return playingIntros;
}

public void setPlayingIntros(boolean playingIntros) {
this.playingIntros = playingIntros;
}

public ServerConfiguration getServerConfiguration() {
return serverConfiguration;
}

public int getServerBitrateLimit() { return maxRemoteBitrate > 0 ? maxRemoteBitrate : 100000000; }

public DisplayPriorityType getDisplayPriority() {
return displayPriority;
}

public void setDisplayPriority(DisplayPriorityType displayPriority) {
this.displayPriority = displayPriority;
}

public GradientDrawable getCurrentBackgroundGradient() {
return currentBackgroundGradient;
}

public void setCurrentBackground(Bitmap currentBackground) {
int[] colors = new int[2];
colors[0] = Utils.darker(Palette.from(currentBackground).generate().getMutedColor(ContextCompat.getColor(this, R.color.black_transparent)), .6f);
colors[1] = Utils.darker(colors[0], .1f);
setCurrentBackgroundGradient(colors);
}

private void setCurrentBackgroundGradient(int[] colors) {
currentBackgroundGradient = new GradientDrawable(GradientDrawable.Orientation.RIGHT_LEFT, colors);
currentBackgroundGradient.setCornerRadius(0f);
currentBackgroundGradient.setGradientCenter(.6f, .5f);
currentBackgroundGradient.setAlpha(200);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private void startAutoLogoffLoop() {
loop = new Runnable() {
@Override
public void run() {
if (System.currentTimeMillis() > app.getLastUserInteraction() + timeoutInterval) {
if (app != null && System.currentTimeMillis() > app.getLastUserInteraction() + timeoutInterval) {
app.getLogger().Info("Logging off due to inactivity "+app.getLastUserInteraction());
Utils.showToast(app, "Jellyfin Logging off due to inactivity...");
if (app.getPlaybackController() != null && app.getPlaybackController().isPaused()) {
Expand All @@ -148,7 +148,7 @@ public void run() {
}
finish();
} else {
handler.postDelayed(this, 30000);
handler.postDelayed(this, 60000);
}
}
};
Expand Down
Loading