Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ewout ter Hoeven
VLC-Android
Commits
8faa09da
Commit
8faa09da
authored
Jul 06, 2014
by
Jean-Baptiste Kempf
Browse files
VideoGridFragment: don't overuse context
Just to send a broadcast, use the VLCApplication context
parent
c7c63062
Changes
2
Hide whitespace changes
Inline
Side-by-side
vlc-android/src/org/videolan/vlc/MediaLibrary.java
View file @
8faa09da
...
...
@@ -81,7 +81,7 @@ public class MediaLibrary {
public
void
loadMediaItems
(
Context
context
)
{
if
(
mLoadingThread
==
null
||
mLoadingThread
.
getState
()
==
State
.
TERMINATED
)
{
isStopping
=
false
;
VideoGridFragment
.
actionScanStart
(
context
.
getApplicationContext
()
);
VideoGridFragment
.
actionScanStart
();
mLoadingThread
=
new
Thread
(
new
GetMediaItemsRunnable
(
context
.
getApplicationContext
()));
mLoadingThread
.
start
();
}
...
...
vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
View file @
8faa09da
...
...
@@ -35,6 +35,7 @@ import org.videolan.vlc.MediaLibrary;
import
org.videolan.vlc.R
;
import
org.videolan.vlc.Thumbnailer
;
import
org.videolan.vlc.Util
;
import
org.videolan.vlc.VLCApplication
;
import
org.videolan.vlc.VlcRunnable
;
import
org.videolan.vlc.WeakHandler
;
import
org.videolan.vlc.gui.CommonDialogs
;
...
...
@@ -153,7 +154,7 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
getActivity
().
registerReceiver
(
messageReceiverVideoListFragment
,
filter
);
Log
.
i
(
TAG
,
"mMediaLibrary.isWorking() "
+
Boolean
.
toString
(
mMediaLibrary
.
isWorking
()));
if
(
mMediaLibrary
.
isWorking
())
{
actionScanStart
(
getActivity
().
getApplicationContext
()
);
actionScanStart
();
}
mAnimator
=
new
VideoGridAnimator
(
getGridView
());
...
...
@@ -479,19 +480,15 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
}
};
public
static
void
actionScanStart
(
Context
context
)
{
if
(
context
==
null
)
return
;
public
static
void
actionScanStart
()
{
Intent
intent
=
new
Intent
();
intent
.
setAction
(
ACTION_SCAN_START
);
context
.
get
ApplicationContext
().
sendBroadcast
(
intent
);
VLC
Application
.
getApp
Context
().
sendBroadcast
(
intent
);
}
public
static
void
actionScanStop
(
Context
context
)
{
if
(
context
==
null
)
return
;
public
static
void
actionScanStop
()
{
Intent
intent
=
new
Intent
();
intent
.
setAction
(
ACTION_SCAN_STOP
);
context
.
get
ApplicationContext
().
sendBroadcast
(
intent
);
VLC
Application
.
getApp
Context
().
sendBroadcast
(
intent
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment