[Cleanup] Removed redundant API 21(Lollipop) or lower version checks as the minimum SDK version is 21
This commit is contained in:
parent
aefd52c12e
commit
de14e72689
11 changed files with 36 additions and 68 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
|||
+ "</table>\n";
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "App version: "
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
if (PreferenceUtil.INSTANCE.isAlbumArtOnLockScreen()) {
|
||||
final Point screenSize = RetroUtil.getScreenSize(MusicService.this);
|
||||
|
|
|
@ -178,7 +178,6 @@ class PlayingNotificationImpl : PlayingNotification(), KoinComponent {
|
|||
.addAction(playPauseAction)
|
||||
.addAction(nextAction)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
builder.setStyle(
|
||||
MediaStyle()
|
||||
.setMediaSession(service.mediaSession.sessionToken)
|
||||
|
@ -190,7 +189,6 @@ class PlayingNotificationImpl : PlayingNotification(), KoinComponent {
|
|||
) {
|
||||
builder.color = color
|
||||
}
|
||||
}
|
||||
|
||||
if (stopped) {
|
||||
return // notification has been stopped before loading was finished
|
||||
|
|
|
@ -102,11 +102,8 @@ 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);
|
||||
}
|
||||
|
||||
/** Makes sure that {@code mTempBuffer} has at least length {@code size}. */
|
||||
private static void ensureBufferSize(int size) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -209,9 +209,7 @@ 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,6 @@ 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
|
||||
|
@ -107,7 +106,6 @@ object ATH {
|
|||
activity.setTaskDescription(ActivityManager.TaskDescription(activity.title as String?))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setTint(view: View, @ColorInt color: Int) {
|
||||
TintHelper.setTintAuto(view, color, false)
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue