-
-
Notifications
You must be signed in to change notification settings - Fork 302
/
IMediaEngine.java
233 lines (200 loc) · 5.19 KB
/
IMediaEngine.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
package dev.engine.media;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import androidx.fragment.app.Fragment;
import java.util.List;
/**
* detail: Media Selector Engine 接口
* @author Ttt
*/
public interface IMediaEngine<Config extends IMediaEngine.EngineConfig,
Data extends IMediaEngine.EngineData> {
/**
* detail: Media Selector Config
* @author Ttt
*/
class EngineConfig {
}
/**
* detail: Media Selector Data
* @author Ttt
*/
class EngineData {
}
// ==========
// = 配置方法 =
// ==========
/**
* 获取全局配置
* @return 全局配置信息
*/
Config getConfig();
/**
* 设置全局配置
* @param config 新的配置信息
*/
void setConfig(Config config);
// =============
// = 对外公开方法 =
// =============
/**
* 打开相册拍照
* @param activity {@link Activity}
* @return {@code true} success, {@code false} fail
*/
boolean openCamera(Activity activity);
/**
* 打开相册拍照
* @param activity {@link Activity}
* @param config 配置信息
* @return {@code true} success, {@code false} fail
*/
boolean openCamera(
Activity activity,
Config config
);
/**
* 打开相册拍照
* @param fragment {@link Fragment}
* @return {@code true} success, {@code false} fail
*/
boolean openCamera(Fragment fragment);
/**
* 打开相册拍照
* @param fragment {@link Fragment}
* @param config 配置信息
* @return {@code true} success, {@code false} fail
*/
boolean openCamera(
Fragment fragment,
Config config
);
// =
/**
* 打开相册选择
* @param activity {@link Activity}
* @return {@code true} success, {@code false} fail
*/
boolean openGallery(Activity activity);
/**
* 打开相册选择
* @param activity {@link Activity}
* @param config 配置信息
* @return {@code true} success, {@code false} fail
*/
boolean openGallery(
Activity activity,
Config config
);
/**
* 打开相册选择
* @param fragment {@link Fragment}
* @return {@code true} success, {@code false} fail
*/
boolean openGallery(Fragment fragment);
/**
* 打开相册选择
* @param fragment {@link Fragment}
* @param config 配置信息
* @return {@code true} success, {@code false} fail
*/
boolean openGallery(
Fragment fragment,
Config config
);
// =
/**
* 打开相册预览
* @param activity {@link Activity}
* @return {@code true} success, {@code false} fail
*/
boolean openPreview(Activity activity);
/**
* 打开相册预览
* @param activity {@link Activity}
* @param config 配置信息
* @return {@code true} success, {@code false} fail
*/
boolean openPreview(
Activity activity,
Config config
);
/**
* 打开相册预览
* @param fragment {@link Fragment}
* @return {@code true} success, {@code false} fail
*/
boolean openPreview(Fragment fragment);
/**
* 打开相册预览
* @param fragment {@link Fragment}
* @param config 配置信息
* @return {@code true} success, {@code false} fail
*/
boolean openPreview(
Fragment fragment,
Config config
);
// ==========
// = 其他方法 =
// ==========
/**
* 删除缓存文件
* @param context {@link Context}
* @param type 类型 ( 图片、视频 )
*/
void deleteCacheDirFile(
Context context,
int type
);
/**
* 删除全部缓存文件
* @param context {@link Context}
*/
void deleteAllCacheDirFile(Context context);
/**
* 是否图片选择 ( onActivityResult )
* @param requestCode 请求 code
* @param resultCode resultCode
* @return {@code true} success, {@code false} fail
*/
boolean isMediaSelectorResult(
int requestCode,
int resultCode
);
// =
/**
* 获取 Media Selector Data List
* @param intent onActivityResult Intent data
* @return Media Selector Data List
*/
List<Data> getSelectors(Intent intent);
/**
* 获取 Media Selector Uri List
* @param intent onActivityResult Intent data
* @param original 是否使用原图
* @return Media Selector Uri List
*/
List<Uri> getSelectorUris(
Intent intent,
boolean original
);
/**
* 获取 Single Media Selector Data
* @param intent onActivityResult Intent data
* @return Single Media Selector Data
*/
Data getSingleSelector(Intent intent);
/**
* 获取 Single Media Selector Uri
* @param intent onActivityResult Intent data
* @param original 是否使用原图
* @return Single Media Selector Uri
*/
Uri getSingleSelectorUri(
Intent intent,
boolean original
);
}