Procházet zdrojové kódy

Remove redundant functions in My tab -- 去掉My标签里多余的功能(resolve: #14329)
The custom field crash after double-clicking a row -- 自定义字段双击一行后闪退(resolve: #14328)
Detail log adds color block to distinguish each sending -- detail log 增加色块区分每次发送(resolve: #14327)
Detail container type cell shows alignment problem -- detail container 类型单元格显示对齐有问题(resolve: #14326)

Ray Zhang před 4 roky
rodič
revize
7440b3ffa3

+ 9 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/DetailFragment.java

@@ -1039,6 +1039,15 @@ public class DetailFragment extends Fragment implements OnClickListener /*
 						JSONObject item=groupobj.getJSONObject("item"+j);
 						String val = item.getString("text");
 						boolean bgcolor=item.getBoolean("bg");
+
+						if(bgcolor)
+						{
+							tvitem.setBackgroundResource(R.color.TFGray);
+						}
+						else
+						{
+							tvitem.setBackgroundResource(R.color.white);
+						}
 						tvitem.setText(val);
 						// tvitem.setBackgroundResource(R.drawable.detail_item);
 						listitem.removeView(tvitem);

+ 56 - 55
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/fields/CustomizeFieldsActivity.java

@@ -265,75 +265,76 @@ public class CustomizeFieldsActivity extends Activity implements
 //		dbUtil.CloseDB(db);
 	}
 
-	public static class DragListAdapter extends ArrayAdapter<JSONObject>
+	public static class DragListAdapter extends DragListView.DragListAdapter
 	{
 
 		// private Context mContext;
 
 		public DragListAdapter(Context context, List<JSONObject> objects)
 		{
-			super(context, 0, objects);
+			super(context,  objects);
 			// this.mContext = context;
 		}
 
+		@Override
 		public List<JSONObject> getList()
 		{
 			return list;
 		}
 
-		@Override
-		public boolean isEnabled(int position)
-		{
-			if (getItem(position).optInt("id") < 0) // _id<0 means a group key
-				return false;
-			// if (groupKey.contains(getItem(position).name))
-			// {
-			// // ����Ƿ����ǩ������false������ѡ�У����ܵ��
-			// return false;
-			// }
-			return super.isEnabled(position);
-		}
-
-		public int switchpos()
-		{
-
-			for (int i = 1; i < getCount(); i++)
-			{
-				if (getItem(i).optInt("id") < 0)
-					return i;
-			}
-			return -1;
-		}
-
-		@Override
-		public View getView(int position, View convertView, ViewGroup parent)
-		{
-
-			View view = convertView;
-			if (getItem(position).optInt("id") < 0) // _id<0 means a group key
-			{
-				view = LayoutInflater.from(getContext()).inflate(
-						R.layout.drag_list_item_tag, null);
-			}
-			// if (groupKey.contains(getItem(position).name))
-			// {
-			// // ����Ƿ����ǩ���ͼ��ط����ǩ�IJ����ļ������������ļ���ʾЧ��ͬ
-			// view = LayoutInflater.from(getContext()).inflate(
-			// R.layout.drag_list_item_tag, null);
-			// }
-			else
-			{
-				// �������������ǩ���ͼ����������IJ����ļ�
-				view = LayoutInflater.from(getContext()).inflate(
-						R.layout.drag_list_item, null);
-			}
-
-			TextView textView = (TextView) view
-					.findViewById(R.id.drag_list_item_text);
-			textView.setText(getItem(position).optString("name"));
-
-			return view;
-		}
+//		@Override
+//		public boolean isEnabled(int position)
+//		{
+//			if (getItem(position).optInt("id") < 0) // _id<0 means a group key
+//				return false;
+//			// if (groupKey.contains(getItem(position).name))
+//			// {
+//			// // ����Ƿ����ǩ������false������ѡ�У����ܵ��
+//			// return false;
+//			// }
+//			return super.isEnabled(position);
+//		}
+//
+//		public int switchpos()
+//		{
+//
+//			for (int i = 1; i < getCount(); i++)
+//			{
+//				if (getItem(i).optInt("id") < 0)
+//					return i;
+//			}
+//			return -1;
+//		}
+//
+//		@Override
+//		public View getView(int position, View convertView, ViewGroup parent)
+//		{
+//
+//			View view = convertView;
+//			if (getItem(position).optInt("id") < 0) // _id<0 means a group key
+//			{
+//				view = LayoutInflater.from(getContext()).inflate(
+//						R.layout.drag_list_item_tag, null);
+//			}
+//			// if (groupKey.contains(getItem(position).name))
+//			// {
+//			// // ����Ƿ����ǩ���ͼ��ط����ǩ�IJ����ļ������������ļ���ʾЧ��ͬ
+//			// view = LayoutInflater.from(getContext()).inflate(
+//			// R.layout.drag_list_item_tag, null);
+//			// }
+//			else
+//			{
+//				// �������������ǩ���ͼ����������IJ����ļ�
+//				view = LayoutInflater.from(getContext()).inflate(
+//						R.layout.drag_list_item, null);
+//			}
+//
+//			TextView textView = (TextView) view
+//					.findViewById(R.id.drag_list_item_text);
+//			textView.setText(getItem(position).optString("name"));
+//
+//			return view;
+//		}
 	}
 
 	@Override

+ 78 - 3
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/fields/DragListView.java

@@ -5,22 +5,26 @@ import android.graphics.Bitmap;
 import android.graphics.PixelFormat;
 import android.util.AttributeSet;
 import android.view.Gravity;
+import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewConfiguration;
 import android.view.ViewGroup;
 import android.view.WindowManager;
 import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
 import android.widget.ImageView;
 import android.widget.ListView;
+import android.widget.TextView;
 
 
 import com.usai.ratradefiling.R;
-import com.usai.ratradefiling.home.FunctionPanelSettingActivity;
+//import com.usai.ratradefiling.home.FunctionPanelSettingActivity;
 
 import org.json.JSONObject;
 
 import java.lang.ref.WeakReference;
+import java.util.List;
 
 import static android.content.Context.WINDOW_SERVICE;
 
@@ -49,13 +53,84 @@ public class DragListView extends ListView
 		this.setOnItemClickListener(mItemClickListenter);
 	}
 
+	public static class DragListAdapter extends ArrayAdapter<JSONObject>
+	{
+
+		// private Context mContext;
+
+		public DragListAdapter(Context context, List<JSONObject> objects)
+		{
+			super(context, 0, objects);
+			// this.mContext = context;
+		}
+
+		public List<JSONObject> getList()
+		{
+			return null;
+		}
+
+		@Override
+		public boolean isEnabled(int position)
+		{
+			if (getItem(position).optInt("id") < 0) // _id<0 means a group key
+				return false;
+			// if (groupKey.contains(getItem(position).name))
+			// {
+			// // ����Ƿ����ǩ������false������ѡ�У����ܵ��
+			// return false;
+			// }
+			return super.isEnabled(position);
+		}
+
+		public int switchpos()
+		{
+
+			for (int i = 1; i < getCount(); i++)
+			{
+				if (getItem(i).optInt("id") < 0)
+					return i;
+			}
+			return -1;
+		}
+
+		@Override
+		public View getView(int position, View convertView, ViewGroup parent)
+		{
+
+			View view = convertView;
+			if (getItem(position).optInt("id") < 0) // _id<0 means a group key
+			{
+				view = LayoutInflater.from(getContext()).inflate(
+						R.layout.drag_list_item_tag, null);
+			}
+			// if (groupKey.contains(getItem(position).name))
+			// {
+			// // ����Ƿ����ǩ���ͼ��ط����ǩ�IJ����ļ������������ļ���ʾЧ��ͬ
+			// view = LayoutInflater.from(getContext()).inflate(
+			// R.layout.drag_list_item_tag, null);
+			// }
+			else
+			{
+				// �������������ǩ���ͼ����������IJ����ļ�
+				view = LayoutInflater.from(getContext()).inflate(
+						R.layout.drag_list_item, null);
+			}
+
+			TextView textView = (TextView) view
+					.findViewById(R.id.drag_list_item_text);
+			textView.setText(getItem(position).optString("name"));
+
+			return view;
+		}
+	}
+
 	private int lastClickId = -1;
 	private long lastClickTime;
 	private OnItemClickListener mItemClickListenter = new OnItemClickListener()
 	{
 		public void onItemClick(AdapterView<?> parent, View v, int pos, long id)
 		{
-			FunctionPanelSettingActivity.DragListAdapter adapter = (FunctionPanelSettingActivity.DragListAdapter) ((ListView) parent)
+			DragListAdapter adapter = (DragListAdapter) ((ListView) parent)
 					.getAdapter();
 
 			if (adapter.isEnabled(pos) == false)// return if item is a group key
@@ -277,7 +352,7 @@ public class DragListView extends ListView
 		if (dragPosition > 0 && dragPosition < getAdapter().getCount())
 		{
 			/* @SuppressWarnings("unchecked") */
-			FunctionPanelSettingActivity.DragListAdapter adapter = (FunctionPanelSettingActivity.DragListAdapter) getAdapter();
+			DragListAdapter adapter = (DragListAdapter) getAdapter();
 			JSONObject dragItem = adapter.getItem(dragSrcPosition);
 
 			DragListViewDelegate delegate = getDelegate();

+ 57 - 57
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/FunctionPanelSettingActivity.java

@@ -259,75 +259,75 @@ public class FunctionPanelSettingActivity extends AppCompatActivity implements
 //		dbUtil.CloseDB(db);
     }
 
-    public static class DragListAdapter extends ArrayAdapter<JSONObject>
+    public static class DragListAdapter extends DragListView.DragListAdapter
     {
 
         // private Context mContext;
 
         public DragListAdapter(Context context, List<JSONObject> objects)
         {
-            super(context, 0, objects);
+            super(context, objects);
             // this.mContext = context;
         }
-
+        @Override
         public List<JSONObject> getList()
         {
             return list;
         }
-
-        @Override
-        public boolean isEnabled(int position)
-        {
-            if (getItem(position).optInt("id") < 0) // _id<0 means a group key
-                return false;
-            // if (groupKey.contains(getItem(position).name))
-            // {
-            // // ����Ƿ����ǩ������false������ѡ�У����ܵ��
-            // return false;
-            // }
-            return super.isEnabled(position);
-        }
-
-        public int switchpos()
-        {
-
-            for (int i = 1; i < getCount(); i++)
-            {
-                if (getItem(i).optInt("id") < 0)
-                    return i;
-            }
-            return -1;
-        }
-
-        @Override
-        public View getView(int position, View convertView, ViewGroup parent)
-        {
-
-            View view = convertView;
-            if (getItem(position).optInt("id") < 0) // _id<0 means a group key
-            {
-                view = LayoutInflater.from(getContext()).inflate(
-                        R.layout.drag_list_item_tag, null);
-            }
-            // if (groupKey.contains(getItem(position).name))
-            // {
-            // // ����Ƿ����ǩ���ͼ��ط����ǩ�IJ����ļ������������ļ���ʾЧ��ͬ
-            // view = LayoutInflater.from(getContext()).inflate(
-            // R.layout.drag_list_item_tag, null);
-            // }
-            else
-            {
-                // �������������ǩ���ͼ����������IJ����ļ�
-                view = LayoutInflater.from(getContext()).inflate(
-                        R.layout.drag_list_item, null);
-            }
-
-            TextView textView = (TextView) view
-                    .findViewById(R.id.drag_list_item_text);
-            textView.setText(getItem(position).optString("name"));
-
-            return view;
-        }
+//
+//        @Override
+//        public boolean isEnabled(int position)
+//        {
+//            if (getItem(position).optInt("id") < 0) // _id<0 means a group key
+//                return false;
+//            // if (groupKey.contains(getItem(position).name))
+//            // {
+//            // // ����Ƿ����ǩ������false������ѡ�У����ܵ��
+//            // return false;
+//            // }
+//            return super.isEnabled(position);
+//        }
+//
+//        public int switchpos()
+//        {
+//
+//            for (int i = 1; i < getCount(); i++)
+//            {
+//                if (getItem(i).optInt("id") < 0)
+//                    return i;
+//            }
+//            return -1;
+//        }
+//
+//        @Override
+//        public View getView(int position, View convertView, ViewGroup parent)
+//        {
+//
+//            View view = convertView;
+//            if (getItem(position).optInt("id") < 0) // _id<0 means a group key
+//            {
+//                view = LayoutInflater.from(getContext()).inflate(
+//                        R.layout.drag_list_item_tag, null);
+//            }
+//            // if (groupKey.contains(getItem(position).name))
+//            // {
+//            // // ����Ƿ����ǩ���ͼ��ط����ǩ�IJ����ļ������������ļ���ʾЧ��ͬ
+//            // view = LayoutInflater.from(getContext()).inflate(
+//            // R.layout.drag_list_item_tag, null);
+//            // }
+//            else
+//            {
+//                // �������������ǩ���ͼ����������IJ����ļ�
+//                view = LayoutInflater.from(getContext()).inflate(
+//                        R.layout.drag_list_item, null);
+//            }
+//
+//            TextView textView = (TextView) view
+//                    .findViewById(R.id.drag_list_item_text);
+//            textView.setText(getItem(position).optString("name"));
+//
+//            return view;
+//        }
     }
 
     @Override

+ 13 - 4
ApexDrivers/ratradefiling/src/main/res/layout/detail_cell_container.xml

@@ -60,16 +60,21 @@
 
                 <TextView
                     android:id="@+id/tv_qty"
-                    android:layout_width="wrap_content"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
+
                     android:layout_weight="1"
+                    android:ellipsize="end"
+                    android:singleLine="true"
                     android:text="QTY" />
 
                 <TextView
                     android:id="@+id/tv_cbm"
-                    android:layout_width="wrap_content"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_weight="1"
+                    android:ellipsize="end"
+                    android:singleLine="true"
                     android:text="CBM" />
             </LinearLayout>
         </LinearLayout>
@@ -87,14 +92,18 @@
 
                 <TextView
                     android:id="@+id/tv_weight"
-                    android:layout_width="wrap_content"
+                    android:ellipsize="end"
+                    android:singleLine="true"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_weight="1"
                     android:text="Weight" />
 
                 <TextView
                     android:id="@+id/tv_seal_no"
-                    android:layout_width="wrap_content"
+                    android:ellipsize="end"
+                    android:singleLine="true"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_weight="1"
                     android:text="Seal No" />

+ 0 - 6
ApexDrivers/ratradefiling/src/main/res/raw/my.json

@@ -13,12 +13,6 @@
       "icon": "mode_search",
       "type": "saved_search"
     },
-    {
-      "name": "Saved Documents",
-      "detail": "Documents you have downloaded",
-      "icon": "mode_document",
-      "type": "saved_document"
-    },
     {
       "name": "Change Password",
       "detail": "Update login password",