Forráskód Böngészése

remove common editor backend interactive interface from common library --从公共库去掉common editor 后台交互接口 (resolve: #14590)
implement common editor backend interactive interface -- 实现common editor 后台交互接口 (resolve: #14591)
Editor save prompt has been logged in other devices -- editor save 提示已在其他设备登陆(resolve: #14592)
Add a log output function to the common library to solve the problem of incomplete system log output -- 公共库添加日志输出函数,解决系统日志输出不全的问题(resolve: #14594)

Ray Zhang 4 éve
szülő
commit
97e0749a1a

+ 66 - 61
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/utils/Network.java

@@ -199,8 +199,11 @@ public class Network {
             // 获取返回数据
             int responseCode = connection.getResponseCode();
 
-            Log.i(TAG, "getJson: " + "Request " + url + " Get Response Code" + responseCode);
-            
+            Log.d(TAG, "getJson: " + "Request " + url + " Get Response Code" + responseCode);
+
+
+
+
             if(connection.getResponseCode() == 200){
                 InputStream is = connection.getInputStream();
 
@@ -214,7 +217,9 @@ public class Network {
                 }
 
                 Log.d(TAG, "Response: content begin");
-                Log.d(TAG, sb.toString());
+
+                dbgUtil.Logd(TAG,sb.toString());
+//                Log.d(TAG, sb.toString());
                 Log.d(TAG, "Response: content end");
 
                 if (sb.length() <= 0)
@@ -1020,63 +1025,63 @@ public class Network {
             return null;
         }
     }
-    public static JSONObject submit_editor(String request_url,Bundle params) {
-
-        if (request_url == null || request_url.isEmpty() || params == null) {
-            return null;
-        }
-
-        String json_string = getJson(request_url,params,REQUEST_TIMEOUT);
-
-        if (json_string == null || json_string.isEmpty()) {
-            json_string = "{\"result\" : \"1\"}";
-        }
-
-        try {
-            return new JSONObject(json_string);
-        } catch (JSONException e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-    public static JSONObject save_editor(String request_url,Bundle params) {
-
-        if (request_url == null || request_url.isEmpty() || params == null) {
-            return null;
-        }
-
-        String json_string = getJson(request_url,params,REQUEST_TIMEOUT);
-
-        if (json_string == null || json_string.isEmpty()) {
-            json_string = "{\"result\" : \"1\"}";
-        }
-
-        try {
-            return new JSONObject(json_string);
-        } catch (JSONException e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-    public static JSONObject request_editor(String request_url,Bundle params) {
-
-        if (request_url == null || request_url.isEmpty() || params == null) {
-            return null;
-        }
-
-        String json_string = getJson(request_url,params,REQUEST_TIMEOUT);
-
-        if (json_string == null || json_string.isEmpty()) {
-            json_string = "{\"result\" : \"1\"}";
-        }
-
-        try {
-            return new JSONObject(json_string);
-        } catch (JSONException e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
+//    public static JSONObject submit_editor(String request_url,Bundle params) {
+//
+//        if (request_url == null || request_url.isEmpty() || params == null) {
+//            return null;
+//        }
+//
+//        String json_string = getJson(request_url,params,REQUEST_TIMEOUT);
+//
+//        if (json_string == null || json_string.isEmpty()) {
+//            json_string = "{\"result\" : \"1\"}";
+//        }
+//
+//        try {
+//            return new JSONObject(json_string);
+//        } catch (JSONException e) {
+//            e.printStackTrace();
+//            return null;
+//        }
+//    }
+//    public static JSONObject save_editor(String request_url,Bundle params) {
+//
+//        if (request_url == null || request_url.isEmpty() || params == null) {
+//            return null;
+//        }
+//
+//        String json_string = getJson(request_url,params,REQUEST_TIMEOUT);
+//
+//        if (json_string == null || json_string.isEmpty()) {
+//            json_string = "{\"result\" : \"1\"}";
+//        }
+//
+//        try {
+//            return new JSONObject(json_string);
+//        } catch (JSONException e) {
+//            e.printStackTrace();
+//            return null;
+//        }
+//    }
+//
+//    public static JSONObject request_editor(String request_url,Bundle params) {
+//
+//        if (request_url == null || request_url.isEmpty() || params == null) {
+//            return null;
+//        }
+//
+//        String json_string = getJson(request_url,params,REQUEST_TIMEOUT);
+//
+//        if (json_string == null || json_string.isEmpty()) {
+//            json_string = "{\"result\" : \"1\"}";
+//        }
+//
+//        try {
+//            return new JSONObject(json_string);
+//        } catch (JSONException e) {
+//            e.printStackTrace();
+//            return null;
+//        }
+//    }
 
 }

+ 22 - 1
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/utils/dbgUtil.java

@@ -198,7 +198,28 @@ public class dbgUtil
 	public static void Logd(String tag, String msg)
 	{
 		String pos = getTracePos();
-		Log.d(tag, msg + pos);
+
+
+
+		if (msg.length() > 4000) {
+			Log.d(tag,  pos);
+			Log.d(tag, "value.length = " + msg.length());
+			// integer division
+			int chunkCount = msg.length() / 4000;
+			for (int i = 0; i <= chunkCount; i++) {
+				int max = 4000 * (i + 1);
+				if (max >= msg.length()) {
+					Log.d(tag, "chunk " + i + " of " + chunkCount + ":" + msg.substring(4000 * i));
+				} else {
+					Log.d(tag, "chunk " + i + " of " + chunkCount + ":" + msg.substring(4000 * i, max));
+				}
+			}
+		} else {
+			Log.d(tag,  pos);
+			Log.d(tag, msg);
+		}
+
+
 	}
 
 	// public static void Log(int type, String tag, String msg)

+ 41 - 1
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/dataprovider/OnlineDataProvider.java

@@ -52,7 +52,7 @@ import com.usai.ratradefiling.dataprovider.RADataProvider;
 
 public class OnlineDataProvider extends com.usai.redant.rautils.utils.Network
 {
-	public static final String SHORT_VER ="2.92";
+	public static final String SHORT_VER ="1.1";
 
 	public static final int		BEHAVIOR_SEARCH					= 0;
 	public static final int		BEHAVIOR_RESULT					= 1;
@@ -147,6 +147,46 @@ public class OnlineDataProvider extends com.usai.redant.rautils.utils.Network
 
 		return handleJson(jstr);
 	}
+
+	public static JSONObject request_submit_editor(String request_url,Bundle params) {
+
+		if (request_url == null || request_url.isEmpty() || params == null) {
+			return null;
+		}
+
+		String json_string = getJson(request_url,params);
+
+		if (json_string == null || json_string.isEmpty()) {
+			json_string = "{\"result\" : \"1\"}";
+		}
+
+		try {
+			return new JSONObject(json_string);
+		} catch (JSONException e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+	public static JSONObject request_save_editor(String request_url,Bundle params) {
+
+		if (request_url == null || request_url.isEmpty() || params == null) {
+			return null;
+		}
+
+		String json_string = getJson(request_url,params);
+
+		if (json_string == null || json_string.isEmpty()) {
+			json_string = "{\"result\" : \"1\"}";
+		}
+
+		try {
+			return new JSONObject(json_string);
+		} catch (JSONException e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+
 	public static JSONObject request_login(String user, String password)
 	{
 

+ 2 - 2
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/dataprovider/RADataProvider.java

@@ -45,7 +45,7 @@ public class RADataProvider {
             return OfflineDataProvider.submit_editor(url,param);
         }
         else {
-            return OnlineDataProvider.submit_editor(url,param);
+            return OnlineDataProvider.request_submit_editor(url,param);
         }
     }
     public static JSONObject save_editor(String url,Bundle param)
@@ -55,7 +55,7 @@ public class RADataProvider {
             return OfflineDataProvider.save_editor(url,param);
         }
         else {
-            return OnlineDataProvider.save_editor(url,param);
+            return OnlineDataProvider.request_save_editor(url,param);
         }
     }