Ray Zhang 12 jaren geleden
bovenliggende
commit
6e6157e65f

+ 12 - 0
Apex/lint.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<lint>
+    <issue id="HardcodedText">
+        <ignore path="res/layout/fragment_direct_tracking.xml" />
+    </issue>
+    <issue id="TextFields">
+        <ignore path="res/layout/fragment_direct_tracking.xml" />
+    </issue>
+    <issue id="UselessParent">
+        <ignore path="res/layout/fragment_direct_tracking.xml" />
+    </issue>
+</lint>

+ 1 - 1
Apex/res/layout/activity_detail.xml

@@ -17,7 +17,7 @@
 
             <TabWidget
                 android:id="@android:id/tabs"
-                android:layout_width="match_parent"
+                android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                  />
         </HorizontalScrollView>

+ 45 - 55
Apex/res/layout/activity_function_select.xml

@@ -1,71 +1,61 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-   
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_alignParentTop="true"
+    android:layout_centerHorizontal="true"
     tools:context=".FunctionSelectActivity" >
 
-    <TableLayout
+    <TableRow
+        android:id="@+id/tableRow3"
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-       
-        android:layout_centerHorizontal="true"
-        android:layout_alignParentTop="true" >
+        android:layout_height="wrap_content" >
 
-        <TableRow
-            android:id="@+id/tableRow3"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content" >
+        <ImageButton
+            android:id="@+id/ibtn_booking"
+            android:src="@drawable/ic_oceanbooking" />
 
-            <ImageButton
-                android:id="@+id/ibtn_booking"
-                android:src="@drawable/ic_oceanbooking" />
+        <ImageButton
+            android:id="@+id/ibtn_info"
+            android:src="@drawable/ic_ocean_blinfo" />
 
-            <ImageButton
-                android:id="@+id/ibtn_info"
-                android:src="@drawable/ic_ocean_blinfo" />
+        <ImageButton
+            android:id="@+id/ibtn_detail"
+            android:src="@drawable/ic_container_detail" />
+    </TableRow>
 
-            <ImageButton
-                android:id="@+id/ibtn_detail"
-                android:src="@drawable/ic_container_detail" />
-        </TableRow>
+    <TableRow
+        android:id="@+id/tableRow4"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" >
 
-        <TableRow
-            android:id="@+id/tableRow4"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content" >
+        <ImageButton
+            android:id="@+id/ibtn_cargo"
+            android:src="@drawable/ic_cargo_tracking" />
 
-            <ImageButton
-                android:id="@+id/ibtn_cargo"
-                android:src="@drawable/ic_cargo_tracking" />
+        <ImageButton
+            android:id="@+id/ibtn_doc"
+            android:src="@drawable/ic_down_doc" />
 
-            <ImageButton
-                android:id="@+id/ibtn_doc"
-                android:src="@drawable/ic_down_doc" />
+        <ImageButton
+            android:id="@+id/ibtn_password"
+            android:src="@drawable/ic_password" />
+    </TableRow>
 
-            <ImageButton
-                android:id="@+id/ibtn_password"
-                android:src="@drawable/ic_password" />
-        </TableRow>
+    <TableRow
+        android:id="@+id/tableRow1"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" >
 
-        <TableRow
-            android:id="@+id/tableRow1"
+        <ImageButton
+            android:id="@+id/ibtn_location"
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content" >
-
-            <ImageButton
-                android:id="@+id/ibtn_location"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:src="@drawable/ic_test" />
-
-            <ImageButton
-                android:id="@+id/ibtn_exit"
-                android:src="@drawable/ic_exit" />
-
-
+            android:layout_height="wrap_content"
+            android:src="@drawable/ic_test" />
 
-        </TableRow>
-    </TableLayout>
+        <ImageButton
+            android:id="@+id/ibtn_exit"
+            android:src="@drawable/ic_exit" />
+    </TableRow>
 
-</RelativeLayout>
+</TableLayout>

+ 2 - 0
Apex/res/layout/activity_result.xml

@@ -72,6 +72,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_weight="1"
+            style="@android:attr/buttonBarButtonStyle"
             android:text="Pre Page" />
 
         <Button
@@ -79,6 +80,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_weight="1"
+            style="@android:attr/buttonBarButtonStyle"
             android:text="Next Page" />
     </LinearLayout>
 

+ 6 - 9
Apex/res/layout/activity_search.xml

@@ -13,17 +13,14 @@
         android:layout_alignParentTop="true" >
     </ListView>
 
-    <LinearLayout
-        android:id="@+id/foot"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_alignParentBottom="true"
-        android:layout_alignParentLeft="true"
-        android:orientation="vertical" >
+
 
         <LinearLayout
+            android:id="@+id/foot"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:layout_alignParentLeft="true"
             android:orientation="horizontal" >
 
             <Button
@@ -40,8 +37,8 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_weight="1"
-                android:text="Search" />
+                android:text="@string/search" />
         </LinearLayout>
-    </LinearLayout>
+
 
 </RelativeLayout>

+ 2 - 31
Apex/res/layout/detail_fragment.xml

@@ -1,37 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    
-    android:layout_width="match_parent"
-    android:layout_height="match_parent" >
 
-<!--     <TextView
-        android:id="@+id/textView1"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
-        android:layout_marginLeft="97dp"
-        android:layout_marginTop="98dp"
-         />
 
-    <TextView
-        android:id="@+id/text2"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingBottom="8dp"
-        android:paddingTop="8dp"
-        android:text="@string/link_text_manual"
-        android:textAppearance="?android:attr/textAppearanceMedium" />
 
-    <WebView
-        android:id="@+id/webView1"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentBottom="true"
-      
-        android:layout_centerHorizontal="true" /> -->
 
-    <ScrollView
+    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
         
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
@@ -42,10 +14,9 @@
         <LinearLayout
             android:id="@+id/ll_root"
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
+            android:layout_height="wrap_content"
             android:orientation="vertical" 
             android:background="@android:color/holo_blue_bright">
         </LinearLayout>
     </ScrollView>
 
-</RelativeLayout>

+ 0 - 41
Apex/res/layout/tabs_scroll.xml

@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-  
-          http://www.apache.org/licenses/LICENSE-2.0
-  
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@android:id/tabhost"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
-    <LinearLayout
-        android:orientation="vertical"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:padding="5dp">
-        <HorizontalScrollView
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:scrollbars="none">
-            <TabWidget
-                android:id="@android:id/tabs"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content" />
-        </HorizontalScrollView>
-        <FrameLayout
-            android:id="@android:id/tabcontent"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:padding="5dp" />
-    </LinearLayout>
-</TabHost>

+ 1 - 1
Apex/res/layout/web_content.xml

@@ -2,7 +2,7 @@
 <WebView xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent" 
-    android:background="#00000000">
+    >
     
 
 </WebView>

+ 1 - 1
Apex/res/menu/search.xml

@@ -8,7 +8,7 @@
     <item
         android:id="@+id/action_help"
         android:orderInCategory="200"
-        android:showAsAction="always"
+        android:showAsAction="ifRoom" 
         android:icon="@android:drawable/ic_menu_help"
         android:title="@string/action_help"/>
 

+ 1 - 0
Apex/res/values/strings.xml

@@ -35,6 +35,7 @@
     <string name="error_field_required">This field is required</string>
     <string name="title_activity_help">HelpActivity</string>
     <string name="title_activity_detail">DetailActivity</string>
+    <string name="search">Search</string>
 
     <!-- test -->
     <string name="url"><a href='http://www.google.com'>A1401330351H.pdf</a></string>

+ 3 - 2
Apex/src/com/usai/apex/DetailFragment.java

@@ -4,7 +4,6 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.util.HashMap;
 import org.json.JSONException;
 import org.json.JSONObject;
 
@@ -14,6 +13,7 @@ import android.content.res.AssetManager;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
 import android.util.Log;
+import android.util.SparseIntArray;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.View.OnClickListener;
@@ -28,7 +28,8 @@ public class DetailFragment extends Fragment implements OnClickListener
 	LinearLayout ll_root;
 	String mimeType = "text/html";
 	
