Skip to content

Commit 231cb60

Browse files
iveshzfMinTate
authored andcommitted
[atomic]update to 3.5.0
1 parent 704babd commit 231cb60

451 files changed

Lines changed: 18127 additions & 3713 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

atomic-x/CHANGELOG.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

atomic-x/LICENSE

Lines changed: 0 additions & 1 deletion
This file was deleted.

atomic-x/android/build.gradle

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ group = "io.trtc.tuikit.atomicx"
22
version = "1.0-SNAPSHOT"
33

44
buildscript {
5-
ext.kotlin_version = "1.7.10"
5+
ext.kotlin_version = "2.0.20"
66
repositories {
77
google()
88
mavenCentral()
99
}
1010

1111
dependencies {
12-
classpath("com.android.tools.build:gradle:7.3.0")
12+
classpath("com.android.tools.build:gradle:8.1.0")
1313
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
14+
classpath("org.jetbrains.kotlin:compose-compiler-gradle-plugin:$kotlin_version")
15+
classpath("org.jetbrains.kotlin:kotlin-serialization:$kotlin_version")
1416
}
1517
}
1618

@@ -23,6 +25,9 @@ allprojects {
2325

2426
apply plugin: "com.android.library"
2527
apply plugin: "kotlin-android"
28+
apply plugin: "kotlin-parcelize"
29+
apply plugin: "org.jetbrains.kotlin.plugin.compose"
30+
apply plugin: "org.jetbrains.kotlin.plugin.serialization"
2631

2732
android {
2833
if (project.android.hasProperty("namespace")) {
@@ -40,16 +45,72 @@ android {
4045
jvmTarget = "1.8"
4146
}
4247

48+
buildFeatures {
49+
compose = true
50+
}
51+
4352
sourceSets {
4453
main.java.srcDirs += "src/main/kotlin"
4554
test.java.srcDirs += "src/test/kotlin"
55+
main.res.srcDirs = [
56+
"src/main/res",
57+
"src/main/res-album-picker",
58+
"src/main/res-base-component"
59+
]
4660
}
4761

4862
defaultConfig {
4963
minSdk = 21
5064
}
5165

5266
dependencies {
67+
implementation("com.tencent.liteav.tuikit:tuicore:8.6.7021")
68+
69+
// AndroidX Core - required
70+
implementation("androidx.core:core-ktx:1.12.0")
71+
implementation("androidx.appcompat:appcompat:1.7.0")
72+
implementation("androidx.activity:activity-compose:1.10.1")
73+
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.7")
74+
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.7")
75+
76+
// Compose - required(AlbumPickerActivity, BaseComponent use Compose UI)
77+
implementation(platform("androidx.compose:compose-bom:2024.09.00"))
78+
implementation("androidx.compose.ui:ui")
79+
implementation("androidx.compose.ui:ui-graphics")
80+
implementation("androidx.compose.ui:ui-tooling-preview")
81+
implementation("androidx.compose.foundation:foundation:1.8.0")
82+
implementation("androidx.compose.material3:material3")
83+
implementation("androidx.compose.material:material-icons-core")
84+
implementation("androidx.compose.material:material-icons-extended")
85+
debugImplementation("androidx.compose.ui:ui-tooling")
86+
debugImplementation("androidx.compose.ui:ui-test-manifest")
87+
88+
// ConstraintLayout Compose - optional
89+
implementation("androidx.constraintlayout:constraintlayout-compose:1.1.1")
90+
91+
// Coil 3.x - required(AlbumPicker use Coil)
92+
implementation("io.coil-kt.coil3:coil-compose:3.1.0")
93+
implementation("io.coil-kt.coil3:coil-gif:3.1.0")
94+
implementation("io.coil-kt.coil3:coil-network-okhttp:3.1.0")
95+
96+
// Glide - required(AlbumPreviewer use Glide)
97+
implementation("com.github.bumptech.glide:glide:4.12.0")
98+
99+
// Material Design - required
100+
implementation("com.google.android.material:material:1.12.0")
101+
102+
// MMKV - required(BaseComponent ThemeState use MMKV)
103+
implementation("com.tencent:mmkv:1.3.14")
104+
105+
// Gson - required
106+
implementation("com.google.code.gson:gson:2.10.1")
107+
108+
// Kotlin Coroutines - required(ViewModel use Coroutines)
109+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
110+
111+
// Kotlin Serialization - required(ThemeState use Serialization)
112+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
113+
53114
testImplementation("org.jetbrains.kotlin:kotlin-test")
54115
testImplementation("org.mockito:mockito-core:5.0.0")
55116
}

atomic-x/android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rootProject.name = 'atomic_x'
1+
rootProject.name = 'tuikit_atomic_x'
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="io.trtc.tuikit.atomicx">
3+
<!-- Android 12 or lower -->
4+
<uses-permission
5+
android:name="android.permission.READ_EXTERNAL_STORAGE"
6+
android:maxSdkVersion="32" />
7+
8+
<!-- Android 13 or higher -->
9+
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
10+
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
11+
12+
<!-- Android 14 or higher -->
13+
<uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED" />
14+
15+
<application>
16+
<activity
17+
android:name="io.trtc.tuikit.atomicx.albumpicker.ui.picker.AlbumPickerActivity"
18+
android:exported="true"
19+
android:screenOrientation="portrait"
20+
android:theme="@style/BaseComponent.Theme.FullScreen" />
21+
22+
<provider
23+
android:name=".basecomponent.utils.ContextProvider"
24+
android:authorities="${applicationId}.BaseComponent.ContextProvider"
25+
android:exported="false"
26+
android:initOrder="10000" />
27+
</application>
328
</manifest>
Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,57 @@
11
package io.trtc.tuikit.atomicx
22

33
import io.flutter.embedding.engine.plugins.FlutterPlugin
4-
import io.flutter.plugin.common.MethodCall
5-
import io.flutter.plugin.common.MethodChannel
6-
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
7-
import io.flutter.plugin.common.MethodChannel.Result
4+
import io.flutter.embedding.engine.plugins.activity.ActivityAware
5+
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
6+
import io.trtc.tuikit.atomicx.permission.Permission
7+
import io.trtc.tuikit.atomicx.albumpicker.AlbumPickerPlugin
88

99
/** Atomic_xPlugin */
10-
class AtomicXPlugin: FlutterPlugin, MethodCallHandler {
11-
/// The MethodChannel that will the communication between Flutter and native Android
12-
///
13-
/// This local reference serves to register the plugin with the Flutter Engine and unregister it
14-
/// when the Flutter Engine is detached from the Activity
15-
private lateinit var channel : MethodChannel
10+
class AtomicXPlugin: FlutterPlugin, ActivityAware {
11+
companion object {
12+
private const val TAG = "AtomicXPlugin"
13+
}
14+
15+
private var permission: Permission? = null
16+
private var pipManager: PictureInPictureManager? = null
17+
private var albumPickerPlugin: AlbumPickerPlugin? = null
1618

1719
override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
18-
channel = MethodChannel(flutterPluginBinding.binaryMessenger, "atomic_x")
19-
channel.setMethodCallHandler(this)
20-
}
20+
// Register permission module
21+
permission = Permission(flutterPluginBinding)
2122

22-
override fun onMethodCall(call: MethodCall, result: Result) {
23-
if (call.method == "getPlatformVersion") {
24-
result.success("Android ${android.os.Build.VERSION.RELEASE}")
25-
} else {
26-
result.notImplemented()
27-
}
23+
// Register picture in picture module
24+
pipManager = PictureInPictureManager(flutterPluginBinding)
25+
// Register AlbumPickerPlugin module
26+
albumPickerPlugin = AlbumPickerPlugin(flutterPluginBinding)
2827
}
2928

3029
override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
31-
channel.setMethodCallHandler(null)
30+
permission?.dispose()
31+
permission = null
32+
pipManager?.dispose()
33+
pipManager = null
34+
albumPickerPlugin?.dispose()
35+
albumPickerPlugin = null
36+
}
37+
38+
override fun onAttachedToActivity(binding: ActivityPluginBinding) {
39+
pipManager?.attachToActivity(binding.activity)
40+
permission?.onAttachedToActivity(binding)
41+
}
42+
43+
override fun onDetachedFromActivityForConfigChanges() {
44+
pipManager?.updateActivity(null)
45+
permission?.onDetachedFromActivityForConfigChanges()
46+
}
47+
48+
override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) {
49+
pipManager?.updateActivity(binding.activity)
50+
permission?.onReattachedToActivityForConfigChanges(binding)
51+
}
52+
53+
override fun onDetachedFromActivity() {
54+
pipManager?.detachFromActivity()
55+
permission?.onDetachedFromActivity()
3256
}
3357
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package io.trtc.tuikit.atomicx.albumpicker
2+
3+
import android.os.Parcelable
4+
import io.trtc.tuikit.atomicx.albumpicker.impl.AlbumPickerImpl
5+
import io.trtc.tuikit.atomicx.albumpicker.interfaces.AlbumPickerListener
6+
import kotlinx.parcelize.Parcelize
7+
8+
enum class PickMode {
9+
IMAGE,
10+
VIDEO,
11+
ALL
12+
}
13+
14+
enum class PickMediaType {
15+
IMAGE,
16+
VIDEO,
17+
GIF
18+
}
19+
20+
data class AlbumPickerModel(
21+
var id: ULong,
22+
val mediaPath: String? = null,
23+
val mediaType: PickMediaType = PickMediaType.IMAGE,
24+
val videoThumbnailPath: String? = null,
25+
val isOrigin: Boolean = false
26+
)
27+
28+
@Parcelize
29+
data class AlbumPickerConfig(
30+
var pickMode: PickMode = PickMode.ALL,
31+
var maxCount: Int = 99,
32+
var gridCount: Int = 4,
33+
var primaryColor: Int = -1
34+
) : Parcelable
35+
36+
interface AbstractAlbumPicker {
37+
fun pickMedia(config: AlbumPickerConfig, listener: AlbumPickerListener)
38+
}
39+
40+
object AlbumPicker {
41+
private val instance = AlbumPickerImpl()
42+
43+
fun pickMedia(config: AlbumPickerConfig = AlbumPickerConfig(), listener: AlbumPickerListener) {
44+
instance.pickMedia(config, listener)
45+
}
46+
}

0 commit comments

Comments
 (0)