浏览代码

功能优化

guilin 1 月之前
父节点
当前提交
ecf6b0c8d4

+ 13 - 5
app/src/main/java/com/fxy/base/StorageApplication.java

@@ -281,11 +281,19 @@ public class StorageApplication extends Application {
                         .logFlattener(new DefaultFlattener())                       // 指定日志平铺器,默认为 DefaultFlattener
                         .build();
 
-        XLog.init(                                                 // 初始化 XLog
-                config,                                                // 指定日志配置,如果不指定,会默认使用 new LogConfiguration.Builder().build()
-                androidPrinter,                                        // 添加任意多的打印器。如果没有添加任何打印器,会默认使用 AndroidPrinter(Android)/ConsolePrinter(java)
-                consolePrinter,
-                filePrinter);
+        if (BuildConfig.DEBUG){
+            XLog.init(                                                 // 初始化 XLog
+                    config,                                                // 指定日志配置,如果不指定,会默认使用 new LogConfiguration.Builder().build()
+                    androidPrinter,                                        // 添加任意多的打印器。如果没有添加任何打印器,会默认使用 AndroidPrinter(Android)/ConsolePrinter(java)
+                    consolePrinter,
+                    filePrinter);
+        }else{
+            XLog.init(                                                 // 初始化 XLog
+                    config,                                                // 指定日志配置,如果不指定,会默认使用 new LogConfiguration.Builder().build()
+                    androidPrinter,                                // 添加任意多的打印器。如果没有添加任何打印器,会默认使用 AndroidPrinter(Android)/ConsolePrinter(java)
+                    filePrinter);
+        }
+
     }
 
 

+ 1 - 1
app/src/main/java/com/fxy/common/AsyncPictureSelector.java

@@ -505,7 +505,7 @@ public class AsyncPictureSelector {
             takePhotosRealm.setUniqueTag(uniqueTag);
 
 
-            String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+RxTimeTool.getYestoryDate("yyyyMMd")+"/";
+            String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+RxTimeTool.getYestoryDate("yyyyMMdd")+"/";
             String urlPath = isCompress && localMedia.getCompressPath()!=null ? localMedia.getCompressPath() :  localMedia.getPath();
             String fileSuffix = urlPath.lastIndexOf(".")>-1 ? urlPath.substring(urlPath.lastIndexOf(".")) : "";
             String fileName = UUID.randomUUID().toString() + fileSuffix;

+ 1 - 1
app/src/main/java/com/fxy/common/AsyncPictureUpload.java

@@ -357,7 +357,7 @@ public class AsyncPictureUpload {
 
 
         }else{
-            path_prefix = resourcePrefix + "/android/" + mPrefix + "/" + RxTimeTool.getYestoryDate("yyyyMMd") + "/";
+            path_prefix = resourcePrefix + "/android/" + mPrefix + "/" + RxTimeTool.getYestoryDate("yyyyMMdd") + "/";
             String fileSuffix = urlPath.lastIndexOf(".")>-1 ? urlPath.substring(urlPath.lastIndexOf(".")) : "";
             fileName = UUID.randomUUID().toString() + fileSuffix;
         }

+ 2 - 2
app/src/main/java/com/fxy/common/FiledUpload.java

@@ -182,7 +182,7 @@ public class FiledUpload {
 
         });
 
-        String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+ RxTimeTool.getYestoryDate("yyyyMMd")+"/";
+        String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+ RxTimeTool.getYestoryDate("yyyyMMdd")+"/";
         if (resourceType.equals("tencent")){
             if (cosService==null){
 
@@ -208,7 +208,7 @@ public class FiledUpload {
      */
     public void filedUpload(String localPath,Handler handler,int sort){
         String fileName = getFileName(localPath);
-        String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+ RxTimeTool.getYestoryDate("yyyyMMd")+"/";
+        String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+ RxTimeTool.getYestoryDate("yyyyMMdd")+"/";
         if (resourceType.equals("tencent")){
             if (cosService==null){
                 cosService  = new CosService(mActivity.getBaseContext(),path_prefix);

+ 7 - 0
app/src/main/java/com/fxy/common/OssService.java

@@ -107,6 +107,7 @@ public class OssService {
                     }
                 } catch (Exception e) {
                     e.printStackTrace();
+                    XLog.e("获取令牌失败",e.getMessage());
                 }
                 return null;
             }
@@ -249,6 +250,8 @@ public class OssService {
 
                     XLog.e("上传失败,本地文件"+request.getUploadFilePath()+"上传目录"+request.getObjectKey());
 
+
+
                     if (clientExcepion != null) {
                         // 本地异常,如网络异常等。
                         msg.obj = "网络异常,请稍后...";
@@ -256,6 +259,10 @@ public class OssService {
                         uploadHandler.sendMessage(msg);
                         XLog.e("RawMessage", clientExcepion.getMessage());
                         XLog.e(clientExcepion);
+
+                        if (clientExcepion.getMessage().equals("Can't get a federation token")){
+                            creationOss();
+                        }
                     }
                     if (serviceException != null) {
                         msg.obj = "服务异常,请稍后...";

+ 1 - 1
app/src/main/java/com/fxy/common/PictureSelectorUpload.java

@@ -462,7 +462,7 @@ public class PictureSelectorUpload {
 
         String fileName= UUID.randomUUID().toString() + fileSuffix;
 
-        String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+RxTimeTool.getYestoryDate("yyyyMMd")+"/";
+        String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+RxTimeTool.getYestoryDate("yyyyMMdd")+"/";
         if (resourceType.equals("tencent")){
             if (cosService==null){
 

+ 1 - 1
app/src/main/res/layout/fragment_homepager.xml

@@ -278,7 +278,7 @@
                            style="@style/ImageViewWithTextStyle.FontSize"
                            android:drawableTop="@drawable/ic_putin_photos"
                            android:drawablePadding="5dp"
-                           android:text="打板" />
+                           android:text="打板操作" />
 
 
                     </TableRow>