Commit 56186686 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

FastScroll for audio lists

parent 8ec4cb0d
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:topLeftRadius="@dimen/fastscroller_handle_corner"
android:topRightRadius="@dimen/fastscroller_handle_corner"
android:bottomLeftRadius="@dimen/fastscroller_handle_corner"
android:bottomRightRadius="0dp" />
<solid android:color="@color/orange600" />
<size
android:height="@dimen/fastscroller_handle_size"
android:width="@dimen/fastscroller_handle_size" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/fastscroller_reack_corner" />
<solid android:color="@color/orange700" />
<size
android:height="@dimen/fastscroller_track_height"
android:width="@dimen/fastscroller_track_width" />
</shape>
\ No newline at end of file
......@@ -23,7 +23,7 @@
android:layout_height="match_parent"
android:nestedScrollingEnabled="true"
android:clipToPadding="false"
android:fastScrollEnabled="true"
android:scrollbars="none"
android:paddingBottom="@dimen/listview_bottom_padding"
android:paddingLeft="20dp"
android:paddingRight="20dp"
......@@ -38,7 +38,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:fastScrollEnabled="true"
android:scrollbars="none"
android:nestedScrollingEnabled="true"
android:paddingBottom="@dimen/listview_bottom_padding"
android:paddingLeft="20dp"
......@@ -50,6 +50,14 @@
style="@style/Theme.VLC.List" />
</android.support.v4.view.ViewPager>
</org.videolan.vlc.gui.view.SwipeRefreshLayout>
<org.videolan.vlc.gui.view.FastScroller
android:id="@+id/songs_fast_scroller"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/swipeLayout"
android:visibility="invisible"/>
<include layout="@layout/shadow_top"
android:layout_width="match_parent"
......
......@@ -39,8 +39,7 @@
android:clipToPadding="false"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:fastScrollEnabled="true"
android:scrollbarStyle="outsideInset"
android:scrollbars="none"
android:focusable="true"
android:nestedScrollingEnabled="true"
android:nextFocusUp="@id/header"
......@@ -55,8 +54,7 @@
android:clipToPadding="false"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:fastScrollEnabled="true"
android:scrollbarStyle="outsideInset"
android:scrollbars="none"
android:focusable="true"
android:nestedScrollingEnabled="true"
android:nextFocusUp="@id/header"
......@@ -71,8 +69,7 @@
android:clipToPadding="false"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:fastScrollEnabled="true"
android:scrollbarStyle="outsideInset"
android:scrollbars="none"
android:focusable="true"
android:nestedScrollingEnabled="true"
android:nextFocusUp="@id/header"
......@@ -87,8 +84,7 @@
android:clipToPadding="false"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:fastScrollEnabled="true"
android:scrollbarStyle="outsideInset"
android:scrollbars="none"
android:focusable="true"
android:nestedScrollingEnabled="true"
android:nextFocusUp="@id/header"
......@@ -103,8 +99,7 @@
android:clipToPadding="false"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:fastScrollEnabled="true"
android:scrollbarStyle="outsideInset"
android:scrollbars="none"
android:focusable="true"
android:nestedScrollingEnabled="true"
android:nextFocusUp="@id/header"
......@@ -113,9 +108,17 @@
android:nextFocusRight="@+id/playlists_list" />
</android.support.v4.view.ViewPager>
</org.videolan.vlc.gui.view.SwipeRefreshLayout>
<org.videolan.vlc.gui.view.FastScroller
android:id="@+id/songs_fast_scroller"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/swipeLayout"
android:visibility="invisible"/>
<include layout="@layout/shadow_top"
android:layout_width="match_parent"
android:layout_height="9dp"
android:layout_below="@+id/sliding_tabs" />
android:layout_below="@+id/sliding_tabs"
android:layout_height="9dp" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/fastscroller_bubble"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/fastscroller_handle"
android:background="@drawable/fastscroller_bubble"
android:gravity="center"
android:textSize="@dimen/fastscroller_handle_text_size"
android:textColor="@color/white"
android:visibility="gone" />
<ImageView
android:id="@+id/fastscroller_handle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/fastscroller_track"
android:src="@drawable/fastscroller_handle"
android:layout_marginStart="@dimen/fastscroller_track_padding"
android:layout_marginLeft="@dimen/fastscroller_track_padding"
android:layout_marginEnd="@dimen/fastscroller_track_padding"
android:layout_marginRight="@dimen/fastscroller_track_padding"/>
</merge>
\ No newline at end of file
......@@ -55,4 +55,12 @@
<dimen name="info_dialog_peek_height">120dip</dimen>
<dimen name="player_peek_height">62dip</dimen>
<!-- fast scroller -->
<dimen name="fastscroller_handle_corner">20dp</dimen>
<dimen name="fastscroller_handle_size">50dp</dimen>
<dimen name="fastscroller_handle_text_size">30dp</dimen>
<dimen name="fastscroller_reack_corner">3dp</dimen>
<dimen name="fastscroller_track_height">30dp</dimen>
<dimen name="fastscroller_track_width">6dp</dimen>
<dimen name="fastscroller_track_padding">5dp</dimen>
</resources>
\ No newline at end of file
......@@ -445,7 +445,11 @@
<string name="permission_ask_again">Grant permission</string>
<string name="exit_app">Close VLC</string>
<!-- PLugins -->
<!-- fast scroller -->
<string name="fastscroller_track">FastScroller track</string>
<string name="fastscroller_handle">FastScroller handle</string>
<!-- Plugins -->
<string name="plugins">Plugins</string>
<string name="download_on_device">Download</string>
<string name="extension_empty">No item to display, go to your extension settings to get some.</string>
......
......@@ -52,6 +52,7 @@ import org.videolan.vlc.gui.dialogs.SavePlaylistDialog;
import org.videolan.vlc.gui.helpers.AudioUtil;
import org.videolan.vlc.gui.helpers.UiTools;
import org.videolan.vlc.gui.view.ContextMenuRecyclerView;
import org.videolan.vlc.gui.view.FastScroller;
import org.videolan.vlc.gui.view.SwipeRefreshLayout;
import org.videolan.vlc.media.MediaUtils;
import org.videolan.vlc.util.AndroidDevices;
......@@ -61,7 +62,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class AudioAlbumsSongsFragment extends MediaBrowserFragment implements SwipeRefreshLayout.OnRefreshListener, AudioBrowserAdapter.ClickHandler {
public class AudioAlbumsSongsFragment extends MediaBrowserFragment implements SwipeRefreshLayout.OnRefreshListener, AudioBrowserAdapter.ClickHandler, TabLayout.OnTabSelectedListener {
private final static String TAG = "VLC/AudioAlbumsSongsFragment";
......@@ -72,9 +73,11 @@ public class AudioAlbumsSongsFragment extends MediaBrowserFragment implements Sw
private SwipeRefreshLayout mSwipeRefreshLayout;
private ViewPager mViewPager;
TabLayout mTabLayout;
private List<View> mLists;
private AudioBrowserAdapter mSongsAdapter;
private AudioBrowserAdapter mAlbumsAdapter;
private FastScroller mFastScroller;
public final static int MODE_ALBUM = 0;
public final static int MODE_SONG = 1;
......@@ -121,8 +124,10 @@ public class AudioAlbumsSongsFragment extends MediaBrowserFragment implements Sw
mViewPager.setOffscreenPageLimit(MODE_TOTAL - 1);
mViewPager.setAdapter(new AudioPagerAdapter(mLists, titles));
mFastScroller = (FastScroller) v.findViewById(R.id.songs_fast_scroller);
mViewPager.setOnTouchListener(mSwipeFilter);
TabLayout mTabLayout = (TabLayout) v.findViewById(R.id.sliding_tabs);
mTabLayout = (TabLayout) v.findViewById(R.id.sliding_tabs);
mTabLayout.setupWithViewPager(mViewPager);
songsList.setAdapter(mSongsAdapter);
......@@ -143,6 +148,8 @@ public class AudioAlbumsSongsFragment extends MediaBrowserFragment implements Sw
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mFastScroller.setRecyclerView((RecyclerView) mLists.get(mViewPager.getCurrentItem()));
mTabLayout.addOnTabSelectedListener(this);
updateList();
}
......@@ -309,7 +316,7 @@ public class AudioAlbumsSongsFragment extends MediaBrowserFragment implements Sw
}
};
public void clear(){
public void clear() {
mAlbumsAdapter.clear();
mSongsAdapter.clear();
}
......@@ -366,4 +373,17 @@ public class AudioAlbumsSongsFragment extends MediaBrowserFragment implements Sw
return;
getActivity().getMenuInflater().inflate(R.menu.audio_list_browser, menu);
}
@Override
public void onTabSelected(TabLayout.Tab tab) {
mFastScroller.setRecyclerView((RecyclerView) mLists.get(tab.getPosition()));
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {}
@Override
public void onTabReselected(TabLayout.Tab tab) {
((RecyclerView)mLists.get(tab.getPosition())).smoothScrollToPosition(0);
}
}
......@@ -15,16 +15,15 @@ import org.videolan.vlc.BR;
import org.videolan.vlc.databinding.AudioBrowserItemBinding;
import org.videolan.vlc.databinding.AudioBrowserSeparatorBinding;
import org.videolan.vlc.gui.helpers.AsyncImageLoader;
import org.videolan.vlc.gui.view.FastScroller;
import java.util.ArrayList;
import java.util.Arrays;
public class AudioBrowserAdapter extends RecyclerView.Adapter<AudioBrowserAdapter.ViewHolder> {
public class AudioBrowserAdapter extends RecyclerView.Adapter<AudioBrowserAdapter.ViewHolder> implements FastScroller.SeparatedAdapter {
private static final String TAG = "VLC/AudioBrowserAdapter";
public static final int TYPE_MEDIA = 0;
public static final int TYPE_SEPARATOR = 1;
private boolean mMakeSections = true;
public interface ClickHandler {
......@@ -32,10 +31,10 @@ public class AudioBrowserAdapter extends RecyclerView.Adapter<AudioBrowserAdapte
void onCtxClick(View v, int position, MediaLibraryItem item);
}
ArrayList<MediaLibraryItem> mDataList = new ArrayList<>();
ArrayList<DummyItem> mSeparators = new ArrayList<>();
Activity mContext;
ClickHandler mClickHandler;
private ArrayList<MediaLibraryItem> mDataList = new ArrayList<>();
private ArrayList<DummyItem> mSeparators = new ArrayList<>();
private Activity mContext;
private ClickHandler mClickHandler;
public AudioBrowserAdapter(Activity context, ClickHandler clickHandler, boolean sections) {
mContext = context;
......@@ -46,7 +45,7 @@ public class AudioBrowserAdapter extends RecyclerView.Adapter<AudioBrowserAdapte
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater inflater = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (viewType == TYPE_SEPARATOR) {
if (viewType == MediaLibraryItem.TYPE_DUMMY) {
AudioBrowserSeparatorBinding binding = AudioBrowserSeparatorBinding.inflate(inflater, parent, false);
return new ViewHolder(binding);
} else {
......@@ -60,7 +59,7 @@ public class AudioBrowserAdapter extends RecyclerView.Adapter<AudioBrowserAdapte
if (position >= mDataList.size())
return;
holder.vdb.setVariable(BR.item, mDataList.get(position));
if (holder.getType() == TYPE_MEDIA)
if (holder.getType() == MediaLibraryItem.TYPE_MEDIA)
holder.vdb.setVariable(BR.cover, AsyncImageLoader.DEFAULT_COVER_AUDIO_DRAWABLE);
}
......@@ -86,18 +85,18 @@ public class AudioBrowserAdapter extends RecyclerView.Adapter<AudioBrowserAdapte
return mDataList;
}
public ArrayList<MediaLibraryItem> getMediaItems() {
ArrayList<MediaLibraryItem> getMediaItems() {
ArrayList<MediaLibraryItem> list = new ArrayList<>();
for (MediaLibraryItem item : mDataList)
if (!(item instanceof DummyItem))
if (!(item.getItemType() == MediaLibraryItem.TYPE_DUMMY))
list.add(item);
return list;
}
public int getListWithPosition(ArrayList<MediaLibraryItem> list, int position) {
int getListWithPosition(ArrayList<MediaLibraryItem> list, int position) {
int offset = 0;
for (int i = 0; i < mDataList.size(); ++i)
if (mDataList.get(i) instanceof DummyItem) {
if (mDataList.get(i).getItemType() == MediaLibraryItem.TYPE_DUMMY) {
if (i < position)
++offset;
} else
......@@ -115,7 +114,20 @@ public class AudioBrowserAdapter extends RecyclerView.Adapter<AudioBrowserAdapte
@Override
public int getItemViewType(int position) {
return getItem(position) instanceof DummyItem ? TYPE_SEPARATOR : TYPE_MEDIA;
return getItem(position).getItemType();
}
public boolean hasSections() {
return mMakeSections;
}
@Override
public String getSectionforPosition(int position) {
if (mMakeSections)
for (int i = position; i >= 0; --i)
if (getItem(i).getItemType() == MediaLibraryItem.TYPE_DUMMY)
return getItem(i).getTitle();
return "";
}
public boolean isEmpty() {
......@@ -194,12 +206,12 @@ public class AudioBrowserAdapter extends RecyclerView.Adapter<AudioBrowserAdapte
}
public int getType() {
return TYPE_SEPARATOR;
return MediaLibraryItem.TYPE_DUMMY;
}
}
public class MediaItemViewHolder extends ViewHolder implements View.OnLongClickListener {
public MediaItemViewHolder(AudioBrowserItemBinding binding) {
MediaItemViewHolder(AudioBrowserItemBinding binding) {
super(binding);
binding.setHolder(this);
itemView.setOnLongClickListener(this);
......@@ -222,7 +234,7 @@ public class AudioBrowserAdapter extends RecyclerView.Adapter<AudioBrowserAdapte
}
public int getType() {
return TYPE_MEDIA;
return MediaLibraryItem.TYPE_MEDIA;
}
}
}
/*****************************************************************************
* AudioBrowserFragment.java
*****************************************************************************
* Copyright © 2011-2012 VLC authors and VideoLAN
* Copyright © 2011-2016 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
......@@ -33,7 +33,6 @@ import android.support.design.widget.BottomSheetDialogFragment;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TabLayout;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
......@@ -53,9 +52,6 @@ import org.videolan.medialibrary.Medialibrary;
import org.videolan.medialibrary.interfaces.DevicesDiscoveryCb;
import org.videolan.medialibrary.interfaces.MediaAddedCb;
import org.videolan.medialibrary.interfaces.MediaUpdatedCb;
import org.videolan.medialibrary.media.Album;
import org.videolan.medialibrary.media.Artist;
import org.videolan.medialibrary.media.Genre;
import org.videolan.medialibrary.media.MediaLibraryItem;
import org.videolan.medialibrary.media.MediaWrapper;
import org.videolan.medialibrary.media.Playlist;
......@@ -69,6 +65,7 @@ import org.videolan.vlc.gui.dialogs.SavePlaylistDialog;
import org.videolan.vlc.gui.helpers.AudioUtil;
import org.videolan.vlc.gui.helpers.UiTools;
import org.videolan.vlc.gui.view.ContextMenuRecyclerView;
import org.videolan.vlc.gui.view.FastScroller;
import org.videolan.vlc.gui.view.NpaLinearLayoutManager;
import org.videolan.vlc.gui.view.SwipeRefreshLayout;
import org.videolan.vlc.interfaces.IBrowser;
......@@ -83,7 +80,7 @@ import java.util.List;
import java.util.Random;
import java.util.concurrent.ConcurrentLinkedQueue;
public class AudioBrowserFragment extends MediaBrowserFragment implements DevicesDiscoveryCb, SwipeRefreshLayout.OnRefreshListener, MediaBrowser.EventListener, IBrowser, ViewPager.OnPageChangeListener, AudioBrowserAdapter.ClickHandler, Medialibrary.ArtistsAddedCb, Medialibrary.ArtistsModifiedCb, Medialibrary.AlbumsAddedCb, Medialibrary.AlbumsModifiedCb, MediaAddedCb, MediaUpdatedCb {
public class AudioBrowserFragment extends MediaBrowserFragment implements DevicesDiscoveryCb, SwipeRefreshLayout.OnRefreshListener, MediaBrowser.EventListener, IBrowser, ViewPager.OnPageChangeListener, AudioBrowserAdapter.ClickHandler, Medialibrary.ArtistsAddedCb, Medialibrary.ArtistsModifiedCb, Medialibrary.AlbumsAddedCb, Medialibrary.AlbumsModifiedCb, MediaAddedCb, MediaUpdatedCb, TabLayout.OnTabSelectedListener {
public final static String TAG = "VLC/AudioBrowserFragment";
private MediaBrowser mMediaBrowser;
......@@ -100,6 +97,7 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements Device
private TabLayout mTabLayout;
private TextView mEmptyView;
private List<View> mLists;
private FastScroller mFastScroller;
private FloatingActionButton mFabPlayShuffleAll;
public static final int REFRESH = 101;
......@@ -143,6 +141,8 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements Device
ContextMenuRecyclerView genreList = (ContextMenuRecyclerView)v.findViewById(R.id.genres_list);
ContextMenuRecyclerView playlistsList = (ContextMenuRecyclerView)v.findViewById(R.id.playlists_list);
mFastScroller = (FastScroller) v.findViewById(R.id.songs_fast_scroller);
mLists = Arrays.asList((View)artistList, albumList, songsList, genreList, playlistsList);
songsList.setAdapter(mSongsAdapter);
......@@ -178,6 +178,7 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements Device
}
mViewPager.setOnTouchListener(mSwipeFilter);
mFastScroller.setRecyclerView((RecyclerView) mLists.get(mViewPager.getCurrentItem()));
}
public void onStart() {
......@@ -201,24 +202,9 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements Device
}
private void setupTabLayout() {
final PagerAdapter adapter = mViewPager.getAdapter();
mTabLayout.setTabsFromPagerAdapter(adapter);
mTabLayout.setupWithViewPager(mViewPager);
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(mTabLayout));
mTabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
mViewPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
((RecyclerView)mLists.get(tab.getPosition())).smoothScrollToPosition(0);
}
});
mTabLayout.addOnTabSelectedListener(this);
}
RecyclerView.OnScrollListener mRVScrollListener = new RecyclerView.OnScrollListener() {
......@@ -385,8 +371,8 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements Device
final MediaLibraryItem mediaLibraryItem = adapter.getItem(position);
String message;
Runnable action;
final MediaLibraryItem separator = adapter.getItemViewType(position-1) == AudioBrowserAdapter.TYPE_SEPARATOR &&
adapter.getItemViewType(position+1) == AudioBrowserAdapter.TYPE_SEPARATOR ? adapter.getItem(position-1) : null;
final MediaLibraryItem separator = adapter.getItemViewType(position-1) == MediaLibraryItem.TYPE_DUMMY &&
adapter.getItemViewType(position+1) == MediaLibraryItem.TYPE_DUMMY ? adapter.getItem(position-1) : null;
adapter.remove(position);
if (separator != null)
adapter.remove(position-1);
......@@ -596,6 +582,19 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements Device
setFabPlayShuffleAllVisibility();
}
@Override
public void onTabSelected(TabLayout.Tab tab) {
mFastScroller.setRecyclerView((RecyclerView) mLists.get(tab.getPosition()));
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {}
@Override
public void onTabReselected(TabLayout.Tab tab) {
((RecyclerView) mLists.get(tab.getPosition())).smoothScrollToPosition(0);
}
private void deleteMedia(final MediaWrapper mw) {
VLCApplication.runBackground(new Runnable() {
@Override
......@@ -633,19 +632,19 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements Device
@Override
public void onClick(View v, int position, MediaLibraryItem item) {
if (item instanceof Artist || item instanceof Genre) {
if (item.getItemType() == MediaLibraryItem.TYPE_ARTIST || item.getItemType() == MediaLibraryItem.TYPE_GENRE) {
Intent i = new Intent(getActivity(), SecondaryActivity.class);
i.putExtra(SecondaryActivity.KEY_FRAGMENT, SecondaryActivity.ALBUMS_SONGS);
i.putExtra(AudioAlbumsSongsFragment.TAG_ITEM, item);
startActivity(i);
} else if (item instanceof MediaWrapper) {
} else if (item.getItemType() == MediaLibraryItem.TYPE_MEDIA) {
mService.load((MediaWrapper) item);
} else if (item instanceof Album) {
} else if (item.getItemType() == MediaLibraryItem.TYPE_ALBUM) {
Intent i = new Intent(getActivity(), SecondaryActivity.class);
i.putExtra(SecondaryActivity.KEY_FRAGMENT, SecondaryActivity.ALBUM);
i.putExtra(AudioAlbumFragment.TAG_ITEM, item);
startActivity(i);
} else if (item instanceof Playlist) {
} else if (item.getItemType() == MediaLibraryItem.TYPE_PLAYLIST) {
mService.load(item.getTracks(mMediaLibrary), 0);
}
}
......
/*****************************************************************************
* FastScroller.java
*****************************************************************************
* Copyright © 2016 VLC authors and VideoLAN
* Inspired by Mark Allison blog post:
* https://blog.stylingandroid.com/recyclerview-fastscroll-part-1/
* https://blog.stylingandroid.com/recyclerview-fastscroll-part-2/
*
* 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.view;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.NonNull;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.R;
public class FastScroller extends LinearLayout {
private static final String TAG = "FastScroller";
private static final int HANDLE_ANIMATION_DURATION = 100;
private static final int HANDLE_HIDE_DELAY = 1000;
private static final int SCROLLER_HIDE_DELAY = 3000;
private static final int TRACK_SNAP_RANGE = 5;
private static final int HIDE_HANDLE = 0;
private static final int HIDE_SCROLLER = 1;
private static final int SHOW_SCROLLER = 2;
private static final String SCALE_X = "scaleX";
private static final String SCALE_Y = "scaleY";