-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xtc
committed
Nov 1, 2022
1 parent
493d276
commit eadc419
Showing
8 changed files
with
85 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package ttlock.demo.utils; | ||
|
||
import android.Manifest; | ||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.content.pm.PackageManager; | ||
import android.os.Build; | ||
|
||
import androidx.core.content.ContextCompat; | ||
|
||
public class AppUtil { | ||
public static final int REQUEST_PERMISSION_REQ_CODE = 1; | ||
|
||
public static boolean isAndroid12OrOver() { | ||
if (getAndroidSDKVersion() >= 31) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
public static int getAndroidSDKVersion() { | ||
int version = 0; | ||
try { | ||
version = Integer.valueOf(Build.VERSION.SDK_INT); | ||
} catch (NumberFormatException e) { | ||
e.printStackTrace(); | ||
} | ||
return version; | ||
} | ||
|
||
public static boolean checkPermission(Activity activity, String permission) { | ||
if (ContextCompat.checkSelfPermission(activity, permission) != PackageManager.PERMISSION_GRANTED) { | ||
activity.requestPermissions(new String[]{permission}, REQUEST_PERMISSION_REQ_CODE); | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Fri Nov 29 12:55:43 CST 2019 | ||
#Tue Oct 18 16:32:06 CST 2022 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip |