Fixed a lot of possible issues raised by a code inspection

This commit is contained in:
CappielloAntonio 2021-09-04 16:14:10 +02:00
parent 39ff821aee
commit 042bf3077f
76 changed files with 148 additions and 225 deletions

View file

@ -2,9 +2,7 @@ package com.cappielloantonio.play.adapter;
import android.content.Context;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.RoundedCorner;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

View file

@ -2,7 +2,6 @@ package com.cappielloantonio.play.adapter;
import android.content.Context;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

View file

@ -2,7 +2,6 @@ package com.cappielloantonio.play.adapter;
import android.content.Context;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

View file

@ -2,7 +2,6 @@ package com.cappielloantonio.play.adapter;
import android.content.Context;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

View file

@ -2,7 +2,6 @@ package com.cappielloantonio.play.adapter;
import android.content.Context;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

View file

@ -95,10 +95,7 @@ public class ArtistHorizontalAdapter extends RecyclerView.Adapter<ArtistHorizont
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
more.setOnClickListener(v -> {
openMore(v);
});
more.setOnClickListener(this::openMore);
artistName.setSelected(true);
}

View file

@ -2,7 +2,6 @@ package com.cappielloantonio.play.adapter;
import android.content.Context;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

View file

@ -1,7 +1,6 @@
package com.cappielloantonio.play.adapter;
import android.content.Context;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@ -13,7 +12,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.App;
import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest;

View file

@ -1,7 +1,6 @@
package com.cappielloantonio.play.adapter;
import android.content.Context;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

View file

@ -1,7 +1,6 @@
package com.cappielloantonio.play.adapter;
import android.content.Context;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

View file

@ -1,7 +1,6 @@
package com.cappielloantonio.play.adapter;
import android.content.Context;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

View file

@ -2,7 +2,6 @@ package com.cappielloantonio.play.adapter;
import android.content.Context;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -16,13 +15,10 @@ import androidx.annotation.NonNull;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.model.Playlist;
import com.cappielloantonio.play.model.Song;
import com.cappielloantonio.play.ui.activity.MainActivity;
import com.cappielloantonio.play.ui.fragment.dialog.PlaylistChooserDialog;
import com.cappielloantonio.play.ui.fragment.dialog.PlaylistEditorDialog;
import com.cappielloantonio.play.util.MusicUtil;

View file

@ -1,7 +1,6 @@
package com.cappielloantonio.play.adapter;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -9,20 +8,12 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentManager;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.App;
import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.model.Playlist;
import com.cappielloantonio.play.model.Song;
import com.cappielloantonio.play.repository.QueueRepository;
import com.cappielloantonio.play.service.MusicPlayerRemote;
import com.cappielloantonio.play.ui.activity.MainActivity;
import com.cappielloantonio.play.util.DownloadUtil;
import com.cappielloantonio.play.util.MusicUtil;
import java.util.ArrayList;
@ -32,8 +23,8 @@ public class PlaylistDialogSongHorizontalAdapter extends RecyclerView.Adapter<Pl
private static final String TAG = "PlaylistDialogSongHorizontalAdapter";
private List<Song> songs;
private LayoutInflater mInflater;
private Context context;
private final LayoutInflater mInflater;
private final Context context;
public PlaylistDialogSongHorizontalAdapter(Context context) {
this.context = context;
@ -81,7 +72,7 @@ public class PlaylistDialogSongHorizontalAdapter extends RecyclerView.Adapter<Pl
return songs.get(id);
}
public class ViewHolder extends RecyclerView.ViewHolder {
public static class ViewHolder extends RecyclerView.ViewHolder {
TextView songTitle;
TextView songArtist;
TextView songDuration;

View file

@ -9,15 +9,12 @@ import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentManager;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.RecyclerView;
import com.cappielloantonio.play.App;
import com.cappielloantonio.play.R;
import com.cappielloantonio.play.interfaces.SystemCallback;
import com.cappielloantonio.play.model.Server;
import com.cappielloantonio.play.model.Song;
import com.cappielloantonio.play.repository.SystemRepository;
import com.cappielloantonio.play.ui.activity.MainActivity;
import com.cappielloantonio.play.ui.fragment.dialog.ServerSignupDialog;
@ -25,7 +22,6 @@ import com.cappielloantonio.play.util.PreferenceUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class ServerAdapter extends RecyclerView.Adapter<ServerAdapter.ViewHolder> {
private static final String TAG = "ServerAdapter";

View file

@ -2,7 +2,6 @@ package com.cappielloantonio.play.adapter;
import android.content.Context;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -10,7 +9,6 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentManager;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.RecyclerView;
@ -68,15 +66,15 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
holder.downloadIndicator.setVisibility(View.GONE);
}
if(isCoverVisible) CustomGlideRequest.Builder
if (isCoverVisible) CustomGlideRequest.Builder
.from(context, song.getPrimary(), CustomGlideRequest.SONG_PIC, null)
.build()
.transform(new RoundedCorners(CustomGlideRequest.CORNER_RADIUS))
.into(holder.cover);
if(isCoverVisible) holder.trackNumber.setVisibility(View.INVISIBLE);
if (isCoverVisible) holder.trackNumber.setVisibility(View.INVISIBLE);
if(!isCoverVisible) holder.cover.setVisibility(View.INVISIBLE);
if (!isCoverVisible) holder.cover.setVisibility(View.INVISIBLE);
}
@Override