Skip to content

Commit 609f7cc

Browse files
authored
chore: bump target SDK version to 35 (#195)
* chore: bump target SDK version to 35 * chore: bump target SDK version to 36 * refactor: update edge-to-edge implementation * refactor: update edge-to-edge implementation * refactor: update edge-to-edge implementation * refactor: migrate away from deprecated onBackPressed() * fix: replace removeFirst()/removeLast() with removeAt() * chore(deps): update org.fossify.commons to 5.5.0 * docs: update changelog * build: bump detekt return count limit * chore: update lint baselines
1 parent b739e51 commit 609f7cc

File tree

12 files changed

+186
-142
lines changed

12 files changed

+186
-142
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Changed
10+
11+
- Compatibility updates for Android 15 & 16
12+
913
## [1.5.0] - 2025-10-10
1014
### Changed
1115
- Updated translations

app/detekt-baseline.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@
7878
<ID>NestedBlockDepth:MainActivity.kt$MainActivity$private fun checkIntents(intent: Intent)</ID>
7979
<ID>NestedBlockDepth:Note.kt$Note$fun getNoteStoredValue(context: Context): String?</ID>
8080
<ID>NestedBlockDepth:TasksFragment.kt$TasksFragment$private fun prepareTaskItems(): List&lt;NoteItem&gt;</ID>
81-
<ID>ReturnCount:TasksFragment.kt$TasksFragment$private fun saveNote(callback: () -&gt; Unit = {})</ID>
82-
<ID>ReturnCount:TextFragment.kt$TextFragment$fun saveText(force: Boolean, callback: ((note: Note) -&gt; Unit)? = null)</ID>
8381
<ID>SwallowedException:MainActivity.kt$MainActivity$e: ActivityNotFoundException</ID>
8482
<ID>SwallowedException:MainActivity.kt$MainActivity$e: Exception</ID>
8583
<ID>SwallowedException:MainActivity.kt$MainActivity$e: NetworkErrorException</ID>

app/lint-baseline.xml

Lines changed: 129 additions & 96 deletions
Large diffs are not rendered by default.

app/src/main/kotlin/org/fossify/notes/activities/MainActivity.kt

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -158,20 +158,13 @@ class MainActivity : SimpleActivity() {
158158
private val binding by viewBinding(ActivityMainBinding::inflate)
159159

160160
override fun onCreate(savedInstanceState: Bundle?) {
161-
isMaterialActivity = true
162161
super.onCreate(savedInstanceState)
163162
setContentView(binding.root)
164163
appLaunched(BuildConfig.APPLICATION_ID)
165164
setupOptionsMenu()
166165
refreshMenuItems()
167166

168-
updateMaterialActivityViews(
169-
mainCoordinatorLayout = binding.mainCoordinator,
170-
nestedView = null,
171-
useTransparentNavigation = false,
172-
useTopSearchMenu = false
173-
)
174-
167+
setupEdgeToEdge(padBottomImeAndSystem = listOf(binding.viewPager))
175168
searchQueryET = findViewById(org.fossify.commons.R.id.search_query)
176169
searchPrevBtn = findViewById(org.fossify.commons.R.id.search_previous)
177170
searchNextBtn = findViewById(org.fossify.commons.R.id.search_next)
@@ -204,7 +197,7 @@ class MainActivity : SimpleActivity() {
204197

205198
override fun onResume() {
206199
super.onResume()
207-
setupToolbar(binding.mainToolbar)
200+
setupTopAppBar(binding.mainAppbar)
208201
if (storedEnableLineWrap != config.enableLineWrap) {
209202
initViewPager()
210203
}
@@ -236,7 +229,7 @@ class MainActivity : SimpleActivity() {
236229
it.applyColorFilter(contrastColor)
237230
}
238231

239-
updateTopBarColors(binding.mainToolbar, getProperBackgroundColor())
232+
updateTopBarColors(binding.mainAppbar, getProperBackgroundColor())
240233
}
241234

242235
override fun onPause() {
@@ -348,8 +341,8 @@ class MainActivity : SimpleActivity() {
348341
}
349342
}
350343

351-
override fun onBackPressed() {
352-
if (!config.autosaveNotes && mAdapter?.anyHasUnsavedChanges() == true) {
344+
override fun onBackPressedCompat(): Boolean {
345+
return if (!config.autosaveNotes && mAdapter?.anyHasUnsavedChanges() == true) {
353346
ConfirmationAdvancedDialog(
354347
activity = this,
355348
message = "",
@@ -361,13 +354,15 @@ class MainActivity : SimpleActivity() {
361354
mAdapter?.saveAllFragmentTexts()
362355
}
363356
appLockManager.lock()
364-
super.onBackPressed()
357+
performDefaultBack()
365358
}
359+
true
366360
} else if (isSearchActive) {
367361
closeSearch()
362+
true
368363
} else {
369364
appLockManager.lock()
370-
super.onBackPressed()
365+
false
371366
}
372367
}
373368

app/src/main/kotlin/org/fossify/notes/activities/SettingsActivity.kt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,16 @@ class SettingsActivity : SimpleActivity() {
7777
private val binding by viewBinding(ActivitySettingsBinding::inflate)
7878

7979
override fun onCreate(savedInstanceState: Bundle?) {
80-
isMaterialActivity = true
8180
super.onCreate(savedInstanceState)
8281
setContentView(binding.root)
8382

84-
updateMaterialActivityViews(
85-
mainCoordinatorLayout = binding.settingsCoordinator,
86-
nestedView = binding.settingsHolder,
87-
useTransparentNavigation = true,
88-
useTopSearchMenu = false
89-
)
90-
setupMaterialScrollListener(binding.settingsNestedScrollview, binding.settingsToolbar)
83+
setupEdgeToEdge(padBottomSystem = listOf(binding.settingsNestedScrollview))
84+
setupMaterialScrollListener(binding.settingsNestedScrollview, binding.settingsAppbar)
9185
}
9286

9387
override fun onResume() {
9488
super.onResume()
95-
setupToolbar(binding.settingsToolbar, NavigationIcon.Arrow)
89+
setupTopAppBar(binding.settingsAppbar, NavigationIcon.Arrow)
9690

9791
setupCustomizeColors()
9892
setupUseEnglish()

app/src/main/kotlin/org/fossify/notes/activities/WidgetConfigureActivity.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class WidgetConfigureActivity : SimpleActivity() {
4949
super.onCreate(savedInstanceState)
5050
setResult(RESULT_CANCELED)
5151
setContentView(binding.root)
52+
setupEdgeToEdge(padTopSystem = listOf(binding.root), padBottomSystem = listOf(binding.root))
5253
initVariables()
5354

5455
mWidgetId = intent.extras?.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID) ?: AppWidgetManager.INVALID_APPWIDGET_ID

app/src/main/kotlin/org/fossify/notes/models/TextHistory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class TextHistory {
2626

2727
fun add(item: TextHistoryItem) {
2828
while (history.size > position) {
29-
history.removeLast()
29+
history.removeAt(history.lastIndex)
3030
}
3131

3232
history.add(item)

app/src/main/res/layout/activity_main.xml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,30 @@
22
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
android:id="@+id/main_coordinator"
5-
android:fitsSystemWindows="true"
65
android:layout_width="match_parent"
76
android:layout_height="match_parent">
87

9-
<com.google.android.material.appbar.MaterialToolbar
10-
android:id="@+id/main_toolbar"
8+
<org.fossify.commons.views.MyAppBarLayout
9+
android:id="@+id/main_appbar"
1110
android:layout_width="match_parent"
12-
android:layout_height="?attr/actionBarSize"
13-
android:background="@color/color_primary"
14-
app:menu="@menu/menu"
15-
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
11+
android:layout_height="wrap_content">
12+
13+
<com.google.android.material.appbar.MaterialToolbar
14+
android:id="@+id/main_toolbar"
15+
android:layout_width="match_parent"
16+
android:layout_height="?attr/actionBarSize"
17+
android:background="@color/color_primary"
18+
app:menu="@menu/menu"
19+
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
20+
21+
</org.fossify.commons.views.MyAppBarLayout>
1622

1723
<LinearLayout
1824
android:id="@+id/main_linear_layout"
1925
android:layout_width="match_parent"
2026
android:layout_height="match_parent"
21-
android:layout_marginTop="?attr/actionBarSize"
22-
android:orientation="vertical">
27+
android:orientation="vertical"
28+
app:layout_behavior="@string/appbar_scrolling_view_behavior">
2329

2430
<include
2531
android:id="@+id/search_wrapper"

app/src/main/res/layout/activity_settings.xml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,28 @@
66
android:layout_width="match_parent"
77
android:layout_height="match_parent">
88

9-
<com.google.android.material.appbar.MaterialToolbar
10-
android:id="@+id/settings_toolbar"
9+
<org.fossify.commons.views.MyAppBarLayout
10+
android:id="@+id/settings_appbar"
1111
android:layout_width="match_parent"
12-
android:layout_height="?attr/actionBarSize"
13-
android:background="@color/color_primary"
14-
app:title="@string/settings"
15-
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
12+
android:layout_height="wrap_content">
13+
14+
<com.google.android.material.appbar.MaterialToolbar
15+
android:id="@+id/settings_toolbar"
16+
android:layout_width="match_parent"
17+
android:layout_height="?attr/actionBarSize"
18+
android:background="@color/color_primary"
19+
app:title="@string/settings"
20+
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
21+
22+
</org.fossify.commons.views.MyAppBarLayout>
1623

1724
<androidx.core.widget.NestedScrollView
1825
android:id="@+id/settings_nested_scrollview"
1926
android:layout_width="match_parent"
2027
android:layout_height="match_parent"
21-
android:layout_marginTop="?attr/actionBarSize"
2228
android:fillViewport="true"
23-
android:scrollbars="none">
29+
android:scrollbars="none"
30+
app:layout_behavior="@string/appbar_scrolling_view_behavior">
2431

2532
<LinearLayout
2633
android:id="@+id/settings_holder"

detekt.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ style:
4040
maxLineLength: 120
4141
excludePackageStatements: true
4242
excludeImportStatements: true
43+
ReturnCount:
44+
active: true
45+
max: 4
46+
excludeGuardClauses: true
47+
excludes: ["**/test/**", "**/androidTest/**"]
4348

4449
naming:
4550
FunctionNaming:

0 commit comments

Comments
 (0)