Commit 417dceb9 by app_dev@sobot.com

去掉Environment.isExternalStorageLegacy()判断

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