Ray Zhang 12 лет назад
Родитель
Сommit
a5e9035119

+ 2 - 1
Apex/AndroidManifest.xml

@@ -2,7 +2,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.usai.apex"
     android:versionCode="1"
-    android:versionName="A140219" >
+    android:versionName="A140224" >
 
     <!-- Copied from Google Maps Library/AndroidManifest.xml. -->
     <uses-sdk
@@ -80,6 +80,7 @@
             android:label="@string/title_activity_function_select"
             android:logo="@drawable/apexlogo_2"
             android:screenOrientation="portrait" >
+            
         </activity>
         <activity
             android:name="com.usai.apex.SearchActivity"

+ 36 - 37
Apex/res/layout/activity_about.xml

@@ -1,50 +1,49 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<ScrollView 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:id="@+id/scrollView1"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
     android:paddingBottom="@dimen/activity_vertical_margin"
     android:paddingLeft="@dimen/activity_horizontal_margin"
     android:paddingRight="@dimen/activity_horizontal_margin"
     android:paddingTop="@dimen/activity_vertical_margin"
     tools:context=".AboutActivity" >
 
-    <ImageView
-        android:id="@+id/imageView1"
-        android:layout_width="wrap_content"
+    <LinearLayout
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_alignParentTop="true"
-        android:layout_centerHorizontal="true"
+        android:orientation="vertical" >
 
-        android:src="@drawable/apexlogo_2" />
+        <ImageView
+            android:id="@+id/imageView1"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:src="@drawable/apexlogo_2" />
 
-    <TextView
-        android:id="@+id/textView1"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@+id/imageView1"
-        android:layout_centerHorizontal="true"
-        android:layout_marginTop="41dp"
-        android:gravity="center_horizontal"
-        android:text="BLAH BLAH BLAH" />
+        <WebView
+            android:id="@+id/webView1"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" />
 
-    <TextView
-        android:id="@+id/textView2"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentBottom="true"
-        android:layout_centerHorizontal="true"
-        android:layout_marginBottom="144dp"
-        android:gravity="center_horizontal"
-        android:text="Tech support:\nusairedant@united-us.net" 
-        android:autoLink="email"/>
+        <TextView
+            android:id="@+id/tv_version"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_horizontal"
+            android:gravity="center_horizontal"
+            android:text="version:" 
+           	android:textSize="20sp"/>
 
-    <TextView
-        android:id="@+id/tv_version"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_centerHorizontal="true"
-        android:layout_centerVertical="true"
-        android:gravity="center_horizontal"
-        android:text="version:" />
+        <TextView
+            android:id="@+id/textView2"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_horizontal"
+            android:layout_marginBottom="144dp"
+            android:autoLink="email"
+            android:gravity="center_horizontal"
+            android:text="Tech support:\nusairedant@united-us.net" 
+            android:textSize="20sp"/>
+    </LinearLayout>
 
-</RelativeLayout>
+</ScrollView>

+ 6 - 5
Apex/res/layout/activity_apex.xml

@@ -37,11 +37,12 @@
                 android:layout_height="fill_parent" >
             </FrameLayout>
 
-    <!--         <FrameLayout
-                android:id="@+id/tab2"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent" >
-            </FrameLayout> -->
+ <!--             <FrameLayout
+                 android:id="@+id/tabtest"
+                 android:layout_width="fill_parent"
+                 android:layout_height="fill_parent" >
+
+            </FrameLayout>  -->
 
             <FrameLayout
                 android:id="@+id/tab3"

+ 8 - 0
Apex/res/layout/activity_search_list.xml

@@ -35,6 +35,14 @@
             android:layout_weight="1"
             android:text="@android:string/cancel" />
 
+        <Button
+            android:id="@+id/btn_clear"
+            style="?android:attr/buttonStyleSmall"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="Reset" />
+
         <Button
             android:id="@+id/btnok"
             style="?android:attr/buttonStyleSmall"

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

@@ -44,7 +44,7 @@
         </RadioGroup>
 
         <EditText
-            android:id="@+id/editText1"
+            android:id="@+id/et_from"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:ems="12" >

+ 4 - 4
Apex/res/layout/fragment_service_location.xml

@@ -3,17 +3,17 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent" >
 
-<!--     <FrameLayout
+     <FrameLayout
         android:id="@+id/map"
         android:layout_width="match_parent"
         android:layout_height="match_parent" >
-    </FrameLayout> -->
+    </FrameLayout> 
 
-    <fragment
+    <!-- <fragment
         
         android:id="@+id/map"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        class="com.google.android.gms.maps.SupportMapFragment" /> 
+        class="com.google.android.gms.maps.SupportMapFragment" /> --> 
 
 </RelativeLayout>

+ 19 - 5
Apex/res/layout/new_function_select.xml

@@ -52,11 +52,25 @@
 
     </AutoCompleteTextView>
 
-    <Button
-        android:id="@+id/btn_search"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:text="Search" />
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content" >
+
+        <Button
+            android:id="@+id/btn_clear"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:text="Clear" 
+            android:layout_weight="1"/>
+
+        <Button
+            android:id="@+id/btn_search"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:text="Search" 
+            android:layout_weight="1"/>
+
+    </LinearLayout>
 
     <View
         android:layout_width="fill_parent"

+ 75 - 0
Apex/res/layout/search_item_datepicker.xml

@@ -0,0 +1,75 @@
+<?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="wrap_content" >
+
+    <TextView
+        android:id="@+id/aname"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentTop="true"
+        android:text="Medium Text"
+        android:textAppearance="?android:attr/textAppearanceMedium" />
+
+
+
+    <LinearLayout
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@+id/aname"
+        android:orientation="vertical" >
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" >
+
+            <EditText
+                android:id="@+id/et_from"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:ems="10"
+                android:hint="from"
+
+                android:focusable="false"
+                />
+
+            <Button
+                android:id="@+id/btn_clear_from"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="Clear" />
+
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" >
+
+            <EditText
+                android:id="@+id/et_to"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:ems="10"
+                android:hint="to"
+                android:focusable="false"
+                 >
+
+                <requestFocus />
+            </EditText>
+
+            <Button
+                android:id="@+id/btn_clear_to"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="Clear" />
+
+        </LinearLayout>
+
+    </LinearLayout>
+
+</RelativeLayout>

