diff --git a/app/src/main/java/code/name/monkey/retromusic/LanguageContextWrapper.java b/app/src/main/java/code/name/monkey/retromusic/LanguageContextWrapper.java index 564fa56c..2e885266 100644 --- a/app/src/main/java/code/name/monkey/retromusic/LanguageContextWrapper.java +++ b/app/src/main/java/code/name/monkey/retromusic/LanguageContextWrapper.java @@ -29,18 +29,10 @@ public class LanguageContextWrapper extends ContextWrapper { LocaleList localeList = new LocaleList(newLocale); LocaleList.setDefault(localeList); configuration.setLocales(localeList); - - context = context.createConfigurationContext(configuration); - - } else if (VersionUtils.INSTANCE.hasLollipop()) { - configuration.setLocale(newLocale); - context = context.createConfigurationContext(configuration); - } else { - configuration.locale = newLocale; - res.updateConfiguration(configuration, res.getDisplayMetrics()); + configuration.setLocale(newLocale); } - + context = context.createConfigurationContext(configuration); return new LanguageContextWrapper(context); } } diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt index 5f038e88..4d72254b 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt @@ -118,12 +118,11 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable { if (statusBar != null) { when { VersionUtils.hasMarshmallow() -> statusBar.setBackgroundColor(color) - VersionUtils.hasLollipop() -> statusBar.setBackgroundColor( + else -> statusBar.setBackgroundColor( ColorUtil.darkenColor( color ) ) - else -> statusBar.setBackgroundColor(color) } } else { when { diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/bugreport/model/DeviceInfo.java b/app/src/main/java/code/name/monkey/retromusic/activities/bugreport/model/DeviceInfo.java index 036cc4da..9ccd6742 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/bugreport/model/DeviceInfo.java +++ b/app/src/main/java/code/name/monkey/retromusic/activities/bugreport/model/DeviceInfo.java @@ -7,6 +7,7 @@ import android.content.pm.PackageManager; import android.os.Build; import androidx.annotation.IntRange; +import androidx.annotation.NonNull; import java.util.Arrays; import java.util.Locale; @@ -16,19 +17,16 @@ import code.name.monkey.retromusic.util.PreferenceUtil; public class DeviceInfo { @SuppressLint("NewApi") - @SuppressWarnings("deprecation") private final String[] abis = - Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP - ? Build.SUPPORTED_ABIS - : new String[] {Build.CPU_ABI, Build.CPU_ABI2}; + Build.SUPPORTED_ABIS; @SuppressLint("NewApi") private final String[] abis32Bits = - Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? Build.SUPPORTED_32_BIT_ABIS : null; + Build.SUPPORTED_32_BIT_ABIS; @SuppressLint("NewApi") private final String[] abis64Bits = - Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? Build.SUPPORTED_64_BIT_ABIS : null; + Build.SUPPORTED_64_BIT_ABIS; private final String baseTheme; @@ -138,6 +136,7 @@ public class DeviceInfo { + "\n"; } + @NonNull @Override public String toString() { return "App version: " diff --git a/app/src/main/java/code/name/monkey/retromusic/service/MusicService.java b/app/src/main/java/code/name/monkey/retromusic/service/MusicService.java index 332e85e7..9ede65f9 100644 --- a/app/src/main/java/code/name/monkey/retromusic/service/MusicService.java +++ b/app/src/main/java/code/name/monkey/retromusic/service/MusicService.java @@ -836,8 +836,7 @@ public class MusicService extends MediaBrowserServiceCompat // Request from an untrusted package: return an empty browser root return new BrowserRoot(AutoMediaIDHelper.MEDIA_ID_EMPTY_ROOT, null); } else { - /** - * By default return the browsable root. Treat the EXTRA_RECENT flag as a special case + /** By default return the browsable root. Treat the EXTRA_RECENT flag as a special case * and return the recent root instead. */ boolean isRecentRequest = false; @@ -1349,9 +1348,7 @@ public class MusicService extends MediaBrowserServiceCompat .putLong(MediaMetadataCompat.METADATA_KEY_YEAR, song.getYear()) .putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, null); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - metaData.putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, getPlayingQueue().size()); - } + metaData.putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, getPlayingQueue().size()); if (PreferenceUtil.INSTANCE.isAlbumArtOnLockScreen()) { final Point screenSize = RetroUtil.getScreenSize(MusicService.this); diff --git a/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl.kt b/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl.kt index b095e2b8..552c82ae 100644 --- a/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl.kt +++ b/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl.kt @@ -178,18 +178,16 @@ class PlayingNotificationImpl : PlayingNotification(), KoinComponent { .addAction(playPauseAction) .addAction(nextAction) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - builder.setStyle( - MediaStyle() - .setMediaSession(service.mediaSession.sessionToken) - .setShowActionsInCompactView(1, 2, 3) - ) - .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) - if (Build.VERSION.SDK_INT <= - Build.VERSION_CODES.O && PreferenceUtil.isColoredNotification - ) { - builder.color = color - } + builder.setStyle( + MediaStyle() + .setMediaSession(service.mediaSession.sessionToken) + .setShowActionsInCompactView(1, 2, 3) + ) + .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) + if (Build.VERSION.SDK_INT <= + Build.VERSION_CODES.O && PreferenceUtil.isColoredNotification + ) { + builder.color = color } if (stopped) { diff --git a/app/src/main/java/code/name/monkey/retromusic/util/ImageUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/ImageUtil.java index bcba5274..8ef4da13 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/ImageUtil.java +++ b/app/src/main/java/code/name/monkey/retromusic/util/ImageUtil.java @@ -102,10 +102,7 @@ public class ImageUtil { 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 res.getDrawable(resId, theme); } /** Makes sure that {@code mTempBuffer} has at least length {@code size}. */ diff --git a/app/src/main/java/code/name/monkey/retromusic/util/SAFUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/SAFUtil.java index c846bc64..71506e19 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/SAFUtil.java +++ b/app/src/main/java/code/name/monkey/retromusic/util/SAFUtil.java @@ -54,7 +54,7 @@ public class SAFUtil { public static final int REQUEST_SAF_PICK_TREE = 43; public static boolean isSAFRequired(File file) { - return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && !file.canWrite(); + return !file.canWrite(); } public static boolean isSAFRequired(String path) { diff --git a/app/src/main/java/code/name/monkey/retromusic/views/CircularImageView.java b/app/src/main/java/code/name/monkey/retromusic/views/CircularImageView.java index 9bdf582f..a4ccfa1f 100644 --- a/app/src/main/java/code/name/monkey/retromusic/views/CircularImageView.java +++ b/app/src/main/java/code/name/monkey/retromusic/views/CircularImageView.java @@ -209,10 +209,8 @@ public class CircularImageView extends AppCompatImageView { private void drawShadow(float shadowRadius, int shadowColor) { this.shadowRadius = shadowRadius; this.shadowColor = shadowColor; - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { setLayerType(LAYER_TYPE_SOFTWARE, paintBorder); - } - paintBorder.setShadowLayer(shadowRadius, 0.0f, shadowRadius / 2, shadowColor); + paintBorder.setShadowLayer(shadowRadius, 0.0f, shadowRadius / 2, shadowColor); } private void updateShader() { diff --git a/app/src/main/java/code/name/monkey/retromusic/views/StatusBarMarginFrameLayout.java b/app/src/main/java/code/name/monkey/retromusic/views/StatusBarMarginFrameLayout.java index 6a95753f..51c3acf8 100644 --- a/app/src/main/java/code/name/monkey/retromusic/views/StatusBarMarginFrameLayout.java +++ b/app/src/main/java/code/name/monkey/retromusic/views/StatusBarMarginFrameLayout.java @@ -40,12 +40,10 @@ public class StatusBarMarginFrameLayout extends FrameLayout { @NonNull @Override public WindowInsets onApplyWindowInsets(@NonNull WindowInsets insets) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { MarginLayoutParams lp = (MarginLayoutParams) getLayoutParams(); lp.topMargin = insets.getSystemWindowInsetTop(); lp.bottomMargin = insets.getSystemWindowInsetBottom(); setLayoutParams(lp); - } - return super.onApplyWindowInsets(insets); + return super.onApplyWindowInsets(insets); } } diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/ATH.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/ATH.kt index 725782ca..0397779a 100755 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/ATH.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/ATH.kt @@ -91,21 +91,19 @@ object ATH { fun setTaskDescriptionColor(activity: Activity, @ColorInt color: Int) { var colorFinal = color - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - // Task description requires fully opaque color - colorFinal = ColorUtil.stripAlpha(colorFinal) - // Sets color of entry in the system recents page - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - activity.setTaskDescription( - ActivityManager.TaskDescription( - activity.title as String?, - -1, - colorFinal - ) + // Task description requires fully opaque color + colorFinal = ColorUtil.stripAlpha(colorFinal) + // Sets color of entry in the system recents page + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + activity.setTaskDescription( + ActivityManager.TaskDescription( + activity.title as String?, + -1, + colorFinal ) - } else { - activity.setTaskDescription(ActivityManager.TaskDescription(activity.title as String?)) - } + ) + } else { + activity.setTaskDescription(ActivityManager.TaskDescription(activity.title as String?)) } } diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/VersionUtils.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/VersionUtils.kt index 0822db40..a9a0d34d 100644 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/VersionUtils.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/VersionUtils.kt @@ -7,14 +7,6 @@ import android.os.Build */ object VersionUtils { - - /** - * @return true if device is running API >= 21 - */ - fun hasLollipop(): Boolean { - return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP - } - /** * @return true if device is running API >= 23 */