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

+ 5 - 2
Apex/AndroidManifest.xml

@@ -93,8 +93,7 @@
         </activity>
         <activity
             android:name="com.usai.apex.ResultActivity"
-            android:label="@string/title_activity_result"
-            >
+            android:label="@string/title_activity_result" >
         </activity>
         <activity
             android:name="com.usai.apex.LocationDetailActivity"
@@ -129,6 +128,10 @@
             android:label="Change Password"
             android:windowSoftInputMode="adjustResize|stateVisible" >
         </activity>
+        <activity
+            android:name="com.usai.apex.AboutActivity"
+            android:label="@string/title_activity_about" >
+        </activity>
     </application>
 
 </manifest>

+ 3 - 0
Apex/lint.xml

@@ -10,4 +10,7 @@
     <issue id="UselessParent">
         <ignore path="res/layout/fragment_direct_tracking.xml" />
     </issue>
+    <issue id="ValidFragment">
+        <ignore path="src/com/usai/apex/DetailFragment.java" />
+    </issue>
 </lint>

BIN
Apex/res/drawable/ic_map.png


+ 50 - 0
Apex/res/layout/activity_about.xml

@@ -0,0 +1,50 @@
+<RelativeLayout 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: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"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:layout_centerHorizontal="true"
+
+        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" />
+
+    <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_centerHorizontal="true"
+        android:layout_centerVertical="true"
+        android:gravity="center_horizontal"
+        android:text="version:" />
+
+</RelativeLayout>

+ 9 - 0
Apex/res/menu/about.xml

@@ -0,0 +1,9 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item
+        android:id="@+id/action_settings"
+        android:orderInCategory="100"
+        android:showAsAction="never"
+        android:title="@string/action_settings"/>
+
+</menu>

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

@@ -34,7 +34,7 @@
     <string name="error_incorrect_password">This password is incorrect</string>
     <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="title_activity_detail">Detail</string>
     <string name="search">Search</string>
     <!-- locations -->
 
@@ -47,5 +47,6 @@
     <string name="title_activity_cargo_tracking">CargoTracking</string>
     <string name="title_activity_search_list">Search</string>
     <string name="title_activity_retrieve_password">RetrievePassword</string>
+    <string name="title_activity_about">About</string>
 
 </resources>

+ 47 - 0
Apex/src/com/usai/apex/AboutActivity.java

@@ -0,0 +1,47 @@
+package com.usai.apex;
+
+import android.net.Uri;
+import android.os.Bundle;
+import android.app.Activity;
+import android.app.DownloadManager;
+import android.app.DownloadManager.Request;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.text.Html;
+import android.text.SpannableString;
+import android.text.method.LinkMovementMethod;
+import android.text.style.URLSpan;
+import android.util.Log;
+import android.view.Menu;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.TextView;
+
+public class AboutActivity extends Activity {
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState) {
+		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>";
+
+		
+		
+		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;
+//	}
+
+}

+ 24 - 0
Apex/src/com/usai/apex/DetailFragment.java

@@ -12,6 +12,8 @@ import android.R.integer;
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
 import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
 import android.os.AsyncTask;
 import android.os.Build;
 import android.os.Bundle;
@@ -25,6 +27,7 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.ViewGroup;
+import android.webkit.DownloadListener;
 import android.webkit.WebView;
 import android.widget.Button;
 import android.widget.LinearLayout;
