Skip to content

Commit

Permalink
Target SDK 32
Browse files Browse the repository at this point in the history
Build tools 32.0.0.
Add helper methods to detect API 32.
  • Loading branch information
pranavpandey committed Dec 14, 2021
1 parent 773c0d0 commit 95abd25
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android:
components:
- tools
- platform-tools
- build-tools-31.0.0
- android-31
- build-tools-32.0.0
- android-32
- extra-android-support
- extra-android-m2repository
- extra-google-m2repository
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

buildscript {
ext.versions = [
'compileSdk': 31,
'compileSdk': 32,
'minSdk' : 14,
'targetSdk' : 31,
'buildTools': '31.0.0',
'targetSdk' : 32,
'buildTools': '32.0.0',
'androidx' : '1.8.0-alpha01'
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,28 @@ public static boolean is31() {
return is31(false);
}

/**
* Detects if the current API version is 31 or above.
*
* @param equals {@code true} to check for equality.
* <p>{@code false} to match greater than or equal.
*
* @return {@code true} if the current API version is 31 or above.
*/
public static boolean is32(boolean equals) {
return equals ? Build.VERSION.SDK_INT == Build.VERSION_CODES.S_V2
: Build.VERSION.SDK_INT >= Build.VERSION_CODES.S_V2;
}

/**
* Detects if the current API version is 32 or above.
*
* @return {@code true} if the current API version is 32 or above.
*/
public static boolean is32() {
return is32(false);
}

/**
* Detects if the current API version is 31 or above.
*
Expand All @@ -442,7 +464,7 @@ public static boolean is31() {
* @return {@code true} if the current API version is S or above.
*/
public static boolean isS(boolean equals) {
return is31(equals) || (is30(equals) && isPreview());
return is32(equals) || (is31(equals) && isPreview()) || (is30(equals) && isPreview());
}

/**
Expand Down

0 comments on commit 95abd25

Please sign in to comment.