Commit 417dceb9 by app_dev@sobot.com

去掉Environment.isExternalStorageLegacy()判断

parent 2e800cab
......@@ -257,7 +257,7 @@ public class SobotDownload {
String path;
if (isExitsSdcard()) {
//SD卡已装入
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || Environment.isExternalStorageLegacy()) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
// /storage/emulated/0/sobot/com.sobot.chat.sdktest/cache/
path = getRootDir(context) + File.separator;
} else {
......
......@@ -75,7 +75,7 @@ public class SobotBitmapUtil {
@SuppressWarnings("deprecation")
public static Bitmap compress(String filePath, Context context, boolean isCamera) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || Environment.isExternalStorageLegacy() || isCamera) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || isCamera) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;// 设置后decode图片不会返回一个bitmap对象,但是会将图片的信息封装到Options中
BitmapFactory.decodeFile(filePath, options);
......
......@@ -576,7 +576,7 @@ public class SobotIOUtils {
// * @return
// */
// public static Uri insertFileIntoMediaStore (Context context,String fileName, String fileType, String relativePath) {
// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q||Environment.isExternalStorageLegacy()) {
// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
// return null;
// }
// ContentResolver resolver = context.getContentResolver();
......@@ -599,7 +599,7 @@ public class SobotIOUtils {
// }
// public static Uri findFileExists(Context context,String filePath) {
// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q||Environment.isExternalStorageLegacy()) {
// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
// File file = new File(filePath);
// if (file.exists()) {
// return FileOpenHelper.getUri(SobotApp.getApplicationContext(), filePath);
......
......@@ -131,7 +131,7 @@ public class SobotImageUtils {
}
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
if (!(Build.VERSION.SDK_INT<Build.VERSION_CODES.Q||Environment.isExternalStorageLegacy())){
if (!(Build.VERSION.SDK_INT<Build.VERSION_CODES.Q)){
return uriToFileApiQ(context, uri);
}
// DocumentProvider
......
......@@ -41,7 +41,6 @@ public class SobotPathManager {
}
return instance;
}
public String getRootDir() {
if (mRootPath == null) {
String packageName = mContext != null ? mContext.getPackageName() : "";
......@@ -52,7 +51,7 @@ public class SobotPathManager {
//sdcard/download/xxxx/video
public String getVideoDir() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || Environment.isExternalStorageLegacy()) {
if (Build.VERSION.SDK_INT<Build.VERSION_CODES.Q){
return getRootDir() + File.separator + VIDEO_DIR + File.separator;
} else {
return mContext.getExternalFilesDir(Environment.DIRECTORY_MOVIES).getPath() + File.separator;
......@@ -61,7 +60,7 @@ public class SobotPathManager {
//sdcard/download/xxxx/voice
public String getVoiceDir() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || Environment.isExternalStorageLegacy()) {
if (Build.VERSION.SDK_INT<Build.VERSION_CODES.Q){
return getRootDir() + File.separator + VOICE_DIR + File.separator;
} else {
return mContext.getExternalFilesDir(Environment.DIRECTORY_MUSIC).getPath() + File.separator;
......@@ -71,7 +70,7 @@ public class SobotPathManager {
//sdcard/download/xxxx/pic
public String getPicDir() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || Environment.isExternalStorageLegacy()) {
if (Build.VERSION.SDK_INT<Build.VERSION_CODES.Q){
return getRootDir() + File.separator + PIC_DIR + File.separator;
} else {
return mContext.getExternalFilesDir(Environment.DIRECTORY_PICTURES).getPath() + File.separator;
......@@ -81,7 +80,7 @@ public class SobotPathManager {
//sdcard/download/xxxx/cache
public String getCacheDir() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || Environment.isExternalStorageLegacy()) {
if (Build.VERSION.SDK_INT<Build.VERSION_CODES.Q){
return getRootDir() + File.separator + CACHE_DIR + File.separator;
} else {
return mContext.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS).getPath() + File.separator + CACHE_DIR + File.separator;
......
......@@ -46,7 +46,7 @@ public class SobotSDCardUtils {
String path;
if (isExitsSdcard()) {
//SD卡已装入
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || Environment.isExternalStorageLegacy()) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
// /storage/emulated/0/sobot/com.sobot.chat.sdktest/cache/
path = getRootDir(context) + File.separator;
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment