Skip to content

Commit

Permalink
fix: #27 isNetworking() 内存泄漏
Browse files Browse the repository at this point in the history
  • Loading branch information
liangjingkanji committed Dec 27, 2022
1 parent 256053d commit bba8594
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ dependencyResolutionManagement {
然后在 module 的 build.gradle 添加依赖框架

```groovy
implementation 'com.github.liangjingkanji:StateLayout:1.3.11'
implementation 'com.github.liangjingkanji:StateLayout:1.3.12'
```

<br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ class StateLayout @JvmOverloads constructor(
* 是否处于联网中
*/
private fun isNetworking(): Boolean {
val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val connectivityManager = context.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
return try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val network = connectivityManager.activeNetwork ?: return false
Expand Down

0 comments on commit bba8594

Please sign in to comment.