Skip to content

Commit 9e213ce

Browse files
committed
feat: 适配Android15
1 parent b8fc67f commit 9e213ce

10 files changed

Lines changed: 67 additions & 48 deletions

File tree

.idea/gradle.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/kotlinc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/sonarlint/issuestore/5/9/59ca5d84a1197004f62a9cb9f53a7df61157ac7a

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FlowHttp/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66

77
//ext.GROUP = "com.lute.network"
88
//ext.POM_ARTIFACT_ID = "NetCore-Flow"
9-
//ext.VERSION_NAME = "1.6.7"
9+
//ext.VERSION_NAME = "1.7.0"
1010
////引用gradle_upload.gradle
1111
//apply from: "${project.rootDir}/maven_upload.gradle"
1212

@@ -19,7 +19,7 @@ afterEvaluate {
1919
// 这里头是artifacts的配置信息,不填会采用默认的
2020
groupId = 'com.github.buhuiming'
2121
artifactId = 'NetCore-Flow'
22-
version = '1.6.9'
22+
version = '1.7.0'
2323

2424
from components.release
2525
artifact androidSourcesJar //打包源码,去除这行打的包将看不到源码
@@ -34,11 +34,11 @@ tasks.register('androidSourcesJar', Jar) {
3434
}
3535

3636
android {
37-
compileSdk 34
37+
compileSdk 35
3838

3939
defaultConfig {
40-
minSdk 21
41-
targetSdk 34
40+
minSdk 26
41+
targetSdk 35
4242
}
4343

4444
buildTypes {
@@ -61,14 +61,14 @@ android {
6161

6262
dependencies {
6363
implementation 'androidx.core:core-ktx:1.13.1'
64-
implementation 'androidx.lifecycle:lifecycle-common:2.8.4'
64+
implementation 'androidx.lifecycle:lifecycle-common:2.9.2'
6565
// Retrofit https://github.com/square/retrofit
6666
api 'com.squareup.retrofit2:retrofit:2.11.0'
6767
api 'com.squareup.retrofit2:converter-gson:2.11.0'
6868
api 'com.squareup.okhttp3:logging-interceptor:4.12.0'
6969
//https://github.com/square/okhttp
7070
api 'com.squareup.okhttp3:okhttp:4.12.0'
7171

72-
implementation 'androidx.appcompat:appcompat:1.7.0'
73-
implementation 'androidx.fragment:fragment-ktx:1.8.2'
72+
implementation 'androidx.appcompat:appcompat:1.7.1'
73+
implementation 'androidx.fragment:fragment-ktx:1.8.8'
7474
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111

1212
dependencies {
13-
implementation 'com.github.buhuiming:NetCore-Flow:1.6.9'
13+
implementation 'com.github.buhuiming:NetCore-Flow:1.7.0'
1414
}
1515

1616
#### 1、Application配置默认的全局配置项(可选)

app/build.gradle

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ plugins {
44
}
55

66
android {
7-
compileSdk 34
7+
compileSdk 35
88

99
defaultConfig {
1010
applicationId "com.bhm.netcore"
11-
minSdk 24
12-
targetSdk 34
11+
minSdk 26
12+
targetSdk 35
1313
versionCode 1
1414
versionName "1.0"
1515
}
@@ -32,16 +32,12 @@ android {
3232

3333
dependencies {
3434
implementation 'androidx.core:core-ktx:1.13.1'
35-
implementation 'androidx.appcompat:appcompat:1.7.0'
35+
implementation 'androidx.appcompat:appcompat:1.7.1'
3636
implementation 'com.google.android.material:material:1.12.0'
3737

38-
implementation 'androidx.recyclerview:recyclerview:1.3.2'
38+
implementation 'androidx.recyclerview:recyclerview:1.4.0'
3939
//noinspection GradleDependency
4040
implementation 'io.github.cymchad:BaseRecyclerViewAdapterHelper:3.0.13'
41-
//permissions
42-
implementation 'com.github.tbruyelle:rxpermissions:0.12'
4341
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
4442
implementation project(path: ':FlowHttp')
45-
46-
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.12'
4743
}

app/src/main/java/com/bhm/sdk/demo/activity/MainActivity.kt

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import android.widget.ProgressBar
1010
import android.widget.Toast
1111
import androidx.activity.result.ActivityResultLauncher
1212
import androidx.activity.result.contract.ActivityResultContracts
13+
import androidx.core.view.ViewCompat
14+
import androidx.core.view.WindowCompat
15+
import androidx.core.view.WindowInsetsCompat
1316
import androidx.fragment.app.FragmentActivity
1417
import androidx.recyclerview.widget.DividerItemDecoration
1518
import androidx.recyclerview.widget.LinearLayoutManager
@@ -30,24 +33,14 @@ import com.bhm.sdk.demo.tools.MyHttpLoadingDialog
3033
import com.bhm.sdk.demo.tools.Utils
3134
import com.bhm.sdk.demo.tools.Utils.getFile
3235
import kotlinx.coroutines.Job
33-
import okhttp3.Call
34-
import okhttp3.EventListener
35-
import okhttp3.MediaType
36-
import okhttp3.MediaType.Companion.toMediaType
3736
import okhttp3.MediaType.Companion.toMediaTypeOrNull
3837
import okhttp3.MultipartBody
3938
import okhttp3.MultipartBody.Part.Companion.createFormData
40-
import okhttp3.OkHttpClient
41-
import okhttp3.Request
4239
import okhttp3.RequestBody
4340
import okhttp3.RequestBody.Companion.asRequestBody
4441
import okhttp3.RequestBody.Companion.toRequestBody
4542
import okhttp3.ResponseBody
46-
import okio.BufferedSink
47-
import okio.IOException
48-
import okio.source
4943
import java.io.File
50-
import java.util.concurrent.TimeUnit
5144

5245
@Suppress("PrivatePropertyName")
5346
@SuppressLint("CheckResult")
@@ -69,6 +62,29 @@ open class MainActivity : FragmentActivity() {
6962
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
7063
super.onCreate(savedInstanceState)
7164
setContentView(R.layout.activity_main)
65+
WindowCompat.setDecorFitsSystemWindows(window, false)
66+
val controller = WindowCompat.getInsetsController(
67+
window,
68+
window.decorView
69+
)
70+
controller.isAppearanceLightStatusBars = true
71+
controller.isAppearanceLightNavigationBars = true
72+
val view = findViewById<View>(R.id.progressBarHorizontal)
73+
val originalTopPadding: Int = view.paddingTop
74+
val originalLeftPadding: Int = view.getPaddingLeft()
75+
val originalRightPadding: Int = view.getPaddingRight()
76+
val originalBottomPadding: Int = view.paddingBottom
77+
ViewCompat.setOnApplyWindowInsetsListener(view) { v: View, insets: WindowInsetsCompat ->
78+
val statusBars = insets.getInsets(WindowInsetsCompat.Type.statusBars())
79+
v.setPadding(
80+
originalLeftPadding,
81+
statusBars.top + originalTopPadding,
82+
originalRightPadding,
83+
originalBottomPadding
84+
)
85+
insets
86+
}
87+
ViewCompat.requestApplyInsets(view)
7288
permissionLauncher = registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()
7389
) {
7490
val refusePermission: ArrayList<String> = ArrayList()
@@ -375,11 +391,11 @@ open class MainActivity : FragmentActivity() {
375391
downloadJob = RequestManager.get()
376392
.buildRequest<ResponseBody>()
377393
.setHttpOptions(builder)
378-
.setBaseUrl("http://s.downpp.com/")
394+
.setBaseUrl("https://count.liqucn.com/")
379395
.downloadExecute(
380396
HttpApi::class.java,
381397
{
382-
it.downLoad("bytes=$downLoadLength-", "http://s1.downpp.com/apk6/com.juying.xstq_v1.1.3_2265.com.apk")
398+
it.downLoad("bytes=$downLoadLength-", "https://count.liqucn.com/d.php?id=78092683095&urlos=android&from_type=web")
383399
},
384400
{
385401
progress { progress, bytesWritten, contentLength ->

app/src/main/java/com/bhm/sdk/demo/activity/StartActivity.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import android.os.Bundle
55
import android.view.View
66
import android.widget.Button
77
import androidx.appcompat.app.AppCompatActivity
8+
import androidx.core.view.WindowCompat
89
import com.bhm.netcore.R
9-
import leakcanary.LeakCanary
1010

1111
/**
1212
* @author Buhuiming
@@ -18,7 +18,13 @@ class StartActivity: AppCompatActivity() {
1818
override fun onCreate(savedInstanceState: Bundle?) {
1919
super.onCreate(savedInstanceState)
2020
setContentView(R.layout.activity_start)
21-
LeakCanary.runCatching { }
21+
WindowCompat.setDecorFitsSystemWindows(window, false)
22+
val controller = WindowCompat.getInsetsController(
23+
window,
24+
window.decorView
25+
)
26+
controller.isAppearanceLightStatusBars = true
27+
controller.isAppearanceLightNavigationBars = true
2228
val button = findViewById<View>(R.id.btnOpen) as Button
2329
button.setOnClickListener {
2430
startActivity(Intent(this@StartActivity, MainActivity::class.java))

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
2-
id 'com.android.application' version '8.0.2' apply false
3-
id 'com.android.library' version '8.0.2' apply false
4-
id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
2+
id 'com.android.application' version '8.2.1' apply false
3+
id 'com.android.library' version '8.2.1' apply false
4+
id 'org.jetbrains.kotlin.android' version '1.8.22' apply false
55
}
66

77
task clean(type: Delete) {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Jul 24 17:47:16 CST 2024
1+
#Mon Jul 28 10:24:29 CST 2025
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)