[Android] Remove unused class
Geoffrey Métais
git at videolan.org
Thu Jan 24 10:26:48 CET 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jan 24 09:31:13 2019 +0100| [28e02644a1694cab8f4d9033798e7406dcd81835] | committer: Geoffrey Métais
Remove unused class
> https://code.videolan.org/videolan/vlc-android/commit/28e02644a1694cab8f4d9033798e7406dcd81835
---
.../videolan/vlc/gui/video/VideoGridAnimator.java | 159 ---------------------
1 file changed, 159 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridAnimator.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridAnimator.java
deleted file mode 100644
index 9ec60d61c..000000000
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridAnimator.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*****************************************************************************
- * 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));
- }
- }
-}
More information about the Android
mailing list