Просмотр исходного кода

The release version cannot display result addational fields -- release 版无法显示result addational fields。(issue50: #14479)

Ray Zhang 4 лет назад
Родитель
Сommit
06c676f2d7

+ 2 - 0
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/base/BaseObject.java

@@ -1,6 +1,7 @@
 package com.usai.redant.rautils.base;
 
 import android.text.TextUtils;
+import android.util.Log;
 
 import org.json.JSONObject;
 
@@ -225,6 +226,7 @@ public class BaseObject extends NoProguard{
 //                        continue;
 //                    }
 
+                    Log.e("DEBUG !!!", "setValuesForKeysWithJSON: "+key );
                     setValue(cls, f, key, value);
                 }
                 cls = cls.getSuperclass();

+ 4 - 4
ApexDrivers/ratradefiling/build.gradle

@@ -33,11 +33,11 @@ android {
         }
         debug {
             debuggable true
-            minifyEnabled true
-            zipAlignEnabled true
-            shrinkResources true
+//            minifyEnabled true
+//            zipAlignEnabled true
+//            shrinkResources true
 
-            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-project.txt'
+//            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-project.txt'
         }
     }
 }

+ 6 - 5
ApexDrivers/ratradefiling/proguard-project.txt

@@ -25,12 +25,12 @@
 
 
 #-keep class com.usai.redant.camera.CameraManager
+-keep class * extends com.usai.redant.rautils.base.NoProguard {*;}
 -keep class javax.naming.*
--keep class * extends com.usai.ratradefiling.base.NoProguard {*;}
--keepclassmembers enum * {
-    public static **[] values();
-    public static ** valueOf(java.lang.String);
-}
+#-keepclassmembers enum * {
+#    public static **[] values();
+#    public static ** valueOf(java.lang.String);
+#}
 
 # Remove all Verbose/Debug logging
 
@@ -42,6 +42,7 @@
     public static *** i(...);
 }
 
+
 ##
 ##-------------------------------------------基本不用动区域----------------------------------------------
 ##

+ 0 - 21
ApexDrivers/ratradefiling/proguard-rules.pro

@@ -1,21 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-#   http://developer.android.com/guide/developing/tools/proguard.html
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-#   public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile

+ 5 - 86
ApexDrivers/ratradefiling/src/debug/assets/searchresult_isf.json

@@ -12,98 +12,19 @@
   "title": "ISF",
   "items": [
     {
-      "bol": "TLKPTAOATL0D199X",
-      "log": "S1,CBP REPLY,SENT",
-
-      "icon": "status_matched",
-      "consignee": "SUNRISE IMPORT&EXPORT LTD",
-      "transactionno": "CLLB98451749890",
-      "rowActionParameters": [
-        "_49208a00d6908828437963179575e3aa"
-      ],
-      "type": 4,
-      "isftype": "10+2"
-    },
-    {
-      "bol": "TLKPTAOATL0D199X",
-      "log": "S1,CBP REPLY,SENT",
-      "addition": [
-        {
-          "name": "Place Of Receipt",
-          "value": "TAICHUNG,TAIWAN"
-        },
-        {
-          "name": "Place Of Delivery",
-          "value": "OAKLAND, CA"
-        }
-      ],
-      "icon": "status_error",
-      "consignee": "SUNRISE IMPORT&EXPORT LTD",
-      "transactionno": "CLLB98451749890",
-      "rowActionParameters": [
-        "_49208a00d6908828437963179575e3aa"
-      ],
-      "type": 4,
-      "isftype": "10+2"
-    },
-    {
-      "bol": "TLKPTAOATL0D199X",
-      "log": "S1,CBP REPLY,SENT",
-      "addition": [
-        {
-          "name": "Place Of Receipt",
-          "value": "TAICHUNG,TAIWAN"
-        },
-        {
-          "name": "Place Of Delivery",
-          "value": "OAKLAND, CA"
-        }
-      ],
-      "icon": "status_error",
-      "consignee": "SUNRISE IMPORT&EXPORT LTD",
-      "transactionno": "CLLB98451749890",
-      "rowActionParameters": [
-        "_49208a00d6908828437963179575e3aa"
-      ],
-      "type": 4,
-      "isftype": "10+2"
-    },
-    {
-      "bol": "TLKPTAOATL0D199X",
-      "log": "S1,CBP REPLY,SENT",
       "addition": [
         {
           "name": "Place Of Receipt",
-          "value": "TAICHUNG,TAIWAN"
+          "value": "NINGBO, PRC"
         },
         {
           "name": "Place Of Delivery",
-          "value": "OAKLAND, CA"
+          "value": "NEW YORK, NY"
         }
       ],
-      "icon": "status_pending",
-      "consignee": "SUNRISE IMPORT&EXPORT LTD",
-      "transactionno": "CLLB98451749890",
-      "rowActionParameters": [
-        "_49208a00d6908828437963179575e3aa"
-      ],
-      "type": 4,
-      "isftype": "10+2"
-    },
-    {
       "bol": "TLKPTAOATL0D199X",
       "log": "S1,CBP REPLY,SENT",
-      "addition": [
-        {
-          "name": "Place Of Receipt",
-          "value": "TAICHUNG,TAIWAN"
-        },
-        {
-          "name": "Place Of Delivery",
-          "value": "OAKLAND, CA"
-        }
-      ],
-      "icon": "status_deleted",
+      "icon": "status_matched",
       "consignee": "SUNRISE IMPORT&EXPORT LTD",
       "transactionno": "CLLB98451749890",
       "rowActionParameters": [
@@ -114,11 +35,9 @@
     }
   ],
   "actions": [
-      "Detail",
-    
+    "Detail",
     "ACE M1 Log",
     "ISF Log"
-    
   ],
   "menu": [
     {
@@ -130,4 +49,4 @@
       "action": "save"
     }
   ]
-}
+}

