Skip to content

Commit

Permalink
[feat] #1 core-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Sangwook123 committed Apr 10, 2024
1 parent e4fd11e commit 9f991eb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
12 changes: 12 additions & 0 deletions core/ui/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
alias(libs.plugins.sopt.android.library)
alias(libs.plugins.sopt.android.library.compose)
}

android {
namespace = "org.sopt.core.ui"
}

dependencies {
implementation(projects.core.model)
}
Empty file added core/ui/consumer-rules.pro
Empty file.
16 changes: 16 additions & 0 deletions core/ui/src/main/java/org/sopt/ui/intent/IntentExt.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.sopt.ui.intent

import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.os.Parcelable

fun <T : Parcelable> Intent.getParcelable(key: String, c: Class<T>): T? = when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU -> getParcelableExtra(key, c)
else -> getParcelableExtra(key) as? T
}

fun <T : Parcelable> Bundle.getParcelableSafe(key: String, c: Class<T>): T? = when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU -> getParcelable(key, c)
else -> getParcelable(key) as? T
}

0 comments on commit 9f991eb

Please sign in to comment.