code clean

This commit is contained in:
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,52 +16,70 @@ 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 {
@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);
@ -99,7 +117,8 @@ public class MediaEntryViewHolder extends AbstractDraggableSwipeableItemViewHold
}
@Override
public void onClick(View v) {}
public void onClick(View v) {
}
@Override
public boolean onLongClick(View v) {

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,8 +159,7 @@ class RealRoomRepository(
)
override suspend fun favoritePlaylistSongs(favorite: String): List<SongEntity> =
if (playlistDao.isPlaylistExists(favorite).isNotEmpty())
playlistDao.favoritesSongs(
if (playlistDao.isPlaylistExists(favorite).isNotEmpty()) playlistDao.favoritesSongs(
playlistDao.isPlaylistExists(favorite).first().playListId
) else emptyList()
@ -192,11 +190,9 @@ class RealRoomRepository(
override suspend fun blackListPaths(): List<BlackListStoreEntity> =
blackListStoreDao.blackListPaths()
override suspend fun deleteSongs(songs: List<Song>) {
songs.forEach {
override suspend fun deleteSongs(songs: List<Song>) = songs.forEach {
playCountDao.deleteSong(it.id)
}
}
override suspend fun deleteBlacklistPath(blackListStoreEntity: BlackListStoreEntity) =
blackListStoreDao.deleteBlacklistPath(blackListStoreEntity)