+ 3 - 17
ApexDrivers/ratradefiling/src/main/AndroidManifest.xml

@@ -2,9 +2,8 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.usai.ratradefiling">
 
-    <uses-permission android:name="android.permission.WAKE_LOCK" />
 
-    <uses-feature android:name="android.hardware.type.watch" />
+
 
     <application
         android:name=".TradeFilingApplication"
@@ -28,27 +27,14 @@
 
 
         <activity android:name=".home.FunctionPanelSettingActivity"></activity>
-        <activity android:name=".home.CompanySelectActivity" /> <!-- <uses-library -->
-        <!-- android:name="com.google.android.wearable" -->
-        <!-- android:required="true" /> -->
-        <!--
-               Set to true if your app is Standalone, that is, it does not require the handheld
-               app to run.
-        -->
-        <meta-data
-            android:name="com.google.android.wearable.standalone"
-            android:value="true" />
+        <activity android:name=".home.CompanySelectActivity" />
+
 
         <activity
             android:name=".signup.SignupActivity"
             android:label="@string/title_activity_signup">
 
-            <!-- <intent-filter> -->
-            <!-- <action android:name="android.intent.action.MAIN" /> -->
-
 
-            <!-- <category android:name="android.intent.category.LAUNCHER" /> -->
-            <!-- </intent-filter> -->
         </activity>
         <activity android:name=".EmptyActivity" />
         <activity

+ 1 - 1
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/Const.java

@@ -4,7 +4,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 public class Const {
 
-    public static final boolean FAKE_DATA = false;
+    public static final boolean FAKE_DATA = true;
 
     public static final int MY_PERMISSIONS_REQUEST = 1;
     private static final AtomicInteger sNextGeneratedId = new AtomicInteger(1);

+ 0 - 171
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/base/BasicObject.java

@@ -1,171 +0,0 @@
-package com.usai.ratradefiling.base;
-
-import org.json.JSONObject;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-public class BasicObject extends NoProguard {
-
-    public void setValuesForKeysWithJSON(JSONObject json) {
-//        Log.e("BasicObject", "setValuesForKeysWithJSON: " );
-        if (json == null || json.length() == 0) {
-
-//            Log.e("BasicObject", "setValuesForKeysWithJSON: json is null" );
-            return;
-        }
-
-
-        try {
-            Class cls = getClass();
-//            Log.e("BasicObject", "cls != null "+(cls != null) );
-//            Log.e("BasicObject", "cls != Class.class "+(cls != Class.class) );
-
-//            Log.e("BasicObject", "Class.class "+Class.class );
-            while (cls != null && cls != Class.class) {
-//                Log.e("BasicObject", "cls "+cls );
-                Field[] fields = cls.getFields();
-
-//                Log.e("BasicObject", "fields  "+fields.length );
-//                Log.e("BasicObject", "fields  "+fields );
-
-                for (Field f : fields) {
-
-                    String key = f.getName();
-
-                    Object value = json.opt(key);
-//                    Log.e("BasicObject full info", "key "+key+" value "+value + " type "+f.getType());
-                    if (value == null) {
-                        continue;
-                    }
-
-                    Class type = f.getType();
-                    if (type == value.getClass() || ((type == int.class || type == long.class) && value.getClass() == Integer.class) || ((type == float.class || type == double.class) && (value.getClass() == Double.class || value.getClass() == Float.class)) || ((type == Boolean.class || type == boolean.class) && (value.getClass() == boolean.class || value.getClass() == Boolean.class))) {
-
-
-                        boolean success = invokeSetter(cls,f,type,key,value);
-                        if (!success) {
-                            f.set(this,value);
-                        }
-
-                    } else {
-
-                        if (value.getClass() == String.class) {
-
-                            String string = (String)value;
-
-                            if (type == Integer.class || type == int.class || type == long.class) {
-
-                                value = Integer.valueOf(string);
-
-
-                            } else if (type == Double.class || type == double.class || type == float.class) {
-
-                                value = Double.valueOf(string);
-
-                            } else if (type == Boolean.class || type == boolean.class) {
-
-                                value = Boolean.valueOf(string);
-                            }
-
-                            boolean success = invokeSetter(cls,f,type,key,value);
-                            if (!success) {
-                                f.set(this,value);
-                            }
-
-                        } else {
-
-                            if (type == Object.class) {
-                                boolean success = invokeObjectSetter(type,key,(Object) value);
-//                                Log.e("invokeObjectSetter", ""+cls+"  ,  "+f+","+type+"  ,  "+key+"  ,  "+value+"  ,  "+success );
-
-                                if (!success) {
-                                    f.set(this,value);
-                                }
-                            }
-
-                        }
-
-                    }
-
-                }
-                cls = cls.getSuperclass();
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    public boolean invokeObjectSetter( Class type,String key,Object value) {
-
-        String setter = "set" + toUpperCaseFirstOne(key);
-        try {
-
-
-//            Class<?> myClassType = Class.forName(cls.getName());
-//            Class<?>[] types = new Class[] { File.class };
-//            Constructor<?> cons = myClassType.getConstructor(types);
-
-//            Log.e("invokeObjectSetter", "settler: "+setter+" type "+type );
-
-            Class[] cArg = new Class[1];
-            cArg[0] = type;
-//            Log.e("invokeObjectSetter", getClass().getName() );
-            Method method = getClass().getMethod(setter,cArg);
-            if (method != null) {
-
-                method.invoke(this,value);
-
-                return true;
-            }
-
-        }
-        catch(NoSuchMethodException e)
-        {
-            e.printStackTrace();
-        }
-        catch (Exception e) {
-//            dbgUtil.Logd("invokeSetter",e.getMessage());
-            e.printStackTrace();
-        }
-
-        return false;
-    }
-    public boolean invokeSetter(Class cls, Field f, Class type,String key,Object value) {
-
-        String setter = "set" + toUpperCaseFirstOne(key);
-        try {
-
-
-            Class<?> myClassType = Class.forName(cls.getName());
-//            Class<?>[] types = new Class[] { File.class };
-//            Constructor<?> cons = myClassType.getConstructor(types);
-
-            Method method = myClassType.getMethod(setter,type);
-            if (method != null) {
-
-                method.invoke(this,value);
-
-                return true;
-            }
-
-        }
-        catch(NoSuchMethodException e)
-        {
-//            e.printStackTrace();
-        }
-        catch (Exception e) {
-//            dbgUtil.Logd("invokeSetter",e.getMessage());
-            e.printStackTrace();
-        }
-
-        return false;
-    }
-
-    public static String toUpperCaseFirstOne(String s){
-        if(Character.isUpperCase(s.charAt(0)))
-            return s;
-        else
-            return (new StringBuilder()).append(Character.toUpperCase(s.charAt(0))).append(s.substring(1)).toString();
-    }
-}

+ 0 - 4
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/base/NoProguard.java

@@ -1,4 +0,0 @@
-package com.usai.ratradefiling.base;
-
-public class NoProguard extends Object {
-}

+ 8 - 4
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/base/ResultBaseModel.java

@@ -39,10 +39,10 @@ public class ResultBaseModel extends BaseObject
             if (rowActionParameters != null) {
                 json.put("rowActionParameters", rowActionParameters);
             }
-
-            if (addition != null) {
-                json.put("addition", addition);
-            }
+//
+//            if (additionobj != null) {
+//                json.put("addition", additionobj);
+//            }
 
         } catch (JSONException e) {
             e.printStackTrace();
@@ -73,8 +73,12 @@ public class ResultBaseModel extends BaseObject
     }
 
     public int type;
+//    public Object testobj;
+//    public int testint;
+//    public String teststring;
     public JSONArray rowActionParameters;
 
+
     // region Addition
 
     public Object addition; // 使用Object对象,便于baseObject赋值

+ 7 - 6
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/ResultAdapter.java

@@ -37,7 +37,8 @@ import java.util.ArrayList;
 public class ResultAdapter extends BaseAdapter {
 
     // region DataSource
-    public static interface ApexResultAdapterDataSource {
+    public static interface ResultAdapterDataSource
+    {
 
         int numberOfResultItem();
         ResultBaseModel resultModelForIndex(int index);
@@ -46,9 +47,9 @@ public class ResultAdapter extends BaseAdapter {
 
     // region Initial
     private WeakReference<Context> mWeakContext;
-    private WeakReference<ApexResultAdapterDataSource> mWeakDataSource;
+    private WeakReference<ResultAdapterDataSource> mWeakDataSource;
 
-    public ResultAdapter(Context context, ApexResultAdapterDataSource dataSource) {
+    public ResultAdapter(Context context, ResultAdapterDataSource dataSource) {
         if (context == null) {
             mWeakContext = null;
         } else {
@@ -72,7 +73,7 @@ public class ResultAdapter extends BaseAdapter {
         return mWeakContext.get();
     }
 
-    private ApexResultAdapterDataSource getDataSource() {
+    private ResultAdapterDataSource getDataSource() {
         if (mWeakDataSource == null) {
             return null;
         }
@@ -85,7 +86,7 @@ public class ResultAdapter extends BaseAdapter {
 
     @Override
     public int getCount() {
-        ApexResultAdapterDataSource dataSource = getDataSource();
+        ResultAdapterDataSource dataSource = getDataSource();
         if (dataSource != null) {
             return dataSource.numberOfResultItem();
         }
@@ -94,7 +95,7 @@ public class ResultAdapter extends BaseAdapter {
 
     @Override
     public Object getItem(int position) {
-        ApexResultAdapterDataSource dataSource = getDataSource();
+        ResultAdapterDataSource dataSource = getDataSource();
         if (dataSource != null) {
             return dataSource.resultModelForIndex(position);
         }

+ 3 - 3
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/ResultAddition.java

@@ -10,7 +10,7 @@ public class ResultAddition extends BaseObject
     public String name;
     public String value;
 
-    public void setName(String name) {
-        this.name = String.format("%s: ",name);
-    }
+//    public void setName(String name) {
+//        this.name = String.format("%s: ",name);
+//    }
 }

+ 4 - 7
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/ResultPresenter.java

@@ -1,9 +1,8 @@
 package com.usai.ratradefiling.result;
 
-import android.app.AlertDialog;
-import android.content.DialogInterface;
 import android.os.Bundle;
 import android.text.TextUtils;
+import android.util.Log;
 
 //import com.usai.apex.ApexTrackingApplication;
 //import com.usai.apex.apexresult.model.ApexResultAirAwbInfoModel;
@@ -13,12 +12,9 @@ import android.text.TextUtils;
 //import com.usai.apex.apexresult.model.ApexResultBookingModel;
 //import com.usai.apex.apexresult.model.ApexResultContainerModel;
 //import com.usai.apex.apexresult.model.ApexResultDocumentModel;
-import com.usai.ratradefiling.R;
-import com.usai.ratradefiling.TradeFilingApplication;
 import com.usai.ratradefiling.base.ResultBaseModel;
 import com.usai.ratradefiling.dataprovider.OnlineDataProvider;
 import com.usai.ratradefiling.dataprovider.RADataProvider;
-import com.usai.ratradefiling.my.ChangePasswordActivity;
 import com.usai.ratradefiling.result.model.ResultACEM1Model;
 import com.usai.ratradefiling.result.model.ResultACIModel;
 import com.usai.ratradefiling.result.model.ResultCustomerModel;
@@ -33,12 +29,12 @@ import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 
-import java.io.File;
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 
-public class ResultPresenter implements ResultAdapter.ApexResultAdapterDataSource {
+public class ResultPresenter implements ResultAdapter.ResultAdapterDataSource
+{
 
     // region Protocol
     public static interface ResultProtocol {
@@ -397,6 +393,7 @@ public class ResultPresenter implements ResultAdapter.ApexResultAdapterDataSourc
                             JSONObject item = items.optJSONObject(i);
                             if (item != null) {
 
+                                Log.e("DEBUG!!!", "operationCompletion: "+i );
                                 ResultBaseModel model = makeModel(item);
                                 if (model != null) {
                                     models.add(model);