Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Android 15. #4147

Merged
merged 22 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3423bbf
Added support for Android 15.
MohitMaliDeveloper Dec 20, 2024
08c0545
Upgraded the dagger version to 2.53.1.
MohitMaliDeveloper Jan 2, 2025
4d8e168
Reverted the automated changes in project.xml file.
MohitMaliDeveloper Dec 24, 2024
811d74d
Reverted the remaining automated changes in project.xml file.
MohitMaliDeveloper Dec 24, 2024
db41f1d
Upgraded the Gradle version to `8.7.2` which is required for Android 15.
MohitMaliDeveloper Dec 25, 2024
ccfc896
Enabled EdgeToEdge mode in project to support latest windowInset API.
MohitMaliDeveloper Dec 26, 2024
4157903
Fixed: The recyclerview content was going in the statusBar.
MohitMaliDeveloper Dec 26, 2024
e35135f
Removed the excluding of dependency from fetch library as now our pro…
MohitMaliDeveloper Dec 26, 2024
53d7738
Fixed the compilation error after rebasing to the main branch.
MohitMaliDeveloper Dec 26, 2024
82ba9f3
Fixed: The navigationView and rightDrawerView was overlapping on stat…
MohitMaliDeveloper Dec 27, 2024
84807a1
Fixed: ErrorActivity buttons overlapping in navigation buttons.
MohitMaliDeveloper Dec 27, 2024
0c15a40
Fixed: All the screen which are overlapping with systemBars.
MohitMaliDeveloper Dec 27, 2024
d94ca86
Improved the full screen mode since the systemBars were visible in fu…
MohitMaliDeveloper Dec 27, 2024
e6bdc0a
Added backward compatibility for edgeToEdge mode to support all andro…
MohitMaliDeveloper Dec 27, 2024
6d983bd
Fixed: The transparent color showing in the statusBar on Android 15 a…
MohitMaliDeveloper Dec 27, 2024
e555e62
Fixed: CoreReaderFragment's bottomBar going to up when closing the fu…
MohitMaliDeveloper Dec 27, 2024
77f67d4
Improved the edge to edge mode in landscape mode.
MohitMaliDeveloper Dec 30, 2024
3b24308
Fixed: ZimManageViewModelTest, NewRecentSearchDaoTest, and SearchView…
MohitMaliDeveloper Jan 2, 2025
60d1ee2
Fixed: PageViewModelTest which was failing.
MohitMaliDeveloper Jan 2, 2025
dfabe27
Added Android 15 emulator in CI to run the test cases on Android 15 d…
MohitMaliDeveloper Jan 3, 2025
93f4a51
Fixed the testOpeningFromFileManager was failing on Android 15.
MohitMaliDeveloper Jan 3, 2025
cd6d5e2
Re-enabled the all emulators in CI.
MohitMaliDeveloper Jan 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Automated tests
strategy:
matrix:
api-level: [ 25, 30, 33, 34 ]
api-level: [ 25, 30, 33, 34, 35 ]
fail-fast: true
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: default
target: ${{ (matrix.api-level == 35) && 'google_apis' || 'default' }}
arch: x86_64
profile: pixel_2
ram-size: 3072M
Expand All @@ -76,7 +76,7 @@ jobs:
GRADLE_OPTS: "-Dorg.gradle.internal.http.connectionTimeout=60000 -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.network.retry.max.attempts=6 -Dorg.gradle.internal.network.retry.initial.backOff=2000"
with:
api-level: ${{ matrix.api-level }}
target: default
target: ${{ (matrix.api-level == 35) && 'google_apis' || 'default' }}
arch: x86_64
profile: pixel_2
ram-size: 3072M
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
name: Automated tests for PlayStore variant
strategy:
matrix:
api-level: [ 25, 30, 33, 34 ]
api-level: [ 25, 30, 33, 34, 35 ]
fail-fast: true
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: default
target: ${{ (matrix.api-level == 35) && 'google_apis' || 'default' }}
arch: x86_64
profile: pixel_2
ram-size: 2048M
Expand All @@ -182,7 +182,7 @@ jobs:
GRADLE_OPTS: "-Dorg.gradle.internal.http.connectionTimeout=60000 -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.network.retry.max.attempts=6 -Dorg.gradle.internal.network.retry.initial.backOff=2000"
with:
api-level: ${{ matrix.api-level }}
target: default
target: ${{ (matrix.api-level == 35) && 'google_apis' || 'default' }}
arch: x86_64
profile: pixel_2
ram-size: 2048M
Expand All @@ -199,7 +199,7 @@ jobs:
name: Automated tests for Custom app
strategy:
matrix:
api-level: [ 25, 30, 33, 34 ]
api-level: [ 25, 30, 33, 34, 35 ]
fail-fast: true
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -244,7 +244,7 @@ jobs:
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: default
target: ${{ (matrix.api-level == 35) && 'google_apis' || 'default' }}
arch: x86_64
profile: pixel_2
ram-size: 2048M
Expand All @@ -263,7 +263,7 @@ jobs:
GRADLE_OPTS: "-Dorg.gradle.internal.http.connectionTimeout=60000 -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.network.retry.max.attempts=6 -Dorg.gradle.internal.network.retry.initial.backOff=2000"
with:
api-level: ${{ matrix.api-level }}
target: default
target: ${{ (matrix.api-level == 35) && 'google_apis' || 'default' }}
arch: x86_64
profile: pixel_2
ram-size: 2048M
Expand All @@ -280,7 +280,7 @@ jobs:
name: Automated tests on Tablet
strategy:
matrix:
api-level: [ 30, 33, 34 ]
api-level: [ 25, 30, 33, 34, 35 ]
fail-fast: true
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -325,7 +325,7 @@ jobs:
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: default
target: ${{ (matrix.api-level == 35) && 'google_apis' || 'default' }}
arch: x86_64
profile: pixel_2
ram-size: 2048M
Expand All @@ -344,7 +344,7 @@ jobs:
GRADLE_OPTS: "-Dorg.gradle.internal.http.connectionTimeout=60000 -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.network.retry.max.attempts=6 -Dorg.gradle.internal.network.retry.initial.backOff=2000"
with:
api-level: ${{ matrix.api-level }}
target: default
target: ${{ (matrix.api-level == 35) && 'google_apis' || 'default' }}
arch: x86_64
profile: pixel_c
ram-size: 2048M
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ class OpeningFilesFromStorageTest : BaseActivityTest() {

@Test
fun testOpeningFileFromFileManager() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R &&
Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM
) {
activityScenario.onActivity {
kiwixMainActivity = it
it.navigate(R.id.libraryFragment)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import android.content.pm.PackageManager
import android.graphics.Bitmap
import android.os.Build
import android.os.Environment
import androidx.annotation.RequiresApi
import androidx.core.content.ContextCompat
import androidx.test.core.app.canTakeScreenshot
import androidx.test.core.app.takeScreenshot
Expand Down Expand Up @@ -91,10 +90,6 @@ object TestUtils {
Manifest.permission.WRITE_EXTERNAL_STORAGE
) == PackageManager.PERMISSION_GRANTED

@RequiresApi(Build.VERSION_CODES.R)
private fun hasManageExternalStoragePermission(): Boolean =
Environment.isExternalStorageManager()

@JvmStatic fun hasStoragePermission() = Build.VERSION.SDK_INT > Build.VERSION_CODES.M &&
hasReadExternalStoragePermission() && hasWriteExternalStoragePermission()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import org.kiwix.kiwixmobile.core.R.string
import org.kiwix.kiwixmobile.core.base.FragmentActivityExtensions
import org.kiwix.kiwixmobile.core.dao.NewBookDao
import org.kiwix.kiwixmobile.core.downloader.downloadManager.DOWNLOAD_NOTIFICATION_TITLE
import org.kiwix.kiwixmobile.core.extensions.applyEdgeToEdgeInsets
import org.kiwix.kiwixmobile.core.extensions.toast
import org.kiwix.kiwixmobile.core.main.ACTION_NEW_TAB
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
Expand Down Expand Up @@ -122,10 +123,12 @@ class KiwixMainActivity : CoreMainActivity() {
setContentView(activityKiwixMainBinding.root)

navController.addOnDestinationChangedListener(finishActionModeOnDestinationChange)
activityKiwixMainBinding.drawerNavView.setupWithNavController(navController)
activityKiwixMainBinding.drawerNavView.setNavigationItemSelectedListener { item ->
closeNavigationDrawer()
onNavigationItemSelected(item)
activityKiwixMainBinding.drawerNavView.apply {
setupWithNavController(navController)
setNavigationItemSelectedListener { item ->
closeNavigationDrawer()
onNavigationItemSelected(item)
}
}
activityKiwixMainBinding.bottomNavView.setupWithNavController(navController)
lifecycleScope.launch {
Expand All @@ -134,6 +137,7 @@ class KiwixMainActivity : CoreMainActivity() {
handleZimFileIntent(intent)
handleNotificationIntent(intent)
handleGetContentIntent(intent)
activityKiwixMainBinding.root.applyEdgeToEdgeInsets()
}

private suspend fun migrateInternalToPublicAppDirectory() {
Expand Down
5 changes: 1 addition & 4 deletions app/src/main/res/layout/activity_kiwix_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
android:id="@+id/navigation_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/open_drawer"
android:fitsSystemWindows="true">
android:contentDescription="@string/open_drawer">

<org.kiwix.kiwixmobile.core.utils.NestedCoordinatorLayout
android:layout_width="match_parent"
Expand Down Expand Up @@ -53,7 +52,6 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_main"
app:menu="@menu/menu_drawer_main" />

Expand All @@ -62,7 +60,6 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end"
android:fitsSystemWindows="true"
app:headerLayout="@layout/drawer_right" />


Expand Down
12 changes: 6 additions & 6 deletions app/src/main/res/layout/activity_language.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:fitsSystemWindows="true">
android:layout_width="match_parent"
android:layout_height="match_parent">

<include layout="@layout/layout_standard_app_bar" />

<androidx.recyclerview.widget.RecyclerView
tools:listitem="@layout/item_language"
android:id="@+id/language_recycler_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:contentDescription="@string/pref_language_title"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/app_bar" />
app:layout_constraintTop_toBottomOf="@id/app_bar"
android:clipToPadding="false"
tools:listitem="@layout/item_language" />

<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/language_progressbar"
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/activity_zim_host.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="org.kiwix.kiwixmobile.webserver.ZimHostFragment">

<include layout="@layout/layout_toolbar" />
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/fragment_destination_download.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
android:layout_height="match_parent"
android:contentDescription="@string/library"
android:scrollbars="vertical"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:listitem="@layout/item_download" />

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_destination_library.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
android:layout_height="match_parent">

<org.kiwix.kiwixmobile.core.utils.NestedCoordinatorLayout
android:layout_width="match_parent"
Expand Down Expand Up @@ -55,6 +54,7 @@
android:id="@+id/zimfilelist"
android:layout_width="0dp"
android:layout_height="match_parent"
android:clipToPadding="false"
android:contentDescription="@string/crash_checkbox_zimfiles"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/fragment_local_file_transfer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:fitsSystemWindows="true"
tools:context="org.kiwix.kiwixmobile.localFileTransfer.LocalFileTransferFragment">


Expand Down Expand Up @@ -80,6 +79,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:clipToPadding="false"
android:visibility="invisible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down Expand Up @@ -161,6 +161,7 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@android:color/transparent"
android:clipToPadding="false"
android:contentDescription="@string/files_for_transfer"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import android.app.Application
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.net.NetworkCapabilities.TRANSPORT_WIFI
import android.os.Build
import com.jraska.livedata.test
import io.mockk.clearAllMocks
import io.mockk.every
Expand Down Expand Up @@ -51,15 +52,15 @@ import org.kiwix.kiwixmobile.core.utils.files.ScanningProgressListener
import org.kiwix.kiwixmobile.core.zim_manager.ConnectivityBroadcastReceiver
import org.kiwix.kiwixmobile.core.zim_manager.Language
import org.kiwix.kiwixmobile.core.zim_manager.NetworkState
import org.kiwix.kiwixmobile.core.zim_manager.NetworkState.CONNECTED
import org.kiwix.kiwixmobile.core.zim_manager.NetworkState.NOT_CONNECTED
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.SelectionMode.MULTI
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.SelectionMode.NORMAL
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk
import org.kiwix.kiwixmobile.zimManager.Fat32Checker.FileSystemState
import org.kiwix.kiwixmobile.zimManager.Fat32Checker.FileSystemState.CanWrite4GbFile
import org.kiwix.kiwixmobile.zimManager.Fat32Checker.FileSystemState.CannotWrite4GbFile
import org.kiwix.kiwixmobile.core.zim_manager.NetworkState.CONNECTED
import org.kiwix.kiwixmobile.core.zim_manager.NetworkState.NOT_CONNECTED
import org.kiwix.kiwixmobile.zimManager.ZimManageViewModel.FileSelectActions.MultiModeFinished
import org.kiwix.kiwixmobile.zimManager.ZimManageViewModel.FileSelectActions.RequestDeleteMultiSelection
import org.kiwix.kiwixmobile.zimManager.ZimManageViewModel.FileSelectActions.RequestMultiSelection
Expand Down Expand Up @@ -139,7 +140,12 @@ class ZimManageViewModelTest {
every { newLanguagesDao.languages() } returns languages
every { fat32Checker.fileSystemStates } returns fileSystemStates
every { connectivityBroadcastReceiver.networkStates } returns networkStates
every { application.registerReceiver(any(), any()) } returns mockk()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
every { application.registerReceiver(any(), any(), any()) } returns mockk()
} else {
@Suppress("UnspecifiedRegisterReceiverFlag")
every { application.registerReceiver(any(), any()) } returns mockk()
}
every { dataSource.booksOnDiskAsListItems() } returns booksOnDiskListItems
every {
connectivityManager.getNetworkCapabilities(connectivityManager.activeNetwork)
Expand Down Expand Up @@ -167,8 +173,15 @@ class ZimManageViewModelTest {
inner class Context {
@Test
fun `registers broadcastReceiver in init`() {
verify {
application.registerReceiver(connectivityBroadcastReceiver, any())
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
verify {
application.registerReceiver(connectivityBroadcastReceiver, any(), any())
}
} else {
@Suppress("UnspecifiedRegisterReceiverFlag")
verify {
application.registerReceiver(connectivityBroadcastReceiver, any())
}
}
}

Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ buildscript {
dependencies {
classpath(Libs.com_android_tools_build_gradle)
classpath(Libs.kotlin_gradle_plugin)
classpath(Libs.kotlin_ksp)
classpath(Libs.navigation_safe_args_gradle_plugin)
classpath(Libs.keeper)

Expand Down
3 changes: 2 additions & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ repositories {
}

dependencies {
implementation("com.android.tools.build:gradle:8.1.3")
implementation("com.android.tools.build:gradle:8.7.2")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0")
implementation("com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:2.0.0-1.0.24")
implementation("org.jacoco:org.jacoco.core:0.8.12")
implementation("org.jlleitschuh.gradle:ktlint-gradle:10.3.0")
implementation("com.google.apis:google-api-services-androidpublisher:v3-rev20230406-2.0.0") {
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ object Config {

// Here is a list of all Android versions with their corresponding API
// levels: https://apilevels.com/
const val compileSdk = 34 // SDK version used by Gradle to compile our app.
const val compileSdk = 35 // SDK version used by Gradle to compile our app.
const val minSdk = 25 // Minimum SDK (Minimum Support Device) is 25 (Android 7.1 Nougat).
const val targetSdk = 34 // Target SDK (Maximum Support Device) is 34 (Android 14).
const val targetSdk = 35 // Target SDK (Maximum Support Device) is 34 (Android 14).

val javaVersion = JavaVersion.VERSION_1_8
val javaVersion = JavaVersion.VERSION_17

// Version Information
const val versionMajor = 3 // Major version component of the app's version name and version code.
Expand Down
Loading
Loading