diff --git a/app/build.gradle b/app/build.gradle index 5ebcda1bf..da1037bb2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId 'com.seafile.seadroid2' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 110 - versionName "2.2.35" + versionCode 111 + versionName "2.2.36" multiDexEnabled true resValue "string", "authorities", applicationId + '.cameraupload.provider' resValue "string", "account_type", "com.seafile.seadroid2.account.api2" @@ -75,7 +75,7 @@ android { } release { signingConfig signingConfigs.release - minifyEnabled false + minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt' applicationVariants.all { variant -> variant.outputs.all { output -> diff --git a/app/src/main/java/com/seafile/seadroid2/SeadroidApplication.java b/app/src/main/java/com/seafile/seadroid2/SeadroidApplication.java index 4f119846f..929cd4c8e 100644 --- a/app/src/main/java/com/seafile/seadroid2/SeadroidApplication.java +++ b/app/src/main/java/com/seafile/seadroid2/SeadroidApplication.java @@ -18,6 +18,7 @@ import com.seafile.seadroid2.data.StorageManager; import com.seafile.seadroid2.gesturelock.AppLockManager; import com.seafile.seadroid2.ui.CustomNotificationBuilder; +import com.seafile.seadroid2.util.Utils; import java.io.File; @@ -39,6 +40,8 @@ public void onCreate() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { initNotificationChannel(); } + + Utils.logPhoneModelInfo(); } @Override diff --git a/app/src/main/java/com/seafile/seadroid2/data/StorageManager.java b/app/src/main/java/com/seafile/seadroid2/data/StorageManager.java index 4c998bc27..5666f4c6d 100644 --- a/app/src/main/java/com/seafile/seadroid2/data/StorageManager.java +++ b/app/src/main/java/com/seafile/seadroid2/data/StorageManager.java @@ -94,7 +94,9 @@ public final static StorageManager getInstance() { private Location buildClassicLocation() { Location classic = new Location(); classic.id = -1; // Android IDs start at 0. so "-1" is safe for us - String rootPath = SeadroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath(); + File[] externalMediaDirs = SeadroidApplication.getAppContext().getExternalMediaDirs(); + String rootPath = externalMediaDirs[0].getAbsolutePath(); +// String rootPath = SeadroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath(); // classic.mediaPath = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Seafile/"); classic.mediaPath = new File(rootPath + "/Seafile/"); classic.cachePath = new File(classic.mediaPath, "cache"); diff --git a/app/src/main/java/com/seafile/seadroid2/gallery/ImageManager.java b/app/src/main/java/com/seafile/seadroid2/gallery/ImageManager.java index 2d306d431..a176856b9 100644 --- a/app/src/main/java/com/seafile/seadroid2/gallery/ImageManager.java +++ b/app/src/main/java/com/seafile/seadroid2/gallery/ImageManager.java @@ -130,7 +130,9 @@ public static List getAutoScannedPathList() { List pathList = Lists.newArrayList(); for (String path : paths) { - String rootPath = SeadroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath(); + File[] externalMediaDirs = SeadroidApplication.getAppContext().getExternalMediaDirs(); + String rootPath = externalMediaDirs[0].getAbsolutePath(); +// String rootPath = SeadroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath(); // String fullPath = Utils.pathJoin(Environment.getExternalStorageDirectory().getAbsolutePath(), path); String fullPath = Utils.pathJoin(rootPath, path); pathList.add(fullPath); diff --git a/app/src/main/java/com/seafile/seadroid2/util/GlideCache.java b/app/src/main/java/com/seafile/seadroid2/util/GlideCache.java index 85a78a2cf..37900f4f7 100644 --- a/app/src/main/java/com/seafile/seadroid2/util/GlideCache.java +++ b/app/src/main/java/com/seafile/seadroid2/util/GlideCache.java @@ -1,7 +1,6 @@ package com.seafile.seadroid2.util; import android.content.Context; -import android.os.Environment; import android.support.annotation.NonNull; import com.bumptech.glide.GlideBuilder; @@ -17,7 +16,9 @@ public class GlideCache extends AppGlideModule { @Override public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) { super.applyOptions(context, builder); - String rootPath = SeadroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath(); +// String rootPath = SeadroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath(); + File[] externalMediaDirs = SeadroidApplication.getAppContext().getExternalMediaDirs(); + String rootPath = externalMediaDirs[0].getAbsolutePath(); File dirPath = new File(rootPath + "/GlideCache/"); builder.setDiskCache(new DiskLruCacheFactory(dirPath.getAbsolutePath(), 1024 * 1024 * 50)); } diff --git a/app/src/main/java/com/seafile/seadroid2/util/SeafileLog.java b/app/src/main/java/com/seafile/seadroid2/util/SeafileLog.java index 86a2b2d11..a73ac2dcb 100644 --- a/app/src/main/java/com/seafile/seadroid2/util/SeafileLog.java +++ b/app/src/main/java/com/seafile/seadroid2/util/SeafileLog.java @@ -1,7 +1,6 @@ package com.seafile.seadroid2.util; import android.content.Context; -import android.os.Environment; import android.util.Log; import com.seafile.seadroid2.SeadroidApplication; @@ -95,7 +94,9 @@ private static void writeLogtoFile(String mylogtype, String tag, String text) { String needWriteFile = logfile.format(nowtime); String needWriteMessage = myLogSdf.format(nowtime) + " " + mylogtype + " " + tag + " " + text; // File dirsFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Seafile/"); - String rootPath = SeadroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath(); +// String rootPath = SeadroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath(); + File[] externalMediaDirs = SeadroidApplication.getAppContext().getExternalMediaDirs(); + String rootPath = externalMediaDirs[0].getAbsolutePath(); File dirsFile = new File(rootPath + "/Seafile/"); if (!dirsFile.exists()) { dirsFile.mkdirs(); @@ -125,7 +126,9 @@ private static void writeLogtoFile(String mylogtype, String tag, String text) { */ public static void delFile() { String needDelFiel = logfile.format(getDateBefore()); - String rootPath = SeadroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath(); + File[] externalMediaDirs = SeadroidApplication.getAppContext().getExternalMediaDirs(); + String rootPath = externalMediaDirs[0].getAbsolutePath(); +// String rootPath = SeadroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath(); // File dirPath = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Seafile/"); File dirPath = new File(rootPath + "/Seafile/"); File file = new File(dirPath, needDelFiel + MYLOGFILENAME);// MYLOG_PATH_SDCARD_DIR @@ -144,4 +147,17 @@ private static Date getDateBefore() { now.set(Calendar.DATE, now.get(Calendar.DATE) - SDCARD_LOG_FILE_SAVE_DAYS); return now.getTime(); } + + public static String getDeviceBrand() { + return android.os.Build.BRAND; + } + + public static String getSystemModel() { + return android.os.Build.MODEL; + } + + public static String getSystemVersion() { + return android.os.Build.VERSION.RELEASE; + } + } diff --git a/app/src/main/java/com/seafile/seadroid2/util/Utils.java b/app/src/main/java/com/seafile/seadroid2/util/Utils.java index 103f731ab..79972e09e 100644 --- a/app/src/main/java/com/seafile/seadroid2/util/Utils.java +++ b/app/src/main/java/com/seafile/seadroid2/util/Utils.java @@ -983,10 +983,14 @@ public static String getRealPathFromURI(Context context, Uri contentUri, String } } + public static void logPhoneModelInfo() { + SeafileLog.d(DEBUG_TAG, "phoneModelInfo-------" + SeafileLog.getDeviceBrand() + "/" + SeafileLog.getSystemModel() + "/" + SeafileLog.getSystemVersion()); + } + public static void utilsLogInfo(boolean b, String info) { if (b) { - Log.d(DEBUG_TAG, info); -// SeafileLog.d(DEBUG_TAG, info); +// Log.d(DEBUG_TAG, info); + SeafileLog.d(DEBUG_TAG, info); } } }