Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
531
Issue boards
Milestones
Wiki
Code
Merge requests
16
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
e49d881d
Commit
e49d881d
authored
7 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Code cleaning
parent
22449694
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+29
-53
29 additions, 53 deletions
vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
with
29 additions
and
53 deletions
vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+
29
−
53
View file @
e49d881d
...
...
@@ -201,10 +201,8 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
@Override
protected
void
onStart
()
{
super
.
onStart
();
if
(!
mBackgroundManager
.
isAttached
())
mBackgroundManager
.
attach
(
getWindow
());
if
(
mSelectedItem
!=
null
)
TvUtil
.
updateBackground
(
mBackgroundManager
,
mSelectedItem
);
if
(!
mBackgroundManager
.
isAttached
())
mBackgroundManager
.
attach
(
getWindow
());
if
(
mSelectedItem
!=
null
)
TvUtil
.
updateBackground
(
mBackgroundManager
,
mSelectedItem
);
}
@Override
...
...
@@ -217,21 +215,16 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
@Override
protected
void
onResume
()
{
super
.
onResume
();
if
(
mService
!=
null
)
mService
.
addCallback
(
this
);
if
(
mMediaLibrary
.
isInitiated
())
setmedialibraryListeners
();
else
setupMediaLibraryReceiver
();
if
(
mService
!=
null
)
mService
.
addCallback
(
this
);
if
(
mMediaLibrary
.
isInitiated
())
setmedialibraryListeners
();
else
setupMediaLibraryReceiver
();
}
@Override
protected
void
onPause
()
{
if
(
mUpdateTask
!=
null
)
mUpdateTask
.
cancel
(
true
);
if
(
mUpdateTask
!=
null
)
mUpdateTask
.
cancel
(
true
);
super
.
onPause
();
if
(
mService
!=
null
)
mService
.
removeCallback
(
this
);
if
(
mService
!=
null
)
mService
.
removeCallback
(
this
);
mMediaLibrary
.
removeMediaUpdatedCb
();
}
...
...
@@ -257,12 +250,11 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
@Override
public
boolean
onKeyDown
(
int
keyCode
,
KeyEvent
event
)
{
if
((
keyCode
==
KeyEvent
.
KEYCODE_MEDIA_PLAY_PAUSE
||
keyCode
==
KeyEvent
.
KEYCODE_BUTTON_Y
)
&&
mSelectedItem
instanceof
MediaWrapper
)
{
if
((
keyCode
==
KeyEvent
.
KEYCODE_MEDIA_PLAY_PAUSE
||
keyCode
==
KeyEvent
.
KEYCODE_BUTTON_Y
)
&&
mSelectedItem
instanceof
MediaWrapper
)
{
MediaWrapper
media
=
(
MediaWrapper
)
mSelectedItem
;
if
(
media
.
getType
()
!=
MediaWrapper
.
TYPE_DIR
)
return
false
;
final
Intent
intent
=
new
Intent
(
this
,
DetailsActivity
.
class
);
if
(
media
.
getType
()
!=
MediaWrapper
.
TYPE_DIR
)
return
false
;
final
Intent
intent
=
new
Intent
(
this
,
DetailsActivity
.
class
);
// pass the item information
intent
.
putExtra
(
"media"
,
(
MediaWrapper
)
mSelectedItem
);
intent
.
putExtra
(
"item"
,
new
MediaItemDetails
(
media
.
getTitle
(),
media
.
getArtist
(),
media
.
getAlbum
(),
media
.
getLocation
(),
media
.
getArtworkURL
()));
...
...
@@ -281,20 +273,17 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
@Override
public
void
onMediaUpdated
(
final
MediaWrapper
[]
mediaList
)
{
if
(
mVideoAdapter
==
null
||
mVideoAdapter
.
size
()
>
NUM_ITEMS_PREVIEW
)
return
;
if
(
mVideoAdapter
==
null
||
mVideoAdapter
.
size
()
>
NUM_ITEMS_PREVIEW
)
return
;
mHandler
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
for
(
MediaWrapper
media
:
mediaList
)
updateItem
(
media
);
for
(
MediaWrapper
media
:
mediaList
)
updateItem
(
media
);
}
});
}
public
void
updateItem
(
MediaWrapper
item
)
{
if
(
item
==
null
)
return
;
if
(
item
==
null
)
return
;
if
(
mVideoAdapter
!=
null
)
{
if
(
mVideoIndex
.
containsKey
(
item
.
getLocation
()))
{
mVideoAdapter
.
notifyArrayItemRangeChanged
(
mVideoIndex
.
get
(
item
.
getLocation
()),
1
);
...
...
@@ -325,28 +314,22 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
startActivity
(
new
Intent
(
this
,
AudioPlayerActivity
.
class
));
return
;
}
CardPresenter
.
SimpleCard
card
=
(
CardPresenter
.
SimpleCard
)
item
;
Intent
intent
=
new
Intent
(
mContext
,
VerticalGridActivity
.
class
);
final
CardPresenter
.
SimpleCard
card
=
(
CardPresenter
.
SimpleCard
)
item
;
final
Intent
intent
=
new
Intent
(
mContext
,
VerticalGridActivity
.
class
);
intent
.
putExtra
(
BROWSER_TYPE
,
HEADER_CATEGORIES
);
intent
.
putExtra
(
MusicFragment
.
AUDIO_CATEGORY
,
card
.
getId
());
startActivity
(
intent
);
}
else
if
(
row
.
getId
()
==
HEADER_MISC
)
{
long
id
=
((
CardPresenter
.
SimpleCard
)
item
).
getId
();
if
(
id
==
ID_SETTINGS
)
startActivityForResult
(
new
Intent
(
this
,
org
.
videolan
.
vlc
.
gui
.
tv
.
preferences
.
PreferencesActivity
.
class
),
ACTIVITY_RESULT_PREFERENCES
);
else
if
(
id
==
ID_ABOUT
)
startActivity
(
new
Intent
(
this
,
org
.
videolan
.
vlc
.
gui
.
tv
.
AboutActivity
.
class
));
else
if
(
id
==
ID_LICENCE
)
startActivity
(
new
Intent
(
this
,
org
.
videolan
.
vlc
.
gui
.
tv
.
LicenceActivity
.
class
));
}
else
{
TvUtil
.
openMedia
(
mContext
,
item
,
row
);
}
if
(
id
==
ID_SETTINGS
)
startActivityForResult
(
new
Intent
(
this
,
org
.
videolan
.
vlc
.
gui
.
tv
.
preferences
.
PreferencesActivity
.
class
),
ACTIVITY_RESULT_PREFERENCES
);
else
if
(
id
==
ID_ABOUT
)
startActivity
(
new
Intent
(
this
,
org
.
videolan
.
vlc
.
gui
.
tv
.
AboutActivity
.
class
));
else
if
(
id
==
ID_LICENCE
)
startActivity
(
new
Intent
(
this
,
org
.
videolan
.
vlc
.
gui
.
tv
.
LicenceActivity
.
class
));
}
else
TvUtil
.
openMedia
(
mContext
,
item
,
row
);
}
@Override
public
void
onClick
(
View
v
)
{
Intent
intent
=
new
Intent
(
mContext
,
SearchActivity
.
class
);
startActivity
(
intent
);
startActivity
(
new
Intent
(
mContext
,
SearchActivity
.
class
));
}
@Override
...
...
@@ -356,8 +339,7 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
@Override
protected
void
onParsingServiceProgress
()
{
if
(
mProgressBar
.
getVisibility
()
==
View
.
GONE
)
mHandler
.
sendEmptyMessage
(
SHOW_LOADING
);
if
(
mProgressBar
.
getVisibility
()
==
View
.
GONE
)
mHandler
.
sendEmptyMessage
(
SHOW_LOADING
);
}
@Override
...
...
@@ -489,9 +471,8 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
private
void
updateBrowsers
()
{
if
(
mBrowserAdapter
==
null
)
return
;
mBrowserAdapter
.
clear
();
List
<
MediaWrapper
>
directories
=
AndroidDevices
.
getMediaDirectoriesList
();
if
(!
AndroidDevices
.
showInternalStorage
&&
!
directories
.
isEmpty
())
directories
.
remove
(
0
);
final
List
<
MediaWrapper
>
directories
=
AndroidDevices
.
getMediaDirectoriesList
();
if
(!
AndroidDevices
.
showInternalStorage
&&
!
directories
.
isEmpty
())
directories
.
remove
(
0
);
for
(
MediaWrapper
directory
:
directories
)
mBrowserAdapter
.
add
(
new
CardPresenter
.
SimpleCard
(
HEADER_DIRECTORIES
,
directory
.
getTitle
(),
R
.
drawable
.
ic_menu_folder_big
,
directory
.
getUri
()));
...
...
@@ -543,8 +524,7 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
}
public
void
updateNowPlayingCard
()
{
if
(
mService
==
null
)
return
;
if
(
mService
==
null
)
return
;
final
boolean
hasmedia
=
mService
.
hasMedia
();
final
boolean
canSwitch
=
mService
.
canSwitchToVideo
();
if
((!
hasmedia
||
canSwitch
)
&&
mNowPlayingCard
!=
null
)
{
...
...
@@ -561,18 +541,14 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
@Override
public
void
run
()
{
if
(
mNowPlayingCard
==
null
)
{
if
(
cover
!=
null
)
mNowPlayingCard
=
new
CardPresenter
.
SimpleCard
(
MusicFragment
.
CATEGORY_NOW_PLAYING
,
display
,
cover
);
else
mNowPlayingCard
=
new
CardPresenter
.
SimpleCard
(
MusicFragment
.
CATEGORY_NOW_PLAYING
,
display
,
R
.
drawable
.
ic_default_cone
);
if
(
cover
!=
null
)
mNowPlayingCard
=
new
CardPresenter
.
SimpleCard
(
MusicFragment
.
CATEGORY_NOW_PLAYING
,
display
,
cover
);
else
mNowPlayingCard
=
new
CardPresenter
.
SimpleCard
(
MusicFragment
.
CATEGORY_NOW_PLAYING
,
display
,
R
.
drawable
.
ic_default_cone
);
mCategoriesAdapter
.
add
(
0
,
mNowPlayingCard
);
}
else
{
mNowPlayingCard
.
setId
(
MusicFragment
.
CATEGORY_NOW_PLAYING
);
mNowPlayingCard
.
setName
(
display
);
if
(
cover
!=
null
)
mNowPlayingCard
.
setImage
(
cover
);
else
mNowPlayingCard
.
setImageId
(
R
.
drawable
.
ic_default_cone
);
if
(
cover
!=
null
)
mNowPlayingCard
.
setImage
(
cover
);
else
mNowPlayingCard
.
setImageId
(
R
.
drawable
.
ic_default_cone
);
}
mCategoriesAdapter
.
notifyArrayItemRangeChanged
(
0
,
1
);
}
...
...
This diff is collapsed.
Click to expand it.
Geoffrey Métais
@Dekans
mentioned in commit
64effe24
·
7 years ago
mentioned in commit
64effe24
mentioned in commit 64effe247731a9b3d342e60cfc02b1c69001d1df
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment