Added For You top bar

This commit is contained in:
CappielloAntonio 2021-04-27 13:59:27 +02:00
parent 81581c623d
commit fdc104f70b
6 changed files with 89 additions and 5 deletions

View file

@ -23,6 +23,7 @@ import com.cappielloantonio.play.adapter.YearAdapter;
import com.cappielloantonio.play.databinding.FragmentHomeBinding;
import com.cappielloantonio.play.model.Song;
import com.cappielloantonio.play.ui.activity.MainActivity;
import com.cappielloantonio.play.util.Util;
import com.cappielloantonio.play.viewmodel.HomeViewModel;
public class HomeFragment extends Fragment {
@ -50,6 +51,7 @@ public class HomeFragment extends Fragment {
homeViewModel = new ViewModelProvider(requireActivity()).get(HomeViewModel.class);
init();
initForYouBar();
return view;
}
@ -112,6 +114,12 @@ public class HomeFragment extends Fragment {
});
}
private void initForYouBar() {
bind.homeDateLabel.setText(Util.getDate());
bind.homeSettingsImageView.setOnClickListener(v -> activity.navController.navigate(R.id.action_homeFragment_to_settingsFragment));
}
private void initDiscoverSongSlideView() {
bind.discoverSongViewPager.setOrientation(ViewPager2.ORIENTATION_HORIZONTAL);
@ -221,6 +229,7 @@ public class HomeFragment extends Fragment {
public void reorder() {
if(bind != null) {
bind.homeLinearLayoutContainer.removeAllViews();
bind.homeLinearLayoutContainer.addView(bind.forYouSector);
bind.homeLinearLayoutContainer.addView(bind.homeDiscoverSector);
bind.homeLinearLayoutContainer.addView(bind.homeRecentlyAddedTracksSector);
bind.homeLinearLayoutContainer.addView(bind.homeFlashbackSector);