Skip to content

Commit dfb76bc

Browse files
authored
Update to SDK 35 (#575)
1 parent 717cfd0 commit dfb76bc

File tree

9 files changed

+51
-12
lines changed

9 files changed

+51
-12
lines changed

.idea/compiler.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/runConfigurations.xml

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

README.md

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

1111
| Readium | Android min SDK | Android compile SDK | Kotlin compiler (✻) | Gradle (✻) |
1212
|-----------|-----------------|---------------------|---------------------|------------|
13-
| `develop` | 21 | 34 | 1.9.24 | 8.10.2 |
13+
| `develop` | 21 | 35 | 1.9.24 | 8.10.2 |
1414
| 3.0.0 | 21 | 34 | 1.9.24 | 8.6.0 |
1515
| 2.3.0 | 21 | 33 | 1.7.10 | 6.9.3 |
1616

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ pom.groupId=org.readium.kotlin-toolkit
99
pom.version=3.0.1
1010

1111
android.minSdk=21
12-
android.compileSdk=34
13-
android.targetSdk=34
12+
android.compileSdk=35
13+
android.targetSdk=35
1414

1515
# Specifies the JVM arguments used for the daemon process.
1616
# The setting is particularly useful for tweaking memory settings.

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ androidx-compose-material3 = "1.3.1"
2020
androidx-compose-runtime = "1.7.5"
2121
androidx-compose-ui = "1.7.5"
2222
androidx-constraintlayout = "2.2.0"
23-
androidx-core = "1.13.1"
23+
androidx-core = "1.15.0"
2424
androidx-datastore = "1.1.1"
2525
androidx-fragment-ktx = "1.8.5"
2626
androidx-legacy = "1.0.0"

readium/shared/src/main/java/org/readium/r2/shared/publication/services/content/iterators/HtmlResourceContentIterator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ public class HtmlResourceContentIterator internal constructor(
392392
if (node.isBlock) {
393393
assert(breadcrumbs.last().element == node)
394394
flushText()
395-
breadcrumbs.removeLast()
395+
breadcrumbs.removeAt(breadcrumbs.lastIndex)
396396
}
397397
}
398398
}

readium/shared/src/main/java/org/readium/r2/shared/util/MemoryObserver.kt

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,25 @@ public interface MemoryObserver {
1414
* Level of memory trim.
1515
*/
1616
public enum class Level {
17-
Moderate, Low, Critical;
17+
/**
18+
* The process has gone on to the LRU list. This is a good opportunity to clean up resources
19+
* that can efficiently and quickly be re-built if the user returns to the app.
20+
*/
21+
Background,
22+
23+
/**
24+
* The process had been showing a user interface, and is no longer doing so. Large
25+
* allocations with the UI should be released at this point to allow memory to be better
26+
* managed.
27+
*/
28+
UiHidden;
1829

1930
public companion object {
2031
public fun fromLevel(level: Int): Level =
21-
when {
22-
level <= ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE -> Moderate
23-
level == ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW -> Low
24-
else -> Critical
32+
when (level) {
33+
ComponentCallbacks2.TRIM_MEMORY_BACKGROUND -> Background
34+
ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN -> UiHidden
35+
else -> Background
2536
}
2637
}
2738
}
@@ -40,6 +51,8 @@ public interface MemoryObserver {
4051
public fun asComponentCallbacks2(observer: MemoryObserver): ComponentCallbacks2 =
4152
object : ComponentCallbacks2 {
4253
override fun onConfigurationChanged(config: Configuration) {}
54+
55+
@Deprecated("Deprecated in Java")
4356
override fun onLowMemory() {}
4457

4558
override fun onTrimMemory(level: Int) {

readium/shared/src/main/java/org/readium/r2/shared/util/cache/Cache.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public class InMemoryCache<V> : Cache<V> {
123123

124124
@OptIn(DelicateCoroutinesApi::class)
125125
override fun onTrimMemory(level: MemoryObserver.Level) {
126-
if (level == MemoryObserver.Level.Critical) {
126+
if (level == MemoryObserver.Level.Background) {
127127
GlobalScope.launch { transaction { clear() } }
128128
}
129129
}

test-app/src/main/java/org/readium/r2/testapp/MainActivity.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
package org.readium.r2.testapp
88

99
import android.os.Bundle
10+
import androidx.activity.enableEdgeToEdge
1011
import androidx.activity.viewModels
1112
import androidx.appcompat.app.AppCompatActivity
13+
import androidx.core.view.ViewCompat
14+
import androidx.core.view.WindowInsetsCompat
1215
import androidx.navigation.NavController
1316
import androidx.navigation.fragment.NavHostFragment
1417
import androidx.navigation.ui.AppBarConfiguration
@@ -24,7 +27,13 @@ class MainActivity : AppCompatActivity() {
2427

2528
override fun onCreate(savedInstanceState: Bundle?) {
2629
super.onCreate(savedInstanceState)
30+
enableEdgeToEdge()
2731
setContentView(R.layout.activity_main)
32+
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.container)) { v, insets ->
33+
val statusBars = insets.getInsets(WindowInsetsCompat.Type.statusBars())
34+
v.setPadding(statusBars.left, statusBars.top, statusBars.right, statusBars.bottom)
35+
insets
36+
}
2837

2938
val navView: BottomNavigationView = findViewById(R.id.nav_view)
3039
val navHostFragment =

0 commit comments

Comments
 (0)