@@ -290,6 +293,27 @@ public class DetailFragment extends Fragment implements OnClickListener /*
 
 						wv.getSettings().setDefaultTextEncodingName("UTF-8");
 						wv.setId(commonUtil.generateViewId());
+						
+						wv.setDownloadListener(new DownloadListener()
+						{
+
+							@Override
+							public void onDownloadStart(String url,
+									String userAgent,
+									String contentDisposition, String mimetype,
+									long contentLength) {
+								Log.d("WebView","Download Action");
+					            Log.i("tag", "url="+url);             
+					            Log.i("tag", "userAgent="+userAgent);  
+					            Log.i("tag", "contentDisposition="+contentDisposition);           
+					            Log.i("tag", "mimetype="+mimetype);  
+					            Log.i("tag", "contentLength="+contentLength);  
+					            Uri uri = Uri.parse(url);  
+					            Intent intent = new Intent(Intent.ACTION_VIEW, uri);  
+					            startActivity(intent); 		
+							}
+							
+						});
 						control.put(v.getId(), wv.getId());
 						wv.loadData(content, mimeType, null);
 

+ 17 - 1
Apex/src/com/usai/apex/FunctionSelectActivity.java

@@ -46,6 +46,8 @@ public class FunctionSelectActivity extends FragmentActivity implements
 		tv_exit.setOnClickListener(this);
 		TextView tv_loc = (TextView) findViewById(R.id.tv_location);
 		tv_loc.setOnClickListener(this);
+		TextView tv_about = (TextView) findViewById(R.id.tv_about);
+		tv_about.setOnClickListener(this);
 		Button btn_search = (Button) findViewById(R.id.btn_search);
 		btn_search.setOnClickListener(this);
 	}
@@ -126,8 +128,15 @@ public class FunctionSelectActivity extends FragmentActivity implements
 		//
 		// break;
 		case R.id.tv_doc:
-
+		{
+			Intent intent = new Intent();
+			intent.setClass(this, SearchListActivity.class);
+			// intent.putExtra("user", user);
+			// intent.putExtra("password", password);
+			intent.putExtra("function_name", "Download Document");
+			startActivity(intent);
 			break;
+		}
 		case R.id.tv_password: {
 			Intent intent = new Intent();
 			intent.setClass(this, ChangePasswordActivity.class);
@@ -140,6 +149,13 @@ public class FunctionSelectActivity extends FragmentActivity implements
 			System.exit(0);
 			break;
 		}
+		case R.id.tv_about: {
+			Intent intent = new Intent();
+			intent.setClass(this, AboutActivity.class);
+			startActivity(intent);
+			
+			break;
+		}
 		case R.id.tv_location: {
 			Log.d("==============", "start location activity");
 			Intent intent = new Intent();

+ 163 - 143
Apex/src/com/usai/apex/ResultActivity.java

@@ -11,17 +11,26 @@ import org.json.JSONObject;
 import com.usai.util.Network;
 import com.usai.util.dbUtil;
 
+import android.net.Uri;
 import android.os.AsyncTask;
 import android.os.Build;
 import android.os.Bundle;
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
 import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DownloadManager;
+import android.app.AlertDialog.Builder;
+import android.app.DownloadManager.Request;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
+import android.text.Html;
+import android.text.style.URLSpan;
 import android.util.Log;
 import android.util.SparseArray;
 import android.view.ContextMenu;
@@ -30,6 +39,7 @@ import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
 import android.view.ContextMenu.ContextMenuInfo;
+import android.view.View.OnClickListener;
 import android.view.View.OnCreateContextMenuListener;
 import android.widget.AdapterView.AdapterContextMenuInfo;
 import android.widget.Button;
@@ -39,8 +49,7 @@ import android.widget.TableRow;
 import android.widget.TextView;
 import android.widget.Toast;
 
-public class ResultActivity extends Activity
-{
+public class ResultActivity extends Activity {
 	String user = null;
 	String password = null;
 	String function_name = null;
@@ -57,6 +66,7 @@ public class ResultActivity extends Activity
 	// private View mSearchFormView;
 	private View footview;
 	private View mStatusView;
+	int actioncount=0;
 
 	// private class resultAdapter extends SimpleAdapter
 	// {
@@ -64,30 +74,40 @@ public class ResultActivity extends Activity
 	//
 	// }
 	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
+	protected void onCreate(Bundle savedInstanceState) {
 		user = ApexTrackingApplication.get_user();
 		password = ApexTrackingApplication.get_pass();
 		function_name = getIntent().getStringExtra("function_name");
 		searchParms = getIntent().getBundleExtra("searchParms");
 		super.onCreate(savedInstanceState);
 		setContentView(R.layout.activity_result);
+		
+		SQLiteDatabase db = dbUtil.OpenDB(ResultActivity.this, null, false);
+		Cursor cursor = db.query("actions_info",
+				new String[] { "count(*)" }, "function_name='"
+						+ function_name + "' and user='" + user + "'",
+				null, null, null, "priority", null);
+		if (cursor.moveToNext()) {
+			actioncount = cursor.getInt(0);
+		}
+
+		dbUtil.CloseCursor(cursor);
+		dbUtil.CloseDB(db);
+				
+		
 		footview = findViewById(R.id.foot);
 		// mSearchFormView = findViewById(R.id.search_form);
 		Button btnnext = (Button) findViewById(R.id.btn_next);
-		btnnext.setOnClickListener(new View.OnClickListener()
-		{
+		btnnext.setOnClickListener(new View.OnClickListener() {
 
 			@Override
-			public void onClick(View v)
-			{
+			public void onClick(View v) {
 				// TextView tv_head = (TextView) findViewById(R.id.tv_head);
 
 				// searchresult.set_direction(1);
 				if (searchresult.get_totalcount() == -1)
 					requestdata(true);
-				else
-				{
+				else {
 					// if (searchresult.get_direction() == -1)
 					searchresult.set_offset(searchresult.get_offset() + 10);
 					requestdata(false);
@@ -97,18 +117,15 @@ public class ResultActivity extends Activity
 		});
 
 		Button btnpre = (Button) findViewById(R.id.btn_pre);
-		btnpre.setOnClickListener(new View.OnClickListener()
-		{
+		btnpre.setOnClickListener(new View.OnClickListener() {
 
 			@Override
-			public void onClick(View v)
-			{
+			public void onClick(View v) {
 				// TextView tv_head = (TextView) findViewById(R.id.tv_head);
 				// searchresult.set_direction(-1);
 				if (searchresult.get_totalcount() == -1)
 					requestdata(true);
-				else
-				{
+				else {
 					searchresult.set_offset(searchresult.get_offset() - 10);
 					requestdata(false);
 				}
@@ -119,12 +136,10 @@ public class ResultActivity extends Activity
 		mStatusMessageView = (TextView) findViewById(R.id.status_message);
 		LinearLayout ll = (LinearLayout) findViewById(R.id.ll_refresh);
 		Button btn_refresh = (Button) ll.findViewById(R.id.btn_refresh);
-		btn_refresh.setOnClickListener(new View.OnClickListener()
-		{
+		btn_refresh.setOnClickListener(new View.OnClickListener() {
 
 			@Override
-			public void onClick(View v)
-			{
+			public void onClick(View v) {
 				LinearLayout ll = (LinearLayout) findViewById(R.id.ll_refresh);
 				ll.setVisibility(View.INVISIBLE);
 				if (searchresult.get_totalcount() == -1)
@@ -138,13 +153,11 @@ public class ResultActivity extends Activity
 		SharedPreferences RunOnce = getSharedPreferences("Apex", 0);
 
 		String vername;
-		try
-		{
+		try {
 			vername = getPackageManager().getPackageInfo("com.usai.apex", 0).versionName;
 			boolean bFirstRun = RunOnce.getBoolean("FirstRun" + vername
 					+ "_result", true);
-			if (bFirstRun)
-			{
+			if (bFirstRun) {
 				SharedPreferences.Editor editor = RunOnce.edit();
 				editor.putBoolean("FirstRun" + vername + "_result", false);
 				// Don't forget to commit your edits!!!
@@ -155,9 +168,7 @@ public class ResultActivity extends Activity
 				startActivity(intent);
 
 			}
-		}
-		catch (NameNotFoundException e)
-		{
+		} catch (NameNotFoundException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
@@ -166,28 +177,21 @@ public class ResultActivity extends Activity
 
 	}
 
-	private OnCreateContextMenuListener m_tableMenu = new OnCreateContextMenuListener()
-	{
+	private OnCreateContextMenuListener m_tableMenu = new OnCreateContextMenuListener() {
 
 		@Override
 		public void onCreateContextMenu(ContextMenu contextmenu, View view,
-				ContextMenuInfo contextmenuinfo)
-		{
-			// TODO Auto-generated method stub
-			// TableLayout tl = (TableLayout) view;
-			//
-			// TableRow tr = (TableRow) tl.getFocusedChild();
-			// View v = (View) tl.getFocusedChild();
-			contextmenu.add(Menu.NONE, 0, 0, "Detail");
-			// contextmenu.add(Menu.NONE, 1, 1, "�༭");
+				ContextMenuInfo contextmenuinfo) {
+
+
+				contextmenu.add(Menu.NONE, 0, 0, "Detail");
 
 		}
 
 	};
 
 	@Override
-	public boolean onContextItemSelected(MenuItem item)
-	{
+	public boolean onContextItemSelected(MenuItem item) {
 		// menuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
 		// Log.d("table row select", sel+ "");
 
@@ -200,8 +204,7 @@ public class ResultActivity extends Activity
 						+ function_name + "' and user='" + user + "'", null,
 				null, null, "priority", null);
 		int i = 0;
-		while (cursor.moveToNext())
-		{
+		while (cursor.moveToNext()) {
 			String name = cursor.getString(0);
 			Log.d("actionname", name);
 			intent.putExtra("action" + i, name);
@@ -229,8 +232,7 @@ public class ResultActivity extends Activity
 	// super.onCreateContextMenu(menu, v, menuInfo);
 	// }
 
-	void initTable()
-	{
+	void initTable() {
 
 		TableLayout tl = (TableLayout) findViewById(R.id.result_table);
 		tl.setFocusable(true);
@@ -253,8 +255,7 @@ public class ResultActivity extends Activity
 		btn.setPadding(0, 0, 0, 0);
 		btn.setText("No.");
 		headerRow.addView(btn);
-		while (cursor.moveToNext())
-		{
+		while (cursor.moveToNext()) {
 			String aname = cursor.getString(0);
 			Button btn1 = new Button(this);
 			btn1.setBackgroundResource(R.drawable.tablehead);
@@ -282,19 +283,16 @@ public class ResultActivity extends Activity
 	}
 
 	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
-	{
+	public boolean onCreateOptionsMenu(Menu menu) {
 		// Inflate the menu; this adds items to the action bar if it is present.
 		getMenuInflater().inflate(R.menu.result, menu);
 		return true;
 	}
 
 	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
+	public boolean onOptionsItemSelected(MenuItem item) {
 		Intent intent = new Intent();
-		switch (item.getItemId())
-		{
+		switch (item.getItemId()) {
 		case R.id.action_custom_fields:
 
 			intent.setClass(this, CustomizeFieldsActivity.class);
@@ -319,11 +317,9 @@ public class ResultActivity extends Activity
 		return super.onOptionsItemSelected(item);
 	}
 
-	public void requestdata(boolean requestcount)
-	{
+	public void requestdata(boolean requestcount) {
 
-		if (m_task != null)
-		{
+		if (m_task != null) {
 			return;
 		}
 		mStatusMessageView.setText("Loading");
@@ -333,24 +329,20 @@ public class ResultActivity extends Activity
 
 	}
 
-	private void showProgress(final boolean show)
-	{
+	private void showProgress(final boolean show) {
 		// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
 		// for very easy animations. If available, use these APIs to fade-in
 		// the progress spinner.
-		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2)
-		{
+		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
 			int shortAnimTime = getResources().getInteger(
 					android.R.integer.config_shortAnimTime);
 
 			mStatusView.setVisibility(View.VISIBLE);
 			mStatusView.animate().setDuration(shortAnimTime)
 					.alpha(show ? 1 : 0)
-					.setListener(new AnimatorListenerAdapter()
-					{
+					.setListener(new AnimatorListenerAdapter() {
 						@Override
-						public void onAnimationEnd(Animator animation)
-						{
+						public void onAnimationEnd(Animator animation) {
 							mStatusView.setVisibility(show ? View.VISIBLE
 									: View.INVISIBLE);
 						}
@@ -358,11 +350,9 @@ public class ResultActivity extends Activity
 
 			footview.setVisibility(View.VISIBLE);
 			footview.animate().setDuration(shortAnimTime).alpha(show ? 0 : 1)
-					.setListener(new AnimatorListenerAdapter()
-					{
+					.setListener(new AnimatorListenerAdapter() {
 						@Override
-						public void onAnimationEnd(Animator animation)
-						{
+						public void onAnimationEnd(Animator animation) {
 							footview.setVisibility(show ? View.INVISIBLE
 									: View.VISIBLE);
 						}
@@ -379,9 +369,7 @@ public class ResultActivity extends Activity
 			// : View.VISIBLE);
 			// }
 			// });
-		}
-		else
-		{
+		} else {
 			// The ViewPropertyAnimator APIs are not available, so simply show
 			// and hide the relevant UI components.
 			mStatusView.setVisibility(show ? View.VISIBLE : View.INVISIBLE);
@@ -391,14 +379,12 @@ public class ResultActivity extends Activity
 		}
 	}
 
-	public class SearchTask extends AsyncTask<Boolean, Void, Boolean>
-	{
+	public class SearchTask extends AsyncTask<Boolean, Void, Boolean> {
 		// int err_code = ERR_CODE_NONE;
 		int errorcode;
 
 		@Override
-		protected Boolean doInBackground(Boolean... params)
-		{
+		protected Boolean doInBackground(Boolean... params) {
 
 			if (!Network.NetworkIsAvailable())
 
@@ -407,17 +393,13 @@ public class ResultActivity extends Activity
 				return false;
 			}
 
-			if (params[0])
-			{
+			if (params[0]) {
 				int ret = Network.get_recordcount(user, password, searchParms);
-				if (ret >= 0)
-				{
+				if (ret >= 0) {
 					searchresult.put_totalcount(ret);
 					if (ret == 0)
 						return true;
-				}
-				else
-				{
+				} else {
 					errorcode = ret;
 					return false;
 				}
@@ -428,8 +410,7 @@ public class ResultActivity extends Activity
 			searchParms.putString("offset", searchresult.get_offset() + "");
 
 			String jstr = Network.get_records(user, password, searchParms);
-			if (jstr == null || jstr.length() <= 0)
-			{
+			if (jstr == null || jstr.length() <= 0) {
 				// Log.d(TAG, "json is wrong");
 				errorcode = Network.RESULT_NET_ERROR;
 				return false;
@@ -438,8 +419,7 @@ public class ResultActivity extends Activity
 			JSONObject jsobj;
 			//
 			// array = new JSONArray(json);
-			try
-			{
+			try {
 				jsobj = new JSONObject(jstr);
 				// if (searchresult.get_fieldscount() == 0)
 				// {
@@ -454,9 +434,7 @@ public class ResultActivity extends Activity
 
 				return true;
 
-			}
-			catch (JSONException e)
-			{
+			} catch (JSONException e) {
 				// TODO Auto-generated catch block
 				e.printStackTrace();
 			}
@@ -466,16 +444,13 @@ public class ResultActivity extends Activity
 		}
 
 		@Override
-		protected void onPostExecute(final Boolean success)
-		{
+		protected void onPostExecute(final Boolean success) {
 			Log.i("onPostExecute", "entry");
 			m_task = null;
 			showProgress(false);
 
-			switch (errorcode)
-			{
-			case Network.RESULT_NET_NOTAVAILABLE:
-			{
+			switch (errorcode) {
+			case Network.RESULT_NET_NOTAVAILABLE: {
 				Toast toast = Toast.makeText(getApplicationContext(),
 						getText(R.string.msg_connection_none),
 						Toast.LENGTH_LONG);
@@ -483,8 +458,7 @@ public class ResultActivity extends Activity
 				toast.show();
 				return;
 			}
-			case Network.RESULT_NET_ERROR:
-			{
+			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);
@@ -506,19 +480,16 @@ public class ResultActivity extends Activity
 				break;
 			}
 
-			if (success)
-			{
+			if (success) {
 
 				// int loadcount = searchresult.get_count();
 				int totalcount = searchresult.get_totalcount();
 				TextView tv_head = (TextView) findViewById(R.id.head);
-				if (totalcount == 0)
-				{
+				if (totalcount == 0) {
 					tv_head.setText("0 record found");
 
 					return;
-				}
-				else
+				} else
 					tv_head.setText(/*
 									 * loadcount + "/" +
 									 */searchresult.get_totalcount()
