[Cleanup] Fixing Warnings
This commit is contained in:
parent
1fdd537253
commit
fa976b1cba
68 changed files with 242 additions and 498 deletions
|
@ -348,7 +348,7 @@ object MusicUtil : KoinComponent {
|
|||
val repository = get<Repository>()
|
||||
fun toggleFavorite(context: Context, song: Song) {
|
||||
GlobalScope.launch {
|
||||
val playlist: PlaylistEntity? = repository.favoritePlaylist()
|
||||
val playlist: PlaylistEntity = repository.favoritePlaylist()
|
||||
if (playlist != null) {
|
||||
val songEntity = song.toSongEntity(playlist.playListId)
|
||||
val isFavorite = repository.isFavoriteSong(songEntity).isNotEmpty()
|
||||
|
@ -529,7 +529,7 @@ object MusicUtil : KoinComponent {
|
|||
val pendingIntent = MediaStore.createDeleteRequest(activity.contentResolver, songs.map {
|
||||
getSongFileUri(it.id)
|
||||
})
|
||||
activity.startIntentSenderForResult(pendingIntent.intentSender, 45, null, 0, 0, 0, null);
|
||||
activity.startIntentSenderForResult(pendingIntent.intentSender, 45, null, 0, 0, 0, null)
|
||||
}
|
||||
|
||||
fun songByGenre(genreId: Long): Song {
|
||||
|
|
|
@ -20,12 +20,10 @@ import android.content.Intent
|
|||
import android.media.audiofx.AudioEffect
|
||||
import android.widget.Toast
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.navigation.findNavController
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.*
|
||||
import code.name.monkey.retromusic.activities.bugreport.BugReportActivity
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote.audioSessionId
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
|
||||
object NavigationUtil {
|
||||
fun bugReport(activity: Activity) {
|
||||
|
@ -40,21 +38,6 @@ object NavigationUtil {
|
|||
ActivityCompat.startActivity(activity, Intent(activity, LicenseActivity::class.java), null)
|
||||
}
|
||||
|
||||
fun goToLyrics(activity: Activity) {
|
||||
if (activity !is MainActivity) return
|
||||
activity.apply {
|
||||
//Hide Bottom Bar First, else Bottom Sheet doesn't collapse fully
|
||||
setBottomNavVisibility(false)
|
||||
if (getBottomSheetBehavior().state == BottomSheetBehavior.STATE_EXPANDED) {
|
||||
collapsePanel()
|
||||
}
|
||||
|
||||
findNavController(R.id.fragment_container).navigate(
|
||||
R.id.lyrics_fragment
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun goToProVersion(context: Context) {
|
||||
ActivityCompat.startActivity(context, Intent(context, PurchaseActivity::class.java), null)
|
||||
}
|
||||
|
|
|
@ -208,11 +208,11 @@ class PackageValidator(
|
|||
private fun getSignature(packageInfo: PackageInfo): String? {
|
||||
// Security best practices dictate that an app should be signed with exactly one (1)
|
||||
// signature. Because of this, if there are multiple signatures, reject it.
|
||||
if (packageInfo.signatures == null || packageInfo.signatures.size != 1) {
|
||||
return null
|
||||
return if (packageInfo.signatures == null || packageInfo.signatures.size != 1) {
|
||||
null
|
||||
} else {
|
||||
val certificate = packageInfo.signatures[0].toByteArray()
|
||||
return getSignatureSha256(certificate)
|
||||
getSignatureSha256(certificate)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ import java.util.List;
|
|||
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.db.PlaylistWithSongs;
|
||||
import code.name.monkey.retromusic.helper.M3UConstants;
|
||||
import code.name.monkey.retromusic.helper.M3UWriter;
|
||||
import code.name.monkey.retromusic.model.Playlist;
|
||||
import code.name.monkey.retromusic.model.PlaylistSong;
|
||||
|
|
|
@ -188,7 +188,7 @@ public class RetroColorUtil {
|
|||
|
||||
public static int getDominantColor(Bitmap bitmap, int defaultFooterColor) {
|
||||
List<Palette.Swatch> swatchesTemp = Palette.from(bitmap).generate().getSwatches();
|
||||
List<Palette.Swatch> swatches = new ArrayList<Palette.Swatch>(swatchesTemp);
|
||||
List<Palette.Swatch> swatches = new ArrayList<>(swatchesTemp);
|
||||
Collections.sort(
|
||||
swatches, (swatch1, swatch2) -> swatch2.getPopulation() - swatch1.getPopulation());
|
||||
return swatches.size() > 0 ? swatches.get(0).getRgb() : defaultFooterColor;
|
||||
|
|
|
@ -40,7 +40,7 @@ import androidx.annotation.ColorInt;
|
|||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
|
@ -127,14 +127,14 @@ public class RetroUtil {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
public static Drawable getTintedVectorDrawable(
|
||||
@NonNull Context context, @DrawableRes int id, @ColorInt int color) {
|
||||
return TintHelper.createTintedDrawable(
|
||||
getVectorDrawable(context.getResources(), id, context.getTheme()), color);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
public static Drawable getTintedVectorDrawable(
|
||||
@NonNull Resources res,
|
||||
@DrawableRes int resId,
|
||||
|
@ -146,10 +146,7 @@ public class RetroUtil {
|
|||
@Nullable
|
||||
public static Drawable getVectorDrawable(
|
||||
@NonNull Resources res, @DrawableRes int resId, @Nullable Resources.Theme theme) {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
return res.getDrawable(resId, theme);
|
||||
}
|
||||
return VectorDrawableCompat.create(res, resId, theme);
|
||||
return ResourcesCompat.getDrawable(res, resId, theme);
|
||||
}
|
||||
|
||||
public static void hideSoftKeyboard(@Nullable Activity activity) {
|
||||
|
|
|
@ -75,11 +75,9 @@ public class MediaNotificationProcessor {
|
|||
*/
|
||||
private static final int LIGHTNESS_TEXT_DIFFERENCE_DARK = -10;
|
||||
|
||||
private static final String TAG = "ColorPicking";
|
||||
private float[] mFilteredBackgroundHsl = null;
|
||||
private final Palette.Filter mBlackWhiteFilter =
|
||||
(rgb, hsl) -> !isWhiteOrBlack(hsl);
|
||||
private boolean mIsLowPriority;
|
||||
private int backgroundColor;
|
||||
private int secondaryTextColor;
|
||||
private int primaryTextColor;
|
||||
|
@ -376,10 +374,6 @@ public class MediaNotificationProcessor {
|
|||
return hslColor[2] >= WHITE_MIN_LIGHTNESS;
|
||||
}
|
||||
|
||||
public void setIsLowPriority(boolean isLowPriority) {
|
||||
mIsLowPriority = isLowPriority;
|
||||
}
|
||||
|
||||
private void ensureColors(int backgroundColor, int mForegroundColor) {
|
||||
{
|
||||
double backLum = NotificationColorUtil.calculateLuminance(backgroundColor);
|
||||
|
|
|
@ -55,7 +55,7 @@ public class NotificationColorUtil {
|
|||
|
||||
private final ImageUtils mImageUtils = new ImageUtils();
|
||||
private final WeakHashMap<Bitmap, Pair<Boolean, Integer>> mGrayscaleBitmapCache =
|
||||
new WeakHashMap<Bitmap, Pair<Boolean, Integer>>();
|
||||
new WeakHashMap<>();
|
||||
|
||||
private final int mGrayscaleIconMaxSize; // @dimen/notification_large_icon_width (64dp)
|
||||
|
||||
|
@ -831,11 +831,11 @@ public class NotificationColorUtil {
|
|||
}
|
||||
|
||||
private static int constrain(int amount, int low, int high) {
|
||||
return amount < low ? low : (amount > high ? high : amount);
|
||||
return amount < low ? low : (Math.min(amount, high));
|
||||
}
|
||||
|
||||
private static float constrain(float amount, float low, float high) {
|
||||
return amount < low ? low : (amount > high ? high : amount);
|
||||
return amount < low ? low : (Math.min(amount, high));
|
||||
}
|
||||
|
||||
private static double pivotXyzComponent(double component) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue