code clean

main
Hemanth S 2020-12-05 11:33:31 +05:30
parent c5a4b4b4c6
commit 6845f75ea0
3 changed files with 84 additions and 83 deletions

View File

@ -16,103 +16,122 @@ package code.name.monkey.retromusic.adapter.base;
import android.graphics.Color;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.recyclerview.widget.RecyclerView;
import code.name.monkey.retromusic.R;
import com.google.android.material.card.MaterialCardView;
import com.h6ah4i.android.widget.advrecyclerview.utils.AbstractDraggableSwipeableItemViewHolder;
public class MediaEntryViewHolder extends AbstractDraggableSwipeableItemViewHolder
implements View.OnLongClickListener, View.OnClickListener {
implements View.OnLongClickListener, View.OnClickListener {
@Nullable public View dragView;
@Nullable
public View dragView;
@Nullable public View dummyContainer;
@Nullable
public View dummyContainer;
@Nullable public ImageView image;
@Nullable
public ImageView image;
@Nullable public ImageView artistImage;
@Nullable
public ImageView artistImage;
@Nullable public ImageView playerImage;
@Nullable
public ImageView playerImage;
@Nullable public MaterialCardView imageContainerCard;
@Nullable
public MaterialCardView imageContainerCard;
@Nullable public TextView imageText;
@Nullable
public TextView imageText;
@Nullable public MaterialCardView imageTextContainer;
@Nullable
public MaterialCardView imageTextContainer;
@Nullable public View mask;
@Nullable
public View mask;
@Nullable public AppCompatImageView menu;
@Nullable
public AppCompatImageView menu;
@Nullable public View paletteColorContainer;
@Nullable
public View paletteColorContainer;
@Nullable public RecyclerView recyclerView;
@Nullable
public RecyclerView recyclerView;
@Nullable public TextView text;
@Nullable
public TextView text;
@Nullable public TextView text2;
@Nullable
public TextView text2;
@Nullable public TextView time;
@Nullable
public TextView time;
@Nullable public TextView title;
@Nullable
public TextView title;
public MediaEntryViewHolder(@NonNull View itemView) {
super(itemView);
title = itemView.findViewById(R.id.title);
text = itemView.findViewById(R.id.text);
text2 = itemView.findViewById(R.id.text2);
public MediaEntryViewHolder(@NonNull View itemView) {
super(itemView);
title = itemView.findViewById(R.id.title);
text = itemView.findViewById(R.id.text);
text2 = itemView.findViewById(R.id.text2);
image = itemView.findViewById(R.id.image);
artistImage = itemView.findViewById(R.id.artistImage);
playerImage = itemView.findViewById(R.id.player_image);
time = itemView.findViewById(R.id.time);
image = itemView.findViewById(R.id.image);
artistImage = itemView.findViewById(R.id.artistImage);
playerImage = itemView.findViewById(R.id.player_image);
time = itemView.findViewById(R.id.time);
imageText = itemView.findViewById(R.id.imageText);
imageTextContainer = itemView.findViewById(R.id.imageTextContainer);
imageContainerCard = itemView.findViewById(R.id.imageContainerCard);
imageText = itemView.findViewById(R.id.imageText);
imageTextContainer = itemView.findViewById(R.id.imageTextContainer);
imageContainerCard = itemView.findViewById(R.id.imageContainerCard);
menu = itemView.findViewById(R.id.menu);
dragView = itemView.findViewById(R.id.drag_view);
paletteColorContainer = itemView.findViewById(R.id.paletteColorContainer);
recyclerView = itemView.findViewById(R.id.recycler_view);
mask = itemView.findViewById(R.id.mask);
dummyContainer = itemView.findViewById(R.id.dummy_view);
menu = itemView.findViewById(R.id.menu);
dragView = itemView.findViewById(R.id.drag_view);
paletteColorContainer = itemView.findViewById(R.id.paletteColorContainer);
recyclerView = itemView.findViewById(R.id.recycler_view);
mask = itemView.findViewById(R.id.mask);
dummyContainer = itemView.findViewById(R.id.dummy_view);
if (imageContainerCard != null) {
imageContainerCard.setCardBackgroundColor(Color.TRANSPARENT);
if (imageContainerCard != null) {
imageContainerCard.setCardBackgroundColor(Color.TRANSPARENT);
}
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
}
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
}
@Nullable
@Override
public View getSwipeableContainerView() {
return null;
}
@Nullable
@Override
public View getSwipeableContainerView() {
return null;
}
@Override
public void onClick(View v) {}
@Override
public void onClick(View v) {
}
@Override
public boolean onLongClick(View v) {
return false;
}
@Override
public boolean onLongClick(View v) {
return false;
}
public void setImageTransitionName(@NonNull String transitionName) {
itemView.setTransitionName(transitionName);
public void setImageTransitionName(@NonNull String transitionName) {
itemView.setTransitionName(transitionName);
/* if (imageContainerCard != null) {
imageContainerCard.setTransitionName(transitionName);
}
if (image != null) {
image.setTransitionName(transitionName);
}*/
}
}
}

View File

@ -95,13 +95,7 @@ fun SeekBar.addAccentColor() {
thumbTintList = colorState
}
fun Button.accentTextColor() {
setTextColor(ThemeStore.accentColor(App.getContext()))
}
fun MaterialButton.accentTextColor() {
setTextColor(ThemeStore.accentColor(App.getContext()))
}
fun Button.accentTextColor() = setTextColor(ThemeStore.accentColor(App.getContext()))
fun MaterialButton.accentBackgroundColor() {
backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(App.getContext()))
@ -154,9 +148,7 @@ fun MaterialButton.applyColor(color: Int) {
iconTint = textColorColorStateList
}
fun MaterialButton.accentColor() {
this.applyColor(ThemeStore.accentColor(context))
}
fun MaterialButton.accentColor() = applyColor(ThemeStore.accentColor(context))
fun MaterialButton.applyOutlineColor(color: Int) {
val textColorColorStateList = ColorStateList.valueOf(color)
@ -183,12 +175,7 @@ fun CircularProgressIndicator.applyColor(color: Int) {
trackColor = ColorUtil.withAlpha(color, 0.2f)
}
fun TextInputEditText.accentColor() {
}
fun AppCompatImageView.accentColor(): Int {
return ThemeStore.accentColor(context)
}
fun AppCompatImageView.accentColor(): Int = ThemeStore.accentColor(context)
@CheckResult
fun Drawable.tint(@ColorInt color: Int): Drawable {
@ -198,9 +185,8 @@ fun Drawable.tint(@ColorInt color: Int): Drawable {
}
@CheckResult
fun Drawable.tint(context: Context, @ColorRes color: Int): Drawable {
return tint(context.getColorCompat(color))
}
fun Drawable.tint(context: Context, @ColorRes color: Int): Drawable =
tint(context.getColorCompat(color))
@ColorInt
fun Context.getColorCompat(@ColorRes colorRes: Int): Int {

View File

@ -100,7 +100,6 @@ class RealRoomRepository(
playlistDao.insertSongsToPlaylist(songs)
}
override fun getSongs(playListId: Long): LiveData<List<SongEntity>> =
playlistDao.songsFromPlaylist(playListId)
@ -160,10 +159,9 @@ class RealRoomRepository(
)
override suspend fun favoritePlaylistSongs(favorite: String): List<SongEntity> =
if (playlistDao.isPlaylistExists(favorite).isNotEmpty())
playlistDao.favoritesSongs(
playlistDao.isPlaylistExists(favorite).first().playListId
) else emptyList()
if (playlistDao.isPlaylistExists(favorite).isNotEmpty()) playlistDao.favoritesSongs(
playlistDao.isPlaylistExists(favorite).first().playListId
) else emptyList()
override suspend fun insertSongInPlayCount(playCountEntity: PlayCountEntity) =
playCountDao.insertSongInPlayCount(playCountEntity)
@ -192,10 +190,8 @@ class RealRoomRepository(
override suspend fun blackListPaths(): List<BlackListStoreEntity> =
blackListStoreDao.blackListPaths()
override suspend fun deleteSongs(songs: List<Song>) {
songs.forEach {
playCountDao.deleteSong(it.id)
}
override suspend fun deleteSongs(songs: List<Song>) = songs.forEach {
playCountDao.deleteSong(it.id)
}
override suspend fun deleteBlacklistPath(blackListStoreEntity: BlackListStoreEntity) =