mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 09:53:33 +00:00
Graphic restyling of the interface
This commit is contained in:
parent
f6e01b8cd7
commit
1ffe52b8a0
27 changed files with 352 additions and 421 deletions
|
|
@ -1,83 +0,0 @@
|
|||
package com.cappielloantonio.play.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.model.RecentSearch;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RecentSearchAdapter extends RecyclerView.Adapter<RecentSearchAdapter.ViewHolder> {
|
||||
private static final String TAG = "RecentSearchAdapter";
|
||||
|
||||
private List<RecentSearch> searches;
|
||||
private LayoutInflater mInflater;
|
||||
private Context context;
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public RecentSearchAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.searches = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = mInflater.inflate(R.layout.item_search_recent_searches, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
RecentSearch search = searches.get(position);
|
||||
|
||||
holder.recentSearch.setText(search.getSearch());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return searches.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
TextView recentSearch;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
recentSearch = itemView.findViewById(R.id.recent_search_text_view);
|
||||
|
||||
itemView.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (itemClickListener != null)
|
||||
itemClickListener.onItemClick(view, getBindingAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
||||
public void setItems(List<RecentSearch> searches) {
|
||||
this.searches = searches;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public RecentSearch getItem(int id) {
|
||||
return searches.get(id);
|
||||
}
|
||||
|
||||
public void setClickListener(ItemClickListener itemClickListener) {
|
||||
this.itemClickListener = itemClickListener;
|
||||
}
|
||||
|
||||
public interface ItemClickListener {
|
||||
void onItemClick(View view, int position);
|
||||
}
|
||||
}
|
||||
|
|
@ -75,6 +75,7 @@ public class SongResultSearchAdapter extends RecyclerView.Adapter<SongResultSear
|
|||
TextView songTitle;
|
||||
TextView songArtist;
|
||||
TextView songDuration;
|
||||
ImageView more;
|
||||
ImageView cover;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
|
|
@ -83,11 +84,16 @@ public class SongResultSearchAdapter extends RecyclerView.Adapter<SongResultSear
|
|||
songTitle = itemView.findViewById(R.id.search_result_song_title_text_view);
|
||||
songArtist = itemView.findViewById(R.id.search_result_song_artist_text_view);
|
||||
songDuration = itemView.findViewById(R.id.search_result_song_duration_text_view);
|
||||
more = itemView.findViewById(R.id.search_result_song_more_button);
|
||||
cover = itemView.findViewById(R.id.song_cover_image_view);
|
||||
|
||||
itemView.setOnClickListener(this);
|
||||
itemView.setOnLongClickListener(this);
|
||||
|
||||
more.setOnClickListener(v -> {
|
||||
openMore(v);
|
||||
});
|
||||
|
||||
songTitle.setSelected(true);
|
||||
}
|
||||
|
||||
|
|
@ -104,11 +110,16 @@ public class SongResultSearchAdapter extends RecyclerView.Adapter<SongResultSear
|
|||
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("song_object", songs.get(getBindingAdapterPosition()));
|
||||
Navigation.findNavController(v).navigate(R.id.songBottomSheetDialog, bundle);
|
||||
openMore(v);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void openMore(View view) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("song_object", songs.get(getBindingAdapterPosition()));
|
||||
Navigation.findNavController(view).navigate(R.id.songBottomSheetDialog, bundle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setItems(List<Song> songs) {
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class AlbumPageFragment extends Fragment {
|
|||
|
||||
bind.albumNameLabel.setText(albumPageViewModel.getAlbum().getTitle());
|
||||
bind.albumArtistLabel.setText(albumPageViewModel.getAlbum().getArtistName());
|
||||
bind.albumReleaseYearLabel.setText(String.valueOf(albumPageViewModel.getAlbum().getYear()));
|
||||
bind.albumReleaseYearLabel.setText(albumPageViewModel.getAlbum().getYear() != 0 ? String.valueOf(albumPageViewModel.getAlbum().getYear()) : "");
|
||||
|
||||
albumPageViewModel.getAlbumSongList().observe(requireActivity(), songs -> {
|
||||
if(bind != null) {
|
||||
|
|
|
|||
|
|
@ -16,15 +16,11 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||
|
||||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.adapter.AlbumAdapter;
|
||||
import com.cappielloantonio.play.adapter.AlbumCatalogueAdapter;
|
||||
import com.cappielloantonio.play.adapter.ArtistAdapter;
|
||||
import com.cappielloantonio.play.adapter.ArtistCatalogueAdapter;
|
||||
import com.cappielloantonio.play.adapter.GenreCatalogueAdapter;
|
||||
import com.cappielloantonio.play.adapter.RecentSearchAdapter;
|
||||
import com.cappielloantonio.play.adapter.SongResultSearchAdapter;
|
||||
import com.cappielloantonio.play.databinding.FragmentSearchBinding;
|
||||
import com.cappielloantonio.play.helper.recyclerview.GridItemDecoration;
|
||||
import com.cappielloantonio.play.model.RecentSearch;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.ui.activities.MainActivity;
|
||||
import com.cappielloantonio.play.util.PreferenceUtil;
|
||||
|
|
@ -33,8 +29,6 @@ import com.paulrybitskyi.persistentsearchview.adapters.model.SuggestionItem;
|
|||
import com.paulrybitskyi.persistentsearchview.listeners.OnSuggestionChangeListener;
|
||||
import com.paulrybitskyi.persistentsearchview.utils.SuggestionCreationUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SearchFragment extends Fragment {
|
||||
private static final String TAG = "SearchFragment";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue