mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 09:53:33 +00:00
Added For You top bar
This commit is contained in:
parent
81581c623d
commit
fdc104f70b
6 changed files with 89 additions and 5 deletions
|
|
@ -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);
|
||||
|
|
|
|||
14
app/src/main/java/com/cappielloantonio/play/util/Util.java
Normal file
14
app/src/main/java/com/cappielloantonio/play/util/Util.java
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package com.cappielloantonio.play.util;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class Util {
|
||||
public static String getDate() {
|
||||
String pattern = "EEEE, MMMM d";
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
|
||||
String date = simpleDateFormat.format(new Date());
|
||||
|
||||
return date;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue