mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
fix: modified the behavior of long clicks on folders, directories and files
This commit is contained in:
parent
86713eb0fd
commit
675ad1e9a6
11 changed files with 22 additions and 66 deletions
|
|
@ -42,13 +42,7 @@ public interface ClickCallback {
|
||||||
|
|
||||||
default void onMusicFolderClick(Bundle bundle) {}
|
default void onMusicFolderClick(Bundle bundle) {}
|
||||||
|
|
||||||
default void onMusicFolderLongClick(Bundle bundle) {}
|
|
||||||
|
|
||||||
default void onMusicDirectoryClick(Bundle bundle) {}
|
default void onMusicDirectoryClick(Bundle bundle) {}
|
||||||
|
|
||||||
default void onMusicDirectoryLongClick(Bundle bundle) {}
|
|
||||||
|
|
||||||
default void onMusicIndexClick(Bundle bundle) {}
|
default void onMusicIndexClick(Bundle bundle) {}
|
||||||
|
|
||||||
default void onMusicIndexLongClick(Bundle bundle) {}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,9 +69,7 @@ public class MusicDirectoryAdapter extends RecyclerView.Adapter<MusicDirectoryAd
|
||||||
item.musicDirectoryTitleTextView.setSelected(true);
|
item.musicDirectoryTitleTextView.setSelected(true);
|
||||||
|
|
||||||
itemView.setOnClickListener(v -> onClick());
|
itemView.setOnClickListener(v -> onClick());
|
||||||
itemView.setOnLongClickListener(v -> onLongClick());
|
item.musicDirectoryMoreButton.setOnClickListener(v -> onClick());
|
||||||
|
|
||||||
item.musicDirectoryMoreButton.setOnClickListener(v -> onLongClick());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
|
|
@ -86,14 +84,5 @@ public class MusicDirectoryAdapter extends RecyclerView.Adapter<MusicDirectoryAd
|
||||||
click.onMediaClick(bundle);
|
click.onMediaClick(bundle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean onLongClick() {
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
bundle.putParcelable(Constants.MUSIC_DIRECTORY_OBJECT, children.get(getBindingAdapterPosition()));
|
|
||||||
|
|
||||||
click.onMusicDirectoryLongClick(bundle);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,9 +72,8 @@ public class MusicFolderAdapter extends RecyclerView.Adapter<MusicFolderAdapter.
|
||||||
item.musicFolderTitleTextView.setSelected(true);
|
item.musicFolderTitleTextView.setSelected(true);
|
||||||
|
|
||||||
itemView.setOnClickListener(v -> onClick());
|
itemView.setOnClickListener(v -> onClick());
|
||||||
itemView.setOnLongClickListener(v -> onLongClick());
|
|
||||||
|
|
||||||
item.musicFolderMoreButton.setOnClickListener(v -> onLongClick());
|
item.musicFolderMoreButton.setOnClickListener(v -> onClick());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
|
|
@ -82,14 +81,5 @@ public class MusicFolderAdapter extends RecyclerView.Adapter<MusicFolderAdapter.
|
||||||
bundle.putParcelable(Constants.MUSIC_FOLDER_OBJECT, musicFolders.get(getBindingAdapterPosition()));
|
bundle.putParcelable(Constants.MUSIC_FOLDER_OBJECT, musicFolders.get(getBindingAdapterPosition()));
|
||||||
click.onMusicFolderClick(bundle);
|
click.onMusicFolderClick(bundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean onLongClick() {
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
bundle.putParcelable(Constants.MUSIC_FOLDER_OBJECT, musicFolders.get(getBindingAdapterPosition()));
|
|
||||||
|
|
||||||
click.onMusicFolderLongClick(bundle);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,7 @@ public class MusicIndexAdapter extends RecyclerView.Adapter<MusicIndexAdapter.Vi
|
||||||
item.musicIndexTitleTextView.setSelected(true);
|
item.musicIndexTitleTextView.setSelected(true);
|
||||||
|
|
||||||
itemView.setOnClickListener(v -> onClick());
|
itemView.setOnClickListener(v -> onClick());
|
||||||
itemView.setOnLongClickListener(v -> onLongClick());
|
item.musicIndexMoreButton.setOnClickListener(v -> onClick());
|
||||||
|
|
||||||
item.musicIndexMoreButton.setOnClickListener(v -> onLongClick());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
|
|
@ -78,14 +76,5 @@ public class MusicIndexAdapter extends RecyclerView.Adapter<MusicIndexAdapter.Vi
|
||||||
bundle.putParcelable(Constants.MUSIC_INDEX_OBJECT, artists.get(getBindingAdapterPosition()));
|
bundle.putParcelable(Constants.MUSIC_INDEX_OBJECT, artists.get(getBindingAdapterPosition()));
|
||||||
click.onMusicIndexClick(bundle);
|
click.onMusicIndexClick(bundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean onLongClick() {
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
bundle.putParcelable(Constants.MUSIC_INDEX_OBJECT, artists.get(getBindingAdapterPosition()));
|
|
||||||
|
|
||||||
click.onMusicIndexLongClick(bundle);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -170,9 +170,4 @@ public class DirectoryFragment extends Fragment implements ClickCallback {
|
||||||
directoryViewModel.setMusicDirectoryName(child.getTitle());
|
directoryViewModel.setMusicDirectoryName(child.getTitle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMusicDirectoryLongClick(Bundle bundle) {
|
|
||||||
Toast.makeText(requireContext(), "Long click!", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -103,9 +103,4 @@ public class IndexFragment extends Fragment implements ClickCallback {
|
||||||
public void onMusicIndexClick(Bundle bundle) {
|
public void onMusicIndexClick(Bundle bundle) {
|
||||||
Navigation.findNavController(requireView()).navigate(R.id.directoryFragment, bundle);
|
Navigation.findNavController(requireView()).navigate(R.id.directoryFragment, bundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMusicIndexLongClick(Bundle bundle) {
|
|
||||||
Toast.makeText(requireContext(), "Long click!", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -307,9 +307,4 @@ public class LibraryFragment extends Fragment implements ClickCallback {
|
||||||
public void onMusicFolderClick(Bundle bundle) {
|
public void onMusicFolderClick(Bundle bundle) {
|
||||||
Navigation.findNavController(requireView()).navigate(R.id.indexFragment, bundle);
|
Navigation.findNavController(requireView()).navigate(R.id.indexFragment, bundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMusicFolderLongClick(Bundle bundle) {
|
|
||||||
Toast.makeText(requireContext(), "Long click!", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
app/src/main/res/drawable/ic_navigate_next.xml
Normal file
10
app/src/main/res/drawable/ic_navigate_next.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960"
|
||||||
|
android:autoMirrored="true">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/titleTextColor"
|
||||||
|
android:pathData="M376,720L320,664L504,480L320,296L376,240L616,480L376,720Z"/>
|
||||||
|
</vector>
|
||||||
|
|
@ -44,11 +44,11 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/music_directory_more_button"
|
android:id="@+id/music_directory_more_button"
|
||||||
android:layout_width="18dp"
|
android:layout_width="22dp"
|
||||||
android:layout_height="18dp"
|
android:layout_height="22dp"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:background="@drawable/ic_more_vert"
|
android:background="@drawable/ic_navigate_next"
|
||||||
android:foreground="?android:attr/selectableItemBackgroundBorderless"
|
android:foreground="?android:attr/selectableItemBackgroundBorderless"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/music_directory_title_text_view"
|
app:layout_constraintBottom_toBottomOf="@id/music_directory_title_text_view"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
|
@ -40,11 +39,11 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/music_folder_more_button"
|
android:id="@+id/music_folder_more_button"
|
||||||
android:layout_width="18dp"
|
android:layout_width="22dp"
|
||||||
android:layout_height="18dp"
|
android:layout_height="22dp"
|
||||||
android:layout_marginStart="4dp"
|
android:layout_marginStart="4dp"
|
||||||
android:layout_marginEnd="4dp"
|
android:layout_marginEnd="4dp"
|
||||||
android:background="@drawable/ic_more_vert"
|
android:background="@drawable/ic_navigate_next"
|
||||||
android:foreground="?android:attr/selectableItemBackgroundBorderless"
|
android:foreground="?android:attr/selectableItemBackgroundBorderless"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/music_folder_title_text_view"
|
app:layout_constraintBottom_toBottomOf="@id/music_folder_title_text_view"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,11 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/music_index_more_button"
|
android:id="@+id/music_index_more_button"
|
||||||
android:layout_width="18dp"
|
android:layout_width="22dp"
|
||||||
android:layout_height="18dp"
|
android:layout_height="22dp"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:background="@drawable/ic_more_vert"
|
android:background="@drawable/ic_navigate_next"
|
||||||
android:foreground="?android:attr/selectableItemBackgroundBorderless"
|
android:foreground="?android:attr/selectableItemBackgroundBorderless"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/music_index_title_text_view"
|
app:layout_constraintBottom_toBottomOf="@id/music_index_title_text_view"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue