blob: 2a3d2cec5d2f0a513566dcd2c8aa5cab80f405a4 (
plain)
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
|
package top.trumeet.redirectstorage.wrapper;
import android.os.Build;
import android.os.Environment;
import java.io.File;
/**
* Created by Trumeet on 2017/9/15.
*/
public abstract class AbstractWrapper extends Environment.UserEnvironment {
public static AbstractWrapper getWrapper (Environment.UserEnvironment base,
String customPath,
Integer userId) {
checkNonNull(base);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
checkNonNull(userId);
return new UserEnvironmentWrapperMarshmallow(base,
userId, customPath);
}
return null;
}
private static void checkNonNull (Object object) {
if (object == null)
throw new NullPointerException();
}
final Environment.UserEnvironment mBase;
String mCustomPath;
boolean mEnable = true;
public AbstractWrapper(Environment.UserEnvironment ue,
int userId, String customPath) {
super(userId);
mBase = ue;
mCustomPath = customPath;
}
public boolean isEnable() {
return mEnable;
}
public void setEnable(boolean mEnable) {
this.mEnable = mEnable;
}
public String getCustomPath() {
return mCustomPath;
}
public void setCustomPath(String mCustomPath) {
this.mCustomPath = mCustomPath;
}
public abstract File getRealExternalStorageDirectory ();
}
|