Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Casanowow Life for love
VLC-Android
Commits
9357ae33
Commit
9357ae33
authored
Jun 20, 2012
by
Edward Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: add a VLCCallbackTask to make threading easier
parent
d92f830d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
0 deletions
+64
-0
vlc-android/src/org/videolan/vlc/VLCCallbackTask.java
vlc-android/src/org/videolan/vlc/VLCCallbackTask.java
+64
-0
No files found.
vlc-android/src/org/videolan/vlc/VLCCallbackTask.java
0 → 100644
View file @
9357ae33
/*****************************************************************************
* VLCCallbackTask.java
*****************************************************************************
* Copyright © 2012 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
package
org.videolan.vlc
;
/**
* A small callback helper class to make running callbacks in threads easier
*/
public
class
VLCCallbackTask
implements
Runnable
{
private
final
CallbackListener
callback
;
private
final
Object
user
;
/**
* The callback interface. Implement callback() to run as the main thread,
* and implement callback_object() to run when the main thread completes.
*/
public
interface
CallbackListener
{
public
abstract
void
callback
();
public
abstract
void
callback_object
(
Object
o
);
}
/**
* @param _callback The CallbackListener as described above
* @param _user Any user object you want to pass
*/
public
VLCCallbackTask
(
CallbackListener
_callback
,
Object
_user
)
{
this
.
callback
=
_callback
;
this
.
user
=
_user
;
}
/**
* A version of VLCCallbackTask if you are not using the user parameter
*
* @param _callback The CallbackListener as described above
*/
public
VLCCallbackTask
(
CallbackListener
_callback
)
{
this
.
callback
=
_callback
;
this
.
user
=
null
;
}
/* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
public
void
run
()
{
callback
.
callback
();
callback
.
callback_object
(
user
);
}
}
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