mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 01:53:31 +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.databinding.FragmentHomeBinding;
|
||||||
import com.cappielloantonio.play.model.Song;
|
import com.cappielloantonio.play.model.Song;
|
||||||
import com.cappielloantonio.play.ui.activity.MainActivity;
|
import com.cappielloantonio.play.ui.activity.MainActivity;
|
||||||
|
import com.cappielloantonio.play.util.Util;
|
||||||
import com.cappielloantonio.play.viewmodel.HomeViewModel;
|
import com.cappielloantonio.play.viewmodel.HomeViewModel;
|
||||||
|
|
||||||
public class HomeFragment extends Fragment {
|
public class HomeFragment extends Fragment {
|
||||||
|
|
@ -50,6 +51,7 @@ public class HomeFragment extends Fragment {
|
||||||
homeViewModel = new ViewModelProvider(requireActivity()).get(HomeViewModel.class);
|
homeViewModel = new ViewModelProvider(requireActivity()).get(HomeViewModel.class);
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
initForYouBar();
|
||||||
|
|
||||||
return view;
|
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() {
|
private void initDiscoverSongSlideView() {
|
||||||
bind.discoverSongViewPager.setOrientation(ViewPager2.ORIENTATION_HORIZONTAL);
|
bind.discoverSongViewPager.setOrientation(ViewPager2.ORIENTATION_HORIZONTAL);
|
||||||
|
|
||||||
|
|
@ -221,6 +229,7 @@ public class HomeFragment extends Fragment {
|
||||||
public void reorder() {
|
public void reorder() {
|
||||||
if(bind != null) {
|
if(bind != null) {
|
||||||
bind.homeLinearLayoutContainer.removeAllViews();
|
bind.homeLinearLayoutContainer.removeAllViews();
|
||||||
|
bind.homeLinearLayoutContainer.addView(bind.forYouSector);
|
||||||
bind.homeLinearLayoutContainer.addView(bind.homeDiscoverSector);
|
bind.homeLinearLayoutContainer.addView(bind.homeDiscoverSector);
|
||||||
bind.homeLinearLayoutContainer.addView(bind.homeRecentlyAddedTracksSector);
|
bind.homeLinearLayoutContainer.addView(bind.homeRecentlyAddedTracksSector);
|
||||||
bind.homeLinearLayoutContainer.addView(bind.homeFlashbackSector);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -12,6 +12,62 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="@dimen/global_padding_bottom">
|
android:paddingBottom="@dimen/global_padding_bottom">
|
||||||
|
|
||||||
|
<!-- For you -->
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/for_you_sector"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clipChildren="false">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/home_date_label"
|
||||||
|
style="@style/SubheadTextView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:text="@string/label_placeholder"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/home_for_you_label"
|
||||||
|
style="@style/MainTitleTextView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:text="For You"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/home_date_label"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/home_settings_image_view"
|
||||||
|
android:layout_width="22dp"
|
||||||
|
android:layout_height="22dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:foreground="?android:attr/selectableItemBackgroundBorderless"
|
||||||
|
android:background="@drawable/ic_settings"
|
||||||
|
android:backgroundTint="@color/bottomNavIconColor"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/home_for_you_label"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/home_top_title_divider"
|
||||||
|
style="@style/Divider"
|
||||||
|
android:layout_marginStart="18dp"
|
||||||
|
android:layout_marginEnd="18dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/home_for_you_label" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<!-- Discover music -->
|
<!-- Discover music -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/home_discover_sector"
|
android:id="@+id/home_discover_sector"
|
||||||
|
|
@ -24,7 +80,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="16dp"
|
android:paddingStart="16dp"
|
||||||
android:paddingTop="20dp"
|
android:paddingTop="24dp"
|
||||||
android:paddingEnd="16dp"
|
android:paddingEnd="16dp"
|
||||||
android:text="Music discovery" />
|
android:text="Music discovery" />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,4 @@
|
||||||
android:id="@+id/searchFragment"
|
android:id="@+id/searchFragment"
|
||||||
android:icon="@drawable/ic_search"
|
android:icon="@drawable/ic_search"
|
||||||
android:title="@string/search_menu_label" />
|
android:title="@string/search_menu_label" />
|
||||||
<item
|
|
||||||
android:id="@+id/settingsFragment"
|
|
||||||
android:icon="@drawable/ic_settings"
|
|
||||||
android:title="@string/settings_menu_label" />
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|
@ -74,6 +74,9 @@
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_homeFragment_to_songListPageFragment"
|
android:id="@+id/action_homeFragment_to_songListPageFragment"
|
||||||
app:destination="@id/songListPageFragment" />
|
app:destination="@id/songListPageFragment" />
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_homeFragment_to_settingsFragment"
|
||||||
|
app:destination="@id/settingsFragment" />
|
||||||
</fragment>
|
</fragment>
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/libraryFragment"
|
android:id="@+id/libraryFragment"
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,12 @@
|
||||||
<item name="android:fontFamily">@font/inter</item>
|
<item name="android:fontFamily">@font/inter</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="MainTitleTextView" parent="InterFontFamily">
|
||||||
|
<item name="android:textSize">30sp</item>
|
||||||
|
<item name="android:textFontWeight">900</item>
|
||||||
|
<item name="android:textColor">@color/titleTextColor</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<!-- Font di tutti i titoli grossi.
|
<!-- Font di tutti i titoli grossi.
|
||||||
Questi comprendono i titoli nelle schermate principali, nel bottom_sheet_player
|
Questi comprendono i titoli nelle schermate principali, nel bottom_sheet_player
|
||||||
il titolo della canzone e la stringa in alto -->
|
il titolo della canzone e la stringa in alto -->
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue