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
266dbd42
Commit
266dbd42
authored
Jan 15, 2014
by
Adrien Maglo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SlidePaneLayout: add a listener to send event on panel sliding
parent
d9883d41
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
3 deletions
+50
-3
vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java
...ndroid/src/org/videolan/vlc/widget/SlidingPaneLayout.java
+50
-3
No files found.
vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java
View file @
266dbd42
...
...
@@ -143,6 +143,34 @@ public class SlidingPaneLayout extends ViewGroup {
}
}
private
PanelSlideListener
mPanelSlideListener
;
/**
* Listener for monitoring events about the sliding pane.
*/
public
interface
PanelSlideListener
{
/**
* Called when the sliding pane position changes.
* @param slideOffset The new offset of this sliding pane within its range, from 0-1
*/
public
void
onPanelSlide
(
float
slideOffset
);
/**
* Called when the sliding pane becomes slid open.
*/
public
void
onPanelOpened
();
/**
* Called when the sliding pane becomes slid open entirely.
*/
public
void
onPanelOpenedEntirely
();
/**
* Called when a sliding pane becomes slid completely closed.
*/
public
void
onPanelClosed
();
}
public
SlidingPaneLayout
(
Context
context
)
{
this
(
context
,
null
);
}
...
...
@@ -179,6 +207,14 @@ public class SlidingPaneLayout extends ViewGroup {
mDragHelper
.
setMinVelocity
(
MIN_FLING_VELOCITY
*
density
);
}
/**
* Set the panel slide listener.
* @param l the PanelSlideListener
*/
public
void
setPanelSlideListener
(
PanelSlideListener
l
)
{
mPanelSlideListener
=
l
;
}
/**
* Set the color used to fade the pane covered by the sliding pane out when the pane
* will become fully covered in the closed state.
...
...
@@ -851,16 +887,27 @@ public class SlidingPaneLayout extends ViewGroup {
public
void
onViewDragStateChanged
(
int
state
)
{
if
(
mDragHelper
.
getViewDragState
()
==
ViewDragHelper
.
STATE_IDLE
)
{
if
(
mSlideOffset
==
0
)
{
if
(
mState
!=
STATE_CLOSED
)
if
(
mState
!=
STATE_CLOSED
)
{
mState
=
STATE_CLOSED
;
if
(
mPanelSlideListener
!=
null
)
mPanelSlideListener
.
onPanelClosed
();
}
}
else
if
(
mSlideOffset
==
1
-
(
float
)
mOverhangSize
/
mSlideRange
)
{
if
(
mState
!=
STATE_OPENED
)
{
mState
=
STATE_OPENED
;
if
(
mPanelSlideListener
!=
null
)
mPanelSlideListener
.
onPanelOpened
();
}
}
else
if
(
mSlideOffset
==
1
)
{
if
(
mState
!=
STATE_OPENED_ENTIRELY
)
{
mState
=
STATE_OPENED_ENTIRELY
;
if
(
mPanelSlideListener
!=
null
)
mPanelSlideListener
.
onPanelOpenedEntirely
();
}
}
else
if
(
mState
!=
STATE_OPENED_ENTIRELY
)
{
mState
=
STATE_OPENED_ENTIRELY
;
}
}
else
if
(
mPanelSlideListener
!=
null
)
mPanelSlideListener
.
onPanelSlide
((
float
)
mSlideOffset
/
mSlideRange
);
}
@Override
...
...
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