This repository has been archived by the owner on May 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Resolve build-time warnings after Android 13 migration (#1803)
- Upgrade libraries to the latest stable versions. - Address Serializable and Parcelable warnings. - Update permissions listeners as per SDK. - Refine onActivityResult handling. - Handle onBackPressed for UX. - Update README with comprehensive docs. Fixes: LEARNER-9413
- Loading branch information
1 parent
b1e9084
commit e5c717f
Showing
35 changed files
with
623 additions
and
626 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
OpenEdXMobile/src/main/java/org/edx/mobile/event/FileSelectionEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package org.edx.mobile.event | ||
|
||
import android.net.Uri | ||
import android.content.Intent | ||
|
||
data class FileSelectionEvent(val files: Array<Uri>?) : BaseEvent() | ||
class FileSelectionEvent(val intent: Intent) : BaseEvent() | ||
5 changes: 5 additions & 0 deletions
5
OpenEdXMobile/src/main/java/org/edx/mobile/event/FileShareEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.edx.mobile.event | ||
|
||
import android.net.Uri | ||
|
||
class FileShareEvent(val files: Array<Uri>?) : BaseEvent() | ||
38 changes: 38 additions & 0 deletions
38
OpenEdXMobile/src/main/java/org/edx/mobile/extenstion/BundleExt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.edx.mobile.extenstion | ||
|
||
import android.os.Build | ||
import android.os.Bundle | ||
import android.os.Parcelable | ||
import java.io.Serializable | ||
|
||
inline fun <reified T : Serializable> Bundle.serializable(key: String): T? { | ||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { | ||
getSerializable(key, T::class.java) | ||
} else { | ||
@Suppress("DEPRECATION") | ||
getSerializable(key) as? T | ||
} | ||
} | ||
|
||
@Throws(IllegalStateException::class) | ||
inline fun <reified T : Serializable> Bundle?.serializableOrThrow(key: String): T { | ||
return this?.serializable(key) ?: run { | ||
throw IllegalStateException("No arguments available") | ||
} | ||
} | ||
|
||
inline fun <reified T : Parcelable> Bundle.parcelable(key: String): T? { | ||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { | ||
getParcelable(key, T::class.java) | ||
} else { | ||
@Suppress("DEPRECATION") | ||
getParcelable(key) as? T | ||
} | ||
} | ||
|
||
@Throws(IllegalStateException::class) | ||
inline fun <reified T : Parcelable> Bundle?.parcelableOrThrow(key: String): T { | ||
return this?.parcelable(key) ?: run { | ||
throw IllegalStateException("No arguments available") | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
OpenEdXMobile/src/main/java/org/edx/mobile/extenstion/IntentExt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.edx.mobile.extenstion | ||
|
||
import android.content.Intent | ||
import android.os.Build | ||
import java.io.Serializable | ||
|
||
inline fun <reified T : Serializable> Intent.serializable(key: String): T? { | ||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { | ||
getSerializableExtra(key, T::class.java) | ||
} else { | ||
@Suppress("DEPRECATION") | ||
getSerializableExtra(key) as? T | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.