+ 23 - 0
Apex/res/layout/search_item_spinner.xml

@@ -0,0 +1,23 @@
+<?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="wrap_content" >
+
+    <TextView
+        android:id="@+id/aname"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentTop="true"
+        android:text="Medium Text"
+        android:textAppearance="?android:attr/textAppearanceMedium" />
+
+    <Spinner
+        android:id="@+id/sp_bool"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@+id/aname"
+        android:drawSelectorOnTop="true"
+        />
+
+</RelativeLayout>

+ 29 - 0
Apex/res/raw/about.htm

@@ -0,0 +1,29 @@
+<html>
+<br><b><span lang=EN-US style='color:red'>2013</span></b><br>
+Apex India is established. Apex remained the second largest NVOCC from Asia to U.S. for the second consecutive year, according to Zepol.
+<br><b><span lang=EN-US style='color:red'>2012</span></b><br>
+Apex was recognized as the second largest NVOCC for Asia to USA trade, according to Zepol.com. China Airlines recognized Apex Maritime for exceeding 5 million revenue contribution. Apex Houston was established as a standalone office.
+<br><b><span lang=EN-US style='color:red'>2011</span></b><br>
+In January, ULS moved into its own 143,000 square foot warehouse in Newark, CA. ULS opened up its second 155,000 square foot Newark warehouse in November. China Airlines recognized Apex Maritime for exceeding 1 million revenue contribution.
+<br><b><span lang=EN-US style='color:red'>2010</span></b><br>
+20th Anniversary of Apex Maritime. Opened up Apex United Kingdom. Exceeded 200,000 in the Asia to USA trade lane. EVA Airlines recognized Apex Maritime as the top performing export airfreight forwarder in Northern California.
+<br><b><span lang=EN-US style='color:red'>2008</span></b><br>
+Apex opened up 7 new offices at Guangzhou, Zhongshan, Chongqing, Fuzhou, Zengzhou, Guadalajara and Atlanta. AFS Cargo Express started servicing New Jersey, New York, Connecticut and Pennsylvania.
+<br><b><span lang=EN-US style='color:red'>2007</span></b><br>
+Apex opened up 6 new offices at Xian, Rotterdam, Ningbo, Ho Chi Minh City, Wuhan and Jakarta. ULS expanded its operations by opening up a 60,000 square foot warehouse in City of Industry.
+AFS Cargo Express geographic scope was expanded to include Southern California, Arizona and the Midwest.
+<br><b><span lang=EN-US style='color:red'>2006</span></b><br>
+Apex has opened up 7 offices at Portland, OR, Cirebon, Lianyangang, Yantai, Nanjing, Zhongshan and Malaysia.
+<br><b><span lang=EN-US style='color:red'>2005</span></b><br>
+Apex has opened 4 new offices in Asia:Xiamen, Semarang, Surabaya, and Bangkok.
+<br><b><span lang=EN-US style='color:red'>2004</span></b><br>
+Apex has set up 10 new offices: Hong Kong, Shenzhen, Shanghai, Qingdao, Tianjin, Los Angeles, New York, Chicago, Seattle, and Dalian.
+<br><b><span lang=EN-US style='color:red'>2003</span></b><br>
+APEX Freight System, the perishable division, is established and is top performer (by tonnage) in SFO by China Air, EVA Air, Singapore Air, and Cathay Pacific. United Logistic Solutions is established to provide supply chain management, distribution, light production, warehousing, inventory control, and packaging.
+<br><b><span lang=EN-US style='color:red'>1994</span></b><br>
+AFS and AMC trucking divisions are established to service FCL and LCL customers.
+<br><b><span lang=EN-US style='color:red'>1993</span></b><br>
+Starlink Freight System, Inc. is registered as an air freight forwarder.
+<br><b><span lang=EN-US style='color:red'>1990</span></b><br>
+Apex Maritime Co., Inc. is established as an ocean freight forwarder in SFO, CA.
+</html>

+ 10 - 0
Apex/res/values/arrays.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <string-array name="spinner_bool_val">
+        <item></item>
+        <item>@string/str_true</item>
+        <item>@string/str_false</item>
+        
+    </string-array>
+</resources>

+ 4 - 2
Apex/res/values/strings.xml

@@ -1,16 +1,18 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <string name="app_name">Apex</string>
+    <string name="app_name">Apex Mobile</string>
     <string name="action_settings">Settings</string>
     <string name="action_forget_password">Forget password</string>
     <string name="action_custom_fields">Customize Fields</string>
+    <string name="str_true">true</string>
+    <string name="str_false">false</string>
     <string name="action_help">Help</string>
     <string name="hello_world">Hello world!</string>
     <string name="msg_net_resulterror">An error occur on server</string>
     <string name="msg_net_error">Can not connect to server</string>
     <string name="msg_connection_none">No available connection </string>
-    <string name="title_activity_apex">Apex</string>
+    <string name="title_activity_apex">Apex Mobile</string>
     <string name="title_activity_direct_tracking">DirectTracking</string>
     <string name="title_activity_function_select">Apex</string>
     <string name="title_activity_search">Search</string>

+ 48 - 16
Apex/src/com/usai/apex/AboutActivity.java

@@ -1,5 +1,9 @@
 package com.usai.apex;
 
+import java.io.InputStream;
+
+import org.apache.http.util.EncodingUtils;
+
 import android.net.Uri;
 import android.os.Bundle;
 import android.app.Activity;
@@ -14,36 +18,64 @@ import android.util.Log;
 import android.view.Menu;
 import android.view.View;
 import android.view.View.OnClickListener;
+import android.webkit.WebView;
 import android.widget.TextView;
 
