Commit 797f78ee authored by Geoffrey Métais's avatar Geoffrey Métais

Improve FAB behavior in audio

Close #402
parent 91487d1d
......@@ -60,6 +60,7 @@ import org.videolan.vlc.util.FileUtils;
import org.videolan.vlc.util.Util;
import java.util.ArrayList;
import java.util.List;
public class AudioAlbumsSongsFragment extends BaseAudioBrowser implements SwipeRefreshLayout.OnRefreshListener, TabLayout.OnTabSelectedListener {
......@@ -155,7 +156,7 @@ public class AudioAlbumsSongsFragment extends BaseAudioBrowser implements SwipeR
rv.setLayoutManager(llm);
rv.setRecycledViewPool(rvp);
}
mFabPlay.setImageResource(R.drawable.ic_fab_play);
mTabLayout.addOnTabSelectedListener(this);
updateList();
}
......@@ -377,4 +378,16 @@ public class AudioAlbumsSongsFragment extends BaseAudioBrowser implements SwipeR
return mViewPager.getCurrentItem() == MODE_SONG;
}
@Override
public void setFabPlayVisibility(boolean enable) {
super.setFabPlayVisibility(enable && mViewPager.getCurrentItem() == 1);
}
@Override
public void onFabPlayClick(View view) {
if (mService == null) return;
@SuppressWarnings("unchecked")
final List<MediaWrapper> list = (List<MediaWrapper>)(List<?>) mSongsAdapter.getMediaItems();
mService.load(list, 0);
}
}
......@@ -343,6 +343,11 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
}
}
@Override
public void setFabPlayVisibility(boolean enable) {
super.setFabPlayVisibility(enable && mViewPager.getCurrentItem() == MODE_SONG);
}
public void setFabPlayShuffleAllVisibility() {
setFabPlayVisibility(mViewPager.getCurrentItem() == MODE_SONG);
}
......
......@@ -77,13 +77,12 @@ public abstract class MediaBrowserFragment extends PlaybackServiceFragment imple
super.onViewCreated(view, savedInstanceState);
if (mSwipeRefreshLayout != null)
mSwipeRefreshLayout.setColorSchemeResources(R.color.orange700);
mFabPlay = getActivity().findViewById(R.id.fab);
}
public void onStart() {
super.onStart();
if (mFabPlay == null)
mFabPlay = getActivity().findViewById(R.id.fab);
if (!isHidden())
onHiddenChanged(false);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment