Skip to content

Commit

Permalink
Remove Obsolete SDK_INT Version checks
Browse files Browse the repository at this point in the history
  • Loading branch information
TuxPaper committed Sep 18, 2023
1 parent 0d16383 commit 4ef648f
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1306,9 +1306,7 @@ private NotificationCompat.Builder getNotificationBuilder() {
builder.setCategory(Notification.CATEGORY_SERVICE);
}
builder.setContentIntent(pi);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
builder.setPriority(Notification.PRIORITY_LOW);
}
builder.setPriority(Notification.PRIORITY_LOW);
builder.setShowWhen(false);

if (!isCoreStopping && !isServiceStopping) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ public void onCreate() {
builder.detectFileUriExposure();
}
builder.detectLeakedClosableObjects();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
builder.detectLeakedRegistrationObjects();
}
builder.detectLeakedRegistrationObjects();
builder.detectLeakedSqlLiteObjects();
StrictMode.setVmPolicy(builder.build());

Expand Down
18 changes: 8 additions & 10 deletions app/src/main/java/com/biglybt/android/client/BiglyBTApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,14 @@ private static void initCommonAsync() {
}
vet.setDeviceName(deviceName);

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
try {
ActivityManager actManager = (ActivityManager) applicationContext.getSystemService(
Context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
//noinspection ConstantConditions
actManager.getMemoryInfo(memInfo);
totalMemoryMB = memInfo.totalMem / 1024 / 1024; // M
} catch (Throwable ignore) {
}
try {
ActivityManager actManager = (ActivityManager) applicationContext.getSystemService(
Context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
//noinspection ConstantConditions
actManager.getMemoryInfo(memInfo);
totalMemoryMB = memInfo.totalMem / 1024 / 1024; // M
} catch (Throwable ignore) {
}

vet.logEvent("AppStart" + (isCoreProcess ? "Core" : ""));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,8 @@ protected void onPostCreate(Bundle savedInstanceState) {
ViewParent parent = button.getParent();
if (parent instanceof ViewGroup) {
int minHeight = AndroidUtilsUI.dpToPx(48);
int curMinHeight;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
curMinHeight = ((ViewGroup) parent).getMinimumHeight();
if (curMinHeight <= 0 && minHeight > curMinHeight) {
((ViewGroup) parent).setMinimumHeight(minHeight);
}
} else {
int curMinHeight = ((ViewGroup) parent).getMinimumHeight();
if (curMinHeight <= 0 && minHeight > curMinHeight) {
((ViewGroup) parent).setMinimumHeight(minHeight);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,16 +295,14 @@ private void setBackgroundGradient() {
View viewCenterOn = findViewById(R.id.login_logo);
assert viewCenterOn != null;

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
LayoutTransition layoutTransition = mainLayout.getLayoutTransition();
layoutTransition.enableTransitionType(LayoutTransition.CHANGING);

ViewGroup ll = findViewById(R.id.login_logo_layout);
if (ll != null) {
LayoutTransition layoutTransition1 = ll.getLayoutTransition();
if (layoutTransition1 != null) {
layoutTransition1.enableTransitionType(LayoutTransition.CHANGING);
}
LayoutTransition layoutTransition = mainLayout.getLayoutTransition();
layoutTransition.enableTransitionType(LayoutTransition.CHANGING);

ViewGroup ll = findViewById(R.id.login_logo_layout);
if (ll != null) {
LayoutTransition layoutTransition1 = ll.getLayoutTransition();
if (layoutTransition1 != null) {
layoutTransition1.enableTransitionType(LayoutTransition.CHANGING);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -823,9 +823,7 @@ public boolean onKeyUp(int keyCode, KeyEvent event) {
}

if (keyCode == KeyEvent.KEYCODE_PROG_RED) {
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
finishAffinity();
}
finishAffinity();
}
return super.onKeyUp(keyCode, event);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,14 +467,8 @@ public boolean expandSideListWidth(Boolean expand, boolean userInitiated) {
return false;
}
boolean noExpanding = width < collapseUntilWidthPx;
// We have a Motorola Xoom on Android 4.0.4 that can't handle shrinking
// (torrent list view overlays)
boolean noShrinking = Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN;

if (expand == null) {
if (noExpanding && noShrinking) {
return false;
}
expand = width >= AndroidUtilsUI.dpToPx(keepExpandedAtParentWidthDp);
}
if (!userInitiated) {
Expand All @@ -487,20 +481,14 @@ public boolean expandSideListWidth(Boolean expand, boolean userInitiated) {

if (sidelistIsExpanded != null) {
// before listening to caller, do our checks
if (sidelistIsExpanded && noExpanding && !noShrinking) {
if (sidelistIsExpanded && noExpanding) {
expand = false;
}
if (!sidelistIsExpanded && noShrinking && !noExpanding) {
expand = true;
}
}

if (expand && noExpanding && !noShrinking) {
if (expand && noExpanding) {
expand = false;
}
if (!expand && noShrinking && !noExpanding) {
expand = true;
}

if (sidelistIsExpanded != null && expand == sidelistIsExpanded) {
return false;
Expand Down

0 comments on commit 4ef648f

Please sign in to comment.