-public class AboutActivity extends Activity {
+public class AboutActivity extends Activity
+{
 
 	@Override
-	protected void onCreate(Bundle savedInstanceState) {
+	protected void onCreate(Bundle savedInstanceState)
+	{
 		Log.e("AboutActivity", "onCreate");
 
 		super.onCreate(savedInstanceState);
 		setContentView(R.layout.activity_about);
-		final TextView tv_ver = (TextView)findViewById(R.id.tv_version);
-		
-//		String str = "<a href='https://ra.apexshipping.com/main.php?action=handset_search&action_type=download_doc&sessionid=hjqvgilu0o64d22qfqgat1afk2&url=QVRwVUswa3ZFNlBFTzhLbFpYcC9rVEhSZ1h0MGd6ekpwZ2ZqTkhXNnN2SytGM0FhRkhyNG5QbkdtV2tPMXZrK2p3' target=_blank>A1303540085F.pdf</a>";
+		final TextView tv_ver = (TextView) findViewById(R.id.tv_version);
+
+		// String str =
+		// "<a href='https://ra.apexshipping.com/main.php?action=handset_search&action_type=download_doc&sessionid=hjqvgilu0o64d22qfqgat1afk2&url=QVRwVUswa3ZFNlBFTzhLbFpYcC9rVEhSZ1h0MGd6ekpwZ2ZqTkhXNnN2SytGM0FhRkhyNG5QbkdtV2tPMXZrK2p3' target=_blank>A1303540085F.pdf</a>";
 
+		WebView wv = (WebView) findViewById(R.id.webView1);
+		String content = "";
+		try
+		{
+			InputStream in = getResources().openRawResource(R.raw.about);
+			// 获取文件的字节数
+			int lenght = in.available();
+			// 创建byte数组
+			byte[] buffer = new byte[lenght];
+			// 将文件中的数据读到byte数组中
+			in.read(buffer);
+			content = EncodingUtils.getString(buffer, "UTF-8");
+		}
+		catch (Exception e)
+		{
+			e.printStackTrace();
+		}
+		wv.getSettings().setDefaultTextEncodingName("UTF-8");
+		wv.loadData(content, "text/html", null);
 		
 		
-		try {
-			tv_ver.setText("ver:"+ApexTrackingApplication.get_instance().getPackageManager().getPackageInfo(
-						"com.usai.apex", 0).versionName);
-		} catch (NameNotFoundException e1) {
+		try
+		{
+			tv_ver.setText("ver:"
+					+ ApexTrackingApplication.get_instance()
+							.getPackageManager()
+							.getPackageInfo("com.usai.apex", 0).versionName);
+		}
+		catch (NameNotFoundException e1)
+		{
 			// TODO Auto-generated catch block
 			e1.printStackTrace();
 		}
 	}
-//
-//	@Override
-//	public boolean onCreateOptionsMenu(Menu menu) {
-//		// Inflate the menu; this adds items to the action bar if it is present.
-//		getMenuInflater().inflate(R.menu.about, menu);
-//		return true;
-//	}
+	//
+	// @Override
+	// public boolean onCreateOptionsMenu(Menu menu) {
+	// // Inflate the menu; this adds items to the action bar if it is present.
+	// getMenuInflater().inflate(R.menu.about, menu);
+	// return true;
+	// }
 
 }

+ 6 - 2
Apex/src/com/usai/apex/ApexActivity.java

@@ -82,7 +82,7 @@ public class ApexActivity extends FragmentActivity /*
 		// int[] tabIds = new int[] { R.id.tab1, R.id.tab2 };
 		mTabHost.addTab(mTabHost.newTabSpec("Login").setIndicator("Login")
 				.setContent(R.id.tab1));
-		// mTabHost.addTab(mTabHost.newTabSpec("Direct Tracking").setIndicator("Direct Tracking").setContent(R.id.tab2));
+//		 mTabHost.addTab(mTabHost.newTabSpec("test").setIndicator("test").setContent(R.id.tabtest));
 		mTabHost.addTab(mTabHost.newTabSpec("Service Location")
 				.setIndicator("Service Location").setContent(R.id.tab3));
 
@@ -103,7 +103,11 @@ public class ApexActivity extends FragmentActivity /*
 		// ft.replace(R.id.tab2, dtFragement);
 		// ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
 		// ft.addToBackStack("Tracking");
-
+//		Fragment test = new ServiceLocationFragment();
+//		ft.replace(R.id.tabtest, (Fragment) test);
+//		ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
+//		ft.addToBackStack("test");
+		
 		ft.replace(R.id.tab3, (Fragment) slFragment);
 		ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
 		ft.addToBackStack("Location");

+ 12 - 0
Apex/src/com/usai/apex/DetailActivity.java

@@ -8,6 +8,7 @@ import java.util.List;
 import com.usai.util.commonUtil;
 
 import android.R.integer;
+import android.app.ActionBar;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.KeyEvent;
@@ -77,6 +78,17 @@ public class DetailActivity extends FragmentActivity implements
 			}
 		}
 		function_name = getIntent().getStringExtra("function_name");
+		
+		if(function_name.equals("Ocean Booking"))
+			setTitle("Booking Detail");
+		else if(function_name.equals("Ocean B/L info."))
+			setTitle("B/L info. Detail");
+		else if(function_name.equals("Container detail"))
+			setTitle("Container Detail");
+//		else if(function_name.equals("Cargo Tracking"))
+//			setTitle("Cargo Detail");
+//		
+		
 		if (function_name.equals("Cargo Tracking"))
 		{
 			criterion_type = getIntent().getIntExtra("criterion_type", 0);

+ 99 - 92
Apex/src/com/usai/apex/FunctionSelectActivity.java

@@ -24,9 +24,9 @@ public class FunctionSelectActivity extends FragmentActivity implements
 {
 	// String user=null;
 	// String password=null;
-	Cursor				m_cur_container_no, m_cur_hbol;
-	SQLiteDatabase		m_db;
-	SimpleCursorAdapter	history_adapter;
+	// Cursor m_cur_container_no, m_cur_hbol;
+	// SQLiteDatabase m_db;
+	// SimpleCursorAdapter history_adapter;
 
 	@Override
 	protected void onCreate(Bundle savedInstanceState)
@@ -59,49 +59,49 @@ public class FunctionSelectActivity extends FragmentActivity implements
 		tv_about.setOnClickListener(this);
 		Button btn_search = (Button) findViewById(R.id.btn_search);
 		btn_search.setOnClickListener(this);
+		Button btn_clear = (Button) findViewById(R.id.btn_clear);
+		btn_clear.setOnClickListener(this);
 
-		
-		
-		
-		m_db = dbUtil.OpenDB(this, null, true);
-		m_cur_container_no = m_db.query("search_history", new String[] {
-				"h_val", "_id" }, "h_field='container_no' and user='"
-				+ ApexTrackingApplication.get_user() + "'", null, null, null,
-				"h_time", null);
-		startManagingCursor(m_cur_container_no);
-
-		m_cur_hbol = m_db.query("search_history",
-				new String[] { "h_val", "_id" }, "h_field='hbol' and user='"
-						+ ApexTrackingApplication.get_user() + "'", null, null,
-				null, "h_time", null);
-		startManagingCursor(m_cur_hbol);
+		// m_db = dbUtil.OpenDB(this, null, true);
+		// m_cur_container_no = m_db.query("search_history", new String[] {
+		// "h_val", "_id" }, "h_field='container_no' and user='"
+		// + ApexTrackingApplication.get_user() + "'", null, null, null,
+		// "h_time", null);
+		// startManagingCursor(m_cur_container_no);
+		//
+		// m_cur_hbol = m_db.query("search_history",
+		// new String[] { "h_val", "_id" }, "h_field='hbol' and user='"
+		// + ApexTrackingApplication.get_user() + "'", null, null,
+		// null, "h_time", null);
+		// startManagingCursor(m_cur_hbol);
+		//
+		// AutoCompleteTextView atv_criterion = (AutoCompleteTextView)
+		// findViewById(R.id.atv_criterion);
+		// history_adapter = new SimpleCursorAdapter(this,
+		// R.layout.dropdown_item,
+		// m_cur_hbol, new String[] { "h_val" },
+		// new int[] { R.id.drop_item });
+		// atv_criterion.setAdapter(history_adapter);
 
-		AutoCompleteTextView atv_criterion = (AutoCompleteTextView) findViewById(R.id.atv_criterion);
-		history_adapter = new SimpleCursorAdapter(this, R.layout.dropdown_item,
-				m_cur_hbol, new String[] { "h_val" },
-				new int[] { R.id.drop_item });
-		atv_criterion.setAdapter(history_adapter);
-		
-		
 		RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup1);
-		rg.setOnCheckedChangeListener(new OnCheckedChangeListener(){
-
-			@Override
-			public void onCheckedChanged(RadioGroup group, int checkedId)
-			{
-				if(checkedId==R.id.radio0)
-				{
-					history_adapter.swapCursor(m_cur_hbol);
-				}
-				else
-				{
-					history_adapter.swapCursor(m_cur_container_no);
-					
-				}
-				
-			}
-			
-		});
+		// rg.setOnCheckedChangeListener(new OnCheckedChangeListener(){
+		//
+		// @Override
+		// public void onCheckedChanged(RadioGroup group, int checkedId)
+		// {
+		// if(checkedId==R.id.radio0)
+		// {
+		// history_adapter.swapCursor(m_cur_hbol);
+		// }
+		// else
+		// {
+		// history_adapter.swapCursor(m_cur_container_no);
+		//
+		// }
+		//
+		// }
+		//
+		// });
 	}
 
 	// @Override
@@ -114,7 +114,7 @@ public class FunctionSelectActivity extends FragmentActivity implements
 	@Override
 	protected void onDestroy()
 	{
-		dbUtil.CloseDB(m_db);
+		// dbUtil.CloseDB(m_db);
 		super.onDestroy();
 	}
 
@@ -125,63 +125,66 @@ public class FunctionSelectActivity extends FragmentActivity implements
 		Log.d(TAG, "ID=" + v.getId());
 		switch (v.getId())
 		{
+			case R.id.btn_clear:
+			{
+
+				AutoCompleteTextView et = (AutoCompleteTextView) findViewById(R.id.atv_criterion);
+				et.setText("");
+
+			}
 			case R.id.btn_search:
+			{
 				AutoCompleteTextView et = (AutoCompleteTextView) findViewById(R.id.atv_criterion);
 				String cargo_criterion = et.getText().toString();
-				if (TextUtils.isEmpty(cargo_criterion))
+				// if (TextUtils.isEmpty(cargo_criterion))
+				// {
+				// et.setError(getString(R.string.error_field_required));
+				// et.requestFocus();
+				// }
+				// else
+				// {
+				Intent intent = new Intent();
+				intent.setClass(this, DetailActivity.class);
+
+				intent.putExtra("action0", "Tracking");
+				intent.putExtra("function_name", "Cargo Tracking");
+
+				intent.putExtra("cargo_criterion", cargo_criterion);
+				intent.putExtra("actions_count", 1);
+				intent.putExtra("_id", "dumb");
+				String h_field;
+				RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup1);
+				if (rg.getCheckedRadioButtonId() == R.id.radio0)
 				{
-					et.setError(getString(R.string.error_field_required));
-					et.requestFocus();
+					intent.putExtra("criterion_type", 0);
+					h_field = "hbol";
 				}
 				else
 				{
-					Intent intent = new Intent();
-					intent.setClass(this, DetailActivity.class);
-
-					intent.putExtra("action0", "Tracking");
-					intent.putExtra("function_name", "Cargo Tracking");
-					intent.putExtra("cargo_criterion", cargo_criterion);
-					intent.putExtra("actions_count", 1);
-					intent.putExtra("_id", "dumb");
-					String h_field;
-					RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup1);
-					if (rg.getCheckedRadioButtonId() == R.id.radio0)
-					{
-						intent.putExtra("criterion_type", 0);
-						h_field = "hbol";
-					}
-					else
-					{
-						intent.putExtra("criterion_type", 1);
-						h_field = "container_no";
-					}
-					String user = ApexTrackingApplication.get_user();
-					long h_time = System.currentTimeMillis();
-					int count = dbUtil
-							.get_count(m_db, "search_history", "user='" + user
-									+ "' and h_field='" + h_field + "'");
-					if (count < 10)
-					{
-						m_db.execSQL("insert into search_history(h_val,h_field,h_time,user) values('"
-								+ cargo_criterion + "','" + h_field + "',"+h_time+",'"+user+"')");
-					}
-					{
-					   int _id=dbUtil.get_recordid(m_db, "search_history", "user='" + user
-							+ "' and h_field='" + h_field + "'", "h_time");
-					   m_db.execSQL("update search_history set h_val='"+cargo_criterion+"' , h_time='"+h_time+"' where _id="+_id);
-					}
-					// dbUtil.isRecordExist(m_db, "search_history", where);
-					// ContentValues cv = new ContentValues();
-					// cv.put("h_val", cargo_criterion);
-					// cv.put("h_field", dbUtil.NUMBER_TYPE_BLACK);
-					// cv.put("h_time", 3);
-					// cv.put("user", ApexTrackingApplication.get_user());
-					// db.insert("user_numberlist", null, cv);
-					// hbol
-					// container_no
-					startActivity(intent);
+					intent.putExtra("criterion_type", 1);
+					h_field = "container_no";
 				}
+				String user = ApexTrackingApplication.get_user();
+				// long h_time = System.currentTimeMillis();
+				// int count = dbUtil
+				// .get_count(m_db, "search_history", "user='" + user
+				// + "' and h_field='" + h_field + "'");
+				// if (count < 10)
+				// {
+				// m_db.execSQL("insert into search_history(h_val,h_field,h_time,user) values('"
+				// + cargo_criterion + "','" + h_field +
+				// "',"+h_time+",'"+user+"')");
+				// }
+				// {
+				// int _id=dbUtil.get_recordid(m_db, "search_history", "user='"
+				// + user
+				// + "' and h_field='" + h_field + "'", "h_time");
+				// m_db.execSQL("update search_history set h_val='"+cargo_criterion+"' , h_time='"+h_time+"' where _id="+_id);
+				// }
+				startActivity(intent);
+				// }
 				break;
+			}
 			case R.id.tv_booking:
 			{
 				Intent intent = new Intent();
@@ -189,6 +192,7 @@ public class FunctionSelectActivity extends FragmentActivity implements
 				// intent.putExtra("user", ApexTrackingApplication.get_user());
 				// intent.putExtra("password", password);
 				intent.putExtra("function_name", "Ocean Booking");
+				intent.putExtra("title", "Booking Search");
 				startActivity(intent);
 				break;
 			}
@@ -199,6 +203,7 @@ public class FunctionSelectActivity extends FragmentActivity implements
 				// intent.putExtra("user", user);
 				// intent.putExtra("password", password);
 				intent.putExtra("function_name", "Ocean B/L info.");
+				intent.putExtra("title", "B/L info. Search");
 				startActivity(intent);
 				break;
 			}
@@ -209,6 +214,7 @@ public class FunctionSelectActivity extends FragmentActivity implements
 				// intent.putExtra("user", user);
 				// intent.putExtra("password", password);
 				intent.putExtra("function_name", "Container detail");
+				intent.putExtra("title", "Container Search");
 				startActivity(intent);
 				break;
 			}
@@ -230,6 +236,7 @@ public class FunctionSelectActivity extends FragmentActivity implements
 				// intent.putExtra("user", user);
 				// intent.putExtra("password", password);
 				intent.putExtra("function_name", "Download Document");
+				intent.putExtra("title", "Document Search");
 				startActivity(intent);
 				break;
 			}

+ 18 - 4
Apex/src/com/usai/apex/ResultActivity.java

@@ -17,6 +17,7 @@ import android.os.Build;
 import android.os.Bundle;
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
+import android.app.ActionBar;
 import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.Dialog;
@@ -78,6 +79,15 @@ public class ResultActivity extends Activity {
 		user = ApexTrackingApplication.get_user();
 		password = ApexTrackingApplication.get_pass();
 		function_name = getIntent().getStringExtra("function_name");
+		if(function_name.equals("Ocean Booking"))
+			setTitle("Booking Result");
+		else if(function_name.equals("Ocean B/L info."))
+			setTitle("B/L info. Result");
+		else if(function_name.equals("Container detail"))
+			setTitle("Container Result");
+		else if(function_name.equals("Download Document"))
+			setTitle("Document Result");
+		
 		searchParms = getIntent().getBundleExtra("searchParms");
 		super.onCreate(savedInstanceState);
 		setContentView(R.layout.activity_result);
@@ -203,7 +213,11 @@ public class ResultActivity extends Activity {
 			tv_head.setText("0 record found");
 
 			return;
-		} else
+		} else if(searchresult.get_totalcount()>2000)
+		{
+			tv_head.setText("2000+ records");
+		}
+		else
 			tv_head.setText(/*
 							 * loadcount + "/" +
 							 */searchresult.get_totalcount()
@@ -633,14 +647,14 @@ public class ResultActivity extends Activity {
 						Toast.LENGTH_LONG);
 				toast.setGravity(Gravity.CENTER, 0, 0);
 				toast.show();
-				return;
+				break;
 			}
 			case Network.RESULT_NET_ERROR: {
 				Toast toast = Toast.makeText(getApplicationContext(),
 						getText(R.string.msg_net_error), Toast.LENGTH_LONG);
 				toast.setGravity(Gravity.CENTER, 0, 0);
 				toast.show();
-				return;
+				break;
 			}
 			case Network.RESULT_ERROR:
 			// case Network.RESULT_RESPONSE_NULL:
@@ -650,7 +664,7 @@ public class ResultActivity extends Activity {
 						Toast.LENGTH_LONG);
 				toast.setGravity(Gravity.CENTER, 0, 0);
 				toast.show();
-				return;
+				break;
 			}
 
 			default:

+ 380 - 101
Apex/src/com/usai/apex/SearchListActivity.java

@@ -1,67 +1,93 @@
 package com.usai.apex;
 
+import java.util.Calendar;
 import java.util.HashMap;
-import java.util.Iterator;
-
 import com.usai.util.Network;
 import com.usai.util.dbUtil;
 
 import android.os.Bundle;
+import android.app.ActionBar;
 import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.AlertDialog.Builder;
+import android.app.DatePickerDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
+import android.support.v4.app.DialogFragment;
+import android.support.v4.app.FragmentActivity;
 import android.text.Editable;
 import android.text.InputType;
+import android.text.TextUtils;
 import android.text.TextWatcher;
+import android.util.Log;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
 import android.view.View.OnClickListener;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
 import android.widget.Button;
-import android.widget.CompoundButton;
+import android.widget.DatePicker;
 import android.widget.EditText;
 import android.widget.LinearLayout;
 import android.widget.RelativeLayout;
-import android.widget.Switch;
+import android.widget.Spinner;
 import android.widget.TextView;
 
-public class SearchListActivity extends Activity implements OnClickListener
+public class SearchListActivity extends FragmentActivity implements
+		OnClickListener
 {
 
-	LinearLayout ll_list;
-	String user = null;
-//	String password = null;
-	String function_name = null;
-	HashMap<String, Field> hashMap = new HashMap<String, Field>();
-	private class Field
-	{
-		String name;
-		String value;
-		public Field(String n,String v)
-		{
-			name=n;
-			value=v;
-		}
-	}
+	// String[] spin_valbool = { "True", "False" };
+	LinearLayout			ll_list;
+	String					user			= null;
+	// String password = null;
+	String					function_name	= null;
+	HashMap<String, String>	hashMap			= new HashMap<String, String>();
+
+	// private class Field
+	// {
+	// String name;
+	// String value;
+	// public Field(String n,String v)
+	// {
+	// name=n;
+	// value=v;
+	// }
+	// }
 	@Override
 	protected void onCreate(Bundle savedInstanceState)
 	{
 		super.onCreate(savedInstanceState);
 		setContentView(R.layout.activity_search_list);
-		user = ApexTrackingApplication.get_user();
 		
-//		password = ApexTrackingApplication.get_pass();
+		user = ApexTrackingApplication.get_user();
+
+		// password = ApexTrackingApplication.get_pass();
 		function_name = getIntent().getStringExtra("function_name");
 
+		
+		setTitle(getIntent().getStringExtra("title"));
+
 		ll_list = (LinearLayout) findViewById(R.id.ll_list);
 		Button btnok = (Button) findViewById(R.id.btnok);
 		btnok.setOnClickListener(this);
 		Button btncancel = (Button) findViewById(R.id.btncancel);
 		btncancel.setOnClickListener(this);
+		Button btnclear = (Button) findViewById(R.id.btn_clear);
+		btnclear.setOnClickListener(this);
+		if (savedInstanceState != null)
+		{
+			hashMap = (HashMap<String, String>) savedInstanceState
+					.getSerializable("hashMap");
+		}
 
-		
 	}
+
 	@Override
 	protected void onResume()
 	{
@@ -71,7 +97,7 @@ public class SearchListActivity extends Activity implements OnClickListener
 
 	void init()
 	{
-		hashMap.clear();
+		// hashMap.clear();
 		ll_list.removeAllViews();
 		SQLiteDatabase db = dbUtil.OpenDB(this, null, true);
 		Cursor cursor = db.query("fields_info", new String[] { "aname",
@@ -85,87 +111,251 @@ public class SearchListActivity extends Activity implements OnClickListener
 			String field_type = cursor.getString(1);
 			final String name = cursor.getString(2);
 
-//			hashMap.put(aname, field);
+			// hashMap.put(aname, field);
 
 			if (field_type.equals("boolean"))
 			{
-				RelativeLayout switchitem = (RelativeLayout) this
+				RelativeLayout spinneritem = (RelativeLayout) this
 						.getLayoutInflater().inflate(
-								R.layout.search_item_switch, null);
-				TextView tvname = (TextView) switchitem
+								R.layout.search_item_spinner, null);
+				spinneritem.setTag("search_item_spinner");
+				TextView tvname = (TextView) spinneritem
 						.findViewById(R.id.aname);
 				tvname.setText(aname);
-				Switch switch_bool = (Switch) switchitem
-						.findViewById(R.id.switch_bool);
-				switch_bool.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
+				tvname.setTag(name);
+				Spinner spinner_bool = (Spinner) spinneritem
+						.findViewById(R.id.sp_bool);
+				ArrayAdapter<CharSequence> adapter = ArrayAdapter
+						.createFromResource(this, R.array.spinner_bool_val,
+								android.R.layout.simple_spinner_item);
+				adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+				spinner_bool.setAdapter(adapter);
+				String val = hashMap.get(name);
+				if (val != null)
+				{
+					if (val.equals("true"))
+						spinner_bool.setSelection(1);
+					else if (val.equals("false"))
+						spinner_bool.setSelection(2);
+					else
+						spinner_bool.setSelection(0);
+				}
+
+				spinner_bool
+						.setOnItemSelectedListener(new OnItemSelectedListener()
+						{
+
+							@Override
+							public void onItemSelected(AdapterView<?> arg0,
+									View arg1, int arg2, long arg3)
+							{
+								if (arg2 == 1)
+									hashMap.put(name, "true");
+								else if (arg2 == 2)
+									hashMap.put(name, "false");
+
+							}
+
+							@Override
+							public void onNothingSelected(AdapterView<?> arg0)
+							{
+
+							}
+
+						});
+				// String val = hashMap.get(name);
+				// if(val!=null)
+
+				// switch_bool.setOnCheckedChangeListener(new
+				// CompoundButton.OnCheckedChangeListener(){
+				//
+				// @Override
+				// public void onCheckedChanged(CompoundButton buttonView,
+				// boolean isChecked)
+				// {
+				// String val;
+				// if(isChecked)
+				// val="true";
+				// else
+				// val="false";
+				// Field field = new Field(name,val);
+				// field.name = name;
+				// hashMap.put(aname,field);
+				//
+				// }
+				//
+				// });
+				ll_list.addView(spinneritem);
+			}
+			else if (field_type.equals("time"))
+			{
+
+				RelativeLayout timeitem = (RelativeLayout) this
+						.getLayoutInflater().inflate(
+								R.layout.search_item_datepicker, null);
+				timeitem.setTag("search_item_datepicker");
+				TextView tvname = (TextView) timeitem.findViewById(R.id.aname);
+				tvname.setText(aname);
+				tvname.setTag(name);
+				final EditText edit_from = (EditText) timeitem
+						.findViewById(R.id.et_from);
+				final EditText edit_to = (EditText) timeitem
+						.findViewById(R.id.et_to);
+
+				String val_from = hashMap.get(name + "_from");
+				String val_to = hashMap.get(name + "_to");
+				if (val_from != null)
+				{
+					edit_from.setText(val_from);
+				}
+				if (val_to != null)
+					edit_to.setText(val_to);
+				// edit_from.setInputType(InputType.TYPE_DATETIME_VARIATION_DATE
+				// | InputType.TYPE_CLASS_DATETIME);
+				final Calendar c = Calendar.getInstance();
+				// int mYear =
+				// int mMonth = c.get(Calendar.MONTH);
+				// int mDay = c.get(Calendar.DAY_OF_MONTH);
+				// final DatePickerDialog dialog =
+				Button btn_clear_from = (Button) timeitem
+						.findViewById(R.id.btn_clear_from);
+				btn_clear_from.setOnClickListener(new OnClickListener()
+				{
 
 					@Override
-					public void onCheckedChanged(CompoundButton buttonView,
-							boolean isChecked)
-					{ 
-						String val;
-						if(isChecked)
-							val="true";
-						else
-							val="false";
-						Field field = new Field(name,val);
-						field.name = name;
-						hashMap.put(aname,field);
-						
+					public void onClick(View v)
+					{
+						edit_from.setText("");
+						hashMap.remove(name+"_from");
+
 					}
-					
+
 				});
-				ll_list.addView(switchitem);
+				Button btn_clear_to = (Button) timeitem
+						.findViewById(R.id.btn_clear_to);
+				btn_clear_to.setOnClickListener(new OnClickListener()
+				{
+
+					@Override
+					public void onClick(View v)
+					{
+						edit_to.setText("");
+						hashMap.remove(name+"_to");
+
+					}
+
+				});
+
+				edit_from.setOnClickListener(new OnClickListener()
+				{
+					public void onClick(View v)
+					{
+						new DatePickerDialog(SearchListActivity.this,
+								new DatePickerDialog.OnDateSetListener()
+								{
+
+									@Override
+									public void onDateSet(DatePicker view,
+											int year, int monthOfYear,
+											int dayOfMonth)
+									{
+										edit_from
+												.setText((monthOfYear + 1)
+														+ "/" + dayOfMonth
+														+ "/" + year);
+										hashMap.put(name+"_from",(monthOfYear + 1)
+												+ "/" + dayOfMonth
+												+ "/" + year);
+
+									}
+
+								}, c.get(Calendar.YEAR), c.get(Calendar.MONTH),
+								c.get(Calendar.DAY_OF_MONTH)).show();
+
+					}
+				});
+
+				edit_to.setOnClickListener(new OnClickListener()
+				{
+					public void onClick(View v)
+					{
+						new DatePickerDialog(SearchListActivity.this,
+								new DatePickerDialog.OnDateSetListener()
+								{
+
+									@Override
+									public void onDateSet(DatePicker view,
+											int year, int monthOfYear,
+											int dayOfMonth)
+									{
+										edit_to.setText((monthOfYear + 1) + "/"
+												+ dayOfMonth + "/" + year);
+										hashMap.put(name+"_to",(monthOfYear + 1)
+												+ "/" + dayOfMonth
+												+ "/" + year);
+
+									}
+
+								}, c.get(Calendar.YEAR), c.get(Calendar.MONTH),
+								c.get(Calendar.DAY_OF_MONTH)).show();
+
+					}
+				});
+
+				ll_list.addView(timeitem);
 			}
 			else
 			{
 				RelativeLayout edititem = (RelativeLayout) this
 						.getLayoutInflater().inflate(R.layout.search_item_edit,
 								null);
+				edititem.setTag("search_item_edit");
 				TextView tvname = (TextView) edititem.findViewById(R.id.aname);
 				tvname.setText(aname);
+				tvname.setTag(name);
 				EditText edit = (EditText) edititem.findViewById(R.id.edit_val);
+				String val = hashMap.get(name);
+				if (val != null)
+				{
+					edit.setText(val);
+				}
 				edit.addTextChangedListener(new TextWatcher()
 				{
 					@Override
 					public void onTextChanged(CharSequence s, int start,
 							int before, int count)
 					{
-	
+
 					}
-	
+
 					@Override
 					public void beforeTextChanged(CharSequence s, int start,
 							int count, int after)
 					{
-	
+
 					}
-	
+
 					@Override
 					public void afterTextChanged(Editable s)
 					{
-						// ��editText�иı��ֵ���õ�HashMap��
 						String val = s.toString();
 						val.trim();
 						if (val.length() > 0)
 						{
-							Field field = new Field(name,val);
-							field.name = name;
-							hashMap.put(aname,field);
+
+							hashMap.put(name, val);
 						}
 					}
 
-		
 				});
-				if (field_type.equals("time"))
-					edit.setInputType(InputType.TYPE_DATETIME_VARIATION_DATE
-							| InputType.TYPE_CLASS_DATETIME);
-				else if (field_type.equals("int"))
+				if (field_type.equals("int"))
 					edit.setInputType(InputType.TYPE_CLASS_NUMBER);
 
 				ll_list.addView(edititem);
 			}
 		}
+		dbUtil.CloseCursor(cursor);
+		dbUtil.CloseDB(db);
 	}
 
 	@Override
@@ -176,39 +366,128 @@ public class SearchListActivity extends Activity implements OnClickListener
 		return true;
 	}
 
+	@Override
+	protected void onSaveInstanceState(Bundle outState)
+	{
+		outState.putSerializable("hashmap", hashMap);
+		super.onSaveInstanceState(outState);
+	}
+
 	@Override
 	public void onClick(View v)
 	{
 		switch (v.getId())
 		{
-		case R.id.btnok:
-		{
-			Intent intent = new Intent();
-			intent.setClass(this, ResultActivity.class);
-//			intent.putExtra("user", user);
-//			intent.putExtra("password", password);
-			intent.putExtra("function_name", function_name);
-			Bundle parms = new Bundle();
-			parms.putString("module_name", function_name);
-			parms.putString("columns", dbUtil.get_fields(user, function_name));
-			Iterator<String> iter = hashMap.keySet().iterator();
-			while (iter.hasNext())
+			case R.id.btnok:
 			{
-				String aname = (String) iter.next();
-				Field field = (Field) hashMap.get(aname);
-				parms.putString(field.name, field.value);
+				Intent intent = new Intent();
+				intent.setClass(this, ResultActivity.class);
+				// intent.putExtra("user", user);
+				// intent.putExtra("password", password);
+				intent.putExtra("function_name", function_name);
+				Bundle parms = new Bundle();
+				parms.putString("module_name", function_name);
+				parms.putString("columns",
+						dbUtil.get_fields(user, function_name));
+				for (int i = 0; i < ll_list.getChildCount(); i++)
+				{
+					View item = ll_list.getChildAt(i);
+					String tag = item.getTag().toString();
+					TextView tv_aname = (TextView) item
+							.findViewById(R.id.aname);
+					String field_name = tv_aname.getTag().toString();
+					String val = "";
+					if (tag.equals("search_item_spinner"))
+					{
+						Spinner spinner_bool = (Spinner) item
+								.findViewById(R.id.sp_bool);
+						long sel = spinner_bool.getSelectedItemId();
+						if (sel == 1)
+							val = "true";
+						else if (sel == 2)
+							val = "false";
+						else
+							val = "";
+						if (!TextUtils.isEmpty(val))
+							parms.putString(field_name, val);
+					}
+					else if (tag.equals("search_item_edit"))
+					{
+						EditText edit = (EditText) item
+								.findViewById(R.id.edit_val);
+						val = edit.getText().toString().trim();
+						if (!TextUtils.isEmpty(val))
+							parms.putString(field_name, val);
+
+					}
+					else if (tag.equals("search_item_datepicker"))
+					{
+						EditText et_from = (EditText) item
+								.findViewById(R.id.et_from);
+						String val_from = et_from.getText().toString().trim();
+						EditText et_to = (EditText) item
+								.findViewById(R.id.et_to);
+						String val_to = et_to.getText().toString().trim();
+						if (!TextUtils.isEmpty(val_from))
+							parms.putString(field_name + "_from", val_from);
+						if (!TextUtils.isEmpty(val_to))
+							parms.putString(field_name + "_to", val_to);
+					}
+
+				}
+				// Iterator<String> iter = hashMap.keySet().iterator();
+				// while (iter.hasNext())
+				// {
+				// String aname = (String) iter.next();
+				// Field field = (Field) hashMap.get(aname);
+				// parms.putString(field.name, field.value);
+				// }
+				intent.putExtra("searchParms", parms);
+
+				startActivity(intent);
+
+				break;
 			}
-			intent.putExtra("searchParms", parms);
+			case R.id.btncancel:
+				finish();
+				break;
+			case R.id.btn_clear:
+			{
+				AlertDialog.Builder builder = new Builder(
+						SearchListActivity.this);
+				builder.setMessage("Click Reset button to reset");
 
-			startActivity(intent);
+				builder.setTitle("Confirm reset");
 
-			break;
-		}
-		case R.id.btncancel:
-			finish();
-			break;
-		default:
-			break;
+				builder.setPositiveButton("Reset", new Dialog.OnClickListener()
+				{
+
+					@Override
+					public void onClick(DialogInterface dialog, int which)
+					{
+						hashMap.clear();
+						init();
+						dialog.dismiss();
+
+					}
+				});
+
+				builder.setNegativeButton("Cancel",
+						new Dialog.OnClickListener()
+						{
+
+							@Override
+							public void onClick(DialogInterface dialog,
+									int which)
+							{
+								dialog.dismiss();
+							}
+						});
+
+				builder.create().show();
+			}
+			default:
+				break;
 		}
 
 	}
@@ -219,25 +498,25 @@ public class SearchListActivity extends Activity implements OnClickListener
 		Intent intent = new Intent();
 		switch (item.getItemId())
 		{
-		case R.id.action_custom_fields:
-			intent.setClass(this, CustomizeFieldsActivity.class);
-//			intent.putExtra("user", user);
-			// intent.putExtra("password", password);
-			intent.putExtra("function_name", function_name);
-			intent.putExtra("behavior", Network.BEHAVIOR_SEARCH);
-			startActivity(intent);
-			break;
-		case R.id.action_help:
-			// Intent intent = new Intent();
-			intent.setClass(this, HelpActivity.class);
-			intent.putExtra("caller", "search");
-			// // intent.putExtra("password", password);
-			// intent.putExtra("function_name", function_name);
-			// intent.putExtra("behavior", Network.BEHAVIOR_SEARCH);
-			startActivity(intent);
-			break;
-		default:
-			break;
+			case R.id.action_custom_fields:
+				intent.setClass(this, CustomizeFieldsActivity.class);
+				// intent.putExtra("user", user);
+				// intent.putExtra("password", password);
+				intent.putExtra("function_name", function_name);
+				intent.putExtra("behavior", Network.BEHAVIOR_SEARCH);
+				startActivity(intent);
+				break;
+			case R.id.action_help:
+				// Intent intent = new Intent();
+				intent.setClass(this, HelpActivity.class);
+				intent.putExtra("caller", "search");
+				// // intent.putExtra("password", password);
+				// intent.putExtra("function_name", function_name);
+				// intent.putExtra("behavior", Network.BEHAVIOR_SEARCH);
+				startActivity(intent);
+				break;
+			default:
+				break;
 		}
 		return super.onOptionsItemSelected(item);
 	}

+ 5 - 0
Apex/src/com/usai/apex/ServiceLocationFragment.java

@@ -121,6 +121,8 @@ public class ServiceLocationFragment extends Fragment implements
 		fragment = (SupportMapFragment) fm.findFragmentById(R.id.map);
 		if (fragment == null)
 		{
+			
+			Log.e("onActivityCreated","create support map fragment");
 			fragment = new SupportMapFragment();// .newInstance();
 			fm.beginTransaction().replace(R.id.map, fragment).commit();
 		}
@@ -132,6 +134,8 @@ public class ServiceLocationFragment extends Fragment implements
 		super.onResume();
 		if (map == null)
 		{
+			
+			Log.e("onResume","get map from fragment");
 			map = fragment.getMap();
 			if (map != null)
 				setUpMap();
@@ -141,6 +145,7 @@ public class ServiceLocationFragment extends Fragment implements
 
 	private void setUpMap()
 	{
+		Log.e("setup map","setup map");
 		// // Hide the zoom controls as the button panel will cover it.
 		// map.getUiSettings().setZoomControlsEnabled(false);
 		//