@@ -527,17 +498,14 @@ public class ResultActivity extends Activity
 
 				tl.removeViews(1, tl.getChildCount() - 1);
 				// int newcount = loadcount - showcount + 1;// +1 header row
-				for (int i = 0; i < searchresult.get_recordscount(); i++)
-				{
+				for (int i = 0; i < searchresult.get_recordscount(); i++) {
 
 					TableRow recordRow = new TableRow(ResultActivity.this);
 					recordRow
-							.setOnLongClickListener(new View.OnLongClickListener()
-							{
+							.setOnLongClickListener(new View.OnLongClickListener() {
 
 								@Override
-								public boolean onLongClick(View v)
-								{
+								public boolean onLongClick(View v) {
 									// TODO Auto-generated method stub
 									// v.setBackgroundColor(Color.GRAY);
 									// v.showContextMenu();
@@ -568,10 +536,9 @@ public class ResultActivity extends Activity
 					field.setPadding(10, 5, 10, 5);
 					field.setTextSize(20);
 					recordRow.addView(field);
-					for (int j = 0; j < showfieldmap.size(); j++)
-					{
+					for (int j = 0; j < showfieldmap.size(); j++) {
 						TextView field1 = new TextView(ResultActivity.this);
-						// Log.d("onPostExecute", showfieldmap.get(j));
+						Log.d("onPostExecute", showfieldmap.get(j));
 						String str = record.get(showfieldmap.get(j));
 						field1.setBackgroundResource(R.drawable.tableitem);
 						if (str.toLowerCase().trim().equals("null"))
@@ -579,7 +546,76 @@ public class ResultActivity extends Activity
 
 						// field1.setBackgroundColor(0xFFFFFFFF);
 
-						field1.setText(str);
+						field1.setText(Html.fromHtml(str));
+
+						if(actioncount==0)
+						field1.setOnClickListener(new OnClickListener() {
+
+							@Override
+							public void onClick(View v) {
+								URLSpan span[] = ((TextView) v).getUrls();
+								if (span.length < 1)
+									return;
+								span[0].getURL();
+								Log.d("Text", span[0].getURL());
+
+								final DownloadManager downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
+
+								Uri uri = Uri.parse(span[0].getURL());
+								final Request request = new Request(uri);
+
+								// 设置允许使用的网络类型,这里是移动网络和wifi都可以
+								request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE
+										| DownloadManager.Request.NETWORK_WIFI);
+
+								// 禁止发出通知,既后台下载,如果要使用这一句必须声明一个权限:android.permission.DOWNLOAD_WITHOUT_NOTIFICATION
+								// request.setShowRunningNotification(false);
+
+								// 不显示下载界面
+								request.setVisibleInDownloadsUi(false);
+								request.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
+
+								/*
+								 * 设置下载后文件存放的位置,如果sdcard不可用,那么设置这个将报错,
+								 * 因此最好不设置如果sdcard可用,下载后的文件
+								 * 在/mnt/sdcard/Android/
+								 * data/packageName/files目录下面
+								 * ,如果sdcard不可用,设置了下面这个将报错,不设置,下载后的文件在/cache这个
+								 * 目录下面
+								 */
+								// request.setDestinationInExternalFilesDir(this,
+								// null, "tar.apk");
+								
+								AlertDialog.Builder builder = new Builder(ResultActivity.this);
+								builder.setMessage("Click start button to begin download");
+
+								builder.setTitle("Confirm download");
+
+								builder.setPositiveButton("Start", new Dialog.OnClickListener() {
+
+									@Override
+									public void onClick(DialogInterface dialog, int which) {
+										long id = downloadManager.enqueue(request);
+										dialog.dismiss();
+
+									}
+								});
+
+								builder.setNegativeButton("Cancel", new Dialog.OnClickListener() {
+				
+									@Override
+									public void onClick(DialogInterface dialog, int which) {
+										dialog.dismiss();
+									}
+								});
+
+								builder.create().show();
+								
+
+							}
+
+						});
+						// field1.setText(str);
 						field1.setGravity(Gravity.CENTER);
 						field1.setPadding(10, 5, 10, 5);
 						field1.setTextSize(20);
@@ -595,8 +631,7 @@ public class ResultActivity extends Activity
 				Button btnpre = (Button) findViewById(R.id.btn_pre);
 				if (searchresult.get_offset() == 0)
 					btnpre.setEnabled(false);
-				else
-				{
+				else {
 					btnpre.setEnabled(true);
 				}
 				if (searchresult.get_totalcount() - searchresult.get_offset() <= 10)
@@ -604,24 +639,20 @@ public class ResultActivity extends Activity
 				else
 					btnnext.setEnabled(true);
 
-			}
-			else
-			{
+			} else {
 				LinearLayout ll = (LinearLayout) findViewById(R.id.ll_refresh);
 				ll.setVisibility(View.VISIBLE);
 			}
 		}
 
 		@Override
-		protected void onCancelled()
-		{
+		protected void onCancelled() {
 			m_task = null;
 			showProgress(false);
 		}
 	}
 
-	private class SearchResult
-	{
+	private class SearchResult {
 		int total_count = -1;
 		// int direction = 1;
 		int offset = 0;
@@ -637,24 +668,19 @@ public class ResultActivity extends Activity
 		//
 		// }
 
-		public int get_recordscount()
-		{
+		public int get_recordscount() {
 			return records.size();
 		}
 
-		public HashMap<String, String> get_record(int i)
-		{
+		public HashMap<String, String> get_record(int i) {
 			return records.get(i);
 		}
 
-		public void add_records(String jsonstr)
-		{
-			try
-			{
+		public void add_records(String jsonstr) {
+			try {
 				records.clear();
 				JSONObject objrecords = new JSONObject(jsonstr);
-				for (int i = 0; i < objrecords.length(); i++)
-				{
+				for (int i = 0; i < objrecords.length(); i++) {
 					// offset++;
 					JSONObject rec = objrecords.getJSONObject("record" + i);
 					Iterator<?> it = rec.keys();
@@ -672,9 +698,7 @@ public class ResultActivity extends Activity
 				// searchresult.set_offset(offset);
 				// Log.e("records count:",objrecords.length()+"");
 
-			}
-			catch (JSONException e)
-			{
+			} catch (JSONException e) {
 				// TODO Auto-generated catch block
 				e.printStackTrace();
 			}
@@ -682,18 +706,15 @@ public class ResultActivity extends Activity
 			Log.d(TAG, jsonstr);
 		}
 
-		public int get_totalcount()
-		{
+		public int get_totalcount() {
 			return total_count;
 		}
 
-		public void put_totalcount(int c)
-		{
+		public void put_totalcount(int c) {
 			total_count = c;
 		}
 
-		public int get_offset()
-		{
+		public int get_offset() {
 			return offset;
 		}
 
@@ -702,8 +723,7 @@ public class ResultActivity extends Activity
 		// return direction;
 		// }
 
-		public void set_offset(int i)
-		{
+		public void set_offset(int i) {
 			offset = i;
 
 		}

+ 2 - 2
Apex/src/com/usai/apex/RetrievePasswordActivity.java

@@ -247,9 +247,9 @@ public class RetrievePasswordActivity extends Activity {
 
 			if (success) {
 				AlertDialog.Builder builder = new Builder(RetrievePasswordActivity.this);
-				builder.setMessage("A retrieve password letter has been send to your email.");
+				builder.setMessage("Email has been sent.");
 
-				builder.setTitle("Retrieve successed");
+				builder.setTitle("Retrieve successfully!");
 
 				builder.setPositiveButton("Ok", new OnClickListener() {
 

+ 1 - 1
Apex/src/com/usai/apex/ServiceLocationFragment.java

@@ -178,7 +178,7 @@ public class ServiceLocationFragment extends Fragment implements
 			marker_detail.put(markertext, detail);
 //			BitmapDescriptor bd=BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher);
 //			Drawable da=getResources().getDrawable(R.drawable.ic_launcher);
-			Bitmap bmp=BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
+			Bitmap bmp=BitmapFactory.decodeResource(getResources(), R.drawable.ic_map);
 			Log.d("markersize",bmp.getWidth()+","+bmp.getHeight());
 			map.addMarker(new MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher))
 					.position(

+ 8 - 2
Apex/src/com/usai/util/Network.java

@@ -61,9 +61,9 @@ public class Network {
 	public static final int BEHAVIOR_SEARCH = 0;
 	public static final int BEHAVIOR_RESULT = 1;
 
-	private static final int REQUEST_TIMEOUT = 30 * 1000;// request time out 20
+	private static final int REQUEST_TIMEOUT = 60 * 1000;// request time out 20
 															// secs
-	private static final int SO_TIMEOUT = 30 * 1000; // so time out 20 secs;
+	private static final int SO_TIMEOUT = 60 * 1000; // so time out 20 secs;
 	public static int AP_USER_AUTH = 1;
 	public static int AP_USER_NOT_AUTH = 2;
 	public static int AP_USER_NOT_EXIST = 3;
@@ -650,6 +650,11 @@ public class Network {
 						field_name = field_info.getString("name");
 						field_type = field_info.getString("type");
 						alias_name = field_info.getString("alias");
+						priority = field_info.getInt("priority");
+						if (priority == 999)
+							show = 0;
+						else
+							show = 1;
 						int id = dbUtil.get_recordid(db, "fields_info",
 								"name='" + field_name + "' and behavior="
 										+ behavior + " and function_name='"
@@ -672,6 +677,7 @@ public class Network {
 						}
 					}
 
+//					objfun.has("actions")
 					objbehavior = objfun.getJSONObject("actions");
 					Iterator<?> itactions = objbehavior.keys();
 					// behavior = BEHAVIOR_RESULT;

+ 1 - 1
Apex/src/com/usai/util/dbUtil.java

@@ -521,7 +521,7 @@ public class dbUtil
 				.getApplicationContext(), null, false);
 		Cursor cursor = db.query("fields_info", new String[] { "name" },
 				"function_name='" + module + "' and user='" + user
-						+ "' and behavior=" + Network.BEHAVIOR_SEARCH, null,
+						+ "' and behavior=" + Network.BEHAVIOR_RESULT, null,
 				null, null, null, null);
 		String ret = "";
 		while (cursor.moveToNext())