Removed swipe2refresh action from home

This commit is contained in:
CappielloAntonio 2021-04-14 14:55:28 +02:00
parent 0c401fce95
commit 3286215462
4 changed files with 321 additions and 303 deletions

View file

@ -51,7 +51,6 @@ public class HomeFragment extends Fragment {
homeViewModel = new ViewModelProvider(requireActivity()).get(HomeViewModel.class); homeViewModel = new ViewModelProvider(requireActivity()).get(HomeViewModel.class);
init(); init();
initSwipeToRefresh();
initDiscoverSongSlideView(); initDiscoverSongSlideView();
initRecentAddedSongView(); initRecentAddedSongView();
initFavoritesSongView(); initFavoritesSongView();
@ -99,10 +98,10 @@ public class HomeFragment extends Fragment {
bundle.putString(Song.IS_FAVORITE, Song.IS_FAVORITE); bundle.putString(Song.IS_FAVORITE, Song.IS_FAVORITE);
activity.navController.navigate(R.id.action_homeFragment_to_songListPageFragment, bundle); activity.navController.navigate(R.id.action_homeFragment_to_songListPageFragment, bundle);
}); });
}
private void initSwipeToRefresh() { bind.syncMusicButton.setOnClickListener(new View.OnClickListener() {
bind.pullToRefreshLayout.setOnRefreshListener(() -> { @Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext()); AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
builder.setMessage("Force reload your entire music library") builder.setMessage("Force reload your entire music library")
.setTitle("Force sync") .setTitle("Force sync")
@ -113,8 +112,7 @@ public class HomeFragment extends Fragment {
activity.goToSync(); activity.goToSync();
}) })
.show(); .show();
}
bind.pullToRefreshLayout.setRefreshing(false);
}); });
} }

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/titleTextColor"
android:pathData="M18.32,4.26C16.84,3.05 15.01,2.25 13,2.05v2.02c1.46,0.18 2.79,0.76 3.9,1.62L18.32,4.26zM19.93,11h2.02c-0.2,-2.01 -1,-3.84 -2.21,-5.32L18.31,7.1C19.17,8.21 19.75,9.54 19.93,11zM18.31,16.9l1.43,1.43c1.21,-1.48 2.01,-3.32 2.21,-5.32h-2.02C19.75,14.46 19.17,15.79 18.31,16.9zM13,19.93v2.02c2.01,-0.2 3.84,-1 5.32,-2.21l-1.43,-1.43C15.79,19.17 14.46,19.75 13,19.93zM15.59,10.59L13,13.17V7h-2v6.17l-2.59,-2.59L7,12l5,5l5,-5L15.59,10.59zM11,19.93v2.02c-5.05,-0.5 -9,-4.76 -9,-9.95s3.95,-9.45 9,-9.95v2.02C7.05,4.56 4,7.92 4,12S7.05,19.44 11,19.93z"/>
</vector>

View file

@ -1,12 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/pull_to_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior"> app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior">
@ -298,7 +293,21 @@
android:paddingEnd="8dp" android:paddingEnd="8dp"
android:paddingBottom="8dp" /> android:paddingBottom="8dp" />
</LinearLayout> </LinearLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/sync_music_button"
style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingTop="8dp"
android:paddingEnd="8dp"
android:layout_gravity="center"
android:textColor="@color/titleTextColor"
android:textAllCaps="false"
app:iconTint="@color/titleTextColor"
android:text="@string/action_sync_music"
app:icon="@drawable/ic_downloading" />
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View file

@ -47,6 +47,8 @@
<string name="action_remove_from_queue">Remove from queue</string> <string name="action_remove_from_queue">Remove from queue</string>
<string name="action_add_to_playlist">Add to playlist</string> <string name="action_add_to_playlist">Add to playlist</string>
<string name="action_sync_music">Sync music</string>
<string name="playing_notification_description">The playing notification provides actions for play/pause etc.</string> <string name="playing_notification_description">The playing notification provides actions for play/pause etc.</string>
<string name="playing_notification_name">Playing Notification</string> <string name="playing_notification_name">Playing Notification</string>
</resources> </resources>