Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
530
Issue boards
Milestones
Wiki
Code
Merge requests
15
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
28e02644
Commit
28e02644
authored
6 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Remove unused class
parent
338297af
No related branches found
Branches containing commit
No related tags found
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/video/VideoGridAnimator.java
+0
-159
0 additions, 159 deletions
...oid/src/org/videolan/vlc/gui/video/VideoGridAnimator.java
with
0 additions
and
159 deletions
vlc-android/src/org/videolan/vlc/gui/video/VideoGridAnimator.java
deleted
100644 → 0
+
0
−
159
View file @
338297af
/*****************************************************************************
* VideoGridAnimator.java
*****************************************************************************
* Copyright © 2011-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.gui.video
;
import
android.annotation.TargetApi
;
import
android.os.Build
;
import
androidx.recyclerview.widget.RecyclerView
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup.OnHierarchyChangeListener
;
import
android.view.animation.AlphaAnimation
;
import
android.view.animation.Animation
;
import
android.view.animation.Animation.AnimationListener
;
import
android.view.animation.AnimationSet
;
import
android.view.animation.TranslateAnimation
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
public
class
VideoGridAnimator
{
public
final
static
String
TAG
=
"VLC/VideoGridAnimator"
;
private
final
RecyclerView
mGridView
;
private
boolean
isAnimating
=
false
;
private
int
mLastNItems
;
private
int
mAnimationsRunning
=
0
;
public
VideoGridAnimator
(
RecyclerView
gridview
)
{
mGridView
=
gridview
;
mGridView
.
setOnHierarchyChangeListener
(
mHCL
);
}
public
void
animate
()
{
isAnimating
=
true
;
mLastNItems
=
-
1
;
mGridView
.
removeCallbacks
(
r
);
mGridView
.
post
(
r
);
}
/* If animation is running, hide the items as they are added to the grid
* so they don't flicker after being laid out and before the animation
* starts.
*/
OnHierarchyChangeListener
mHCL
=
new
OnHierarchyChangeListener
()
{
@Override
public
void
onChildViewRemoved
(
View
parent
,
View
child
)
{
// TODO Auto-generated method stub
}
@Override
public
void
onChildViewAdded
(
View
parent
,
View
child
)
{
if
(
isAnimating
&&
parent
==
mGridView
)
setAlpha
(
0
,
child
);
}
};
final
Runnable
r
=
new
Runnable
()
{
@Override
public
void
run
()
{
/* Ensure the number of visible items is stable between two run */
if
(
mGridView
.
getChildCount
()
!=
mLastNItems
)
{
/* List not not ready yet: reschedule */
mLastNItems
=
mGridView
.
getChildCount
();
Log
.
e
(
TAG
,
"Rescheduling animation: list not ready"
);
mGridView
.
postDelayed
(
this
,
200
);
return
;
}
isAnimating
=
false
;
for
(
int
i
=
0
;
i
<
mLastNItems
;
i
++)
{
AnimationSet
animSet
=
new
AnimationSet
(
true
);
Animation
animation
=
new
AlphaAnimation
(
0.0f
,
1.0f
);
animation
.
setDuration
(
300
);
animation
.
setStartOffset
(
i
*
80
);
animSet
.
addAnimation
(
animation
);
if
(((
VideoListAdapter
)
mGridView
.
getAdapter
()).
isListMode
())
{
animation
=
new
TranslateAnimation
(
Animation
.
RELATIVE_TO_SELF
,
-
1.0f
,
Animation
.
RELATIVE_TO_SELF
,
0.0f
,
Animation
.
RELATIVE_TO_SELF
,
0.0f
,
Animation
.
RELATIVE_TO_SELF
,
0.0f
);
animation
.
setDuration
(
400
);
animation
.
setStartOffset
(
i
*
80
);
animSet
.
addAnimation
(
animation
);
}
animSet
.
setAnimationListener
(
new
AnimationListener
()
{
@Override
public
void
onAnimationStart
(
Animation
animation
)
{
mAnimationsRunning
+=
1
;
}
@Override
public
void
onAnimationRepeat
(
Animation
animation
)
{
// TODO Auto-generated method stub
}
@Override
public
void
onAnimationEnd
(
Animation
animation
)
{
mAnimationsRunning
-=
1
;
}
});
isAnimating
=
false
;
View
v
=
mGridView
.
getChildAt
(
i
);
setAlpha
(
1
,
v
);
v
.
startAnimation
(
animSet
);
}
}
};
public
boolean
isAnimationDone
()
{
return
mAnimationsRunning
==
0
;
}
/* Support pre-11 device */
@TargetApi
(
Build
.
VERSION_CODES
.
HONEYCOMB
)
public
void
setAlpha
(
float
alpha
,
View
view
)
{
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
HONEYCOMB
)
view
.
setAlpha
(
alpha
);
else
if
(
view
instanceof
ViewGroup
)
{
for
(
int
i
=
0
;
i
<
((
ViewGroup
)
view
).
getChildCount
();
i
++)
{
setAlpha
(
alpha
,
((
ViewGroup
)
view
).
getChildAt
(
i
));
if
(((
ViewGroup
)
view
).
getBackground
()
!=
null
)
((
ViewGroup
)
view
).
getBackground
().
setAlpha
((
int
)
(
alpha
*
255
));
}
}
else
if
(
view
instanceof
ImageView
)
{
if
(((
ImageView
)
view
).
getDrawable
()
!=
null
)
((
ImageView
)
view
).
getDrawable
().
setAlpha
((
int
)
(
alpha
*
255
));
if
(((
ImageView
)
view
).
getBackground
()
!=
null
)
((
ImageView
)
view
).
getBackground
().
setAlpha
((
int
)
(
alpha
*
255
));
}
else
if
(
view
instanceof
TextView
)
{
((
TextView
)
view
).
setTextColor
(((
TextView
)
view
).
getTextColors
().
withAlpha
((
int
)
(
alpha
*
255
)));
if
(((
TextView
)
view
).
getBackground
()
!=
null
)
((
TextView
)
view
).
getBackground
().
setAlpha
((
int
)
(
alpha
*
255
));
}
}
}
This diff is collapsed.
Click to expand it.
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