|
@@ -80,6 +80,8 @@ import androidx.core.widget.NestedScrollView;
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
import androidx.recyclerview.widget.GridLayoutManager;
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
+import androidx.recyclerview.widget.LinearSnapHelper;
|
|
|
+import androidx.recyclerview.widget.PagerSnapHelper;
|
|
|
import androidx.viewpager.widget.ViewPager;
|
|
|
import androidx.viewpager2.widget.ViewPager2;
|
|
|
|
|
@@ -168,6 +170,8 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
LinearLayoutManager recommendMusicSheetManager = new LinearLayoutManager(getContext());
|
|
|
recommendMusicSheetManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
|
|
mRecommendAdapter = new HomeHotMusicSheetAdapter();
|
|
|
+ LinearSnapHelper recommendlinearSnapHelper =new LinearSnapHelper();
|
|
|
+ recommendlinearSnapHelper.attachToRecyclerView(mViewBinding.rvRecommendTrack);
|
|
|
HomeHotMusicSheetItemDecoration itemDecoration1 = new HomeHotMusicSheetItemDecoration(0, SizeUtils.dp2px(12), 0, SizeUtils.dp2px(12), 0);
|
|
|
mViewBinding.rvRecommendTrack.addItemDecoration(itemDecoration1);
|
|
|
mViewBinding.rvRecommendTrack.setLayoutManager(recommendMusicSheetManager);
|
|
@@ -177,6 +181,8 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
LinearLayoutManager latestMusicSheetManager = new LinearLayoutManager(getContext());
|
|
|
latestMusicSheetManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
|
|
mLatestAdapter = new HomeHotMusicSheetAdapter();
|
|
|
+ LinearSnapHelper linearSnapHelper =new LinearSnapHelper();
|
|
|
+ linearSnapHelper.attachToRecyclerView(mViewBinding.rvLatestTrack);
|
|
|
HomeHotMusicSheetItemDecoration itemDecoration2 = new HomeHotMusicSheetItemDecoration(0, SizeUtils.dp2px(12), 0, SizeUtils.dp2px(12), 0);
|
|
|
mViewBinding.rvLatestTrack.addItemDecoration(itemDecoration2);
|
|
|
mViewBinding.rvLatestTrack.setLayoutManager(latestMusicSheetManager);
|
|
@@ -187,6 +193,8 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
LinearLayoutManager musicSheetManager = new LinearLayoutManager(getContext());
|
|
|
musicSheetManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
|
|
mHomeHotMusicSheetAdapter = new HomeHotMusicSheetAdapter();
|
|
|
+ LinearSnapHelper hotTracklinearSnapHelper =new LinearSnapHelper();
|
|
|
+ hotTracklinearSnapHelper.attachToRecyclerView(mViewBinding.rvHotTrack);
|
|
|
HomeHotMusicSheetItemDecoration itemDecoration = new HomeHotMusicSheetItemDecoration(0, 0, 0, SizeUtils.dp2px(12), 0);
|
|
|
mViewBinding.rvHotTrack.addItemDecoration(itemDecoration);
|
|
|
mViewBinding.rvHotTrack.setLayoutManager(musicSheetManager);
|