-	HashMap<Integer, Integer> control = new HashMap<Integer, Integer>() ;
+	SparseIntArray control = new SparseIntArray() ;
+//	HashMap<Integer, Integer> control = new HashMap<Integer, Integer>() ;
 
 	@Override
 	public View onCreateView(LayoutInflater inflater, ViewGroup container,

+ 7 - 7
Apex/src/com/usai/apex/ResultActivity.java

@@ -3,6 +3,8 @@ package com.usai.apex;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Locale;
+
 import org.json.JSONException;
 import org.json.JSONObject;
 
@@ -19,6 +21,7 @@ import android.content.Intent;
 import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
 import android.util.Log;
+import android.util.SparseArray;
 import android.view.ContextMenu;
 import android.view.Gravity;
 import android.view.Menu;
@@ -45,7 +48,8 @@ public class ResultActivity extends Activity
 	Bundle searchParms = null;
 	SearchResult searchresult = new SearchResult();
 
-	HashMap<Integer, String> showfieldmap = new HashMap<Integer, String>();
+	SparseArray< String> showfieldmap = new SparseArray< String>();
+//	HashMap<Integer, String> showfieldmap = new HashMap<Integer, String>();
 	private TextView mStatusMessageView;
 	// private View mSearchFormView;
 	private View footview;
@@ -134,9 +138,7 @@ public class ResultActivity extends Activity
 	@Override
 	public boolean onContextItemSelected(MenuItem item)
 	{
-		// TODO Auto-generated method stub
-		AdapterContextMenuInfo menuInfo;
-//		menuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
+		//		menuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
 		Log.d("table row select", sel+ "");
 		
 	
@@ -499,7 +501,6 @@ public class ResultActivity extends Activity
 							+ " records");
 				TableLayout tl = (TableLayout) findViewById(R.id.result_table);
 
-				int showcount = tl.getChildCount();
 				tl.removeViews(1, tl.getChildCount() - 1);
 				// int newcount = loadcount - showcount + 1;// +1 header row
 				for (int i = 0; i < 10; i++)
@@ -519,7 +520,6 @@ public class ResultActivity extends Activity
 									// return true;
 									TableRow tr = (TableRow)v;
 									TextView tvno=(TextView)tr.getChildAt(0);
-									String no = tvno.getText().toString();
 									sel=Integer.parseInt(tvno.getText().toString());
 									registerForContextMenu(v);
 									openContextMenu(v);
@@ -658,7 +658,7 @@ public class ResultActivity extends Activity
 				{
 					offset++;
 					JSONObject rec = objrecords.getJSONObject("record" + i);
-					Iterator it = rec.keys();
+					Iterator<?> it = rec.keys();
 					HashMap<String, String> record = new HashMap<String, String>();
 					while (it.hasNext()) // loop for each function
 					{

+ 3 - 4
Apex/src/com/usai/apex/SearchActivity.java

@@ -23,7 +23,6 @@ import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
 import android.widget.EditText;
-import android.widget.ListView;
 import android.widget.SimpleCursorAdapter;
 import android.widget.Switch;
 
@@ -35,7 +34,7 @@ public class SearchActivity extends ListActivity implements OnClickListener
 	String password = null;
 	String function_name = null;
 	RecordsAdapter m_listadapter;
-	private ListView m_ListView = null;
+//	private ListView m_ListView = null;
 	HashMap<String, String> hashMap = new HashMap<String, String>();
 
 	public class RecordsAdapter extends SimpleCursorAdapter
@@ -210,7 +209,7 @@ public class SearchActivity extends ListActivity implements OnClickListener
 		m_db = dbUtil.OpenDB(this, null, true);
 		// m_TextView = (TextView) findViewById(R.id.summarytext);
 		// m_TextView.setText(getString(m_Activityinfo.TextViewValue));
-		m_ListView = (ListView) findViewById(android.R.id.list);
+//		m_ListView = (ListView) findViewById(android.R.id.list);
 		m_cursor = m_db.query("fields_info", new String[] { "aname",
 				"field_type", "name", "_id" }, "function_name='"
 				+ function_name + "' and user='" + user + "' and behavior="
@@ -364,7 +363,7 @@ public class SearchActivity extends ListActivity implements OnClickListener
 			Bundle parms = new Bundle();
 			parms.putString("module_name",function_name);
 			parms.putString("columns", dbUtil.get_fields(user, function_name));
-			Iterator iter = hashMap.keySet().iterator();
+			Iterator<String> iter = hashMap.keySet().iterator();
 			while (iter.hasNext())
 			{
 				String field = (String) iter.next();