@andycui/react-native-get-music-files 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +226 -0
- package/android/build.gradle +127 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/turbosongs/BundlePair.kt +95 -0
- package/android/src/main/java/com/turbosongs/TurboSongsModule.kt +498 -0
- package/android/src/main/java/com/turbosongs/TurboSongsPackage.kt +35 -0
- package/android/src/newarch/TurboSongsSpec.kt +7 -0
- package/android/src/oldarch/TurboSongsSpec.kt +14 -0
- package/ios/TurboSongs.h +12 -0
- package/ios/TurboSongs.mm +420 -0
- package/package.json +171 -0
- package/react-native-turbo-songs.podspec +41 -0
- package/src/NativeTurboSongs.ts +60 -0
- package/src/index.tsx +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Dante Cervantes
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# react-native-get-music-files
|
|
2
|
+
React Native package to get music files from local and sd for iOS and Android
|
|
3
|
+
# What does this package?
|
|
4
|
+
|
|
5
|
+
This package allow you to get music files from Android & iOS with following properties:
|
|
6
|
+
|
|
7
|
+
* Title
|
|
8
|
+
* Author
|
|
9
|
+
* Album
|
|
10
|
+
* Duration
|
|
11
|
+
* FilePath
|
|
12
|
+
* Cover
|
|
13
|
+
* Duration
|
|
14
|
+
* Genre
|
|
15
|
+
## Getting started
|
|
16
|
+
|
|
17
|
+
`$ yarn add react-native-get-music-files`
|
|
18
|
+
or
|
|
19
|
+
`$ yarn add https://github.com/cinder92/react-native-get-music-files.git`
|
|
20
|
+
|
|
21
|
+
#### iOS
|
|
22
|
+
|
|
23
|
+
1. Add in `info.plist` following permission
|
|
24
|
+
```
|
|
25
|
+
<key>NSAppleMusicUsageDescription</key>
|
|
26
|
+
<string>This permission is not needed by the app, but it is required by an underlying API. If you see this dialog, contact us.</string>
|
|
27
|
+
```
|
|
28
|
+
2. Add MediaPlayer.framework under build settings in Xcode
|
|
29
|
+
3. Ensure all your music files are sync from a computer to a real iPhone device (this package does not work in simulators)
|
|
30
|
+
|
|
31
|
+
#### Android
|
|
32
|
+
|
|
33
|
+
1. Navigate to `android/app/src/main/AndroidManifest.xml` and ensure to add this permission
|
|
34
|
+
```
|
|
35
|
+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
|
36
|
+
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/> <-- Add this for Android 13 and newer versions
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Before usage
|
|
40
|
+
|
|
41
|
+
As this package needs permissions from the device, please ensure that you asked for permissions before run any of this package functions.
|
|
42
|
+
|
|
43
|
+
## Constants
|
|
44
|
+
```js
|
|
45
|
+
SortSongFields {
|
|
46
|
+
TITLE, DURATION, ARTIST, GENRE, ALBUM
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
SortSongOrder {
|
|
50
|
+
ASC, DESC
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Usage
|
|
55
|
+
```js
|
|
56
|
+
|
|
57
|
+
import { getAll, getAlbums, searchSongs, SortSongFields, SortSongOrder } from "react-native-get-music-files";
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
const songsOrError = await getAll({
|
|
61
|
+
limit: 20,
|
|
62
|
+
offset: 0,
|
|
63
|
+
coverQuality: 50,
|
|
64
|
+
minSongDuration: 1000,
|
|
65
|
+
sortBy: SortSongFields.TITLE,
|
|
66
|
+
sortOrder: SortSongOrder.DESC,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// error
|
|
70
|
+
if (typeof songsOrError === 'string') {
|
|
71
|
+
// do something with the error
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const albumsOrError = await getAlbums({
|
|
76
|
+
limit: 10,
|
|
77
|
+
offset: 0,
|
|
78
|
+
coverQuality: 50,
|
|
79
|
+
artist: 'Rihanna',
|
|
80
|
+
sortBy: SortSongFields.ALBUM,
|
|
81
|
+
sortOrder: SortSongOrder.DESC,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// error
|
|
85
|
+
if (typeof albumsOrError === 'string') {
|
|
86
|
+
// do something with the error
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const resultsOrError = await searchSongs({
|
|
91
|
+
limit: 10,
|
|
92
|
+
offset: 0,
|
|
93
|
+
coverQuality: 50,
|
|
94
|
+
searchBy: '...',
|
|
95
|
+
sortBy: SortSongFields.DURATION,
|
|
96
|
+
sortOrder: SortSongOrder.DESC,
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// error
|
|
100
|
+
if (typeof resultsOrError === 'string') {
|
|
101
|
+
// do something with the error
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
MusicFiles returns an array of objects where you can loop, something like this.
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
[
|
|
110
|
+
{
|
|
111
|
+
title : "La danza del fuego",
|
|
112
|
+
author : "Mago de Oz",
|
|
113
|
+
album : "Finisterra",
|
|
114
|
+
genre : "Folk",
|
|
115
|
+
duration : 209120,
|
|
116
|
+
cover : "data:image/jpeg;base64, ....",
|
|
117
|
+
url : "/sdcard/0/la-danza-del-fuego.mp3"
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
#### Return Types
|
|
124
|
+
* Album
|
|
125
|
+
|
|
126
|
+
Type: Object
|
|
127
|
+
|
|
128
|
+
| property | type | description |
|
|
129
|
+
|---------------: |:--------: |------------------------------- |
|
|
130
|
+
| album | string | album name |
|
|
131
|
+
| artist | string | author |
|
|
132
|
+
| cover | string | base64 of the artwork |
|
|
133
|
+
| numberOfSongs | number | number of songs in this album |
|
|
134
|
+
|
|
135
|
+
* Song
|
|
136
|
+
|
|
137
|
+
| property | type | description |
|
|
138
|
+
|--------------- |-------- |------------------------------- |
|
|
139
|
+
| title | string | title |
|
|
140
|
+
| artist | string | artist |
|
|
141
|
+
| album | string | album name |
|
|
142
|
+
| duration | string | duration in ms |
|
|
143
|
+
| genre | string | genre |
|
|
144
|
+
| cover | string | base64 of the artwork |
|
|
145
|
+
| url | string | path of the song |
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
#### Methods
|
|
149
|
+
|
|
150
|
+
* ##### getAlbums
|
|
151
|
+
|
|
152
|
+
`async getAlbums(options) → {Promise<Album[] | string>}`
|
|
153
|
+
|
|
154
|
+
* options
|
|
155
|
+
|
|
156
|
+
Type: Object
|
|
157
|
+
|
|
158
|
+
| property | type | description |
|
|
159
|
+
|--------------- |-------- |------------------------------- |
|
|
160
|
+
| artist | string | required |
|
|
161
|
+
| limit | number | optional |
|
|
162
|
+
| offset | number | required if limit set |
|
|
163
|
+
| coverQuality | number | optional |
|
|
164
|
+
| sortBy | string | optional |
|
|
165
|
+
| sortOrder | string | optional |
|
|
166
|
+
|
|
167
|
+
* returns
|
|
168
|
+
|
|
169
|
+
Type: Albums
|
|
170
|
+
Error: string
|
|
171
|
+
* ##### getAll
|
|
172
|
+
|
|
173
|
+
`async getAll(options) → {Promise<Song[] | string>}`
|
|
174
|
+
|
|
175
|
+
* options
|
|
176
|
+
|
|
177
|
+
Type: Object
|
|
178
|
+
|
|
179
|
+
| property | type | description |
|
|
180
|
+
|--------------- |-------- |------------------------------- |
|
|
181
|
+
| limit | number | optional |
|
|
182
|
+
| offset | number | required if limit set |
|
|
183
|
+
| coverQuality | string | optional |
|
|
184
|
+
| minSongDuration | number | optional |
|
|
185
|
+
| sortBy | string | optional |
|
|
186
|
+
| sortOrder | string | optional |
|
|
187
|
+
|
|
188
|
+
* returns
|
|
189
|
+
|
|
190
|
+
Type: Song
|
|
191
|
+
Error: string
|
|
192
|
+
* ##### searchSongs
|
|
193
|
+
|
|
194
|
+
`async searchSongs(options) → { Promise<Song[] | string> }`
|
|
195
|
+
|
|
196
|
+
* options
|
|
197
|
+
|
|
198
|
+
Type: Object
|
|
199
|
+
|
|
200
|
+
| property | type | description |
|
|
201
|
+
|--------------- |-------- |------------------------------- |
|
|
202
|
+
| searchBy | string | required |
|
|
203
|
+
| limit | number | optional |
|
|
204
|
+
| offset | number | required if limit set |
|
|
205
|
+
| coverQuality | number | optional |
|
|
206
|
+
| sortBy | string | optional |
|
|
207
|
+
| sortOrder | string | optional |
|
|
208
|
+
|
|
209
|
+
* returns
|
|
210
|
+
Type: Song
|
|
211
|
+
Error: string
|
|
212
|
+
|
|
213
|
+
## Usage:
|
|
214
|
+
|
|
215
|
+
[example app](https://github.com/cinder92/react-native-get-music-files/tree/master/example)
|
|
216
|
+
|
|
217
|
+
# Version Changes
|
|
218
|
+
|
|
219
|
+
# 2.2
|
|
220
|
+
|
|
221
|
+
- [x] Android & iOS compatible
|
|
222
|
+
- [x] Retro-compat turbo module
|
|
223
|
+
- [x] Limit & offset to paginate results
|
|
224
|
+
- [x] Compatible with `https://github.com/zoontek/react-native-permissions`
|
|
225
|
+
|
|
226
|
+
PR are welcome!
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
+
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["TurboSongs_kotlinVersion"]
|
|
4
|
+
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
mavenCentral()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
dependencies {
|
|
11
|
+
classpath "com.android.tools.build:gradle:7.2.1"
|
|
12
|
+
// noinspection DifferentKotlinGradleVersion
|
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def isNewArchitectureEnabled() {
|
|
18
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
apply plugin: "com.android.library"
|
|
22
|
+
apply plugin: "kotlin-android"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
|
|
26
|
+
|
|
27
|
+
if (isNewArchitectureEnabled()) {
|
|
28
|
+
apply plugin: "com.facebook.react"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
def getExtOrDefault(name) {
|
|
32
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["TurboSongs_" + name]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
def getExtOrIntegerDefault(name) {
|
|
36
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["TurboSongs_" + name]).toInteger()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
def supportsNamespace() {
|
|
40
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
41
|
+
def major = parsed[0].toInteger()
|
|
42
|
+
def minor = parsed[1].toInteger()
|
|
43
|
+
|
|
44
|
+
// Namespace support was added in 7.3.0
|
|
45
|
+
if (major == 7 && minor >= 3) {
|
|
46
|
+
return true
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return major >= 8
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
android {
|
|
53
|
+
if (supportsNamespace()) {
|
|
54
|
+
namespace "com.turbosongs"
|
|
55
|
+
|
|
56
|
+
sourceSets {
|
|
57
|
+
main {
|
|
58
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
64
|
+
|
|
65
|
+
defaultConfig {
|
|
66
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
67
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
68
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
buildFeatures {
|
|
73
|
+
buildConfig true
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
buildTypes {
|
|
77
|
+
release {
|
|
78
|
+
minifyEnabled false
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
lintOptions {
|
|
83
|
+
disable "GradleCompatible"
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
compileOptions {
|
|
87
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
88
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
sourceSets {
|
|
92
|
+
main {
|
|
93
|
+
if (isNewArchitectureEnabled()) {
|
|
94
|
+
java.srcDirs += [
|
|
95
|
+
"src/newarch",
|
|
96
|
+
// This is needed to build Kotlin project with NewArch enabled
|
|
97
|
+
"${project.buildDir}/generated/source/codegen/java"
|
|
98
|
+
]
|
|
99
|
+
} else {
|
|
100
|
+
java.srcDirs += ["src/oldarch"]
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
repositories {
|
|
107
|
+
mavenCentral()
|
|
108
|
+
google()
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
112
|
+
|
|
113
|
+
dependencies {
|
|
114
|
+
// For < 0.71, this will be from the local maven repo
|
|
115
|
+
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
116
|
+
//noinspection GradleDynamicVersion
|
|
117
|
+
implementation "com.facebook.react:react-native:+"
|
|
118
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (isNewArchitectureEnabled()) {
|
|
122
|
+
react {
|
|
123
|
+
jsRootDir = file("../src/")
|
|
124
|
+
libraryName = "TurboSongs"
|
|
125
|
+
codegenJavaPackageName = "com.turbosongs"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
|
|
2
|
+
package com.turbosongs
|
|
3
|
+
|
|
4
|
+
import android.os.Bundle
|
|
5
|
+
|
|
6
|
+
class BundlePair(
|
|
7
|
+
private val block: (Bundle) -> Unit
|
|
8
|
+
) {
|
|
9
|
+
fun apply(bundle: Bundle) = block(bundle)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
inline fun bundle(initFun: Bundle.() -> Unit) = Bundle().apply(initFun)
|
|
13
|
+
inline fun bundleOf(initFun: (Bundle) -> Unit) =
|
|
14
|
+
Bundle().also(initFun)
|
|
15
|
+
|
|
16
|
+
fun bundleOf(vararg pairs: BundlePair) = bundle {
|
|
17
|
+
pairs.forEach { it.apply(this) }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
infix fun String.bundleTo(value: Boolean) = BundlePair { it[this] = value }
|
|
21
|
+
infix fun String.bundleTo(value: Byte) = BundlePair { it[this] = value }
|
|
22
|
+
infix fun String.bundleTo(value: Short) = BundlePair { it[this] = value }
|
|
23
|
+
infix fun String.bundleTo(value: Int) = BundlePair { it[this] = value }
|
|
24
|
+
infix fun String.bundleTo(value: Long) = BundlePair { it[this] = value }
|
|
25
|
+
infix fun String.bundleTo(value: Float) = BundlePair { it[this] = value }
|
|
26
|
+
infix fun String.bundleTo(value: Double) = BundlePair { it[this] = value }
|
|
27
|
+
infix fun String.bundleTo(value: Char) = BundlePair { it[this] = value }
|
|
28
|
+
infix fun String.bundleTo(value: CharSequence) = BundlePair { it[this] = value }
|
|
29
|
+
infix fun String.bundleTo(value: String) = BundlePair { it[this] = value }
|
|
30
|
+
infix fun String.bundleTo(value: Bundle) = BundlePair { it[this] = value }
|
|
31
|
+
/*infix fun String.bundleTo(value: Parcelable) = BundlePair { it[this] = value }
|
|
32
|
+
infix fun String.bundleTo(value: Serializable) = BundlePair { it[this] = value }*/
|
|
33
|
+
|
|
34
|
+
/*@RequiresApi(18)
|
|
35
|
+
infix fun String.bundleTo(value: Binder) = BundlePair { it[this] = value }
|
|
36
|
+
@RequiresApi(21)
|
|
37
|
+
infix fun String.bundleTo(value: Size) = BundlePair { it[this] = value }
|
|
38
|
+
@RequiresApi(21)
|
|
39
|
+
infix fun String.bundleTo(value: SizeF) = BundlePair { it[this] = value }*/
|
|
40
|
+
|
|
41
|
+
infix fun String.bundleTo(value: BooleanArray) = BundlePair { it[this] = value }
|
|
42
|
+
infix fun String.bundleTo(value: ByteArray) = BundlePair { it[this] = value }
|
|
43
|
+
infix fun String.bundleTo(value: ShortArray) = BundlePair { it[this] = value }
|
|
44
|
+
infix fun String.bundleTo(value: IntArray) = BundlePair { it[this] = value }
|
|
45
|
+
infix fun String.bundleTo(value: LongArray) = BundlePair { it[this] = value }
|
|
46
|
+
infix fun String.bundleTo(value: FloatArray) = BundlePair { it[this] = value }
|
|
47
|
+
infix fun String.bundleTo(value: DoubleArray) = BundlePair { it[this] = value }
|
|
48
|
+
infix fun String.bundleTo(value: CharArray) = BundlePair { it[this] = value }
|
|
49
|
+
infix fun String.bundleTo(value: Array<out CharSequence>) = BundlePair { it[this] = value }
|
|
50
|
+
infix fun String.bundleTo(value: Array<out String>) = BundlePair { it[this] = value }
|
|
51
|
+
//infix fun String.bundleTo(value: Array<out Parcelable>) = BundlePair { it[this] = value }
|
|
52
|
+
|
|
53
|
+
//infix fun String.bundleTo(value: SparseArray<out Parcelable>) = BundlePair { it[this] = value }
|
|
54
|
+
|
|
55
|
+
//for null
|
|
56
|
+
infix fun String.bundleTo(n: Void?) = BundlePair { it[this] = null }
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
operator fun Bundle.set(key: String, value: Boolean) = putBoolean(key, value)
|
|
60
|
+
operator fun Bundle.set(key: String, value: Byte) = putByte(key, value)
|
|
61
|
+
operator fun Bundle.set(key: String, value: Short) = putShort(key, value)
|
|
62
|
+
operator fun Bundle.set(key: String, value: Int) = putInt(key, value)
|
|
63
|
+
operator fun Bundle.set(key: String, value: Long) = putLong(key, value)
|
|
64
|
+
operator fun Bundle.set(key: String, value: Float) = putFloat(key, value)
|
|
65
|
+
operator fun Bundle.set(key: String, value: Double) = putDouble(key, value)
|
|
66
|
+
operator fun Bundle.set(key: String, value: Char) = putChar(key, value)
|
|
67
|
+
operator fun Bundle.set(key: String, value: CharSequence) = putCharSequence(key, value)
|
|
68
|
+
operator fun Bundle.set(key: String, value: String) = putString(key, value)
|
|
69
|
+
operator fun Bundle.set(key: String, value: Bundle) = putBundle(key, value)
|
|
70
|
+
/*operator fun Bundle.set(key: String, value: Parcelable) = putParcelable(key, value)
|
|
71
|
+
operator fun Bundle.set(key: String, value: Serializable) = putSerializable(key, value)*/
|
|
72
|
+
|
|
73
|
+
/*@RequiresApi(18)
|
|
74
|
+
operator fun Bundle.set(key: String, value: Binder) = putBinder(key, value)
|
|
75
|
+
@RequiresApi(21)
|
|
76
|
+
operator fun Bundle.set(key: String, value: Size) = putSize(key, value)
|
|
77
|
+
@RequiresApi(21)
|
|
78
|
+
operator fun Bundle.set(key: String, value: SizeF) = putSizeF(key, value)*/
|
|
79
|
+
|
|
80
|
+
operator fun Bundle.set(key: String, value: BooleanArray) = putBooleanArray(key, value)
|
|
81
|
+
operator fun Bundle.set(key: String, value: ByteArray) = putByteArray(key, value)
|
|
82
|
+
operator fun Bundle.set(key: String, value: ShortArray) = putShortArray(key, value)
|
|
83
|
+
operator fun Bundle.set(key: String, value: IntArray) = putIntArray(key, value)
|
|
84
|
+
operator fun Bundle.set(key: String, value: LongArray) = putLongArray(key, value)
|
|
85
|
+
operator fun Bundle.set(key: String, value: FloatArray) = putFloatArray(key, value)
|
|
86
|
+
operator fun Bundle.set(key: String, value: DoubleArray) = putDoubleArray(key, value)
|
|
87
|
+
operator fun Bundle.set(key: String, value: CharArray) = putCharArray(key, value)
|
|
88
|
+
operator fun Bundle.set(key: String, value: Array<out CharSequence>) = putCharSequenceArray(key, value)
|
|
89
|
+
operator fun Bundle.set(key: String, value: Array<out String>) = putStringArray(key, value)
|
|
90
|
+
//operator fun Bundle.set(key: String, value: Array<out Parcelable>) = putParcelableArray(key, value)
|
|
91
|
+
|
|
92
|
+
//operator fun Bundle.set(key: String, value: SparseArray<out Parcelable>) = putSparseParcelableArray(key, value)
|
|
93
|
+
|
|
94
|
+
//for null
|
|
95
|
+
operator fun Bundle.set(key: String, value: Void?) = putString(key, null)
|