Преглед изворни кода

Apex Mobile a191219

替换地图
去掉部分不再使用的框架和类
兼容Android 10
Ray Zhang пре 6 година
родитељ
комит
5c3fcd7a09
58 измењених фајлова са 566 додато и 7335 уклоњено
  1. 11 10
      ApexDrivers/apexmobile/build.gradle
  2. BIN
      ApexDrivers/apexmobile/libs/BaiduLBS_Android.jar
  3. BIN
      ApexDrivers/apexmobile/libs/arm64-v8a/libBaiduMapSDK_base_v4_5_2.so
  4. BIN
      ApexDrivers/apexmobile/libs/arm64-v8a/libBaiduMapSDK_map_v4_5_2.so
  5. BIN
      ApexDrivers/apexmobile/libs/arm64-v8a/liblocSDK7a.so
  6. BIN
      ApexDrivers/apexmobile/libs/armeabi-v7a/libBaiduMapSDK_base_v4_5_2.so
  7. BIN
      ApexDrivers/apexmobile/libs/armeabi-v7a/libBaiduMapSDK_map_v4_5_2.so
  8. BIN
      ApexDrivers/apexmobile/libs/armeabi-v7a/liblocSDK7a.so
  9. BIN
      ApexDrivers/apexmobile/libs/armeabi/libBaiduMapSDK_base_v4_5_2.so
  10. BIN
      ApexDrivers/apexmobile/libs/armeabi/libBaiduMapSDK_map_v4_5_2.so
  11. BIN
      ApexDrivers/apexmobile/libs/armeabi/liblocSDK7a.so
  12. BIN
      ApexDrivers/apexmobile/libs/x86/libBaiduMapSDK_base_v4_5_2.so
  13. BIN
      ApexDrivers/apexmobile/libs/x86/libBaiduMapSDK_map_v4_5_2.so
  14. BIN
      ApexDrivers/apexmobile/libs/x86/liblocSDK7a.so
  15. BIN
      ApexDrivers/apexmobile/libs/x86_64/libBaiduMapSDK_base_v4_5_2.so
  16. BIN
      ApexDrivers/apexmobile/libs/x86_64/libBaiduMapSDK_map_v4_5_2.so
  17. BIN
      ApexDrivers/apexmobile/libs/x86_64/liblocSDK7a.so
  18. 25 99
      ApexDrivers/apexmobile/src/main/AndroidManifest.xml
  19. 0 360
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/Alarmreceiver.java
  20. 0 223
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/ApexActivity.java
  21. 33 36
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/ApexTrackingApplication.java
  22. 0 763
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/BaiduMapFragment.java
  23. 2 1
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/ChangePasswordActivity.java
  24. 0 1
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/CustomizeFieldsActivity.java
  25. 0 607
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/DetailActivity.java
  26. 7 19
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/DetailFragment.java
  27. 0 410
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/FunctionSelectActivity.java
  28. 8 69
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/InnerMapActivity.java
  29. 8 9
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/MessageActivity.java
  30. 27 30
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/MessageDetailActivity.java
  31. 0 871
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/ResultActivity.java
  32. 0 412
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/SearchActivity.java
  33. 3 5
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/SearchResult.java
  34. 0 73
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/ServiceLocationFragment.java
  35. 0 15
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/SettingsActivity.java
  36. 0 71
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/TestActivity.java
  37. 0 57
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/TestAppComActivity.java
  38. 26 2
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/apexresult/ApexResultActivity.java
  39. 0 94
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/mainframe/BottomNavigationViewHelper.java
  40. 1 2
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/mainframe/KPIFragment.java
  41. 3 135
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/mainframe/NewDetailActivity.java
  42. 6 35
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/mainframe/RootActivity.java
  43. 0 646
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/result/AMResultActivity.java
  44. 0 1360
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/result/SearchResultActivity.java
  45. 7 1
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/servicelocationmap/ApexServiceLocationMapFragment.java
  46. 394 326
      ApexDrivers/apexmobile/src/main/java/com/usai/apex/shipmap/ShipMap.java
  47. 0 39
      ApexDrivers/apexmobile/src/main/java/com/usai/util/RAUtil.java
  48. 1 1
      ApexDrivers/apexmobile/src/main/java/com/usai/util/dbUtil.java
  49. 0 33
      ApexDrivers/apexmobile/src/main/res/layout/activity_detail.xml
  50. 0 64
      ApexDrivers/apexmobile/src/main/res/layout/activity_function_select.xml
  51. 2 1
      ApexDrivers/apexmobile/src/main/res/layout/activity_new_detail.xml
  52. 0 140
      ApexDrivers/apexmobile/src/main/res/layout/activity_result.xml
  53. 2 1
      ApexDrivers/apexmobile/src/main/res/layout/activity_root.xml
  54. 0 44
      ApexDrivers/apexmobile/src/main/res/layout/activity_search.xml
  55. 0 58
      ApexDrivers/apexmobile/src/main/res/layout/activity_search_result.xml
  56. 0 16
      ApexDrivers/apexmobile/src/main/res/layout/activity_test.xml
  57. 0 10
      ApexDrivers/apexmobile/src/main/res/layout/activity_test_app_com.xml
  58. 0 186
      ApexDrivers/apexmobile/src/main/res/layout/new_function_select.xml

+ 11 - 10
ApexDrivers/apexmobile/build.gradle

@@ -13,15 +13,15 @@ android {
     }
     signingConfigs {
     }
-    compileSdkVersion 26
+    compileSdkVersion 28
 
     defaultConfig {
         applicationId "com.usai.apex"
         minSdkVersion 23
-        targetSdkVersion 26
-        versionCode 21
-        versionName "A190419"
-
+        targetSdkVersion 28
+        versionCode 22
+        versionName "A191219"
+//        ndk.abiFilters 'armeabi-v7a',"arm64-v8a"
 //        multiDexEnabled true
 
 //        ndk {
@@ -52,19 +52,20 @@ android {
 }
 
 dependencies {
+
     //    compile 'com.android.support:support-v4:19.1.0'
-    api 'com.android.support:appcompat-v7:26.1.0'
-    api 'com.android.support:support-v4:26.1.0'
+    api 'com.android.support:appcompat-v7:28.0.0'
+    api 'com.android.support:support-v4:28.0.0'
     api 'com.android.support.constraint:constraint-layout:1.1.3'
-    api 'com.android.support:design:26.1.0'
+    implementation 'com.android.support:design:28.0.0'
     //    compile 'com.android.support:recyclerview-v7:26.1.0'
     //    compile 'com.google.android.gms:play-services:11.0.4'
-    api 'com.google.android.gms:play-services-maps:16.0.0'
+//    api 'com.google.android.gms:play-services-maps:16.0.0'
     //    api 'com.google.android.gms:play-services-location:11.4.2'
     //    compile files('libs/baidumapapi_base_v3_7_1.jar')
     //    compile files('libs/baidumapapi_map_v3_7_1.jar')
     //    api 'com.github.barteksc:android-pdf-viewer:3.0.0-beta.5'
-    implementation files('libs/BaiduLBS_Android.jar')
+
     implementation project(path: ':RAUtilsLibrary')
     implementation project(':apexmap')
 }

BIN
ApexDrivers/apexmobile/libs/BaiduLBS_Android.jar


BIN
ApexDrivers/apexmobile/libs/arm64-v8a/libBaiduMapSDK_base_v4_5_2.so


BIN
ApexDrivers/apexmobile/libs/arm64-v8a/libBaiduMapSDK_map_v4_5_2.so


BIN
ApexDrivers/apexmobile/libs/arm64-v8a/liblocSDK7a.so


BIN
ApexDrivers/apexmobile/libs/armeabi-v7a/libBaiduMapSDK_base_v4_5_2.so


BIN
ApexDrivers/apexmobile/libs/armeabi-v7a/libBaiduMapSDK_map_v4_5_2.so


BIN
ApexDrivers/apexmobile/libs/armeabi-v7a/liblocSDK7a.so


BIN
ApexDrivers/apexmobile/libs/armeabi/libBaiduMapSDK_base_v4_5_2.so


BIN
ApexDrivers/apexmobile/libs/armeabi/libBaiduMapSDK_map_v4_5_2.so


BIN
ApexDrivers/apexmobile/libs/armeabi/liblocSDK7a.so


BIN
ApexDrivers/apexmobile/libs/x86/libBaiduMapSDK_base_v4_5_2.so


BIN
ApexDrivers/apexmobile/libs/x86/libBaiduMapSDK_map_v4_5_2.so


BIN
ApexDrivers/apexmobile/libs/x86/liblocSDK7a.so


BIN
ApexDrivers/apexmobile/libs/x86_64/libBaiduMapSDK_base_v4_5_2.so


BIN
ApexDrivers/apexmobile/libs/x86_64/libBaiduMapSDK_map_v4_5_2.so


BIN
ApexDrivers/apexmobile/libs/x86_64/liblocSDK7a.so


+ 25 - 99
ApexDrivers/apexmobile/src/main/AndroidManifest.xml

@@ -93,6 +93,7 @@
     <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
     -->
     <application
+
         android:name=".ApexTrackingApplication"
         android:allowBackup="true"
         android:icon="@drawable/ic_launcher"
@@ -101,6 +102,8 @@
         android:screenOrientation="portrait"
         android:theme="@style/FixedActionbarTheme"
         tools:replace="android:theme">
+
+
         <provider
             android:name="android.support.v4.content.FileProvider"
             android:authorities="com.usai.apex.fileprovider"
@@ -110,56 +113,33 @@
                 android:name="android.support.FILE_PROVIDER_PATHS"
                 android:resource="@xml/download_dir"/>
         </provider>
-
+        <uses-library
+            android:name="org.apache.http.legacy"
+            android:required="false" />
         <!-- release key -->
-        <meta-data
-            android:name="com.google.android.maps.v2.API_KEY"
-            android:value="AIzaSyDdbk58Lx6QzaXcB_hNpSHVp3l_CJeNpoo"/>
-        <meta-data
-            android:name="com.baidu.lbsapi.API_KEY"
-            android:value="nqBQoSDbxrslhuzW91uViQX7"/>
-        <meta-data
-            android:name="com.google.android.gms.version"
-            android:value="@integer/google_play_services_version"/>
+<!--        <meta-data-->
+<!--            android:name="com.google.android.maps.v2.API_KEY"-->
+<!--            android:value="AIzaSyDdbk58Lx6QzaXcB_hNpSHVp3l_CJeNpoo"/>-->
+<!--        <meta-data-->
+<!--            android:name="com.baidu.lbsapi.API_KEY"-->
+<!--            android:value="nqBQoSDbxrslhuzW91uViQX7"/>-->
+<!--        <meta-data-->
+<!--            android:name="com.google.android.gms.version"-->
+<!--            android:value="@integer/google_play_services_version"/>-->
 
         <!-- debug key -->
 
 
-         <!--<meta-data-->
-         <!--android:name="com.google.android.maps.v2.API_KEY"-->
-         <!--android:value="AIzaSyD6Snyg2SDUGtkC3sOAr979__IDCZnGGuU" />-->
-         <!--<meta-data-->
-         <!--android:name="com.baidu.lbsapi.API_KEY"-->
-         <!--android:value="tznWFxd3RvSoul1TGQp6GSzo" />-->
-         <!--<meta-data-->
-         <!--android:name="com.google.android.gms.version"-->
-         <!--android:value="@integer/google_play_services_version" />-->
+<!--         <meta-data-->
+<!--         android:name="com.google.android.maps.v2.API_KEY"-->
+<!--         android:value="AIzaSyD6Snyg2SDUGtkC3sOAr979__IDCZnGGuU" />-->
+<!--         <meta-data-->
+<!--         android:name="com.baidu.lbsapi.API_KEY"-->
+<!--         android:value="tznWFxd3RvSoul1TGQp6GSzo" />-->
+<!--         <meta-data-->
+<!--         android:name="com.google.android.gms.version"-->
+<!--         android:value="@integer/google_play_services_version" />-->
 
-        <activity
-            android:name=".DetailActivity"
-            android:label="@string/title_activity_detail"
-            android:screenOrientation="portrait"
-            android:theme="@style/DetailActionbarTheme">
-
-            <!--
-                 <meta-data
-                android:name="android.support.PARENT_ACTIVITY"
-                android:value="android.support.v4.app.FragmentActivity" />
-
-           
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-            -->
-        </activity>
-        <activity
-            android:name=".ApexActivity"
-            android:label="@string/title_activity_apex"
-            android:logo="@drawable/apexlogo_2"
-            android:screenOrientation="portrait"
-            android:windowSoftInputMode="adjustPan"/>
         <!--
              <activity
             android:name="com.usai.apex.LoginFragment"
@@ -184,24 +164,6 @@
                 <category android:name="android.intent.category.LAUNCHER"/>
             </intent-filter>
         </activity>
-        <activity
-            android:name=".FunctionSelectActivity"
-            android:label="@string/title_activity_function_select"
-            android:launchMode="singleTop"
-            android:logo="@drawable/apexlogo_2"
-            android:screenOrientation="portrait">
-
-            <!-- <intent-filter> -->
-            <!-- <action android:name="android.intent.action.MAIN" /> -->
-
-
-            <!-- <category android:name="android.intent.category.LAUNCHER" /> -->
-            <!-- </intent-filter> -->
-        </activity>
-        <activity
-            android:name=".SearchActivity"
-            android:label="@string/title_activity_search"
-            android:screenOrientation="portrait"/>
         <activity
             android:name=".AnnouncementActivity"
             android:label="@string/title_activity_announcements"
@@ -210,10 +172,6 @@
             android:name=".CustomizeFieldsActivity"
             android:label="@string/title_activity_customize_fields"
             android:screenOrientation="portrait"/>
-        <activity
-            android:name=".ResultActivity"
-            android:label="@string/title_activity_result"
-            android:screenOrientation="portrait"/>
         <activity
             android:name=".LocationDetailActivity"
             android:label="@string/title_activity_location_detail"
@@ -303,43 +261,13 @@
         <service
             android:name=".ApexBackgroundService"
             android:label="Apex Mobile Background Service"/>
-        <service
-            android:name="com.baidu.location.f"
-            android:enabled="true"
-            android:permission="" android:process=":remote">
-            <intent-filter>
-                <action android:name="com.baidu.location.service_v2.2">
-                </action>
-            </intent-filter>
-        </service>
+
 
         <activity
             android:name=".saved.CheckSavedActivity"
             android:screenOrientation="portrait"
             android:theme="@style/FixedActionbarTheme"/>
 
-        <activity
-            android:name=".TestAppComActivity"
-            android:screenOrientation="portrait"
-            android:theme="@style/FixedActionbarTheme">
-
-            <!-- <intent-filter> -->
-            <!-- <action android:name="android.intent.action.MAIN" /> -->
-
-
-            <!-- <category android:name="android.intent.category.LAUNCHER" /> -->
-            <!-- </intent-filter> -->
-        </activity>
-
-        <activity
-            android:name=".result.AMResultActivity"
-            android:screenOrientation="portrait"
-            android:theme="@style/ResultActionbarTheme"/>
-
-        <activity
-            android:name=".result.SearchResultActivity"
-            android:screenOrientation="portrait"/>
-
         <activity android:name=".ContainerSearchActivity"/>
 
         <activity
@@ -349,8 +277,6 @@
 
         <activity android:name=".LicenseActivity"/>
 
-        <activity android:name=".TestActivity"/>
-
         <activity
             android:name=".mainframe.NewDetailActivity"
             android:screenOrientation="portrait"

+ 0 - 360
ApexDrivers/apexmobile/src/main/java/com/usai/apex/Alarmreceiver.java

@@ -1,360 +0,0 @@
-package com.usai.apex;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-//import com.usai.util.Crypto;
-import com.usai.util.Network;
-import com.usai.util.dbUtil;
-
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.database.sqlite.SQLiteDatabase;
-import android.os.AsyncTask;
-import android.os.Parcelable;
-import android.os.SystemClock;
-import android.util.Log;
-
-public class Alarmreceiver extends BroadcastReceiver
-{
-	private SearchTask	m_task	= null;
-
-	public void checkpush(Context context)
-	{
-
-		if (m_task != null)
-		{
-			return;
-		}
-		// mStatusMessageView.setText(R.string.str_Loading);
-		// showProgress(true);
-		m_task = new SearchTask(context);
-
-		// TextView text_page = (TextView) view_page_footer
-		// .findViewById(R.id.text_page);
-		// text_page.setText("Loading...");
-		// text_page.setEnabled(false);
-		m_task.execute();
-
-	}
-
-	class SearchTask extends AsyncTask<Void, Void, Boolean>
-	{
-		int		errorcode;
-		String	content	= null;
-		Context	mcontext;
-
-		public SearchTask(Context context)
-		{
-			mcontext = context;
-		}
-
-		@Override
-		protected Boolean doInBackground(Void... params)
-		{
-			Log.d("SearchTask", "doInBackground");
-			if (!Network.NetworkIsAvailable())
-
-			{
-				errorcode = Network.RESULT_NET_NOTAVAILABLE;
-				return false;
-			}
-			String jstr = "";
-			jstr = Network.check_push();
-			// if (module_name.equals("Announcements"))
-			// jstr = Network.get_announcements(lastid, limit);
-			// else
-			// jstr = Network.get_marketnews(lastid, limit);
-			if (jstr == null || jstr.length() <= 0)
-			{
-				// Log.d(TAG, "json is wrong");
-
-				errorcode = Network.RESULT_NET_ERROR;
-				return false;
-			}
-
-			content = jstr;
-			return true;
-		}
-
-		@Override
-		protected void onPostExecute(Boolean success)
-		{
-
-			m_task = null;
-			// showProgress(false);
-
-			// switch (errorcode)
-			// {
-			// // case Network.RESULT_NET_NOTAVAILABLE:
-			// // {
-			// // Toast toast = Toast.makeText(
-			// // ApexTrackingApplication.get_instance(),
-			// // getText(R.string.msg_connection_none),
-			// // Toast.LENGTH_LONG);
-			// // toast.setGravity(Gravity.CENTER, 0, 0);
-			// // toast.show();
-			// // break;
-			// // }
-			// // case Network.RESULT_NET_ERROR:
-			// // {
-			// // Toast toast = Toast.makeText(
-			// // ApexTrackingApplication.get_instance(),
-			// // getText(R.string.msg_net_error), Toast.LENGTH_LONG);
-			// // toast.setGravity(Gravity.CENTER, 0, 0);
-			// // toast.show();
-			// // break;
-			// // }
-			// // case Network.RESULT_ERROR:
-			// // // case Network.RESULT_RESPONSE_NULL:
-			// // {
-			// // Toast toast = Toast.makeText(
-			// // ApexTrackingApplication.get_instance(),
-			// // getText(R.string.msg_net_resulterror),
-			// // Toast.LENGTH_LONG);
-			// // toast.setGravity(Gravity.CENTER, 0, 0);
-			// // toast.show();
-			// // break;
-			// // }
-			//
-			// default:
-			// break;
-			// }
-
-			if (success)
-			{
-				JSONObject jsobj;
-				//
-				// array = new JSONArray(json);
-				try
-				{
-					jsobj = new JSONObject(content);
-
-					String message = jsobj.getString("message");
-					String date = jsobj.getString("date");
-					String s_id = jsobj.getString("s_id");
-					String e_id = jsobj.getString("e_id");
-					int count = jsobj.getInt("count");
-					SQLiteDatabase db = dbUtil.OpenDB(
-							ApexTrackingApplication.get_instance(), null, true);
-					db.execSQL("insert into push_message(s_id,e_id,msgcount,message,h_time,user,create_time,read) values('"
-							+ s_id
-							+ "','"
-							+ e_id
-							+ "',"
-							+ count
-							+ ",'"
-							+ message
-							+ "','"
-							+ date
-							+ "','"
-							+ ApexTrackingApplication.get_user()
-							+ "',"
-							+ System.currentTimeMillis() + ",0)");
-					dbUtil.CloseDB(db);
-
-					boolean bnotify = mcontext.getSharedPreferences("setting",
-							0).getBoolean("notifications_new_message", true);
-					if (bnotify)
-					{
-
-						boolean bsound = mcontext.getSharedPreferences(
-								"setting", 0).getBoolean(
-								"notifications_new_message_sound", true);
-						boolean bvibrate = mcontext.getSharedPreferences(
-								"setting", 0).getBoolean(
-								"notifications_new_message_vibrate", true);
-						NotificationManager nManager = (NotificationManager) mcontext
-								.getSystemService(Context.NOTIFICATION_SERVICE);
-
-//						Notification notification = new Notification(
-//								R.drawable.ic_launcher,
-//								mcontext.getString(R.string.str_notification_title),
-//								System.currentTimeMillis());
-						Intent intent = new Intent(mcontext,
-								FunctionSelectActivity.class);
-						intent.putExtra("launcher", "notification");
-
-						PendingIntent pintent = PendingIntent.getActivity(
-								mcontext, 0, intent,
-								PendingIntent.FLAG_UPDATE_CURRENT);
-
-
-						Notification.Builder builder = new Notification.Builder(mcontext);//新建Notification.Builder对象
-						String ntitle = "";
-						int number = ApexTrackingApplication.ncount++;
-						if (number > 1)
-							ntitle=number
-									+ " "
-									+ ApexTrackingApplication
-									.get_instance()
-									.getString(
-											R.string.str_mnotification_title);
-						else
-							ntitle = ApexTrackingApplication
-									.get_instance()
-									.getString(
-											R.string.str_notification_title);
-
-						builder.setContentTitle(ntitle);//设置标题
-						builder.setContentText(ApexTrackingApplication
-								.get_instance()
-								.getString(
-										R.string.str_notification_text)
-								+ date);//设置内容
-						builder.setSmallIcon(R.drawable.ic_launcher);//设置图片
-						builder.setContentIntent(pintent);//执行intent
-						Notification notification = builder.getNotification();//将builder对象转换为普通的notifications
-
-						if (bsound && bvibrate)
-							notification.defaults = Notification.DEFAULT_ALL;
-						else if (bsound)
-							notification.defaults = Notification.DEFAULT_SOUND
-									| Notification.DEFAULT_LIGHTS;
-						else if (bvibrate)
-							notification.defaults = Notification.DEFAULT_VIBRATE
-									| Notification.DEFAULT_LIGHTS;
-						notification.flags = Notification.FLAG_AUTO_CANCEL;
-						notification.number = number;
-//						if (notification.number > 1)
-//							notification
-//									.setLatestEventInfo(
-//											mcontext,
-//											notification.number
-//													+ " "
-//													+ ApexTrackingApplication
-//															.get_instance()
-//															.getString(
-//																	R.string.str_mnotification_title),
-//											ApexTrackingApplication
-//													.get_instance()
-//													.getString(
-//															R.string.str_notification_text)
-//													+ date, pintent);
-//						else
-//							notification
-//									.setLatestEventInfo(
-//											mcontext,
-//
-//											ApexTrackingApplication
-//													.get_instance()
-//													.getString(
-//															R.string.str_notification_text)
-//													+ date, pintent);
-						nManager.notify(R.layout.activity_apex, notification);
-					}
-
-					// Intent intenticon = new Intent();
-					// intenticon.setClass(ApexTrackingApplication
-					// .get_instance(), FunctionSelectActivity.class);
-					// Intent addShortcut = new
-					// Intent("com.android.launcher.action.INSTALL_SHORTCUT");
-					// Parcelable icon =
-					// Intent.ShortcutIconResource.fromContext(mcontext,
-					// R.drawable.ic_launcher_new);
-					// addShortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,
-					// ApexTrackingApplication
-					// .get_instance().getString(R.string.app_name));
-					// addShortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT,
-					// intent);
-					// addShortcut.putExtra("duplicate", 0);
-					// addShortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
-					// icon);
-					// ApexTrackingApplication
-					// .get_instance().sendBroadcast(addShortcut);
-
-					// notification
-
-				}
-				catch (JSONException e)
-				{
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-				// if (bfinish)
-				// {
-				// // getListView().removeFooterView(view_page_footer);
-				// // Toast.makeText(AnnouncementActivity.this, "Load all!",
-				// // Toast.LENGTH_LONG).show();
-				//
-				// TextView tv = (TextView) view_page_footer
-				// .findViewById(R.id.text_page);
-				// tv.setText("No more items");
-				// tv.setEnabled(false);
-				// }
-				// else
-				// {
-				// TextView tv = (TextView) view_page_footer
-				// .findViewById(R.id.text_page);
-				// tv.setText("More...");
-				// tv.setEnabled(true);
-				// }
-				// adapter.notifyDataSetChanged();
-				// // getListAdapter().notifyDataSetChanged;
-				// // BaseAdapter mJson = null;
-				// // mJson.notifyDataSetChanged();
-			}
-
-			super.onPostExecute(success);
-		}
-
-		@Override
-		protected void onCancelled()
-		{
-			m_task = null;
-			// showProgress(false);
-		}
-	}
-
-	@Override
-	public void onReceive(Context context, Intent intent)
-	{
-		String tag = "onReceive@Alarmreceiver";
-		if (intent.getAction().equals("com.usai.apex.push"))
-		{
-
-			// Bundle b = intent.getExtras();
-			// Set<String> keySet = b.keySet();
-			// for(String key : keySet) {
-			// Log.e(tag, key);
-			// }
-			// String s =b.getString("caller");
-			Log.i( tag, "receive alarm broadcast caller =="
-					+ intent.getStringExtra("caller"));
-
-			if (SystemClock.elapsedRealtime()
-					- ApexTrackingApplication.getLastCheckMessageTime() > 120000)
-			{
-				Log.i(tag, "check messsage");
-				ApexTrackingApplication.UpdateLastCheckMessageTime();
-				checkpush(context);
-
-			}
-			// Intent i = new Intent();
-			// i.setClass(context, DaemonService.class);
-			// // 启动service
-			// // 多次调用startService并不会启动多个service 而是会多次调用onStart
-			// context.startService(i);
-		}
-		else if (intent.getAction().equals("com.usai.apex.push.cancel"))
-		{
-			if (m_task != null)
-				m_task.cancel(true);
-			NotificationManager nManager = (NotificationManager) context
-					.getSystemService(Context.NOTIFICATION_SERVICE);
-			nManager.cancel(R.layout.activity_apex);
-			ApexTrackingApplication.cancelalarm();
-			// ApexTrackingApplication.put_password("");
-			// ApexTrackingApplication.put_sessionid("");
-			// ApexTrackingApplication.put_user("");
-			ApexTrackingApplication.logout();
-
-		}
-	}
-
-}

+ 0 - 223
ApexDrivers/apexmobile/src/main/java/com/usai/apex/ApexActivity.java

@@ -1,223 +0,0 @@
-package com.usai.apex;
-
-//import com.google.android.gms.maps.SupportMapFragment;
-
-import android.app.ActionBar;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.os.Bundle;
-//import android.app.Fragment;
-//import android.app.FragmentTransaction;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentActivity;
-import android.support.v4.app.FragmentTransaction;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.widget.TabHost;
-
-import com.usai.apex.mainframe.LoginFragment;
-import com.usai.apex.mainframe.ToolsFragment;
-
-public class ApexActivity extends FragmentActivity /*
-													 * implements
-													 * OnTabChangeListener
-													 */
-{
-	boolean	m_bhasgoogleframework	= false;
-
-	@Override
-	public boolean onKeyDown(int keyCode, KeyEvent event)
-	{
-		if (keyCode == KeyEvent.KEYCODE_BACK)
-		{
-			// Intent myIntent = new Intent();
-			// myIntent = new Intent(EditActivity.this, tabActivity.class);
-			// startActivity(myIntent);
-			finish();
-			
-			return false;
-		}
-		return super.onKeyDown(keyCode, event);
-	}
-
-	TabHost	mTabHost;
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		Log.d("ApexActivity", "onCreate");
-
-		// ApexTrackingApplication.get_instance()
-		// .getPackageManager().
-		PackageInfo packageInfo;
-		try
-		{
-			packageInfo = this.getPackageManager().getPackageInfo(
-					"com.google.android.gms", 0);
-
-		}
-		catch (NameNotFoundException e)
-		{
-			packageInfo = null;
-			e.printStackTrace();
-		}
-
-
-		String able= getResources().getConfiguration().locale.getCountry();
-
-		if (able.equals("CN") /*packageInfo == null*/)
-		{
-			m_bhasgoogleframework = false;
-			System.out.println("没有安装");
-		}
-		else
-		{
-			m_bhasgoogleframework = true;
-			System.out.println("已经安装");
-		}
-
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.activity_apex);
-		ActionBar bar = getActionBar();
-		bar.setTitle("");
-		setupTabs();
-
-	}
-
-	// @Override
-	// public boolean onCreateOptionsMenu(Menu menu) {
-	// // Inflate the menu; this adds items to the action bar if it is present.
-	// getMenuInflater().inflate(R.menu.apex, menu);
-	// return true;
-	// }
-	//
-	// @Override
-	// public boolean onOptionsItemSelected(MenuItem item) {
-	// switch (item.getItemId()) {
-	// case R.id.forget_password:
-	// Intent intent = new Intent();
-	// intent.setClass(this, RetrievePasswordActivity.class);
-	// startActivity(intent);
-	//
-	// break;
-	// default:
-	// break;
-	//
-	// }
-	// return super.onOptionsItemSelected(item);
-	// }
-
-	private void setupTabs()
-	{
-		mTabHost = (TabHost) this.findViewById(R.id.tabhost);
-
-		mTabHost.setup();
-		// // ��ɵײ��Զ�����ʽ�İ�ť
-		// String[] title = new String[] { "Login", "Not login" };
-		// int[] tabIds = new int[] { R.id.tab1, R.id.tab2 };
-		mTabHost.addTab(mTabHost.newTabSpec(getString(R.string.action_sign_in_short)).setIndicator(getString(R.string.action_sign_in_short))
-				.setContent(R.id.tab1));
-		// mTabHost.addTab(mTabHost.newTabSpec("test").setIndicator("test").setContent(R.id.tabtest));
-
-		mTabHost.addTab(mTabHost.newTabSpec(getString(R.string.str_tool)).setIndicator(getString(R.string.str_tool))
-				.setContent(R.id.tab2));
-		mTabHost.addTab(mTabHost.newTabSpec(getString(R.string.str_location))
-				.setIndicator(getString(R.string.str_location)).setContent(R.id.tab3));
-
-		// Instantiate a new fragment.
-		Fragment loginFragment = new LoginFragment();
-		Fragment toolsFragment = new ToolsFragment();
-		Fragment slFragment;
-//		 m_bhasgoogleframework=false;
-		if (m_bhasgoogleframework)
-			slFragment = new ServiceLocationFragment();
-		else
-			slFragment = new BaiduMapFragment();
-		// Add the fragment to the activity, pushing this transaction
-		// on to the back stack.
-
-		FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
-		ft.replace(R.id.tab1, loginFragment);
-		ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		ft.addToBackStack("Login");
-
-		ft.replace(R.id.tab2, toolsFragment);
-		ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		ft.addToBackStack("Tools");		
-		
-		
-		// 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");
-
-		ft.commit();
-
-		// if (manager.findFragmentByTag(tabId) == null)
-		// {
-		// FragmentTransaction trans = manager.beginTransaction();
-		// trans.replace(contentViewID, frag, tabId);
-		// trans.commit();
-		// }
-		// for (int i = 0; i < title.length; i++) {
-		// Button button = new Button(this);
-		// button.setText(title[i]);
-		// button.setBackgroundDrawable(this.getResources().getDrawable(
-		// R.drawable.tab_lable)); //�Զ��尴ť��ʽ
-		// mTabHost.addTab(mTabHost.newTabSpec(title[i]).setIndicator(button)
-		// .setContent(tabIds[i]));
-		// }
-
-		// mTabHost.setOnTabChangedListener(this);
-	}
-
-	// @Override
-	// public void onTabChanged(String tabId)
-	// {
-	// TODO Auto-generated method stub
-	// Fragment frag = null;
-	// int contentViewID = 0;
-	// if (tabId.equals("Login")) {
-	// frag = new LoginFragment();
-	// //�Զ���̳�Fragment��UI������һ���򵥵���ʾ�ı�����Ŀؼ���
-	// contentViewID = R.id.tab1;
-	// } else if (tabId.equals("Not login")) {
-	// frag = new DirectTrackingFragment();
-	// contentViewID = R.id.tab2;
-	// }
-	// if (frag == null)
-	// return;
-	//
-	// FragmentManager manager = this.getFragmentManager();
-	//
-	// if (manager.findFragmentByTag(tabId) == null) {
-	// FragmentTransaction trans = manager.beginTransaction();
-	// trans.replace(contentViewID, frag, tabId);
-	// trans.commit();
-	// }
-	// }
-	// public class LoginFragment extends Fragment implements OnClickListener{
-	// @Override
-	// public View onCreateView(LayoutInflater inflater, ViewGroup container,
-	// Bundle savedInstanceState) {
-	// View view = inflater.inflate(R.layout.activity_login, null);
-	// Button btn = (Button)view.findViewById(R.id.sign_in_button);
-	// btn.setOnClickListener(this);
-	// return view;
-	// }
-	//
-	// @Override
-	// public void onClick(View v)
-	// {
-	// // TODO Auto-generated method stub
-	//
-	// }
-	// }
-}

+ 33 - 36
ApexDrivers/apexmobile/src/main/java/com/usai/apex/ApexTrackingApplication.java

@@ -1,15 +1,12 @@
 package com.usai.apex;
 
 import android.app.Activity;
-import android.app.AlarmManager;
 import android.app.AlertDialog;
 import android.app.Application;
 import android.app.DownloadManager;
-import android.app.PendingIntent;
 import android.app.ProgressDialog;
 import android.content.Context;
 import android.content.DialogInterface;
-import android.content.Intent;
 import android.content.SharedPreferences;
 import android.content.res.Configuration;
 import android.content.res.Resources;
@@ -376,44 +373,44 @@ public class ApexTrackingApplication extends Application implements RAProviderHe
 
 	public static void startalarm(String caller)
 	{
-		// 新版暂时停用通知
-		if(true)
-			return;
-		SharedPreferences pref = get_instance()
-				.getSharedPreferences("Apex", 0);
-		boolean autologin = pref.getBoolean("autologin", false);
-		if (autologin == false)
-			return;
-		// 启动完成
-		Intent iAlarm = new Intent(get_instance(), Alarmreceiver.class);
-		iAlarm.putExtra("caller", caller);
-		iAlarm.setAction("com.usai.apex.push");
-		PendingIntent sender = PendingIntent.getBroadcast(get_instance(), 0,
-				iAlarm, PendingIntent.FLAG_UPDATE_CURRENT);
-
-		long firstime = SystemClock.elapsedRealtime();
-//		UpdateLastAlermTime();
-		AlarmManager am = (AlarmManager) get_instance().getSystemService(
-				Context.ALARM_SERVICE);
-
-		// 5分钟一个周期,不停的发送广播
-		am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstime,
-				300 * 1000, sender);
+//		// 新版暂时停用通知
+//		if(true)
+//			return;
+//		SharedPreferences pref = get_instance()
+//				.getSharedPreferences("Apex", 0);
+//		boolean autologin = pref.getBoolean("autologin", false);
+//		if (autologin == false)
+//			return;
+//		// 启动完成
+//		Intent iAlarm = new Intent(get_instance(), Alarmreceiver.class);
+//		iAlarm.putExtra("caller", caller);
+//		iAlarm.setAction("com.usai.apex.push");
+//		PendingIntent sender = PendingIntent.getBroadcast(get_instance(), 0,
+//				iAlarm, PendingIntent.FLAG_UPDATE_CURRENT);
+//
+//		long firstime = SystemClock.elapsedRealtime();
+////		UpdateLastAlermTime();
+//		AlarmManager am = (AlarmManager) get_instance().getSystemService(
+//				Context.ALARM_SERVICE);
+//
+//		// 5分钟一个周期,不停的发送广播
+//		am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstime,
+//				300 * 1000, sender);
 	}
 
 	public static void cancelalarm()
 	{
 
-		// 启动完成
-		Intent iAlarm = new Intent(get_instance(), Alarmreceiver.class);
-		iAlarm.setAction("com.usai.apex.push");
-		PendingIntent sender = PendingIntent.getBroadcast(get_instance(), 0,
-				iAlarm, PendingIntent.FLAG_UPDATE_CURRENT);
-
-		AlarmManager am = (AlarmManager) get_instance().getSystemService(
-				Context.ALARM_SERVICE);
-
-		am.cancel(sender);
+//		// 启动完成
+//		Intent iAlarm = new Intent(get_instance(), Alarmreceiver.class);
+//		iAlarm.setAction("com.usai.apex.push");
+//		PendingIntent sender = PendingIntent.getBroadcast(get_instance(), 0,
+//				iAlarm, PendingIntent.FLAG_UPDATE_CURRENT);
+//
+//		AlarmManager am = (AlarmManager) get_instance().getSystemService(
+//				Context.ALARM_SERVICE);
+//
+//		am.cancel(sender);
 	}
 
 	public static void logout()

+ 0 - 763
ApexDrivers/apexmobile/src/main/java/com/usai/apex/BaiduMapFragment.java

@@ -1,763 +0,0 @@
-package com.usai.apex;
-
-//import com.google.android.gms.maps.SupportMapFragment;
-
-//import baidumapsdk.demo.DemoApplication;
-//import baidumapsdk.demo.DemoApplication.MyGeneralListener;
-
-import android.Manifest;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.support.v4.app.ActivityCompat;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.baidu.location.BDLocation;
-import com.baidu.location.BDLocationListener;
-import com.baidu.location.LocationClient;
-import com.baidu.location.LocationClientOption;
-import com.baidu.mapapi.BMapManager;
-import com.baidu.mapapi.SDKInitializer;
-import com.baidu.mapapi.map.BaiduMap.OnMapClickListener;
-import com.baidu.mapapi.map.BaiduMap.OnMarkerClickListener;
-import com.baidu.mapapi.map.BitmapDescriptor;
-import com.baidu.mapapi.map.BitmapDescriptorFactory;
-import com.baidu.mapapi.map.InfoWindow;
-import com.baidu.mapapi.map.InfoWindow.OnInfoWindowClickListener;
-import com.baidu.mapapi.map.MapPoi;
-import com.baidu.mapapi.map.MapStatusUpdate;
-import com.baidu.mapapi.map.MapStatusUpdateFactory;
-import com.baidu.mapapi.map.MapView;
-import com.baidu.mapapi.map.Marker;
-import com.baidu.mapapi.map.MarkerOptions;
-import com.baidu.mapapi.map.MyLocationData;
-import com.baidu.mapapi.map.SupportMapFragment;
-import com.baidu.mapapi.model.LatLng;
-import com.usai.redant.rautils.location.GeoUtils;
-import com.usai.redant.rautils.utils.FileManager;
-import com.usai.util.Network;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.File;
-import java.util.HashMap;
-
-//import baidumapsdk.demo.R;
-//import com.baidu.mapapi.MKGeneralListener;
-//import com.baidu.mapapi.map.ItemizedOverlay;
-//import com.baidu.mapapi.map.MKEvent;
-//import com.baidu.mapapi.map.MapController;
-//import com.baidu.mapapi.map.OverlayItem;
-//import com.baidu.mapapi.map.PopupClickListener;
-//import com.baidu.mapapi.map.PopupOverlay;
-//import com.baidu.platform.comapi.basestruct.GeoPoint;
-
-public class BaiduMapFragment extends Fragment implements BDLocationListener
-{
-	private SearchTask				m_task				= null;
-	String							fragment_content	= null;
-	private MapView					mMapView			= null;
-	// private MyOverlay mOverlay = null;
-	// private OverlayItem mCurItem = null;
-	// private Button button = null;
-	// private ArrayList<OverlayItem> mItems = null;
-	// private PopupOverlay pop = null;
-	SupportMapFragment				fragment;
-	BMapManager						mBMapManager		= null;
-	public static boolean			m_bKeyRight			= true;
-	HashMap<String, LocationDetail>	marker_detail		= new HashMap<String, LocationDetail>();
-
-	// OverlayItem m_curitem = null;
-	/*
-	 * public class MyOverlay extends ItemizedOverlay {
-	 * 
-	 * public MyOverlay(Drawable defaultMarker, MapView mapView) {
-	 * super(defaultMarker, mapView); }
-	 * 
-	 * @Override public boolean onTap(int index) {
-	 * Log.d("baidumap...................", "ontap"); View viewCache =
-	 * getActivity().getLayoutInflater().inflate( R.layout.marker_view, null);
-	 * 
-	 * TextView tv_title = (TextView) viewCache .findViewById(R.id.tv_title);
-	 * TextView tv_info = (TextView) viewCache.findViewById(R.id.tv_info);
-	 * 
-	 * OverlayItem item = getItem(index);
-	 * 
-	 * tv_title.setText(item.getTitle()); tv_info.setText(item.getSnippet());
-	 * m_curitem = item; pop.showPopup(viewCache, item.getPoint(), 32); return
-	 * true; }
-	 * 
-	 * @Override public boolean onTap(GeoPoint pt, MapView mMapView) {
-	 * Log.d("baidu map demo ", "hide pop"); if (pop != null) {
-	 * 
-	 * pop.hidePop(); // mMapView.removeView(button); } return false; }
-	 * 
-	 * }
-	 */
-
-	void AddMarker()
-	{
-
-		if (mMapView == null)
-		{
-
-			Log.d("onResume", "get map from fragment");
-			mMapView = fragment.getMapView();
-			if (mMapView == null)
-				return;
-		}
-        mMapView.getMap().clear();
-//		mMapView.getMap()
-
-		try
-		{
-			JSONObject jsobj = new JSONObject(fragment_content);
-
-			int count = jsobj.getInt("total");
-
-			JSONObject objrecords = jsobj.getJSONObject("records");
-			// mOverlay = new MyOverlay(getResources().getDrawable(
-			// R.drawable.ic_marker), mMapView);
-			BitmapDescriptor icon = BitmapDescriptorFactory
-					.fromResource(R.drawable.ic_marker);
-			for (int i = 0; i < count; i++)
-			{
-				// offset++;
-
-				JSONObject objrec = objrecords.getJSONObject("record" + i);
-				String area = objrec.getString("area");
-				String company = objrec.getString("company");
-				String city = objrec.getString("city");
-				String longitude = objrec.getString("longitude");
-				String latitude = objrec.getString("latitude");
-				String address = objrec.getString("address");
-				String telephone = objrec.getString("telephone");
-				String fax = objrec.getString("fax");
-				String contact = objrec.getString("contact");
-				String email = objrec.getString("email");
-				String sbmap_china = objrec.getString("bmap_china");
-				boolean bmap_china = false;
-				if(sbmap_china.equals("t"))
-					bmap_china = true;
-
-				LocationDetail detail = new LocationDetail(company, address,
-						telephone, fax, contact, email);
-//				detail.addr_city = "chengdu";
-//				detail.addr_country = "china";
-//				detail.addr_state = "sichuan";
-//				detail.addr_zip = "610000";
-				marker_detail.put(company, detail);
-
-				Bundle extrainfo = new Bundle();
-				extrainfo.putString("company", company);
-				extrainfo.putSerializable("detail", detail);
-				extrainfo.putSerializable("city", city);
-				extrainfo.putSerializable("area", area);
-				// // 准备overlay 数据
-				//
-				// GeoPoint p1 = new GeoPoint(
-				// (int) (Double.parseDouble(latitude) * 1E6),
-				// (int) (Double.parseDouble(longitude) * 1E6));
-				// OverlayItem item1 = new OverlayItem(p1, company, city + "\n"
-				// + area);
-				//
-				// //
-				// // * 将item 添加到overlay中 注意: 同一个itme只能add一次
-				// //
-				// mOverlay.addItem(item1);
-
-
-				double dlatitude=Double.parseDouble(latitude);
-				double dlongitude=Double
-						.parseDouble(longitude);
-
-
-			//	String able= getResources().getConfiguration().locale.getCountry();
-				if (bmap_china)
-				{
-					Log.d("service location", "cn 变形: "+area);
-//					Log.d("service location", "cn 变形前: "+dlatitude+","+dlongitude);
-					double bd[] = GeoUtils.wgs84tobd09(dlongitude,dlatitude);
-                    dlongitude = bd[0];
-                    dlatitude = bd[1];
-//					Log.d("service location", "cn 变形: "+dlatitude+","+dlongitude);
-
-				}
-				LatLng llA = new LatLng(dlatitude,
-						dlongitude);
-
-				MarkerOptions markeroption = new MarkerOptions().position(llA)
-						.icon(icon).zIndex(9).title(company)
-						.extraInfo(extrainfo).draggable(true);
-
-				// if (animationBox.isChecked()) {
-				// //掉下动画
-				// ooA.animateType(MarkerAnimateType.drop);
-				// }
-				Marker mMarkerA = (Marker) (mMapView.getMap()
-						.addOverlay(markeroption));
-
-			}
-			//
-			// * 保存所有item,以便overlay在reset后重新添加
-			//
-			// mItems = new ArrayList<OverlayItem>();
-			// mItems.addAll(mOverlay.getAllItem());
-			// //
-			// // * 将overlay 添加至MapView中
-			// //
-			// mMapView.getOverlays().add(mOverlay);
-			// //
-			// // * 刷新地图
-			// //
-			// mMapView.refresh();
-			// PopupClickListener popListener = new PopupClickListener()
-			// {
-			// @Override
-			// public void onClickedPopup(int index)
-			// {
-			// Log.d("baidu map.......", "popup on click");
-			// pop.hidePop();
-			//
-			// mMapView.refresh();
-			// Intent intent = new Intent();
-			// intent.setClass(getActivity(), LocationDetailActivity.class);
-			//
-			// String markertext = m_curitem.getTitle();
-			//
-			// intent.putExtra("detail", marker_detail.get(markertext));
-			// // // intent.putExtra("password", password);
-			// // intent.putExtra("function_name", function_name);
-			// // intent.putExtra("behavior", Network.BEHAVIOR_SEARCH);
-			// startActivity(intent);
-			//
-			// }
-			// };
-			// pop = new PopupOverlay(mMapView, popListener);
-		}
-		catch (JSONException e)
-		{
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-
-	public void requestloactions()
-	{
-
-		if (m_task != null)
-		{
-			return;
-		}
-
-//		if (fragment_content != null)
-//		{
-//			// LayoutInflater inflater = (LayoutInflater)
-//			// ApexTrackingApplication
-//			// .get_instance().getSystemService(
-//			// Context.LAYOUT_INFLATER_SERVICE);
-//			// init(fragment_content,inflater);
-//			return;
-//		}
-		// mStatusMessageView.setText(R.string.str_Loading);
-		// showProgress(true);
-		m_task = new SearchTask();
-
-		// TextView text_page = (TextView) view_page_footer
-		// .findViewById(R.id.text_page);
-		// text_page.setText("Loading...");
-		// text_page.setEnabled(false);
-		m_task.execute();
-
-	}
-
-
-	private LocationClient mLocationClient;
-
-	private void initLocation() {
-		//定位客户端的设置
-		mLocationClient = new LocationClient(getContext());
-
-		//注册监听
-		mLocationClient.registerLocationListener(this);
-
-		//配置定位
-		LocationClientOption option = new LocationClientOption();
-		option.setCoorType("bd09ll");//坐标类型
-		option.setIsNeedAddress(true);//可选,设置是否需要地址信息,默认不需要
-		option.setOpenGps(true);//打开Gps
-		option.setScanSpan(1000);//1000毫秒定位一次
-		option.setIsNeedLocationPoiList(true);//可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到
-		mLocationClient.setLocOption(option);
-	}
-
-	@Override
-	public void onReceiveLocation(BDLocation bdLocation) {
-
-		//将获取的location信息给百度map
-		MyLocationData data = new MyLocationData.Builder()
-				.accuracy(bdLocation.getRadius())
-				// 此处设置开发者获取到的方向信息,顺时针0-360
-				.direction(100)
-				.latitude(bdLocation.getLatitude())
-				.longitude(bdLocation.getLongitude())
-				.build();
-
-		if (fragment != null) {
-			fragment.getMapView().getMap().setMyLocationData(data);
-		}
-
-	}
-
-	class SearchTask extends AsyncTask<Void, Void, Boolean>
-	{
-		int	errorcode;
-
-		// boolean bfinish = false;
-
-		@Override
-		protected Boolean doInBackground(Void... params)
-		{
-			Log.d("SearchTask", "doInBackground");
-			if (!Network.NetworkIsAvailable())
-
-			{
-				errorcode = Network.RESULT_NET_NOTAVAILABLE;
-				return false;
-			}
-			String jstr = Network.get_servicelocation();
-
-			if (jstr == null || jstr.length() <= 0)
-			{
-				// Log.d(TAG, "json is wrong");
-
-				errorcode = Network.RESULT_NET_ERROR;
-				return false;
-			}
-
-			JSONObject jsobj;
-			//
-			// array = new JSONArray(json);
-			try
-			{
-				jsobj = new JSONObject(jstr);
-				// if (searchresult.get_fieldscount() == 0)
-				// {
-				// JSONObject objfields = jsobj.getJSONObject("fields");
-				// if (objfields != null)
-				// searchresult.init_fields(objfields.toString());
-				// }
-				int count = jsobj.getInt("total");
-				// if (count < limit)
-				// bfinish = true;
-				JSONObject objrecords = jsobj.getJSONObject("records");
-				if (objrecords != null)
-				{
-					fragment_content = jstr;
-					errorcode = Network.RESULT_TRUE;
-
-					return true;
-				}
-			}
-			catch (JSONException e)
-			{
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			errorcode = Network.RESULT_NET_ERROR;
-			return false;
-		}
-
-		@Override
-		protected void onPostExecute(Boolean success)
-		{
-
-			m_task = null;
-			// showProgress(false);
-
-			switch (errorcode)
-			{
-				case Network.RESULT_NET_NOTAVAILABLE:
-				{
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_connection_none),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-				case Network.RESULT_NET_ERROR:
-				{
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_net_error), Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-				case Network.RESULT_ERROR:
-				// case Network.RESULT_RESPONSE_NULL:
-				{
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_net_resulterror),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-
-				default:
-					break;
-			}
-
-			if (success)
-			{
-				AddMarker();
-
-				mMapView.getMap().setOnMapClickListener( new OnMapClickListener()
-				{
-					
-					@Override
-					public boolean onMapPoiClick(MapPoi arg0)
-					{
-						mMapView.getMap().hideInfoWindow();
-						return false;
-					}
-					
-					@Override
-					public void onMapClick(LatLng arg0)
-					{
-						mMapView.getMap().hideInfoWindow();
-						
-					}
-				});
-				mMapView.getMap().setOnMarkerClickListener(
-						new OnMarkerClickListener()
-						{
-							public boolean onMarkerClick(final Marker marker)
-							{
-								// Button button = new
-								// Button(getActivity().getApplicationContext());
-								// button.setBackgroundResource(R.drawable.popup);
-
-								View viewCache = getActivity()
-										.getLayoutInflater().inflate(
-												R.layout.marker_view, null);
-
-								TextView tv_title = (TextView) viewCache
-										.findViewById(R.id.tv_title);
-								TextView tv_info = (TextView) viewCache
-										.findViewById(R.id.tv_info);
-
-								final String title = marker.getTitle();
-
-								Bundle bundle = marker.getExtraInfo();
-
-								final LocationDetail detail = (LocationDetail) bundle
-										.getSerializable("detail");
-								String city = bundle.getString("city");
-								String area = bundle.getString("area");
-								// OverlayItem item = getItem(index);
-
-								// marker.get
-
-								tv_title.setText(title);
-								tv_info.setText(city + "\n" + area);
-								// m_curitem = item;
-								// pop.showPopup(viewCache, item.getPoint(),
-								// 32);
-								OnInfoWindowClickListener listener = null;
-								if (true)
-								{
-									// button.setText("更改位置");
-									listener = new OnInfoWindowClickListener()
-									{
-										public void onInfoWindowClick()
-										{
-
-											mMapView.getMap().hideInfoWindow();
-
-											Log.d("baidu map.......",
-													"popup on click");
-											
-
-//											mMapView.refresh();
-											Intent intent = new Intent();
-											intent.setClass(
-													getActivity(),
-													LocationDetailActivity.class);
-
-											String markertext = title;
-
-											intent.putExtra("detail",
-													detail);
-											// // intent.putExtra("password",
-											// password);
-											// intent.putExtra("function_name",
-											// function_name);
-											// intent.putExtra("behavior",
-											// Network.BEHAVIOR_SEARCH);
-//											startActivity(intent);
-
-                                            LocationDetail detail = marker_detail.get(markertext);
-
-                                            if (markerClickListener != null) {
-                                                markerClickListener.markerClicked(detail);
-                                            }
-
-										}
-									};
-									LatLng ll = marker.getPosition();
-									InfoWindow mInfoWindow = new InfoWindow(
-											BitmapDescriptorFactory
-													.fromView(viewCache), ll,
-											-100, listener);
-									mMapView.getMap().showInfoWindow(
-											mInfoWindow);
-								}
-								// else if (marker == mMarkerB) {
-								// button.setText("更改图标");
-								// button.setOnClickListener(new
-								// OnClickListener() {
-								// public void onClick(View v) {
-								// marker.setIcon(bd);
-								// mBaiduMap.hideInfoWindow();
-								// }
-								// });
-								// LatLng ll = marker.getPosition();
-								// mInfoWindow = new InfoWindow(button, ll,
-								// -47);
-								// mBaiduMap.showInfoWindow(mInfoWindow);
-								// } else if (marker == mMarkerC) {
-								// button.setText("删除");
-								// button.setOnClickListener(new
-								// OnClickListener() {
-								// public void onClick(View v) {
-								// marker.remove();
-								// mBaiduMap.hideInfoWindow();
-								// }
-								// });
-								// LatLng ll = marker.getPosition();
-								// mInfoWindow = new InfoWindow(button, ll,
-								// -47);
-								// mBaiduMap.showInfoWindow(mInfoWindow);
-								// }
-								return true;
-							}
-						});
-				//
-				// if (bfinish)
-				// {
-				// // getListView().removeFooterView(view_page_footer);
-				// // Toast.makeText(AnnouncementActivity.this, "Load all!",
-				// // Toast.LENGTH_LONG).show();
-				//
-				// TextView tv = (TextView) view_page_footer
-				// .findViewById(R.id.text_page);
-				// tv.setText("No more items");
-				// tv.setEnabled(false);
-				// }
-				// else
-				// {
-				// TextView tv = (TextView) view_page_footer
-				// .findViewById(R.id.text_page);
-				// tv.setText("More...");
-				// tv.setEnabled(true);
-				// }
-				// adapter.notifyDataSetChanged();
-				// // getListAdapter().notifyDataSetChanged;
-				// // BaseAdapter mJson = null;
-				// // mJson.notifyDataSetChanged();
-			}
-
-			super.onPostExecute(success);
-		}
-
-		@Override
-		protected void onCancelled()
-		{
-			m_task = null;
-			// showProgress(false);
-		}
-	}
-
-	public void initEngineManager(Context context)
-	{
-
-		SDKInitializer.initialize(ApexTrackingApplication.get_instance());
-		// String strKey = ApexTrackingApplication.get_instance().getString(
-		// R.string.baidu_key);
-		// if (mBMapManager == null)
-		// {
-		// mBMapManager = new BMapManager(context);
-		// }
-		//
-		// if (!mBMapManager.init(strKey, new MyGeneralListener()))
-		// {
-		// // Toast.makeText(getActivity().getApplicationContext(),
-		// // "BMapManager  初始化错误!", Toast.LENGTH_LONG).show();
-		// }
-	}
-
-	/*
-	 * // 常用事件监听,用来处理通常的网络错误,授权验证错误等 static class MyGeneralListener implements
-	 * MKGeneralListener {
-	 * 
-	 * @Override public void onGetNetworkState(int iError) { if (iError ==
-	 * MKEvent.ERROR_NETWORK_CONNECT) { // Toast.makeText( //
-	 * ApexTrackingApplication.get_instance() // .getApplicationContext(),
-	 * "您的网络出错啦!", // Toast.LENGTH_LONG).show(); } else if (iError ==
-	 * MKEvent.ERROR_NETWORK_DATA) { // Toast.makeText( //
-	 * ApexTrackingApplication.get_instance() // .getApplicationContext(),
-	 * "输入正确的检索条件!", // Toast.LENGTH_LONG).show(); } // ... }
-	 * 
-	 * @Override public void onGetPermissionState(int iError) { // 非零值表示key验证未通过
-	 * if (iError != 0) { // 授权Key错误: // Toast.makeText( //
-	 * ApexTrackingApplication.get_instance() // .getApplicationContext(), //
-	 * "请在 DemoApplication.java文件输入正确的授权Key,并检查您的网络连接是否正常!error: " // + iError,
-	 * Toast.LENGTH_LONG).show(); m_bKeyRight = false; } else { m_bKeyRight =
-	 * true; // Toast.makeText( // ApexTrackingApplication.get_instance() //
-	 * .getApplicationContext(), "key认证成功", // Toast.LENGTH_LONG).show(); } } }
-	 */
-	@Override
-	public void onActivityCreated(Bundle savedInstanceState)
-	{
-
-		super.onActivityCreated(savedInstanceState);
-		initEngineManager(getActivity().getApplicationContext());
-
-		FragmentManager fm = getChildFragmentManager();
-		fragment = (SupportMapFragment) fm.findFragmentById(R.id.map);
-
-		if (fragment == null)
-		{
-
-			Log.d("onActivityCreated", "create support map fragment");
-			fragment = SupportMapFragment.newInstance();
-			;// .newInstance();
-			fm.beginTransaction().replace(R.id.map, fragment).commit();
-		}
-		mMapView = fragment.getMapView();
-
-
-
-		// location cache
-		String path=FileManager.internalStorageFileDir(ApexTrackingApplication.get_instance().getApplicationContext())+ File.separator + "service_location.json";
-		String jstr = FileManager.readJson(path);
-		JSONObject cachejson=handleJson(jstr);
-		if(cachejson!=null)
-		{
-			try {
-				cachejson.put("iscache",true);
-			} catch (JSONException e) {
-				e.printStackTrace();
-			}
-			this.fragment_content = jstr;
-		}
-		AddMarker();
-	}
-
-	@Override
-	public View onCreateView(LayoutInflater inflater, ViewGroup container,
-			Bundle savedInstanceState)
-	{
-		// TODO Auto-generated method stub
-		// return super.onCreateView(inflater, container, savedInstanceState);
-				
-
-
-
-
-		requestloactions();
-
-		return inflater.inflate(R.layout.fragment_service_location, container,
-				false);
-	}
-
-	private static JSONObject handleJson(String jsonStr) {
-
-		if (jsonStr == null || jsonStr.isEmpty()) {
-			return null;
-		}
-
-		try {
-			JSONObject json = new JSONObject(jsonStr);
-			String msg = json.optString("msg");
-			if (msg != null) {
-				json.put("err_msg",msg);
-			}
-
-			return json;
-		} catch (JSONException e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-
-	@Override
-	public void onResume()
-	{
-		super.onResume();
-
-		Log.d("onResume", "get map from fragment");
-		LatLng center = new LatLng(29.945,104.7);
-		MapStatusUpdate msu = MapStatusUpdateFactory.newLatLngZoom(center,4.8f);//MapStatusUpdateFactory.zoomTo(4.5f);
-		
-		
-		fragment.getMapView().getMap().setMapStatus(msu);
-		
-//		float zoomLevel = Float.parseFloat(t.getText().toString());
-//		MapStatusUpdate u = MapStatusUpdateFactory.zoomTo(zoomLevel);
-//		mBaiduMap.animateMapStatus(u);
-//		 MapController controller = fragment.getMapView().getController();
-//		 controller.setCenter(new GeoPoint((int) ( * 1E6),
-//		 (int)  * 1E6)));
-//		 controller.setZoom(5);
-
-		if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
-			// TODO: Consider calling
-			//    ActivityCompat#requestPermissions
-			// here to request the missing permissions, and then overriding
-			//   public void onRequestPermissionsResult(int requestCode, String[] permissions,
-			//                                          int[] grantResults)
-			// to handle the case where the user grants the permission. See the documentation
-			// for ActivityCompat#requestPermissions for more details.
-
-		} else {
-			fragment.getMapView().getMap().setMyLocationEnabled(true);
-			initLocation();
-			if(mLocationClient != null && !mLocationClient.isStarted()){//如果定位client没有开启,开启定位
-				mLocationClient.start();
-			}
-		}
-
-	}
-
-	@Override
-	public void onPause() {
-		super.onPause();
-
-		if(mLocationClient != null && mLocationClient.isStarted()){//如果定位client开启,关闭定位
-			mLocationClient.stop();
-		}
-	}
-
-	public BaiduMarkerClickListener markerClickListener;
-	public interface BaiduMarkerClickListener {
-		void markerClicked(LocationDetail detail);
-	}
-
-}

+ 2 - 1
ApexDrivers/apexmobile/src/main/java/com/usai/apex/ChangePasswordActivity.java

@@ -247,7 +247,8 @@ public class ChangePasswordActivity extends AppCompatActivity {
 									: View.VISIBLE);
 						}
 					});
-		} else {
+		} else
+			{
 			// The ViewPropertyAnimator APIs are not available, so simply show
 			// and hide the relevant UI components.
 			mLoginStatusView.setVisibility(show ? View.VISIBLE : View.GONE);

+ 0 - 1
ApexDrivers/apexmobile/src/main/java/com/usai/apex/CustomizeFieldsActivity.java

@@ -20,7 +20,6 @@ import android.widget.ArrayAdapter;
 import android.widget.Button;
 import android.widget.TextView;
 
-import com.usai.util.RAUtil;
 import com.usai.util.dbUtil;
 
 import java.util.ArrayList;

+ 0 - 607
ApexDrivers/apexmobile/src/main/java/com/usai/apex/DetailActivity.java

@@ -1,607 +0,0 @@
-package com.usai.apex;
-
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.database.sqlite.SQLiteDatabase;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentTransaction;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.EditText;
-import android.widget.FrameLayout;
-import android.widget.TabHost;
-import android.widget.TabWidget;
-import android.widget.TextView;
-
-import com.usai.apex.result.AMResultActivity;
-import com.usai.apex.mainframe.RootActivity;
-import com.usai.util.commonUtil;
-import com.usai.util.dbUtil;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-
-public class DetailActivity extends AppCompatActivity implements
-		TabHost.TabContentFactory
-{
-	boolean showlogin = false;
-	// int radomid = 1 + (int) (Math.random() * 15);
-	TabHost							mTabHost;
-	LinkedHashMap<String, Integer>	tabmap	= new LinkedHashMap<String, Integer>();
-	HashMap<String,String> contentmap = new HashMap<String ,String>();
-
-	// HashMap<String, DetailFragment> fragments = new HashMap<String,
-	// DetailFragment>();
-	String							function_name;
-	String							_id;
-	String							cargo_criterion;
-	int								criterion_type;
-
-	String email_to = null,email_subject = null,email_content = null;
-	TextView mtitleview;
-//	@Override
-//	public void setTitle(CharSequence title) {
-////        View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-////
-////        TextView mtitleviewtitleview = mActionBarView.findViewById(R.id.title);
-//
-//		if(title==null)
-//			title="";
-//		if(mtitleview!=null)
-//			mtitleview.setText(title);
-//	}
-	private void setCustomActionBar() {
-		ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
-		View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-
-		mtitleview= mActionBarView.findViewById(R.id.title);
-
-
-		function_name = getIntent().getStringExtra("function_name");
-		String title = "";
-		if(function_name.equals("Ocean Booking"))
-			title="Booking Detail";
-		else if(function_name.equals("Ocean B/L info."))
-			title="B/L info. Detail";
-		else if(function_name.equals("Container detail"))
-			title="Container Detail";
-		else if(function_name.equals("Cargo Tracking"))
-			title="Cargo Detail";
-		mtitleview.setText(title);
-		setTitle(title);
-//
-//        mActionBarView.setBackgroundColor(Color.YELLOW);
-//        titleview.setBackgroundColor(Color.BLUE);
-		ActionBar actionBar = getSupportActionBar();
-		actionBar.setCustomView(mActionBarView, lp);
-//		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
-//		actionBar.setDisplayShowCustomEnabled(true);
-		actionBar.setDisplayHomeAsUpEnabled(true);
-
-
-//        actionBar.setIcon(getNumberDrawable());
-//        actionBar.setDisplayShowHomeEnabled(true);
-		actionBar.setDisplayShowTitleEnabled(true);
-	}
-
-	public DetailActivity get_instance()
-	{
-		return this;
-	}
-
-
-//	String email_to = null,email_subject = null,email_content = null;
-
-	public void save_content(String which,String content)
-	{
-		contentmap.put(which, content);
-
-		try {
-
-			JSONObject jsonObject = new JSONObject(content);
-			email_to = jsonObject.optString("email",null);
-			email_subject = jsonObject.optString("email_subject",null);
-			email_content = jsonObject.optString("email_content",null);
-
-		} catch (JSONException e) {
-			e.printStackTrace();
-		}
-
-	}
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		Log.d("DetailActivity", "onCreate");
-
-		super.onCreate(savedInstanceState);
-
-		setContentView(R.layout.activity_detail);
-
-		setCustomActionBar();
-
-		List<Fragment> fragments = getSupportFragmentManager().getFragments();
-		if (fragments != null)
-		{
-			Log.d("DetailActivity", "fragments count=" + fragments.size());
-//			for (int i = 0; i < fragments.size(); i++)
-//				Log.e("DetailFragment", "fragment name="
-//						+ fragments.get(i).getTag());
-
-		}
-
-		if (savedInstanceState != null)
-		{
-			tabmap = (LinkedHashMap<String, Integer>) savedInstanceState
-					.getSerializable("tabmap");
-			contentmap = (HashMap<String, String>) savedInstanceState.getSerializable("contentmap");
-		}
-		else
-		{
-			int count = getIntent().getIntExtra("actions_count", 0);
-			for (int i = 0; i < count; i++)
-			{
-				int vid = commonUtil.generateViewId();
-				tabmap.put(getIntent().getStringExtra("action" + i), vid);
-			}
-		}
-		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);
-			cargo_criterion = getIntent().getStringExtra("cargo_criterion");
-			setTitle("Cargo Detail");
-		}
-		_id = getIntent().getStringExtra("_id");
-		setupTabs();
-
-	}
-
-	// @Override
-	// protected void onSaveInstanceState(Bundle outState)
-	// {
-	// Iterator<String> iter=fragments.keySet().iterator();
-	//
-	// while (iter.hasNext())
-	// {
-	// String tag = (String) iter.next();
-	// getSupportFragmentManager().putFragment(outState,tag,fragments.get(tag));
-	//
-	// }
-	// outState.putStringArray("tags", fragments.keySet().toArray(new
-	// String[0]));
-	// Log.d("onSaveInstanceState","save fragments" +
-	// fragments.keySet().size());
-	// super.onSaveInstanceState(outState);
-	// }
-	//
-	// @Override
-	// protected void onRestoreInstanceState(Bundle savedInstanceState)
-	// {
-	// String [] tags =savedInstanceState.getStringArray("tags");
-	// Log.d("onRestoreInstanceState","load fragments" + tags.length);
-	// for(int i=0;i<tags.length;i++)
-	// {
-	// Log.d("onRestoreInstanceState","load fragment" + tags[i]);
-	// fragments.put(tags[i],(DetailFragment)
-	// getSupportFragmentManager().getFragment(savedInstanceState,tags[i]));
-	// }
-	//
-	// super.onRestoreInstanceState(savedInstanceState);
-	// }
-
-	/** {@inheritDoc} */
-	public View createTabContent(String tag)
-	{
-		FrameLayout fl = new FrameLayout(this);
-		fl.setId(tabmap.get(tag));
-
-		Fragment f;
-		Bundle bundle = new Bundle();
-		if (function_name.equals("Cargo Tracking"))
-		{
-			if (criterion_type == 0)
-				bundle.putString("hbol", cargo_criterion);
-			else
-				bundle.putString("container_no", cargo_criterion);
-
-		}
-		bundle.putString("action_type", tag);
-		bundle.putString("id", _id);
-		bundle.putString("module_name", function_name);
-
-//		Log.e("findFragmentByTag", "tag=" + tag + ", isnull= "
-//				+ (getSupportFragmentManager().findFragmentByTag(tag) == null));
-
-		f = getSupportFragmentManager().findFragmentById(tabmap.get(tag));
-		if (f == null)
-		{
-			Log.d("createTabContent", "create fragment" + tag);
-			f = new DetailFragment();
-
-			
-			f.setArguments(bundle);
-		}
-		((DetailFragment)f).set_content( contentmap.get(tag));
-		FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
-		ft.replace(fl.getId(), f);
-		ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		ft.addToBackStack(tag);
-		ft.commit();
-		return fl;
-	}
-
-	@Override
-	protected void onSaveInstanceState(Bundle outState)
-	{
-		outState.putSerializable("tabmap", tabmap);
-		outState.putSerializable("contentmap", contentmap);
-		super.onSaveInstanceState(outState);
-	}
-
-	// TabHost mTabHost;
-	// private FrameLayout mTabContent;
-	
-//	@Override
-//	public boolean onKeyDown(int keyCode, KeyEvent event)
-//	{
-//		if (keyCode == KeyEvent.KEYCODE_BACK)
-//		{
-//			// Intent myIntent = new Intent();
-//			// myIntent = new Intent(EditActivity.this, tabActivity.class);
-//			// startActivity(myIntent);
-//			finish();
-//			return true;
-//		}
-//		return super.onKeyDown(keyCode, event);
-//	}
-
-	@Override
-	public boolean onKeyUp(int keyCode, KeyEvent event)
-	{
-		if (keyCode == KeyEvent.KEYCODE_BACK)
-		{
-			// Intent myIntent = new Intent();
-			// myIntent = new Intent(EditActivity.this, tabActivity.class);
-			// startActivity(myIntent);
-			finish();
-			return true;
-		}
-		return super.onKeyUp(keyCode, event);
-	}
-	//
-	// @Override
-	// protected void onCreate(Bundle savedInstanceState)
-	// {
-	// super.onCreate(savedInstanceState);
-	// setContentView(R.layout.activity_detail);
-	// // Show the Up button in the action bar.
-	// setupActionBar();
-	// setupTabs();
-	// }
-	//
-	// /**
-	// * Set up the {@link android.app.ActionBar}.
-	// */
-	// private void setupActionBar()
-	// {
-	//
-	// getActionBar().setDisplayHomeAsUpEnabled(true);
-	//
-	// }
-	//
-	// // private View createTabIndicatorView(ViewGroup parent, CharSequence
-	// label, Drawable icon) {
-	// // final LayoutInflater inflater = LayoutInflater.from(this);
-	// // final View tabIndicator = inflater.inflate(R.layout.tab_indicator,
-	// parent, false);
-	// //
-	// //// final TextView tv = (TextView)
-	// tabIndicator.findViewById(R.id.tab_title);
-	// //// tv.setText(label);
-	// ////
-	// //// final ImageView iconView = (ImageView)
-	// tabIndicator.findViewById(R.id.tab_icon);
-	// //// iconView.setImageDrawable(icon);
-	// //
-	// // return tabIndicator;
-	// // }
-	//
-	// @Override
-	// public View createTabContent(String tag)
-	// {
-	// final TextView tv = new TextView(this);
-	// tv.setText("Content for tab with tag " + tag);
-	// return tv;
-	// }
-	private void setupTabs()
-	{
-		mTabHost = (TabHost) findViewById(R.id.tabhost);
-		// mTabContent = (FrameLayout) findViewById(android.R.id.tabcontent);
-		// FrameLayout tab1 = new FrameLayout(this);
-		mTabHost.setup();
-
-		Iterator<String> iter = tabmap.keySet().iterator();
-		while (iter.hasNext())
-		{
-			String name = (String) iter.next();
-			mTabHost.addTab(mTabHost.newTabSpec(name).setIndicator(name)
-					.setContent(this));
-			// String val = (String) tabmap.get(field);
-			// parms.putString(field, val);
-			// // Cursor c = (Cursor) m_listadapter.getItem(key);
-			// Log.d("@@@@@@@@@", field + " : " + val);
-		}
-
-
-		TabWidget tabWidget=mTabHost.getTabWidget();
-		for (int i = 0; i < tabWidget.getChildCount(); i++) {
-
-			tabWidget.getChildAt(i).getLayoutParams().height = commonUtil.dp2px(this,39);
-			tabWidget.getChildAt(i).setPadding(24,0,24,0);
-//			tabWidget.getChildAt(i).getLayoutParams().height = 60;
-			TextView tv=(TextView)tabWidget.getChildAt(i).findViewById(android.R.id.title);
-//			tv.setGravity(BIND_AUTO_CREATE);
-//			tv.setPadding(10, 10,10, 10);
-			tv.setTextSize(12);//设置字体的大小;
-//			tv.setTextColor(Color.WHITE);//设置字体的颜色;
-//获取tabs图片;
-//			ImageView iv=(ImageView)tabWidget.getChildAt(i).findViewById(android.R.id.icon);
-		}
-
-		// for (int i=1; i <= tabmap.size(); i++) {
-		// String name = tabmap.keySet().iterator().;
-		// mTabHost.addTab(mTabHost.newTabSpec(name)
-		// .setIndicator(name)
-		// .setContent(this));
-		// }
-		// // if(true)
-		// // return;
-		//
-		// // View tab1 = createTabIndicatorView(mTabHost.getTabWidget(),
-		// // "Login",null);
-		// // tabhost.addTab(
-		// // tabhost.newTabSpec("tab" + i).setIndicator(tab)
-		// // .setContent(Mytabfirst.this)); tabhost.setCurrentTab(i);
-		// // i++; tab = null;
-		//
-		// // // ��ɵײ��Զ�����ʽ�İ�ť
-		// // String[] title = new String[] { "Login", "Not login" };
-		// // int[] tabIds = new int[] { R.id.tab1, R.id.tab2 };
-		// mTabHost.addTab(mTabHost.newTabSpec("Login").setIndicator("Login")
-		// .setContent(this));
-		// //
-		// mTabHost.addTab(mTabHost.newTabSpec("Direct Tracking").setIndicator("Direct Tracking").setContent(R.id.tab2));
-		// mTabHost.addTab(mTabHost.newTabSpec("Service Location")
-		// .setIndicator("Service Location").setContent(this));
-
-		// FragmentManager manager = this.getFragmentManager();
-
-		// Instantiate a new fragment.
-		// Fragment loginFragment = new LoginFragment();
-		// // Fragment dtFragement = new DirectTrackingFragment();
-		// Fragment slFragment = new ServiceLocationFragment();
-		// // Add the fragment to the activity, pushing this transaction
-		// // on to the back stack.
-		//
-		// FragmentTransaction ft =
-		// getSupportFragmentManager().beginTransaction();
-		// ft.replace(mTabHost.getTabContentView().getChildAt(0).getId(),
-		// loginFragment);
-		// ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		// ft.addToBackStack("Login");
-		//
-		// // ft.replace(R.id.tab2, dtFragement);
-		// // ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		// // ft.addToBackStack("Tracking");
-		//
-		// ft.replace(R.id.tab3, (Fragment) slFragment);
-		// ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		// ft.addToBackStack("Location");
-		//
-		// ft.commit();
-
-		// if (manager.findFragmentByTag(tabId) == null)
-		// {
-		// FragmentTransaction trans = manager.beginTransaction();
-		// trans.replace(contentViewID, frag, tabId);
-		// trans.commit();
-		// }
-		// for (int i = 0; i < title.length; i++) {
-		// Button button = new Button(this);
-		// button.setText(title[i]);
-		// button.setBackgroundDrawable(this.getResources().getDrawable(
-		// R.drawable.tab_lable)); //�Զ��尴ť��ʽ
-		// mTabHost.addTab(mTabHost.newTabSpec(title[i]).setIndicator(button)
-		// .setContent(tabIds[i]));
-		// }
-
-		// mTabHost.setOnTabChangedListener(this);
-	}
-
-	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
-	{
-		// Inflate the menu; this adds items to the action bar if it is present.
-
-		if (function_name.equals("Cargo Tracking")) {
-			getMenuInflater().inflate(R.menu.cargo_menu, menu);
-		} else {
-			getMenuInflater().inflate(R.menu.detail, menu);
-		}
-		return true;
-	}
-
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		switch (item.getItemId())
-		{
-			case R.id.action_close:
-
-				finish();
-//				if (SearchResultActivity.instance != null) {
-//					SearchResultActivity.instance.finish();
-//				}
-//				if (SearchListActivity.instance != null) {
-//					SearchListActivity.instance.finish();
-//				}
-				Intent intent = new Intent(this, RootActivity.class);
-
-//                Intent intent = new Intent(context, LoginView.class);
-                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-
-
-				startActivity(intent);
-				break;
-			case android.R.id.home:
-				finish();
-				break;
-			case R.id.action_addto_favorite:
-//	            LayoutInflater factory = LayoutInflater.from(this);
-//	            final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null);
-	            final View edit = new EditText(this);
-	             new AlertDialog.Builder(this)
-	                .setIconAttribute(android.R.attr.alertDialogIcon)
-	                .setTitle(R.string.str_createname)
-	                .setView(edit)
-	                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
-	                    public void onClick(DialogInterface dialog, int whichButton) {
-                            String name = ((EditText)edit).getText().toString();
-                            if(TextUtils.isEmpty(name))
-                            {
-                                new android.app.AlertDialog.Builder(DetailActivity.this)
-                                        .setTitle("Warning")
-                                        .setMessage("Name can not be empty.")
-
-                                        .setPositiveButton("OK", new DialogInterface.OnClickListener() {
-                                            @Override
-                                            public void onClick(DialogInterface dialog, int which) {
-
-                                            }
-                                        })
-                                        .show();
-                                return;
-                            }
-
-	                    	String param = getIntent().toUri(0);
-
-	        				SQLiteDatabase db = dbUtil.OpenDB(
-	        						ApexTrackingApplication.get_instance(), null, true);
-	        				db.execSQL("insert into favorites(name,params,user,create_time,module_name) values('"
-	        						+ name
-	        						+ "','"
-	        						+ param
-	        						+ "','"
-	        						+ ApexTrackingApplication.get_user()
-	        						+ "',"
-	        						+ System.currentTimeMillis()
-									+ ",'"
-									+getIntent().getStringExtra("function_name")+ "')");
-	        				dbUtil.CloseDB(db);
-
-	                        /* User clicked OK so do some stuff */
-	                    }
-	                })
-	                .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
-	                    public void onClick(DialogInterface dialog, int whichButton) {
-
-	                        /* User clicked cancel so do some stuff */
-	                    }
-	                })
-	                .create().show();
-	             return true;
-
-			case R.id.action_search_document: {
-				String cargo_str = contentmap.get("Tracking");
-				try {
-					JSONObject cargo_json = new JSONObject(cargo_str);
-					String hbol = cargo_json.optString("hbol");
-					if (hbol != null && hbol.length() > 0) {
-
-						Bundle parms = new Bundle();
-						parms.putString("bol",hbol);
-						parms.putString("module_name","Download Document");
-						Intent resultIntent = new Intent(this, AMResultActivity.class);
-						resultIntent.putExtra("query_params",parms);
-						startActivity(resultIntent);
-
-					} else {
-						showAlter("There is no hbol to search");
-					}
-
-				} catch (JSONException e) {
-					e.printStackTrace();
-					showAlter("There is no hbol to search");
-				}
-
-			}
-			break;
-
-			case R.id.action_share_detail: {
-
-				Intent share = new Intent();
-				share.setAction(Intent.ACTION_SEND);
-//				share.putExtra(Intent.EXTRA_STREAM, uri);
-				share.setType("text/plain");
-
-
-
-
-				if (email_content != null) {
-					share.putExtra(Intent.EXTRA_TEXT, email_content);   //附带的说明信息
-				}
-				if (email_subject != null) {
-					share.putExtra(Intent.EXTRA_SUBJECT, email_subject);
-				}
-				if (email_to != null) {
-					share.putExtra(Intent.EXTRA_EMAIL, email_to.split(","));
-				}
-
-//        share.putExtra(Intent.EXTRA_CC, new String[]{"ray.zhang@united-cn.net"});
-//        startActivity(Intent.createChooser(share,getString(R.string.str_sendto)));
-				startActivity(Intent.createChooser(share, "Share"));
-			}
-			break;
-		}
-		return super.onOptionsItemSelected(item);
-	}
-
-	public void showAlter(String msg) {
-		new AlertDialog.Builder(this)
-				.setMessage(msg)
-				.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
-					@Override
-					public void onClick(DialogInterface dialogInterface, int i) {
-
-					}
-				})
-				.show();
-	}
-
-}

+ 7 - 19
ApexDrivers/apexmobile/src/main/java/com/usai/apex/DetailFragment.java

@@ -50,6 +50,7 @@ import com.usai.apex.pdf.PDFPreviewActivity;
 import com.usai.util.Network;
 import com.usai.util.RAUtil;
 import com.usai.util.commonUtil;
+import com.usai.util.dbUtil;
 
 import org.apache.http.util.EncodingUtils;
 import org.json.JSONException;
@@ -1222,6 +1223,8 @@ public class DetailFragment extends Fragment implements OnClickListener, ShipMap
 						if (email.length() > 0) {
 							if (emailType != null && Integer.valueOf(emailType) == ContactsContract.CommonDataKinds.Email.TYPE_WORK) {
 								appendContactEmail(email,mSelectContactPosition);
+								dbUtil.CloseCursor(c);
+								dbUtil.CloseCursor(cursor);
 								return;
 							}
 						}
@@ -1230,8 +1233,10 @@ public class DetailFragment extends Fragment implements OnClickListener, ShipMap
 
 				}
 
-			}
+				dbUtil.CloseCursor(cursor);
 
+			}
+			dbUtil.CloseCursor(c);
 			mSelectContactPosition = -1;
 		}
 
@@ -1287,24 +1292,7 @@ public class DetailFragment extends Fragment implements OnClickListener, ShipMap
 			m_task = null;
 			showProgress(false);
 
-//			if (ApexTrackingApplication.get_authorization() == false)
-//			{
-//				if(((DetailActivity) getActivity()).showlogin == true)
-//					return;
-//				((DetailActivity) getActivity()).showlogin = true;
-//				LinearLayout ll = (LinearLayout) ll_root
-//						.findViewById(R.id.ll_refresh);
-//				ll.setVisibility(View.VISIBLE);
-//				Toast toast = Toast.makeText(
-//						ApexTrackingApplication.get_instance(),
-//						getText(R.string.msg_net_passwordchangedremote) , Toast.LENGTH_LONG);
-//				toast.setGravity(Gravity.CENTER, 0, 0);
-//				toast.show();
-//				Intent i = new Intent();
-//				i.setClass(getActivity(), ApexActivity.class);
-//				startActivityForResult(i, REQUEST_LOGINACTIVITY);
-//				return;
-//			}
+
 			
 			switch (errorcode)
 			{

+ 0 - 410
ApexDrivers/apexmobile/src/main/java/com/usai/apex/FunctionSelectActivity.java

@@ -1,410 +0,0 @@
-package com.usai.apex;
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.app.NotificationManager;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.database.sqlite.SQLiteDatabase;
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.ArrayAdapter;
-import android.widget.AutoCompleteTextView;
-import android.widget.Button;
-import android.widget.RadioGroup;
-import android.widget.RadioGroup.OnCheckedChangeListener;
-import android.widget.TextView;
-
-import com.usai.apex.mainframe.NewDetailActivity;
-import com.usai.util.dbUtil;
-
-public class FunctionSelectActivity extends FragmentActivity implements
-		OnClickListener, OnCheckedChangeListener
-{
-
-	static final int PASSWORD_CHANGED = 1;
-	private static final int	REQUEST_LOGINACTIVITY			= 1;
-	private static final int	REQUEST_CHANGEPASSWORD_ACTIVITY	= 2;
-	private static final int	REQUEST_TOOLS_ACTIVITY			= 3;
-	ArrayAdapter<String>		adapter							= null;
-	
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		Intent intent = new Intent();
-		switch (item.getItemId())
-		{
-			case R.id.action_settings:
-				intent.setClass(this, SettingsActivity.class);
-				// intent.putExtra("user", user);
-				// 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);
-	}
-	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
-	{
-		// Inflate the menu; this adds items to the action bar if it is present.
-		getMenuInflater().inflate(R.menu.function_select, menu);
-		return true;
-	}
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		// user = ApexTrackingApplication.get_user();
-		// password= getIntent().getStringExtra("password");
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.new_function_select);
-
-		ActionBar bar = getActionBar();
-		bar.setTitle("");
-		//
-		TextView tv_booking = (TextView) findViewById(R.id.tv_booking);
-		tv_booking.setOnClickListener(this);
-		TextView tv_info = (TextView) findViewById(R.id.tv_info);
-		tv_info.setOnClickListener(this);
-		TextView tv_detail = (TextView) findViewById(R.id.tv_detail);
-		tv_detail.setOnClickListener(this);
-		// TextView tv_cargo = (TextView)findViewById(R.id.tv_cargo);
-		// tv_cargo.setOnClickListener(this);
-		TextView tv_doc = (TextView) findViewById(R.id.tv_doc);
-		tv_doc.setOnClickListener(this);
-		TextView tv_message = (TextView) findViewById(R.id.tv_message);
-		tv_message.setOnClickListener(this);
-		TextView tv_exit = (TextView) findViewById(R.id.tv_exit);
-		tv_exit.setOnClickListener(this);
-		TextView tv_loc = (TextView) findViewById(R.id.tv_location);
-		tv_loc.setOnClickListener(this);
-		TextView tv_tools = (TextView) findViewById(R.id.tv_tools);
-		tv_tools.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);
-		RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup1);
-		rg.setOnCheckedChangeListener(this);
-		// AutoCompleteTextView et = (AutoCompleteTextView)
-		// findViewById(R.id.atv_criterion);
-		// if (rg.getCheckedRadioButtonId() == R.id.radio0)
-		// adapter = new ArrayAdapter<String>(this,
-		// android.R.layout.simple_dropdown_item_1line,
-		// dbUtil.get_searchhistory("h_bol"));
-		// else
-		// adapter = new ArrayAdapter<String>(this,
-		// android.R.layout.simple_dropdown_item_1line,
-		// dbUtil.get_searchhistory("ctnr"));
-		// et.setAdapter(adapter);
-		SharedPreferences pref = ApexTrackingApplication.get_instance()
-				.getSharedPreferences("Apex", 0);
-		boolean autologin = pref.getBoolean("autologin", false);
-
-		if (!autologin)
-		{
-			Intent i = new Intent();
-			i.setClass(this, ApexActivity.class);
-			startActivityForResult(i, REQUEST_LOGINACTIVITY);
-		}
-
-	}
-
-	@Override
-	protected void onActivityResult(int requestCode, int resultCode, Intent data)
-	{
-		switch (requestCode)
-		{
-			case REQUEST_LOGINACTIVITY:
-				if (resultCode == Activity.RESULT_CANCELED)
-					finish();
-				break;
-			case REQUEST_TOOLS_ACTIVITY:
-				if (resultCode == PASSWORD_CHANGED)
-				{
-					String UNIQUE_STRING = "com.usai.apex.push.cancel";
-					Intent intent = new Intent(UNIQUE_STRING);
-					sendBroadcast(intent);
-					Intent i = new Intent();
-					i.setClass(this, ApexActivity.class);
-					startActivityForResult(i, REQUEST_LOGINACTIVITY);
-				}
-				break;
-			default:
-				break;
-		}
-
-		super.onActivityResult(requestCode, resultCode, data);
-	}
-
-	@Override
-	protected void onDestroy()
-	{
-		// dbUtil.CloseDB(m_db);
-		super.onDestroy();
-	}
-
-	@Override
-	public void onClick(View v)
-	{
-
-		switch (v.getId())
-		{
-			case R.id.btn_clear:
-			{
-
-				AutoCompleteTextView et = (AutoCompleteTextView) findViewById(R.id.atv_criterion);
-				et.setText("");
-				break;
-
-			}
-			case R.id.btn_search:
-			{
-
-				AutoCompleteTextView et = (AutoCompleteTextView) findViewById(R.id.atv_criterion);
-				// et.clearFocus();
-
-				InputMethodManager inputMethodManager = (InputMethodManager) getApplicationContext()
-						.getSystemService(Context.INPUT_METHOD_SERVICE);
-
-				inputMethodManager.hideSoftInputFromWindow(et.getWindowToken(),
-						0);
-				inputMethodManager.hideStatusIcon(et.getWindowToken());
-				String cargo_criterion = et.getText().toString();
-				// if (TextUtils.isEmpty(cargo_criterion))
-				// {
-				// et.setError(getString(R.string.error_field_required));
-				// et.requestFocus();
-				// }
-				// else
-				// {
-				Intent intent = new Intent();
-				intent.setClass(this, NewDetailActivity.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 = "h_bol";
-				}
-				else
-				{
-					intent.putExtra("criterion_type", 1);
-					h_field = "ctnr";
-				}
-
-				dbUtil.savehistory(h_field, cargo_criterion);
-
-				startActivity(intent);
-
-				break;
-			}
-			case R.id.tv_booking:
-			{
-				Intent intent = new Intent();
-				intent.setClass(this, SearchListActivity.class);
-				// intent.putExtra("user", ApexTrackingApplication.get_user());
-				// intent.putExtra("password", password);
-				intent.putExtra("function_name", "Ocean Booking");
-				intent.putExtra("title", "Booking Search");
-				startActivity(intent);
-				break;
-			}
-			case R.id.tv_info:
-			{
-				Intent intent = new Intent();
-				intent.setClass(this, SearchListActivity.class);
-				// 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;
-			}
-			case R.id.tv_detail:
-			{
-				Intent intent = new Intent();
-				intent.setClass(this, SearchListActivity.class);
-				// intent.putExtra("user", user);
-				// intent.putExtra("password", password);
-				intent.putExtra("function_name", "Container detail");
-				intent.putExtra("title", "Container Search");
-				startActivity(intent);
-				break;
-			}
-
-			case R.id.tv_doc:
-			{
-				Intent intent = new Intent();
-				intent.setClass(this, DocumentsActivity.class);
-				// // intent.putExtra("user", user);
-				// // intent.putExtra("password", password);
-				// intent.putExtra("function_name", "Download Document");
-				// intent.putExtra("title", "Document Search");
-				startActivity(intent);
-				break;
-			}
-			case R.id.tv_message:
-			{
-
-				Intent intent = new Intent();
-				intent.setClass(this, MessageActivity.class);
-				startActivity(intent);
-				//
-				// Intent intent = new Intent();
-				// intent.setClass(this, ChangePasswordActivity.class);
-				// // intent.putExtra("function_name", "Container Detail");
-				// startActivityForResult(intent,
-				// REQUEST_CHANGEPASSWORD_ACTIVITY);
-				break;
-			}
-			case R.id.tv_exit:
-			{
-				String UNIQUE_STRING = "com.usai.apex.push.cancel";
-				Intent intent = new Intent(UNIQUE_STRING);
-				// intent.putExtra("key1", "value1");
-				// intent.putExtra("key2", "value2");
-				sendBroadcast(intent);
-
-				// ApexTrackingApplication.cancelalarm();
-				// ApexTrackingApplication.put_password("");
-				// ApexTrackingApplication.put_sessionid("");
-				// ApexTrackingApplication.put_user("");
-
-				Intent i = new Intent();
-				i.setClass(this, ApexActivity.class);
-				startActivityForResult(i, 1);
-
-				// finish();
-				// System.exit(0);
-				break;
-			}
-			case R.id.tv_tools:
-			{
-				Intent intent = new Intent();
-				intent.setClass(this, InnerToolsActivity.class);
-				intent.putExtra("launcher", "inner");
-				startActivityForResult(intent,REQUEST_TOOLS_ACTIVITY);
-				break;
-			}
-			case R.id.tv_location:
-			{
-				Log.d("==============", "start location activity");
-				Intent intent = new Intent();
-				intent.setClass(this, InnerMapActivity.class);
-				// intent.putExtra("user", user);
-				// intent.putExtra("password", password);
-				// intent.putExtra("function_name", "Container Detail");
-				startActivity(intent);
-				break;
-			}
-
-			default:
-				break;
-		}
-		// TODO Auto-generated method stub
-
-	}
-
-	// class HistoryAdapter extends SimpleCursorAdapter{
-	//
-	// public HistoryAdapter(Context context, int layout, Cursor c,
-	// String[] from, int[] to)
-	// {
-	// super(context, layout, c, from, to,FLAG_AUTO_REQUERY);
-	// // TODO Auto-generated constructor stub
-	// }
-	//
-	// }
-
-	@Override
-	protected void onResume()
-	{
-		SQLiteDatabase db = dbUtil.OpenDB(this, null, false);
-		int count = dbUtil.get_count(db, "push_message", "read = 0 and user = '"+ApexTrackingApplication.get_user()+"'");
-
-		dbUtil.CloseDB(db);
-		NotificationManager nManager = (NotificationManager) this
-				.getSystemService(Context.NOTIFICATION_SERVICE);
-		nManager.cancel(R.layout.activity_apex);
-		ApexTrackingApplication.ncount=1;
-
-		// Intent intent = new Intent();
-		// intent.setClass(ApexTrackingApplication
-		// .get_instance(), FunctionSelectActivity.class);
-		// Intent addShortcut = new Intent(
-		// "com.android.launcher.action.INSTALL_SHORTCUT");
-		// Parcelable icon = Intent.ShortcutIconResource.fromContext(this,
-		// R.drawable.ic_launcher);
-		// addShortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,
-		// getString(R.string.app_name));
-		// addShortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent);
-		// addShortcut.putExtra("duplicate", 0);
-		// addShortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
-		// Log.e("uuuuuuuuuuuuuuuurrrrrrrrrrrrrriiiiiiiii",
-		// intent.toUri(MODE_WORLD_WRITEABLE));
-		// sendBroadcast(addShortcut);
-		if (count > 0)
-		{
-			TextView tv_message = (TextView) findViewById(R.id.tv_message);
-			tv_message.setCompoundDrawablesWithIntrinsicBounds(0,
-					R.drawable.ic_message_new, 0, 0);
-
-		}
-		else
-		{
-			TextView tv_message = (TextView) findViewById(R.id.tv_message);
-			tv_message.setCompoundDrawablesWithIntrinsicBounds(0,
-					R.drawable.ic_message, 0, 0);
-		}
-
-		RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup1);
-		AutoCompleteTextView et = (AutoCompleteTextView) findViewById(R.id.atv_criterion);
-		if (rg.getCheckedRadioButtonId() == R.id.radio0)
-			adapter = new ArrayAdapter<String>(this,
-					android.R.layout.simple_dropdown_item_1line,
-					dbUtil.get_searchhistory("h_bol"));
-		else
-			adapter = new ArrayAdapter<String>(this,
-					android.R.layout.simple_dropdown_item_1line,
-					dbUtil.get_searchhistory("ctnr"));
-		et.setAdapter(adapter);
-		super.onResume();
-	}
-
-	@Override
-	public void onCheckedChanged(RadioGroup group, int checkedId)
-	{
-
-		AutoCompleteTextView et = (AutoCompleteTextView) findViewById(R.id.atv_criterion);
-		if (checkedId == R.id.radio0)
-			adapter = new ArrayAdapter<String>(this,
-					android.R.layout.simple_dropdown_item_1line,
-					dbUtil.get_searchhistory("h_bol"));
-		else
-			adapter = new ArrayAdapter<String>(this,
-					android.R.layout.simple_dropdown_item_1line,
-					dbUtil.get_searchhistory("ctnr"));
-		et.setAdapter(adapter);
-
-	}
-
-}

+ 8 - 69
ApexDrivers/apexmobile/src/main/java/com/usai/apex/InnerMapActivity.java

@@ -3,15 +3,10 @@ package com.usai.apex;
 import android.app.AlertDialog;
 import android.content.Context;
 import android.content.DialogInterface;
-
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager.NameNotFoundException;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.net.Uri;
 import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentTransaction;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.AppCompatActivity;
@@ -22,7 +17,6 @@ import android.view.MenuItem;
 import android.view.View;
 import android.widget.TextView;
 
-import com.baidu.mapapi.map.SupportMapFragment;
 import com.usai.apex.servicelocationmap.ApexServiceLocationMapFragment;
 import com.usai.redant.rautils.contactkit.Contact;
 import com.usai.redant.rautils.contactkit.ContactHelper;
@@ -37,14 +31,16 @@ import com.usai.redant.rautils.contactkit.element.WebSite;
 
 import java.util.ArrayList;
 
+//import com.baidu.mapapi.map.SupportMapFragment;
+
 
-public class InnerMapActivity extends AppCompatActivity implements BaiduMapFragment.BaiduMarkerClickListener,ServiceLocationFragment.MarkerClickListener, ApexServiceLocationMapFragment.ApexServiceLocationMapInfoWindowClickListener
+public class InnerMapActivity extends AppCompatActivity implements  ApexServiceLocationMapFragment.ApexServiceLocationMapInfoWindowClickListener
 {
 
-	SupportMapFragment			map;
-	boolean						m_bhasgoogleframework	= true;
+//	SupportMapFragment			map;
+//	boolean						m_bhasgoogleframework	= true;
 	private InnerMapActivity self = this;
-	private final static boolean USE_APEX_MAP = false;
+//	private final static boolean USE_APEX_MAP = true;
 
 
 	@Override
@@ -96,12 +92,8 @@ public class InnerMapActivity extends AppCompatActivity implements BaiduMapFragm
 		super.onCreate(savedInstanceState);
 		mContext = this;
 		setCustomActionBar();
-
-		if (USE_APEX_MAP) {
-			setupApexMap();
-		} else {
-			setupMap();
-		}
+		setupApexMap();
+//
 	}
 
 	private void setupApexMap() {
@@ -116,61 +108,8 @@ public class InnerMapActivity extends AppCompatActivity implements BaiduMapFragm
 		transaction.commit();
 	}
 
-	private void setupMap() {
-
-		PackageInfo packageInfo;
-		try
-		{
-			packageInfo = this.getPackageManager().getPackageInfo("com.google.android.gms", 0);
-
-		}
-		catch (NameNotFoundException e)
-		{
-			packageInfo = null;
-			e.printStackTrace();
-		}
-
-		String able= getResources().getConfiguration().locale.getCountry();
-//        if (packageInfo == null)
-		if (able.equals("CN"))
-		{
-			m_bhasgoogleframework = false;
-			System.out.println("没有安装");
-		}
-		else
-		{
-			m_bhasgoogleframework = true;
-			System.out.println("已经安装");
-		}
 
-//		m_bhasgoogleframework = false;
-//		m_bhasgoogleframework= true;
 
-		Fragment slFragment = null;
-		if (m_bhasgoogleframework )
-		{
-			setContentView(R.layout.activity_inner_map);
-			slFragment = new ServiceLocationFragment();
-			((ServiceLocationFragment)slFragment).markerClickListener = this;
-			FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
-			ft.replace(R.id.inner_map, slFragment);
-			ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-			ft.addToBackStack("Location");
-			ft.commit();
-
-		}
-		else
-		{
-			setContentView(R.layout.activity_inner_map);
-			BaiduMapFragment f  = new BaiduMapFragment();
-			FragmentManager manager = getSupportFragmentManager();
-			manager.beginTransaction().add(R.id.inner_map, f, "map_fragment").commit();
-			f.markerClickListener = this;
-		}
-
-	}
-
-	@Override
 	public void markerClicked(LocationDetail detail) {
 
 		if (detail == null) {

+ 8 - 9
ApexDrivers/apexmobile/src/main/java/com/usai/apex/MessageActivity.java

@@ -1,18 +1,10 @@
 package com.usai.apex;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.usai.util.Network;
-import com.usai.util.dbUtil;
-
 import android.app.AlertDialog;
+import android.app.AlertDialog.Builder;
 import android.app.Dialog;
 import android.app.ListActivity;
 import android.app.NotificationManager;
-import android.app.AlertDialog.Builder;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
@@ -34,6 +26,13 @@ import android.widget.Button;
 import android.widget.ListView;
 import android.widget.TextView;
 
+import com.usai.util.dbUtil;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 public class MessageActivity extends ListActivity implements OnTouchListener
 {
 	SearchResult	searchresult	= new SearchResult();

+ 27 - 30
ApexDrivers/apexmobile/src/main/java/com/usai/apex/MessageDetailActivity.java

@@ -1,34 +1,31 @@
 package com.usai.apex;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import com.usai.util.Network;
-
 import android.app.ListActivity;
 import android.content.Context;
 import android.content.Intent;
 import android.os.AsyncTask;
 import android.os.Bundle;
 import android.text.Html;
-import android.text.method.LinkMovementMethod;
 import android.util.Log;
 import android.view.Gravity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.AutoCompleteTextView;
 import android.widget.BaseAdapter;
 import android.widget.ListView;
-import android.widget.RadioGroup;
 import android.widget.TextView;
 import android.widget.Toast;
 
+import com.usai.util.Network;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 public class MessageDetailActivity extends ListActivity
 {
 	long				msgcount		= 0;
@@ -65,23 +62,23 @@ public class MessageDetailActivity extends ListActivity
 	@Override
 	protected void onListItemClick(ListView l, View v, int position, long id)
 	{
-		super.onListItemClick(l, v, position, id);
-
-		Intent intent = new Intent();
-		intent.setClass(this, DetailActivity.class);
-
-		intent.putExtra("action0", "Tracking");
-		intent.putExtra("function_name", "Cargo Tracking");
-
-		intent.putExtra("cargo_criterion", searchresult.getData().get(position)
-				.get("url").toString());
-		intent.putExtra("actions_count", 1);
-		intent.putExtra("_id", "dumb");
-//		String h_field;
-		intent.putExtra("criterion_type", 1);
-//		h_field = "container_no";
-
-		startActivity(intent);
+//		super.onListItemClick(l, v, position, id);
+//
+//		Intent intent = new Intent();
+//		intent.setClass(this, DetailActivity.class);
+//
+//		intent.putExtra("action0", "Tracking");
+//		intent.putExtra("function_name", "Cargo Tracking");
+//
+//		intent.putExtra("cargo_criterion", searchresult.getData().get(position)
+//				.get("url").toString());
+//		intent.putExtra("actions_count", 1);
+//		intent.putExtra("_id", "dumb");
+////		String h_field;
+//		intent.putExtra("criterion_type", 1);
+////		h_field = "container_no";
+//
+//		startActivity(intent);
 
 	}
 

+ 0 - 871
ApexDrivers/apexmobile/src/main/java/com/usai/apex/ResultActivity.java

@@ -1,871 +0,0 @@
-package com.usai.apex;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.AlertDialog.Builder;
-import android.app.Dialog;
-import android.app.DownloadManager;
-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.net.Uri;
-import android.os.AsyncTask;
-import android.os.Build;
-import android.os.Bundle;
-import android.text.Html;
-import android.text.style.URLSpan;
-import android.util.Log;
-import android.util.SparseArray;
-import android.view.ContextMenu;
-import android.view.ContextMenu.ContextMenuInfo;
-import android.view.Gravity;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnCreateContextMenuListener;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.TableLayout;
-import android.widget.TableRow;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.usai.apex.mainframe.NewDetailActivity;
-import com.usai.util.Network;
-import com.usai.util.dbUtil;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Set;
-
-public class ResultActivity extends Activity
-{
-
-	private static final int	REQUEST_LOGINACTIVITY	= 1;
-	String						user					= null;
-	String						password				= null;
-	String						function_name			= null;
-	private SearchTask			m_task					= null;
-
-	final int					OFFSET					= 5;
-
-	int							sel						= -1;
-
-	Bundle						searchParms				= null;
-	SearchResult				searchresult			= new SearchResult();
-
-	SparseArray<String>			showfieldmap			= new SparseArray<String>();
-	// HashMap<Integer, String> showfieldmap = new HashMap<Integer, String>();
-	private TextView			mStatusMessageView;
-	// private View mSearchFormView;
-	private View				footview;
-	private View				mStatusView;
-	int							actioncount				= 0;
-
-	// private class resultAdapter extends SimpleAdapter
-	// {
-	//
-	//
-	// }
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		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);
-
-		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()
-		{
-
-			@Override
-			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
-				{
-					// if (searchresult.get_direction() == -1)
-					searchresult.set_offset(searchresult.get_offset() + OFFSET);
-					requestdata(false);
-				}
-
-			}
-		});
-
-		Button btnpre = (Button) findViewById(R.id.btn_pre);
-		btnpre.setOnClickListener(new View.OnClickListener()
-		{
-
-			@Override
-			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
-				{
-					searchresult.set_offset(searchresult.get_offset() - OFFSET);
-					requestdata(false);
-				}
-
-			}
-		});
-		mStatusView = findViewById(R.id.status);
-		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()
-		{
-
-			@Override
-			public void onClick(View v)
-			{
-				LinearLayout ll = (LinearLayout) findViewById(R.id.ll_refresh);
-				ll.setVisibility(View.INVISIBLE);
-				if (searchresult.get_totalcount() == -1)
-					requestdata(true);
-				else
-					requestdata(false);
-
-			}
-		});
-
-		SharedPreferences RunOnce = getSharedPreferences("Apex", 0);
-
-		String vername;
-		try
-		{
-			vername = getPackageManager().getPackageInfo("com.usai.apex", 0).versionName;
-			boolean bFirstRun = RunOnce.getBoolean("FirstRun" + vername
-					+ "_result", true);
-			if (bFirstRun&&false)
-			{
-				SharedPreferences.Editor editor = RunOnce.edit();
-				editor.putBoolean("FirstRun" + vername + "_result", false);
-				// Don't forget to commit your edits!!!
-				editor.commit();
-				Intent intent = new Intent();
-				intent.setClass(this, HelpActivity.class);
-				intent.putExtra("caller", "result");
-				startActivity(intent);
-
-			}
-		}
-		catch (NameNotFoundException e)
-		{
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		initTableHeader();
-		if (savedInstanceState != null)
-		{
-			searchresult = (SearchResult) savedInstanceState
-					.getSerializable("searchresult");
-			if (searchresult.get_totalcount() == -1)
-				requestdata(true);
-			else
-				initTable();
-		}
-		else
-			requestdata(true);
-
-	}
-
-	@Override
-	protected void onDestroy()
-	{
-		if (m_task != null)
-			m_task.cancel(false);
-		super.onDestroy();
-	}
-
-	private void initTable()
-	{
-		// int loadcount = searchresult.get_count();
-		int totalcount = searchresult.get_totalcount();
-		TextView tv_head = (TextView) findViewById(R.id.head);
-		if (totalcount == 0)
-		{
-			tv_head.setText(R.string.str_0);
-
-			return;
-		}
-		else if (searchresult.get_totalcount() > 2000)
-		{
-			tv_head.setText(R.string.str_2000);
-		}
-		else
-			tv_head.setText(/*
-							 * loadcount + "/" + //
-							 */searchresult.get_totalcount()
-					+ getText(R.string.str_records).toString());
-		TableLayout tl = (TableLayout) findViewById(R.id.result_table);
-
-		tl.removeViews(1, tl.getChildCount() - 1);
-		// int newcount = loadcount - showcount + 1;// +1 header row
-		for (int i = 0; i < searchresult.get_recordscount(); i++)
-		{
-
-			TableRow recordRow = new TableRow(ResultActivity.this);
-			recordRow.setOnLongClickListener(new View.OnLongClickListener()
-			{
-
-				@Override
-				public boolean onLongClick(View v)
-				{
-					// TODO Auto-generated method stub
-					// v.setBackgroundColor(Color.GRAY);
-					// v.showContextMenu();
-					// return true;
-					TableRow tr = (TableRow) v;
-					TextView tvno = (TextView) tr.getChildAt(0);
-					sel = (Integer.parseInt(tvno.getText().toString())-1) % 5 ;
-					registerForContextMenu(v);
-					openContextMenu(v);
-					unregisterForContextMenu(v);
-					return true;
-				}
-			});
-
-			// registerForContextMenu(recordRow);
-			// recordRow.setClickable(true);
-			// registerForContextMenu(recordRow);
-			// recordRow.setOnCreateContextMenuListener(m_tableMenu);
-			// recordRow.SETSE
-
-			HashMap<String, String> record = searchresult.get_record(i);
-			TextView field = new TextView(ResultActivity.this);
-			field.setBackgroundResource(R.drawable.tableitem);
-			field.setText(searchresult.get_offset() + i + 1 + "");
-			Log.d("offset=" + searchresult.get_offset(), "");
-			field.setGravity(Gravity.CENTER);
-			field.setPadding(10, 5, 10, 5);
-			field.setTextSize(20);
-			recordRow.addView(field);
-			for (int j = 0; j < showfieldmap.size(); j++)
-			{
-				TextView field1 = new TextView(ResultActivity.this);
-				// Log.d("onPostExecute", showfieldmap.get(j));
-				String str = record.get(showfieldmap.get(j));
-				field1.setBackgroundResource(R.drawable.tableitem);
-				if (str.toLowerCase().trim().equals("null"))
-					str = "";
-
-				// field1.setBackgroundColor(0xFFFFFFFF);
-
-				field1.setText(Html.fromHtml(str));
-
-				if (actioncount == 0)
-					field1.setOnClickListener(new OnClickListener()
-					{
-
-						@Override
-						public void onClick(View v)
-						{
-							// if (true)
-							// return;
-							URLSpan span[] = ((TextView) v).getUrls();
-							if (span.length < 1)
-								return;
-							span[0].getURL();
-							Log.d("Text", span[0].getURL());
-							
-							TextView tv = (TextView)v;
-
-							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);
-							
-							request.setDestinationInExternalPublicDir("Apex Mobile",tv.getText().toString()); 
-
-							// 禁止发出通知,既后台下载,如果要使用这一句必须声明一个权限: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(getString(R.string.str_downloadmessage));
-
-							builder.setTitle(getString(R.string.str_confirmdownload));
-
-							builder.setPositiveButton(
-									getString(R.string.str_download),
-									new Dialog.OnClickListener()
-									{
-
-										@Override
-										public void onClick(
-												DialogInterface dialog,
-												int which)
-										{
-											downloadManager.enqueue(request);
-											dialog.dismiss();
-
-										}
-									});
-
-							builder.setNegativeButton(
-									getString(R.string.str_cancel),
-									new Dialog.OnClickListener()
-									{
-
-										@Override
-										public void onClick(
-												DialogInterface dialog,
-												int which)
-										{
-											dialog.dismiss();
-										}
-									});
-
-							builder.create().show();
-
-						}
-
-					});
-				// field1.setText(str);
-				field1.setGravity(Gravity.LEFT);
-				field1.setPadding(10, 5, 10, 5);
-				field1.setTextSize(20);
-				// field.setTextAppearance(ResultActivity.this,
-				// android.R.attr.textAppearanceMedium);
-				recordRow.addView(field1);
-			}
-			tl.addView(recordRow);
-		}
-
-		Button btnnext = (Button) findViewById(R.id.btn_next);
-
-		Button btnpre = (Button) findViewById(R.id.btn_pre);
-		if (searchresult.get_offset() == 0)
-			btnpre.setEnabled(false);
-		else
-		{
-			btnpre.setEnabled(true);
-		}
-		if ((searchresult.get_totalcount() - searchresult.get_offset() <= OFFSET)
-				|| (searchresult.get_totalcount() == 0))
-			btnnext.setEnabled(false);
-		else
-			btnnext.setEnabled(true);
-	}
-
-	private OnCreateContextMenuListener	m_tableMenu	= new OnCreateContextMenuListener()
-													{
-
-														@Override
-														public void onCreateContextMenu(
-																ContextMenu contextmenu,
-																View view,
-																ContextMenuInfo contextmenuinfo)
-														{
-
-															contextmenu
-																	.add(Menu.NONE,
-																			0,
-																			0,
-																			getString(R.string.str_detail));
-
-														}
-
-													};
-
-	@Override
-	public boolean onContextItemSelected(MenuItem item)
-	{
-		// menuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
-		// Log.d("table row select", sel+ "");
-
-		Intent intent = new Intent();
-		intent.setClass(this, NewDetailActivity.class);
-
-		SQLiteDatabase db = dbUtil.OpenDB(this, null, false);
-		Cursor cursor = db.query("actions_info",
-				new String[] { "name", "_id" }, "function_name='"
-						+ function_name + "' and user='" + user + "'", null,
-				null, null, "priority", null);
-		int i = 0;
-		while (cursor.moveToNext())
-		{
-			String name = cursor.getString(0);
-			Log.d("actionname", name);
-			intent.putExtra("action" + i, name);
-			i++;
-		}
-		intent.putExtra("function_name", function_name);
-		intent.putExtra("actions_count", i);
-		intent.putExtra("_id", searchresult.get_record(sel).get("_id")
-				.toString());
-		dbUtil.CloseCursor(cursor);
-		dbUtil.CloseDB(db);
-
-		startActivity(intent);
-
-		return super.onContextItemSelected(item);
-	}
-
-	// @Override
-	// public void onCreateContextMenu(ContextMenu menu, View v,
-	// ContextMenuInfo menuInfo)
-	// {
-	// // // TODO Auto-generated method stub
-	// menu.add(Menu.NONE, 0, 0, "Detail");
-	// // // contextmenu.add(Menu.NONE, 1, 1, "�༭");
-	// super.onCreateContextMenu(menu, v, menuInfo);
-	// }
-
-	void initTableHeader()
-	{
-
-		TableLayout tl = (TableLayout) findViewById(R.id.result_table);
-		tl.setFocusable(true);
-		tl.setOnCreateContextMenuListener(m_tableMenu);
-		SQLiteDatabase db = dbUtil.OpenDB(this, null, false);
-		Cursor cursor = db.query("fields_info", new String[] { "aname", "name",
-				"_id" }, "function_name='" + function_name + "' and user='"
-				+ user + "' and behavior=" + Network.BEHAVIOR_RESULT
-				+ " and show = 1", null, null, null, "priority , aname", null);
-		TableRow headerRow = (TableRow) findViewById(R.id.tr_header);
-		int pos = 0;
-		showfieldmap.clear();
-		headerRow.removeAllViews();
-		ArrayList<HashMap<String, String>> gridheader = new ArrayList<HashMap<String, String>>();
-		HashMap<String, String> map = new HashMap<String, String>();
-		map.put("key", "no.");
-		gridheader.add(map);
-		Button btn = new Button(this);
-		btn.setBackgroundResource(R.drawable.tablehead);
-		btn.setPadding(0, 0, 0, 0);
-		btn.setText("No.");
-		headerRow.addView(btn);
-		while (cursor.moveToNext())
-		{
-			String aname = cursor.getString(0);
-			Button btn1 = new Button(this);
-			btn1.setBackgroundResource(R.drawable.tablehead);
-			btn1.setText(aname);
-			headerRow.addView(btn1);
-			showfieldmap.put(pos, cursor.getString(1));
-
-			map.put("key", "header");
-			gridheader.add(map);
-			pos++;
-		}
-		dbUtil.CloseCursor(cursor);
-		dbUtil.CloseDB(db);
-
-		// SimpleAdapter adapter = new SimpleAdapter(this,
-		// gridheader,// �����Դ
-		// R.layout.result_item,//XMLʵ��
-		// new String[] { "key" }, // ��̬������ImageItem��Ӧ������
-		// new int[] { R.id.tv_value });
-		//
-		// GridView gridview = (GridView) findViewById(R.id.grid_result);
-		// gridview.setNumColumns(2);
-		// gridview.setAdapter(adapter);
-
-	}
-
-	@Override
-	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)
-	{
-		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_RESULT);
-				startActivity(intent);
-				break;
-			case R.id.action_help:
-				// Intent intent = new Intent();
-				intent.setClass(this, HelpActivity.class);
-				intent.putExtra("caller", "result");
-				// // intent.putExtra("password", password);
-				// intent.putExtra("function_name", function_name);
-				// intent.putExtra("behavior", Network.BEHAVIOR_SEARCH);
-				startActivity(intent);
-				break;
-			case R.id.action_save_search:
-				// LayoutInflater factory = LayoutInflater.from(this);
-				// final View textEntryView =
-				// factory.inflate(R.layout.alert_dialog_text_entry, null);
-				final View edit = new EditText(this);
-				new AlertDialog.Builder(this)
-						.setIconAttribute(android.R.attr.alertDialogIcon)
-						.setTitle(R.string.str_createname)
-						.setView(edit)
-						.setPositiveButton(android.R.string.ok,
-								new DialogInterface.OnClickListener()
-								{
-									public void onClick(DialogInterface dialog,
-											int whichButton)
-									{
-										String name = ((EditText) edit)
-												.getText().toString();
-										String param = getIntent().toUri(0);
-
-										JSONObject obj = new JSONObject();
-										Set<String> keys = searchParms.keySet();
-										for (String key : keys)
-										{
-
-											
-											try
-											{
-												obj.put(key, searchParms.get(key).toString());
-
-											}
-											catch (JSONException e)
-											{
-												// TODO Auto-generated catch block
-												e.printStackTrace();
-											}
-
-										}
-										obj.toString();
-
-										SQLiteDatabase db = dbUtil.OpenDB(
-												ApexTrackingApplication.get_instance(), null, true);
-										db.execSQL("insert into history(params,name,criterion,module_name,user,create_time) values('"
-
-												+ param
-												+ "','"
-												+ name
-												+ "','"
-												+ obj.toString()
-												+ "','"
-												+ function_name
-												+ "','"
-												+ ApexTrackingApplication.get_user()
-												+ "',"
-												+ System.currentTimeMillis() + ")");
-										dbUtil.CloseDB(db);
-
-										/* User clicked OK so do some stuff */
-									}
-								})
-						.setNegativeButton(android.R.string.cancel,
-								new DialogInterface.OnClickListener()
-								{
-									public void onClick(DialogInterface dialog,
-											int whichButton)
-									{
-
-										/* User clicked cancel so do some stuff */
-									}
-								}).create().show();
-				break;
-			default:
-				break;
-		}
-		return super.onOptionsItemSelected(item);
-	}
-
-	public void requestdata(boolean requestcount)
-	{
-
-		if (m_task != null)
-		{
-			return;
-		}
-		mStatusMessageView.setText(R.string.str_Loading);
-		showProgress(true);
-		m_task = new SearchTask();
-		m_task.execute(requestcount);
-
-	}
-
-	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)
-		{
-			int shortAnimTime = getResources().getInteger(
-					android.R.integer.config_shortAnimTime);
-
-			mStatusView.setVisibility(View.VISIBLE);
-			mStatusView.animate().setDuration(shortAnimTime)
-					.alpha(show ? 1 : 0)
-					.setListener(new AnimatorListenerAdapter()
-					{
-						@Override
-						public void onAnimationEnd(Animator animation)
-						{
-							mStatusView.setVisibility(show ? View.VISIBLE
-									: View.INVISIBLE);
-						}
-					});
-
-			footview.setVisibility(View.VISIBLE);
-			footview.animate().setDuration(shortAnimTime).alpha(show ? 0 : 1)
-					.setListener(new AnimatorListenerAdapter()
-					{
-						@Override
-						public void onAnimationEnd(Animator animation)
-						{
-							footview.setVisibility(show ? View.INVISIBLE
-									: View.VISIBLE);
-						}
-					});
-			// mSearchFormView.setVisibility(View.VISIBLE);
-			// mSearchFormView.animate().setDuration(shortAnimTime)
-			// .alpha(show ? 0 : 1)
-			// .setListener(new AnimatorListenerAdapter()
-			// {
-			// @Override
-			// public void onAnimationEnd(Animator animation)
-			// {
-			// mSearchFormView.setVisibility(show ? View.INVISIBLE
-			// : View.VISIBLE);
-			// }
-			// });
-		}
-		else
-		{
-			// The ViewPropertyAnimator APIs are not available, so simply show
-			// and hide the relevant UI components.
-			mStatusView.setVisibility(show ? View.VISIBLE : View.INVISIBLE);
-			footview.setVisibility(show ? View.INVISIBLE : View.VISIBLE);
-			// mSearchFormView.setVisibility(show ? View.INVISIBLE :
-			// View.VISIBLE);
-		}
-	}
-
-	public class SearchTask extends AsyncTask<Boolean, Void, Boolean>
-	{
-		// int err_code = ERR_CODE_NONE;
-		int	errorcode;
-
-		@Override
-		protected Boolean doInBackground(Boolean... params)
-		{
-
-			if (!Network.NetworkIsAvailable())
-
-			{
-				errorcode = Network.RESULT_NET_NOTAVAILABLE;
-				return false;
-			}
-
-			if (params[0])
-			{
-				int ret = Network.get_recordcount(searchParms);
-				if (ret >= 0)
-				{
-					searchresult.put_totalcount(ret);
-					if (ret == 0)
-						return true;
-				}
-				else
-				{
-					errorcode = ret;
-					return false;
-				}
-			}
-
-			// if (searchresult.get_direction() == -1)
-			// searchresult.set_offset(searchresult.get_offset() - 20);
-			searchParms.putString("offset", searchresult.get_offset() + "");
-
-			String jstr = Network.get_records(user, password, searchParms);
-			if (jstr == null || jstr.length() <= 0)
-			{
-				// Log.d(TAG, "json is wrong");
-				errorcode = Network.RESULT_NET_ERROR;
-				return false;
-			}
-
-			JSONObject jsobj;
-			//
-			// array = new JSONArray(json);
-			try
-			{
-				jsobj = new JSONObject(jstr);
-				// if (searchresult.get_fieldscount() == 0)
-				// {
-				// JSONObject objfields = jsobj.getJSONObject("fields");
-				// if (objfields != null)
-				// searchresult.init_fields(objfields.toString());
-				// }
-				JSONObject objrecords = jsobj.getJSONObject("records");
-				if (objrecords != null)
-					searchresult.add_records(objrecords.toString());
-				errorcode = Network.RESULT_TRUE;
-
-				return true;
-
-			}
-			catch (JSONException e)
-			{
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			errorcode = Network.RESULT_NET_ERROR;
-			return false;
-
-		}
-
-		@Override
-		protected void onPostExecute(final Boolean success)
-		{
-			Log.d("onPostExecute", "entry");
-			m_task = null;
-			showProgress(false);
-			if (ApexTrackingApplication.get_authorization() == false)
-			{
-				LinearLayout ll = (LinearLayout) findViewById(R.id.ll_refresh);
-				ll.setVisibility(View.VISIBLE);
-				Toast toast = Toast.makeText(
-						ApexTrackingApplication.get_instance(),
-						getText(R.string.msg_net_passwordchangedremote),
-						Toast.LENGTH_LONG);
-				toast.setGravity(Gravity.CENTER, 0, 0);
-				toast.show();
-				Intent i = new Intent();
-				i.setClass(ResultActivity.this, ApexActivity.class);
-				startActivityForResult(i, REQUEST_LOGINACTIVITY);
-				return;
-			}
-			switch (errorcode)
-			{
-				case Network.RESULT_NET_NOTAVAILABLE:
-				{
-					Toast toast = Toast.makeText(getApplicationContext(),
-							getText(R.string.msg_connection_none),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-				case Network.RESULT_NET_ERROR:
-				{
-
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_net_resulterror) + ":"
-									+ errorcode, Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-
-					break;
-				}
-				case Network.RESULT_ERROR:
-				// case Network.RESULT_RESPONSE_NULL:
-				{
-					Toast toast = Toast.makeText(getApplicationContext(),
-							getText(R.string.msg_net_resulterror),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-
-				default:
-					break;
-			}
-
-			if (success)
-			{
-
-				initTable();
-
-			}
-			else
-			{
-				LinearLayout ll = (LinearLayout) findViewById(R.id.ll_refresh);
-				ll.setVisibility(View.VISIBLE);
-			}
-		}
-
-		@Override
-		protected void onCancelled()
-		{
-			m_task = null;
-			showProgress(false);
-		}
-	}
-
-	@Override
-	protected void onSaveInstanceState(Bundle outState)
-	{
-		outState.putSerializable("searchresult", searchresult);
-		super.onSaveInstanceState(outState);
-	}
-
-}

+ 0 - 412
ApexDrivers/apexmobile/src/main/java/com/usai/apex/SearchActivity.java

@@ -1,412 +0,0 @@
-package com.usai.apex;
-
-import android.app.ListActivity;
-import android.content.Context;
-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.os.Bundle;
-import android.text.InputType;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.SimpleCursorAdapter;
-import android.widget.Switch;
-
-import com.usai.util.Network;
-import com.usai.util.dbUtil;
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-public class SearchActivity extends ListActivity implements OnClickListener
-{
-	private SQLiteDatabase m_db = null;
-	private Cursor m_cursor = null;
-	String user = null;
-	String password = null;
-	String function_name = null;
-	RecordsAdapter m_listadapter;
-	// private ListView m_ListView = null;
-	HashMap<String, String> hashMap = new HashMap<String, String>();
-
-	public class RecordsAdapter extends SimpleCursorAdapter
-	{
-
-		public RecordsAdapter(Context context, int layout, Cursor c,
-				String[] from, int[] to)
-		{
-			super(context, layout, c, from, to);
-			// TODO Auto-generated constructor stub
-		}
-
-		// @Override
-		// public View getView(int position, View convertView, ViewGroup parent)
-		// {
-		// // if(true)
-		// // return super.getView(position, convertView, parent);
-		// if(convertView==null)
-		// convertView = LayoutInflater.from(getApplication()).inflate(
-		// R.layout.search_lvitem_edit, null);
-		// // holder = new ViewHolder();
-		// // holder.textView = (TextView)convertView.findViewById(R.id.text);
-		// // convertView.setTag(holder);
-		// final int pos=position;
-		// // convertView = LayoutInflater.from(getApplication()).inflate(
-		// // R.layout.search_lvitem_edit, null);
-		//
-		// EditText editText = (EditText) convertView
-		// .findViewById(R.id.edit_val);
-		// // editText.setText(str);
-		//
-		// // 为editText设置TextChangedListener,每次改变的值设置到hashMap
-		// // 我们要拿到里面的值根据position拿值
-		// editText.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)
-		// {
-		// // int a = position;
-		// // 将editText中改变的值设置的HashMap中
-		// hashMap.put(pos, s.toString());
-		// }
-		// });
-		//
-		// // // 如果hashMap不为空,就设置的editText
-		// // if (hashMap.get(position) != null)
-		// // {
-		// // editText.setText(hashMap.get(position));
-		// // }
-		// return convertView;
-		// }
-
-		@Override
-		public void bindView(View view, Context context, Cursor cursor)
-		{
-			final String f0 = cursor.getString(0);
-			final String field_type = cursor.getString(1);
-			final String name = cursor.getString(2);
-
-			Log.d("cursor val", "name=" + f0 + " , type=" + field_type);
-			final EditText edit = (EditText) view.findViewById(R.id.edit_val);
-			edit.setText(hashMap.get(name));
-			Log.v("from hashmap",
-					"name=" + name + " , val=" + hashMap.get(name));
-
-//			edit.seton
-//			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)
-//					{
-//						hashMap.put(name, val);
-//
-//						Log.i("to hashmap", "name=" + name + " , val=" + val);
-//					}
-//				}
-//			});
-			Switch switch_bool = (Switch) view.findViewById(R.id.switch_bool);
-			if (field_type.equals("boolean"))
-			{
-				edit.setVisibility(View.GONE);
-				switch_bool.setVisibility(View.VISIBLE);
-			}
-			else
-			{
-				edit.setVisibility(View.VISIBLE);
-				switch_bool.setVisibility(View.GONE);
-				if (field_type.equals("time"))
-				{
-					edit.setInputType(InputType.TYPE_DATETIME_VARIATION_DATE
-							| InputType.TYPE_CLASS_DATETIME);
-
-				}
-				else
-					if (field_type.equals("int"))
-					{
-
-						edit.setInputType(InputType.TYPE_CLASS_NUMBER);
-					}
-					else
-					{
-						edit.setInputType(InputType.TYPE_CLASS_TEXT);
-					}
-				Log.d("ime debug", "name=" + f0 + " , type=" + field_type
-						+ ", ime=" + edit.getInputType());
-			}
-			super.bindView(view, context, cursor);
-
-			// TextView tvname = (TextView) view.findViewById(R.id.name);
-			// TextView tvinfo = (TextView) view.findViewById(R.id.info);
-			// String sname = cursor.getString(1);
-			// int iburntype = cursor.getInt(2);
-			// dbgUtil.Log(Log.INFO, "============>", "BURN TYPE =" +
-			// iburntype);
-			// if (sname == null || sname.equals(""))
-			// tvname.setVisibility(TextView.GONE);
-			// else
-			// tvname.setVisibility(View.VISIBLE);
-			// if (m_Activityinfo.NumberType != dbUtil.NUMBER_TYPE_WHITE
-			// && iburntype >= 0)
-			// {
-			//
-			// tvinfo.setText(m_arrBurntype[iburntype]);
-			// tvinfo.setVisibility(View.VISIBLE);
-			// }
-			// else
-			// {
-			// tvinfo.setVisibility(View.GONE);
-			// }
-
-		}
-
-	}
-
-	@Override
-	protected void onDestroy()
-	{
-		dbUtil.CloseDB(m_db);
-		super.onDestroy();
-	}
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		super.onCreate(savedInstanceState);
-		user = ApexTrackingApplication.get_user();
-		
-		password = ApexTrackingApplication.get_pass();
-		function_name = getIntent().getStringExtra("function_name");
-		setContentView(R.layout.activity_search);
-		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_cursor = m_db.query("fields_info", new String[] { "aname",
-				"field_type", "name", "_id" }, "function_name='"
-				+ function_name + "' and user='" + user + "' and behavior="
-				+ Network.BEHAVIOR_SEARCH + " and show = 1", null, null, null,
-				"priority , aname", null);
-		startManagingCursor(m_cursor);
-		m_listadapter = new RecordsAdapter(this,
-		// Use a template that displays a text view
-				R.layout.search_lvitem_edit,
-				// Give the cursor to the list adatper
-				m_cursor,
-				// Map the NAME column in the people database to...
-				new String[] { "aname", "field_type", "name" },
-				// The "text1" view defined in the XML template
-				new int[] { R.id.aname, R.id.tv_type });
-		setListAdapter(m_listadapter);
-		Button btnok = (Button) findViewById(R.id.btnok);
-		btnok.setOnClickListener(this);
-		Button btncancel = (Button) findViewById(R.id.btncancel);
-		btncancel.setOnClickListener(this);
-
-		SharedPreferences RunOnce = getSharedPreferences("Apex", 0);
-
-		String vername;
-		try
-		{
-			vername = getPackageManager().getPackageInfo("com.usai.apex", 0).versionName;
-			boolean bFirstRun = RunOnce.getBoolean("FirstRun" + vername
-					+ "_search", true);
-			if (bFirstRun&&false)
-			{
-				SharedPreferences.Editor editor = RunOnce.edit();
-				editor.putBoolean("FirstRun" + vername + "_search", false);
-				// Don't forget to commit your edits!!!
-				editor.commit();
-				Intent intent = new Intent();
-				intent.setClass(this, HelpActivity.class);
-				intent.putExtra("caller", "search");
-				startActivity(intent);
-
-			}
-		}
-		catch (NameNotFoundException e)
-		{
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		// initlist();
-
-		// m_ListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
-
-		// m_listadapter = new FieldsAdapter(this, data, resource, from, to);
-
-		// m_listadapter = new RecordsAdapter(this,
-		// // Use a template that displays a text view
-		// m_iListItemID,
-		// // Give the cursor to the list adatper
-		// m_cursor,
-		// // Map the NAME column in the people database to...
-		// m_sDispFields,
-		// // The "text1" view defined in the XML template
-		// m_iViewIDs);
-
-	}
-
-//	private void RefreshList()
-//	{
-//		// if (dbUtil.isRecordExist(m_db,
-//		// "user_numberlist","type = "+m_Activityinfo.NumberType))
-//		// {
-//		// m_TextView.setVisibility(ListView.INVISIBLE);
-//		// m_ListView.setVisibility(ListView.VISIBLE);
-//		//
-//		// }
-//		// else
-//		// {
-//		// m_TextView.setVisibility(ListView.VISIBLE);
-//		// m_ListView.setVisibility(ListView.INVISIBLE);
-//		// }
-//		hashMap.clear();
-//		m_cursor.requery();
-//	}
-
-	// private void initlist()
-	// {
-	// m_ListView = (ListView) findViewById(android.R.id.list);
-	// ArrayList<HashMap<String, Object>> list = new ArrayList<HashMap<String,
-	// Object>>();
-	// HashMap<String, Object> map = null;
-	//
-	// String[] strings = { "alias", "type", "name" };// Map的key集合数组
-	// int[] ids = { R.id.aliasName, R.id.tv_type };// 对应布局文件的id
-	// SimpleAdapter simpleAdapter = new SimpleAdapter(this, list,
-	// R.layout.search_lvitem_edit, strings, ids);
-	//
-	// // listView1.setAdapter(simpleAdapter);//绑定适配器
-	// setListAdapter(simpleAdapter);
-	// }
-
-	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
-	{
-		// Inflate the menu; this adds items to the action bar if it is present.
-		getMenuInflater().inflate(R.menu.search, menu);
-		return true;
-	}
-
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		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;
-		}
-		return super.onOptionsItemSelected(item);
-	}
-
-	@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())
-			{
-				String field = (String) iter.next();
-				String val = (String) hashMap.get(field);
-				parms.putString(field, val);
-				// Cursor c = (Cursor) m_listadapter.getItem(key);
-				Log.d("@@@@@@@@@", field + " : " + val);
-			}
-			intent.putExtra("searchParms", parms);
-
-			startActivity(intent);
-
-			break;
-		}
-		case R.id.btncancel:
-			finish();
-			break;
-		default:
-			break;
-		}
-
-	}
-
-	// class FieldsAdapter extends SimpleAdapter
-	// {
-	//
-	// public FieldsAdapter(Context context,
-	// List<? extends Map<String, ?>> data, int resource,
-	// String[] from, int[] to)
-	// {
-	// super(context, data, resource, from, to);
-	// // TODO Auto-generated constructor stub
-	// }
-	//
-	// }
-
-}

+ 3 - 5
ApexDrivers/apexmobile/src/main/java/com/usai/apex/SearchResult.java

@@ -1,15 +1,13 @@
 package com.usai.apex;
 
+import org.json.JSONException;
+import org.json.JSONObject;
+
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import android.util.Log;
-
 public class SearchResult implements Serializable
 {
 	/**

Разлика између датотеке није приказан због своје велике величине
+ 0 - 73
ApexDrivers/apexmobile/src/main/java/com/usai/apex/ServiceLocationFragment.java


+ 0 - 15
ApexDrivers/apexmobile/src/main/java/com/usai/apex/SettingsActivity.java

@@ -1,23 +1,8 @@
 package com.usai.apex;
 
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.media.Ringtone;
-import android.media.RingtoneManager;
-import android.net.Uri;
-import android.os.Build;
 import android.os.Bundle;
-import android.preference.ListPreference;
-import android.preference.Preference;
 import android.preference.PreferenceActivity;
-import android.preference.PreferenceCategory;
 import android.preference.PreferenceFragment;
-import android.preference.PreferenceManager;
-import android.preference.RingtonePreference;
-import android.text.TextUtils;
-
-import java.util.List;
 
 /**
  * A {@link PreferenceActivity} that presents a set of application settings. On

+ 0 - 71
ApexDrivers/apexmobile/src/main/java/com/usai/apex/TestActivity.java

@@ -1,71 +0,0 @@
-package com.usai.apex;
-
-import android.support.v7.app.AppCompatActivity;
-import android.os.Bundle;
-
-import com.usai.apex.shipmap.ShipMap;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-@Deprecated
-public class TestActivity extends AppCompatActivity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_test);
-
-        String test = "{\n" +
-                "            \"title\":\"SH - PT. WANGSA MANUNGGAL JAYA PERKASA\",\n" +
-                "            \"icon\":\"status_vd\",\n" +
-                "            \"serial_no\":\"85625278dbaae299ffbbd10ee22cf875\",\n" +
-                "            \"hbol\":\"A1805340018\",\n" +
-                "            \"description\":\"A1805340018(1 containers)\",\n" +
-                "            \"detail\":\"Vessel Departure; IDSUB (SURABAYA, INDONESIA 2018-05-05)\",\n" +
-                "            \"date\":\"05/05/2018 - 06/02/2018\",\n" +
-                "            \"port\":\"IDSUB - USOAK\",\n" +
-                "            \"transport_stage\":\"3\",\n" +
-                "            \"locations\":{\n" +
-                "                \"por\":{\n" +
-                "                    \"icon\":\"\",\n" +
-                "                    \"lat\":\"-7.2000000000\",\n" +
-                "                    \"lon\":\"112.7333333333\",\n" +
-                "                    \"name\":\"SURABAYA\",\n" +
-                "                    \"addr\":\"\"\n" +
-                "                },\n" +
-                "                \"pol\":{\n" +
-                "                    \"icon\":\"\",\n" +
-                "                    \"lat\":\"-7.2000000000\",\n" +
-                "                    \"lon\":\"112.7333333333\",\n" +
-                "                    \"name\":\"SURABAYA\",\n" +
-                "                    \"addr\":\"\"\n" +
-                "                },\n" +
-                "                \"pod\":{\n" +
-                "                    \"icon\":\"\",\n" +
-                "                    \"lat\":\"37.7978400000\",\n" +
-                "                    \"lon\":\"-122.2864000000\",\n" +
-                "                    \"name\":\"OAKLAND\",\n" +
-                "                    \"addr\":\"\"\n" +
-                "                }\n" +
-                "            }\n" +
-                "        }";
-
-        ShipMap shipMap = findViewById(R.id.ship_map);
-
-        shipMap.setShowPol(true);
-        shipMap.setShowPod(true);
-        shipMap.setShowPoe(true);
-        shipMap.setShowPor(true);
-        shipMap.setShowOrigin(true);
-        shipMap.setShowDestination(true);
-        shipMap.setShowCurrent(true);
-
-        try {
-            JSONObject j = new JSONObject(test);
-            shipMap.showShipAnnotation(j.getJSONObject("locations"),"");
-
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-    }
-}

+ 0 - 57
ApexDrivers/apexmobile/src/main/java/com/usai/apex/TestAppComActivity.java

@@ -1,57 +0,0 @@
-package com.usai.apex;
-
-import android.os.Bundle;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.view.Menu;
-
-public class TestAppComActivity extends AppCompatActivity {
-
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        getMenuInflater().inflate(R.menu.quick_search,menu);
-        return  true;
-    }
-
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_test_app_com);
-
-
-        ActionBar actionBar = getSupportActionBar();
-        actionBar.setLogo(R.drawable.apexlogo);
-//        actionBar.setIcon(R.drawable.ic_launcher);
-
-        actionBar.setDisplayUseLogoEnabled(true);
-        actionBar.setDisplayShowHomeEnabled(true);
-//        actionBar.setHomeAsUpIndicator(R.drawable.ic_launcher);
-        actionBar.setDisplayHomeAsUpEnabled(false);
-        actionBar.setDisplayShowTitleEnabled(true);
-
-
-//        actionBar.add
-//        getSupportActionBar().setIcon(R.drawable.ic_launcher);
-//        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-
-//        Toolbar toolbar =(Toolbar) findViewById(R.id.toolbar);
-//        setSupportActionBar(toolbar);
-//
-//        setSupportActionBar(toolbar);
-////        setTitle("aaaa");//设置标题
-////        toolbar.setNavigationIcon(R.mipmap.ic_launcher_round);//设置返回键,我这里没有,就有icon代替吧
-////        toolbar.setNavigationOnClickListener(new OnClickListener() {
-////            @Override
-////            public void onClick(View view) {
-////                finish();
-////            }
-////        });//返回监听
-//        toolbar.setLogo(R.drawable.apexlogo_2);//设置logo
-////        toolbar.setSubtitle("bbbb");//设置副标题
-//
-//
-
-    }
-}

+ 26 - 2
ApexDrivers/apexmobile/src/main/java/com/usai/apex/apexresult/ApexResultActivity.java

@@ -5,6 +5,8 @@ import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.graphics.Color;
+import android.net.Uri;
+import android.support.v4.content.FileProvider;
 import android.support.v4.widget.SwipeRefreshLayout;
 import android.support.v7.app.AlertDialog;
 import android.support.v7.app.AppCompatActivity;
@@ -29,12 +31,14 @@ import com.usai.apex.mainframe.NewDetailActivity;
 import com.usai.apex.pdf.PDFPreviewActivity;
 import com.usai.redant.rautils.actionsheet.ActionSheet;
 import com.usai.util.Network;
+import com.usai.util.RAUtil;
 import com.usai.util.commonUtil;
 
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.Iterator;
 
@@ -73,7 +77,7 @@ public class ApexResultActivity extends AppCompatActivity implements ApexResultP
 
     private Context mCtx = this;
 
-    private ListView mListView;
+
     private SwipeRefreshLayout mRefreshLayout;
     private ProgressBar mProgressBar;
     private TextView mListFooterView;
@@ -169,7 +173,7 @@ public class ApexResultActivity extends AppCompatActivity implements ApexResultP
 
     private void setupListView() {
 
-        mListView = findViewById(R.id.apex_result_list_view);
+         ListView mListView = findViewById(R.id.apex_result_list_view);
         mListView.setAdapter(mAdapter);
 
         setupListFooterView();
@@ -609,6 +613,26 @@ public class ApexResultActivity extends AppCompatActivity implements ApexResultP
 
     private void previewPDF(String file,String email,String subject,String content) {
 
+
+
+//        File f = new File(file);
+//
+//        Intent intent = new Intent(Intent.ACTION_VIEW);
+//        intent.addCategory("android.intent.category.DEFAULT");
+//        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+//        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+//
+//        Uri uri = FileProvider.getUriForFile(this, RAUtil.getProviderAuthorities(), f);
+////        Uri uri = Uri.fromFile(f);
+//        intent.setDataAndType(uri, "application/pdf");
+//        startActivity(intent);
+//
+//
+//        if(true)
+//            return;
+
+
+
         Intent myIntent = new Intent(mCtx, PDFPreviewActivity.class);
         myIntent.putExtra("file",file);
         myIntent.putExtra("iscache",true);

+ 0 - 94
ApexDrivers/apexmobile/src/main/java/com/usai/apex/mainframe/BottomNavigationViewHelper.java

@@ -1,94 +0,0 @@
-package com.usai.apex.mainframe;
-
-import android.support.design.internal.BaselineLayout;
-import android.support.design.internal.BottomNavigationItemView;
-import android.support.design.internal.BottomNavigationMenuView;
-import android.support.design.widget.BottomNavigationView;
-import android.util.DisplayMetrics;
-import android.util.TypedValue;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.FrameLayout;
-
-import com.usai.apex.ApexTrackingApplication;
-
-import java.lang.reflect.Field;
-
-// 利用反射,改变 item 中 mShiftingMode 的值
-public class BottomNavigationViewHelper {
-
-    public static void disableShiftMode(BottomNavigationView navigationView, boolean showIcon) {
-
-
-        BottomNavigationMenuView menuView = (BottomNavigationMenuView) navigationView.getChildAt(0);
-
-
-
-//        for (int i = 0; i < menuView.getChildCount(); i++) {
-//            final View iconView = menuView.getChildAt(i).findViewById(android.support.design.R.id.icon);
-//            final ViewGroup.LayoutParams layoutParams = iconView.getLayoutParams();
-//            final DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
-//            layoutParams.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, displayMetrics);
-//            layoutParams.width = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, displayMetrics);
-//            iconView.setLayoutParams(layoutParams);
-//        }
-
-        try {
-            Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode");
-            shiftingMode.setAccessible(true);
-            shiftingMode.setBoolean(menuView, false);
-            shiftingMode.setAccessible(false);
-
-            for (int i = 0; i < menuView.getChildCount(); i++) {
-                BottomNavigationItemView itemView = (BottomNavigationItemView) menuView.getChildAt(i);
-
-
-
-
-
-
-                 View iconView = itemView.findViewById(android.support.design.R.id.icon);
-
-                final ViewGroup.LayoutParams layoutParams = iconView.getLayoutParams();
-                final DisplayMetrics displayMetrics = ApexTrackingApplication.get_instance().getResources().getDisplayMetrics();
-                layoutParams.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 26, displayMetrics);
-                layoutParams.width = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 26, displayMetrics);
-                iconView.setLayoutParams(layoutParams);
-
-
-//                itemView.removeView(iconView);
-//                iconView.remove
-
-                if(!showIcon)
-                {
-                    for(int k=0;k<itemView.getChildCount();k++)
-                    {
-                        View v = itemView.getChildAt(k);
-                        if(v instanceof BaselineLayout)
-                        {
-//                        BaselineLayout bl = (BaselineLayout)v;
-                            FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) v.getLayoutParams();
-                            params.gravity = Gravity.CENTER;
-                            v.setLayoutParams(params);
-
-                        }
-                    }
-
-                    iconView.setVisibility(View.GONE);
-                }
-
-                itemView.setShiftingMode(false);
-                itemView.setChecked(itemView.getItemData().isChecked());
-
-
-            }
-//            navigationView.setSelectedItemId(navigationView.getMenu().getItem(0).getItemId());
-
-
-
-        } catch (NoSuchFieldException | IllegalAccessException e) {
-            e.printStackTrace();
-        }
-    }
-}

+ 1 - 2
ApexDrivers/apexmobile/src/main/java/com/usai/apex/mainframe/KPIFragment.java

@@ -25,12 +25,11 @@ import android.view.ViewGroup;
 import android.widget.ProgressBar;
 
 import com.usai.apex.ApexTrackingApplication;
+import com.usai.apex.R;
 import com.usai.apex.apexresult.ApexResultActivity;
 import com.usai.apex.kpi.KPICell;
 import com.usai.apex.kpi.KPIViewPager;
 import com.usai.apex.kpi.PieChartView;
-import com.usai.apex.R;
-import com.usai.apex.result.AMResultActivity;
 import com.usai.util.Network;
 
 import org.json.JSONArray;

+ 3 - 135
ApexDrivers/apexmobile/src/main/java/com/usai/apex/mainframe/NewDetailActivity.java

@@ -116,12 +116,7 @@ public class NewDetailActivity extends AppCompatActivity {
             case R.id.action_close:
 
                 finish();
-//				if (SearchResultActivity.instance != null) {
-//					SearchResultActivity.instance.finish();
-//				}
-//				if (SearchListActivity.instance != null) {
-//					SearchListActivity.instance.finish();
-//				}
+
                 Intent intent = new Intent(this, RootActivity.class);
 
 //                Intent intent = new Intent(context, LoginView.class);
@@ -381,7 +376,7 @@ public class NewDetailActivity extends AppCompatActivity {
 //        bottomNavigationView.setlistener
 
         //默认 >3 的选中效果会影响ViewPager的滑动切换时的效果,故利用反射去掉
-        BottomNavigationViewHelper.disableShiftMode(bottomNavigationView, false);
+
         bottomNavigationView.setOnNavigationItemSelectedListener(
                 new BottomNavigationView.OnNavigationItemSelectedListener() {
                     @Override
@@ -704,37 +699,7 @@ public class NewDetailActivity extends AppCompatActivity {
 //    }
 
     private void setupViewPager(final ViewPager viewPager) {
-//        TestFragment.LoginCallBack logincallback = new TestFragment.LoginCallBack() {
-//            @Override
-//            public void onLogin() {
-//                System.out.println("login ");
-//                login = true;
-////                bottomNavigationView.setSelectedItemId(bottomNavigationView.getMenu().getItem(0).getItemId());
-//                bottomNavigationView.getChildAt(0).setSelected(true);
-//                bottomNavigationView.getMenu().clear();
-////                bottomNavigationView.getMenu().
-//                bottomNavigationView.inflateMenu(R.menu.navi_login);
-//                BottomNavigationViewHelper.disableShiftMode(bottomNavigationView);
-//                setupViewPager(viewPager);
-//
-//            }
-//
-//            @Override
-//            public void onLogout() {
-//                System.out.println("log out ");
-//                login=false;
-//
-////                BottomNavigationView v;
-//
-////                v.getse
-////                bottomNavigationView.setSelectedItemId(bottomNavigationView.getMenu().getItem(0).getItemId());
-////                navigation.setSelectedItemId(navigation.getMenu().getItem(position).getItemId());
-//                bottomNavigationView.getMenu().clear();
-//                bottomNavigationView.inflateMenu(R.menu.navi_logout);
-//                BottomNavigationViewHelper.disableShiftMode(bottomNavigationView);
-//                setupViewPager(viewPager);
-//            }
-//        };
+
 
 
         ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
@@ -793,111 +758,14 @@ public class NewDetailActivity extends AppCompatActivity {
 //
 //            tabmap.put(getIntent().getStringExtra("action" + i), vid);
             }
-            BottomNavigationViewHelper.disableShiftMode(bottomNavigationView, false);
 
 
-//		Log.e("findFragmentByTag", "tag=" + tag + ", isnull= "
-//				+ (getSupportFragmentManager().findFragmentByTag(tag) == null));
-
-//            f = getSupportFragmentManager().findFragmentById(tabmap.get(tag));
-//            if (f == null)
-//            {
-//                Log.d("createTabContent", "create fragment" + tag);
-//                f = new DetailFragment();
-//
-//
-//                f.setArguments(bundle);
-//            }
-
-//            HomeFragment homeFragment = new HomeFragment();
-//            HistoryFragment historyFragment = new HistoryFragment();
-//            SearchFragment searchFragment = new SearchFragment();
-//            ToolsFragment toolsFragment = new ToolsFragment();
-//            MyFragment myFragment = new MyFragment();
-//            myFragment.setCallBack(new MyFragment.LogoutCallBack() {
-//                @Override
-//                public void onLogout() {
-//
-//                                    System.out.println("log out ");
-//                login=false;
-//
-////                BottomNavigationView v;
-//
-////                v.getse
-////                bottomNavigationView.setSelectedItemId(bottomNavigationView.getMenu().getItem(0).getItemId());
-////                navigation.setSelectedItemId(navigation.getMenu().getItem(position).getItemId());
-//
-//                setupViewPager(viewPager);
-//                }
-//            });
-
-
-//            adapter.addFragment(homeFragment);
-//            adapter.addFragment(historyFragment);
-//            adapter.addFragment(searchFragment);
-//            adapter.addFragment(toolsFragment);
-//
-//
-//            adapter.addFragment(myFragment);
 
 
             ApexTrackingApplication.get_instance().homeactive = true;
 
 
-
-//            adapter.addFragment(BaseFragment.newInstance("home"));
-//            adapter.addFragment(BaseFragment.newInstance("history"));
-//            adapter.addFragment(BaseFragment.newInstance("search"));
-//            adapter.addFragment(BaseFragment.newInstance("tool"));
-//
-//            TestFragment logoutf = TestFragment.newInstance("logout");
-//            logoutf.setCallBack(logincallback);
-//            adapter.addFragment(logoutf);
         }
-//        else
-//        {
-//            ApexTrackingApplication.get_instance().homeactive = false;
-//            ApexTrackingApplication.get_instance().historyactive = false;
-//            ApexTrackingApplication.get_instance().recentactive = false;
-//            if(actionbutton!=null)
-//                actionbutton.getItem(0).setVisible(false);
-//            bottomNavigationView.getChildAt(0).setSelected(true);
-//            bottomNavigationView.getMenu().clear();
-//            bottomNavigationView.inflateMenu(R.menu.navi_logout);
-//            BottomNavigationViewHelper.disableShiftMode(bottomNavigationView);
-//
-//
-//            LoginFragment loginFragment = new LoginFragment();
-////            loginFragment.setCallBack(new LoginFragment.LoginCallBack() {
-////                @Override
-////                public void onLogin() {
-////                System.out.println("login ");
-////                login = true;
-//////                bottomNavigationView.setSelectedItemId(bottomNavigationView.getMenu().getItem(0).getItemId());
-////
-////                setupViewPager(viewPager);
-////                }
-////            });
-////            TestFragment loginf = TestFragment.newInstance("login");
-////            loginf.setCallBack(logincallback);
-//
-//
-//            adapter.addFragment(loginFragment);
-//
-////            SearchFragment searchFragment = new SearchFragment();
-////            adapter.addFragment(searchFragment);
-//
-//            Fragment toolsFragment = new ToolsFragment();
-//            adapter.addFragment(toolsFragment);
-//        }
-
-
-
-
-
-
-
-//        viewPager.removeAllViews();
 
 
         viewPager.setAdapter(adapter);

+ 6 - 35
ApexDrivers/apexmobile/src/main/java/com/usai/apex/mainframe/RootActivity.java

@@ -174,8 +174,8 @@ public class RootActivity extends AppCompatActivity {
 
 //        bottomNavigationView.setlistener
 
-        //默认 >3 的选中效果会影响ViewPager的滑动切换时的效果,故利用反射去掉
-        BottomNavigationViewHelper.disableShiftMode(bottomNavigationView,true);
+
+
         bottomNavigationView.setOnNavigationItemSelectedListener(
                 new BottomNavigationView.OnNavigationItemSelectedListener() {
                     @Override
@@ -488,37 +488,8 @@ public class RootActivity extends AppCompatActivity {
     }
 
     private void setupViewPager(final ViewPager viewPager) {
-//        TestFragment.LoginCallBack logincallback = new TestFragment.LoginCallBack() {
-//            @Override
-//            public void onLogin() {
-//                System.out.println("login ");
-//                login = true;
-////                bottomNavigationView.setSelectedItemId(bottomNavigationView.getMenu().getItem(0).getItemId());
-//                bottomNavigationView.getChildAt(0).setSelected(true);
-//                bottomNavigationView.getMenu().clear();
-////                bottomNavigationView.getMenu().
-//                bottomNavigationView.inflateMenu(R.menu.navi_login);
-//                BottomNavigationViewHelper.disableShiftMode(bottomNavigationView);
-//                setupViewPager(viewPager);
-//
-//            }
-//
-//            @Override
-//            public void onLogout() {
-//                System.out.println("log out ");
-//                login=false;
-//
-////                BottomNavigationView v;
-//
-////                v.getse
-////                bottomNavigationView.setSelectedItemId(bottomNavigationView.getMenu().getItem(0).getItemId());
-////                navigation.setSelectedItemId(navigation.getMenu().getItem(position).getItemId());
-//                bottomNavigationView.getMenu().clear();
-//                bottomNavigationView.inflateMenu(R.menu.navi_logout);
-//                BottomNavigationViewHelper.disableShiftMode(bottomNavigationView);
-//                setupViewPager(viewPager);
-//            }
-//        };
+
+
 
 
         ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
@@ -535,7 +506,7 @@ public class RootActivity extends AppCompatActivity {
             bottomNavigationView.getMenu().clear();
 //                bottomNavigationView.getMenu().
             bottomNavigationView.inflateMenu(R.menu.navi_login);
-            BottomNavigationViewHelper.disableShiftMode(bottomNavigationView ,true);
+
 
 
             HomeFragment homeFragment = new HomeFragment();
@@ -593,7 +564,7 @@ public class RootActivity extends AppCompatActivity {
             bottomNavigationView.getChildAt(0).setSelected(true);
             bottomNavigationView.getMenu().clear();
             bottomNavigationView.inflateMenu(R.menu.navi_logout);
-            BottomNavigationViewHelper.disableShiftMode(bottomNavigationView,true);
+
 
 
             LoginFragment loginFragment = new LoginFragment();

+ 0 - 646
ApexDrivers/apexmobile/src/main/java/com/usai/apex/result/AMResultActivity.java

@@ -1,646 +0,0 @@
-package com.usai.apex.result;
-
-import android.app.Dialog;
-import android.app.DownloadManager;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.net.Uri;
-import android.os.Bundle;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AlertDialog;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.EditText;
-import android.widget.TextView;
-
-import com.usai.apex.ApexTrackingApplication;
-import com.usai.apex.CustomizeFieldsActivity;
-import com.usai.apex.R;
-import com.usai.apex.mainframe.NewDetailActivity;
-import com.usai.apex.pdf.PDFPreviewActivity;
-import com.usai.util.Network;
-import com.usai.util.RAUtil;
-import com.usai.util.dbUtil;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Set;
-
-/**
- * Created by macmini1 on 2018/2/23.
- */
-
-public class AMResultActivity extends SearchResultActivity {
-    TextView mtitleview;
-    private static int REQUEST_FIELD_SETTING = 1000;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-
-        setCustomActionBar();
-
-    }
-    private void setCustomActionBar() {
-        ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
-        View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-
-        mtitleview= mActionBarView.findViewById(R.id.title);
-        String title = mParams.getString("title");
-        mtitleview.setText(title);
-        setTitle(title);
-//
-//        mActionBarView.setBackgroundColor(Color.YELLOW);
-//        titleview.setBackgroundColor(Color.BLUE);
-        ActionBar actionBar = getSupportActionBar();
-        actionBar.setCustomView(mActionBarView, lp);
-//        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
-//        actionBar.setDisplayShowCustomEnabled(true);
-        actionBar.setDisplayHomeAsUpEnabled(true);
-
-
-//        actionBar.setIcon(getNumberDrawable());
-//        actionBar.setDisplayShowHomeEnabled(true);
-        actionBar.setDisplayShowTitleEnabled(true);
-    }
-//    @Override
-//    public void setTitle(CharSequence title) {
-////        View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-////
-////        TextView mtitleviewtitleview = mActionBarView.findViewById(R.id.title);
-//
-//        if(title==null)
-//            title="";
-//        if(mtitleview!=null)
-//            mtitleview.setText(title);
-//    }
-    @Override
-    protected void loadData() {
-        if (mParams.getString("columns") == null) {
-            ArrayList<String> header_name = new ArrayList<String>();
-            ArrayList<String> header_aname = new ArrayList<String>();
-            getHeader(header_name, header_aname);
-            String fields = "";
-            Iterator<String> iterator = header_name.iterator();
-            while (iterator.hasNext()) {
-                String name = iterator.next();
-                fields = fields + name + ",";
-            }
-            if (fields.length() > 0) {
-                fields = fields.substring(0, fields.length() - 1);
-            }
-            mParams.putString("columns", fields);
-        }
-        super.loadData();
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-
-//        resultListView.setAdapter(adapter);
-//
-//        Iterator<String> keyIterator = resultData.keys();
-//        ArrayList<String> keys = new ArrayList<>();
-//        while (keyIterator.hasNext()) {
-//            String key = keyIterator.next();
-//            keys.add(key);
-//        }
-//        for (int i = 0; i < keys.size(); i++) {
-//            String key = keys.get(i);
-//            resultData.remove(key);
-//        }
-//
-//        adapter.notifyDataSetChanged();
-
-        if (requestCode == REQUEST_FIELD_SETTING) {
-
-            ArrayList<String> header_name = new ArrayList<String>();
-            ArrayList<String> header_aname = new ArrayList<String>();
-            getHeader(header_name,header_aname);
-            String fields = "";
-            Iterator<String> iterator = header_name.iterator();
-            while (iterator.hasNext()) {
-                String name = iterator.next();
-                fields = fields + name + ",";
-            }
-            fields = fields.substring(0,fields.length() - 1);
-            mParams.putString("columns",fields);
-
-
-            loadData();
-
-        }
-
-    }
-
-    // 动态修改Menu
-    @Override
-    public boolean onPrepareOptionsMenu(Menu menu) {
-        super.onPrepareOptionsMenu(menu);
-        menu.clear();
-
-
-        if (resultData != null && resultData.length() > 0) {
-            try {
-                JSONArray menu_json = resultData.getJSONArray("menu");
-
-                if (menu_json != null && menu_json.length() > 0) {
-
-                    for (int i = 0; i < menu_json.length(); i++) {
-                        JSONObject json = menu_json.getJSONObject(i);
-                        String title = json.getString("title");
-                        menu.add(0, i, 0, title);
-                    }
-                }
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        }
-
-        return true;
-    }
-
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-
-
-        int which = item.getItemId();
-
-        switch (item.getItemId())
-        {
-
-            case android.R.id.home:
-                finish();
-                break;
-            default:
-            {
-                try {
-                    JSONArray menu = resultData.getJSONArray("menu");
-                    JSONObject json = menu.getJSONObject(which);
-
-                    String actionType = json.getString("action");
-                    String url = json.optString("url");
-
-
-
-                    if (actionType.equals("field_setting")) {
-
-                        fieldSetting();
-                    } else if (actionType.equals("save")) {
-
-                        save();
-                    } else if (actionType.equals("download")) {
-
-                        export(url);
-                    }
-
-                } catch (JSONException exception) {
-                    Log.d("Result", "onClick: ",exception);
-                }
-            }
-        }
-
-
-
-        return true;
-    }
-
-
-    @Override
-    public void cellDoubleTapAction(final int position) {
-
-        final JSONArray content_action = contentAction();
-        if (content_action != null) {
-
-            try {
-                if (content_action.length() == 1) {
-
-                    JSONObject action = content_action.getJSONObject(0);
-                    String module = action.getString("module");
-
-                    if (module.equals("quick_look")) {
-
-                        showQuickLookForPosition(position,action);
-
-                    } else if (module.equals("detail")) {
-
-                        showDetailForPosition(position);
-                    }
-
-
-                } else if (content_action.length() > 1) {
-
-                    ArrayList<String> titleList = new ArrayList<>();
-
-                    for (int i = 0; i < content_action.length(); i++) {
-                        JSONObject json = content_action.getJSONObject(i);
-                        String title = json.getString("title");
-                        titleList.add(title);
-                    }
-
-                    new AlertDialog.Builder(mContext)
-                            .setSingleChoiceItems((String[])titleList.toArray(new String[titleList.size()]), -1, new DialogInterface.OnClickListener() {
-                                @Override
-                                public void onClick(DialogInterface dialog, int which) {
-
-                                    try {
-
-                                        JSONObject json = content_action.getJSONObject(which);
-                                        String module = json.getString("module");
-
-                                        if (module.equals("quick_look")) {
-
-                                            showQuickLookForPosition(position,json);
-                                        } else if (module.equals("detail")) {
-
-                                            showDetailForPosition(position);
-                                        }
-
-
-                                    } catch (JSONException exception) {
-                                        Log.d("Result", "onClick: ",exception);
-                                    }
-                                    dialog.dismiss();
-
-                                }
-                            })
-                            .show();
-                }
-
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-
-        }
-
-    }
-
-    public void showDetailForPosition(final int position) {
-
-        ArrayList<String> actions = getActions();
-        if (actions.size() < 1) {
-            return;
-        }
-
-        try {
-            JSONArray arr_col = contentLayout().getJSONObject("header").getJSONArray("col");
-            JSONArray item = contentData().getJSONArray("item_" + (position - 1));
-
-            String module_name = mParams.getString("module_name");
-            String detail_id = item.getString(arr_col.length());
-
-            Intent intent = new Intent(mContext, NewDetailActivity.class);
-            intent.putExtra("function_name", module_name);
-            intent.putExtra("actions_count", actions.size());
-            intent.putExtra("_id",detail_id);
-
-            Iterator<String> iterator = actions.iterator();
-            int i = 0;
-            while (iterator.hasNext()) {
-                String name = iterator.next();
-                intent.putExtra("action" + i++, name);
-            }
-            startActivity(intent);
-
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-    }
-    @Override
-    public void showQuickLook(final JSONObject param, final String url) {
-
-        showProgressDialog("Please wait","Downloading...");
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-
-                String cacheDir = ApexTrackingApplication.getInstance().getExternalCacheDir().getAbsolutePath();//ApexTrackingApplication.getInstance().getDocumentDir();
-
-                // 下载文件
-                final File downloadFile = Network.downloadFile(RAUtil.Json2Bundle(param),url,cacheDir);
-
-                runOnUiThread(new Runnable() {
-                    @Override
-                    public void run() {
-                        progressDialog.dismiss();
-                        if (downloadFile != null && downloadFile.exists()) {
-                            String email = null,email_subject = null,email_content = null;
-                            try {
-                                //此处需要新增保存文档的本地表
-
-                                email=param.getString("email");
-                                email_subject=param.getString("email_subject");
-                                email_content=param.getString("email_content");
-
-                            } catch (JSONException e) {
-                                e.printStackTrace();
-                            }
-                            previewPDF(downloadFile.getAbsolutePath(),email,email_subject,email_content);
-                        } else {
-                            showAlert("Sorry,there is a wrong.");
-                        }
-                    }
-                });
-
-            }
-        }).start();
-
-
-    }
-    public void showQuickLookForPosition(final int position,JSONObject action) {
-
-        try {
-
-            JSONObject params = new JSONObject();
-            Iterator<String> iterator = action.getJSONObject("params").keys();
-            while (iterator.hasNext()) {
-                String key = iterator.next();
-                JSONArray item = contentData().getJSONArray("item_" + (position - 1));
-                int idx = action.getJSONObject("params").getInt(key);
-                params.put(key,item.get(idx));
-            }
-
-            String url = action.getString("url");
-//            String module_name = mParams.getString("module_name");
-
-            showQuickLook(params,url);
-//            downloaddoc(url);
-
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-    }
-
-
-    protected void previewPDF(String file,String email,String subject,String content) {
-        Intent myIntent = new Intent();
-        myIntent = new Intent(AMResultActivity.this, PDFPreviewActivity.class);
-
-        myIntent.putExtra("file",file);
-        myIntent.putExtra("iscache",true);
-
-        try {
-            JSONObject json = new JSONObject();
-//            email = "66666@qq.com";
-//            subject = "test subject";
-//            content = "test body";
-            if (email != null) {
-                json.put("email",email);
-            }
-            if (subject != null) {
-                json.put("subject",subject);
-            }
-            if (content != null) {
-                json.put("content",content);
-            }
-            myIntent.putExtra("email",json.toString());
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-
-        startActivity(myIntent);
-    }
-
-    private void downloaddoc(String url)
-    {
-
-            // if (true)
-            // return;
-//            URLSpan span[] = ((TextView) v).getUrls();
-//            if (span.length < 1)
-//                return;
-//            span[0].getURL();
-//            Log.d("Text", span[0].getURL());
-//
-//            TextView tv = (TextView)v;
-
-            final DownloadManager downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
-
-            Uri uri = Uri.parse(url);
-            final DownloadManager.Request request = new DownloadManager.Request(uri);
-
-            // 设置允许使用的网络类型,这里是移动网络和wifi都可以
-            request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE
-                    | DownloadManager.Request.NETWORK_WIFI);
-
-            request.setDestinationInExternalPublicDir("Apex Mobile",url);
-
-            // 禁止发出通知,既后台下载,如果要使用这一句必须声明一个权限:android.permission.DOWNLOAD_WITHOUT_NOTIFICATION
-            // request.setShowRunningNotification(false);
-
-            // 不显示下载界面
-            request.setVisibleInDownloadsUi(false);
-            request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
-
-							/*
-							 * 设置下载后文件存放的位置,如果sdcard不可用,那么设置这个将报错,
-							 * 因此最好不设置如果sdcard可用,下载后的文件 在/mnt/sdcard/Android/
-							 * data/packageName/files目录下面
-							 * ,如果sdcard不可用,设置了下面这个将报错,不设置,下载后的文件在/cache这个 目录下面
-							 */
-            // request.setDestinationInExternalFilesDir(this,
-            // null, "tar.apk");
-
-            android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(
-                    AMResultActivity.this);
-            builder.setMessage(getString(R.string.str_downloadmessage));
-
-            builder.setTitle(getString(R.string.str_confirmdownload));
-
-            builder.setPositiveButton(
-                    getString(R.string.str_download),
-                    new Dialog.OnClickListener()
-                    {
-
-                        @Override
-                        public void onClick(
-                                DialogInterface dialog,
-                                int which)
-                        {
-                            downloadManager.enqueue(request);
-                            dialog.dismiss();
-
-                        }
-                    });
-
-            builder.setNegativeButton(
-                    getString(R.string.str_cancel),
-                    new Dialog.OnClickListener()
-                    {
-
-                        @Override
-                        public void onClick(
-                                DialogInterface dialog,
-                                int which)
-                        {
-                            dialog.dismiss();
-                        }
-                    });
-
-            builder.create().show();
-
-
-    }
-
-    public void getHeader(ArrayList<String> header_name, ArrayList<String> header_aname) {
-
-        String module_name = mParams.getString("module_name");
-        String user = ApexTrackingApplication.get_user();
-
-        SQLiteDatabase db = dbUtil.OpenDB(this, null, false);
-        Cursor cursor = db.query("fields_info", new String[] { "aname", "name",
-                "_id" }, "function_name='" + module_name + "' and user='"
-                + user + "' and behavior=" + Network.BEHAVIOR_RESULT
-                + " and show = 1", null, null, null, "priority , aname", null);
-        while (cursor.moveToNext())
-        {
-            String aname = cursor.getString(0);
-            String name = cursor.getString(1);
-
-            header_name.add(name);
-            header_aname.add(aname);
-        }
-        dbUtil.CloseCursor(cursor);
-        dbUtil.CloseDB(db);
-    }
-
-    public ArrayList<String> getActions() {
-
-        String module_name = mParams.getString("module_name");
-
-        SQLiteDatabase db = dbUtil.OpenDB(this, null, false);
-        Cursor cursor = db.query("actions_info",
-                new String[] { "name" }, "function_name='"
-                        + module_name + "' and user='" + ApexTrackingApplication.get_user() + "'", null,
-                null, null, "priority", null);
-
-        ArrayList<String> actions = new ArrayList<>();
-
-        while (cursor.moveToNext())
-        {
-            String name = cursor.getString(0);
-            actions.add(name);
-        }
-        dbUtil.CloseCursor(cursor);
-        dbUtil.CloseDB(db);
-
-        return actions;
-
-    }
-
-    public void save() {
-
-        final View edit = new EditText(this);
-        new android.app.AlertDialog.Builder(this)
-                .setIconAttribute(android.R.attr.alertDialogIcon)
-                .setTitle(R.string.str_createname)
-                .setView(edit)
-                .setPositiveButton(android.R.string.ok,
-                        new DialogInterface.OnClickListener()
-                        {
-                            public void onClick(DialogInterface dialog,
-                                                int whichButton)
-                            {
-                                String name = ((EditText) edit)
-                                        .getText().toString();
-
-                                if(TextUtils.isEmpty(name))
-                                {
-                                    new android.app.AlertDialog.Builder(AMResultActivity.this)
-                                            .setTitle("Warning")
-                                            .setMessage("Name can not be empty.")
-
-                                            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
-                                                @Override
-                                                public void onClick(DialogInterface dialog, int which) {
-
-                                                }
-                                            })
-                                            .show();
-                                    return;
-                                }
-
-                                String param = getIntent().toUri(0);
-
-                                JSONObject obj = new JSONObject();
-                                Set<String> keys = mParams.keySet();
-                                for (String key : keys)
-                                {
-
-
-                                    try
-                                    {
-                                        obj.put(key, mParams.get(key).toString());
-
-                                    }
-                                    catch (JSONException e)
-                                    {
-                                        // TODO Auto-generated catch block
-                                        e.printStackTrace();
-                                    }
-
-                                }
-                                obj.toString();
-
-                                SQLiteDatabase db = dbUtil.OpenDB(
-                                        ApexTrackingApplication.get_instance(), null, true);
-                                db.execSQL("insert into history(params,name,criterion,module_name,user,create_time) values('"
-
-                                        + param
-                                        + "','"
-                                        + name
-                                        + "','"
-                                        + obj.toString()
-                                        + "','"
-                                        + mParams.getString("module_name")
-                                        + "','"
-                                        + ApexTrackingApplication.get_user()
-                                        + "',"
-                                        + System.currentTimeMillis() + ")");
-                                dbUtil.CloseDB(db);
-
-										/* User clicked OK so do some stuff */
-                            }
-                        })
-                .setNegativeButton(android.R.string.cancel,
-                        new DialogInterface.OnClickListener()
-                        {
-                            public void onClick(DialogInterface dialog,
-                                                int whichButton)
-                            {
-
-										/* User clicked cancel so do some stuff */
-                            }
-                        }).create().show();
-    }
-
-    public void fieldSetting() {
-
-        Intent intent = new Intent();
-        intent.setClass(this, CustomizeFieldsActivity.class);
-        intent.putExtra("user", ApexTrackingApplication.get_user());
-        intent.putExtra("function_name", mParams.getString("module_name"));
-        intent.putExtra("behavior", Network.BEHAVIOR_RESULT);
-        startActivityForResult(intent,REQUEST_FIELD_SETTING);
-
-    }
-
-}

+ 0 - 1360
ApexDrivers/apexmobile/src/main/java/com/usai/apex/result/SearchResultActivity.java

@@ -1,1360 +0,0 @@
-package com.usai.apex.result;
-
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.res.Resources;
-import android.database.DataSetObserver;
-import android.graphics.Color;
-import android.graphics.drawable.ColorDrawable;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Bundle;
-import android.support.v4.content.FileProvider;
-import android.support.v4.widget.SwipeRefreshLayout;
-import android.support.v7.app.AlertDialog;
-import android.support.v7.app.AppCompatActivity;
-import android.text.Html;
-import android.text.Layout;
-import android.text.TextUtils;
-import android.util.Log;
-import android.util.TypedValue;
-import android.view.GestureDetector;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AbsListView;
-import android.widget.BaseAdapter;
-import android.widget.HorizontalScrollView;
-import android.widget.RelativeLayout;
-import android.widget.TableRow;
-import android.widget.TextView;
-
-import com.usai.apex.ApexTrackingApplication;
-import com.usai.apex.R;
-import com.usai.util.Network;
-import com.usai.util.RAUtil;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-
-//import com.usai.redant.Detail.KVDetailActivity;
-//import com.usai.redant.Detail.OrderDetailActivity;
-//import com.usai.apex.redantmobile.BuildConfig;
-
-//import static com.usai.redant.CommonEditor.CommonEditorActivity.URL_REMOTE;
-
-
-public class SearchResultActivity extends AppCompatActivity {
-
-    public static SearchResultActivity instance = null;
-    protected Bundle mParams;
-    protected JSONObject resultData = new JSONObject();
-
-    protected Context mContext;
-    protected PullRefreshListView resultListView;
-    protected ResultAdapter adapter;
-    protected SwipeRefreshLayout resultSwipe;
-    protected View list_footer;
-    protected View refresh_footer;
-
-    private View clickedView;
-    private View.OnTouchListener resultRowClickListener;
-    private GestureDetector detector;
-
-    protected int footer_height;
-    protected int header_height;
-
-    ProgressDialog progressDialog;
-    public boolean isLoading = false;//表示是否正处于加载状态
-
-
-    public void cellDoubleTapAction(int position) {
-
-//        try {
-//
-//            JSONArray row_action = resultData.optJSONArray("row_action");
-//            if (row_action != null) {
-//
-//                if (row_action.length() == 1) {
-//
-//                    JSONObject action = row_action.getJSONObject(0);
-//                    String module = action.getString("module");
-//
-//                    if (module.equals("quick_look")) {
-//                        JSONObject param = action.getJSONObject("params");
-//                        String url = action.getString("url");
-//                        showQuickLook(param,url);
-//                    } else if (module.equals("kv_detail")) {
-//                        JSONObject params = new JSONObject();
-//                        params.put("query_id",mParams.get("query_id"));
-//
-//                        JSONObject criteria = new JSONObject();
-//                        JSONObject action_params = action.getJSONObject("params");
-//                        Iterator<String> iterator = action_params.keys();
-//                        while (iterator.hasNext()) {
-//                            String key = iterator.next();
-//                            JSONArray item = contentData().getJSONArray("item_" + position);
-//                            int idx = action_params.getInt(key);
-//                            criteria.put(key,item.get(idx));
-//                        }
-//
-//                        params.put("criteria",criteria.toString());
-//                        showKVDetail(params);
-//
-//                    } else if (module.equals("order_detail")) {
-//
-//                        showOrderDetail();
-//
-//                    }
-//
-//
-//                } else if (row_action.length() > 1) {
-//
-//                    ArrayList<String> titleList = new ArrayList<>();
-//
-//                    for (int i = 0; i < row_action.length(); i++) {
-//                        JSONObject json = row_action.getJSONObject(i);
-//                        String title = json.getString("title");
-//                        titleList.add(title);
-//                    }
-//
-//                    new AlertDialog.Builder(mContext)
-//                            .setSingleChoiceItems((String[])titleList.toArray(new String[titleList.size()]), -1, new DialogInterface.OnClickListener() {
-//                                @Override
-//                                public void onClick(DialogInterface dialog, int which) {
-//
-//                                    try {
-//                                        JSONArray content_action = resultData.getJSONArray("row_action");
-//                                        JSONObject json = content_action.getJSONObject(which);
-//                                        String module = json.getString("module");
-//                                        JSONObject add_params = json.getJSONObject("params");
-//
-//                                        if (module.equals("quick_look")) {
-//                                            JSONObject param = json.getJSONObject("params");
-//                                            String url = json.getString("url");
-//                                            showQuickLook(param,url);
-//                                        } else if (module.equals("kv_detail")) {
-//
-//                                            JSONObject params = json.getJSONObject("params");
-//                                            showKVDetail(params);
-//
-//                                        } else if (module.equals("order_detail")) {
-//
-//                                            showOrderDetail();
-//
-//                                        }
-//
-//
-//                                    } catch (JSONException exception) {
-//                                        Log.d("Result", "onClick: ",exception);
-//                                    }
-//                                    dialog.dismiss();
-//
-//                                }
-//                            })
-//                            .show();
-//
-//                }
-//
-//            }
-//
-//        } catch (JSONException exception) {
-//            Log.e("Result", "onDoubleTapEvent: ",exception);
-//        }
-    }
-
-    void setMargin(View view,int l,int t,int r,int b) {
-        RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(view.getLayoutParams());
-        lp.setMargins(l, t, r, b);
-        view.setLayoutParams(lp);
-    }
-
-    @Override
-    public void onDestroy() {
-        super.onDestroy();
-        if (progressDialog != null) {
-            progressDialog.dismiss();
-            progressDialog = null;
-        }
-    }
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_search_result);
-
-        instance = this;
-        mContext = this;
-        footer_height = dp2px(this,30);
-        header_height = dp2px(this,60);
-
-        resultListView = (PullRefreshListView) findViewById(R.id.result_table_list);
-        resultSwipe = findViewById(R.id.result_swipe);
-
-        progressDialog = new ProgressDialog(mContext);
-        progressDialog.setCancelable(false);
-
-        initClickListener();
-
-
-        adapter = new ResultAdapter(mContext);
-        resultListView.setAdapter(adapter);
-        resultListView.setDividerHeight(0);
-
-        // refresh header & footer
-        list_footer = View.inflate(this, R.layout.refresh_footer, null);
-        resultListView.setRefreshFooter(list_footer);
-
-        refresh_footer = findViewById(R.id.result_refresh_footer);
-        refresh_footer.bringToFront();
-
-        resultListView.setOnRefreshListener(new PullRefreshListView.OnRefreshListener() {
-            @Override
-            public void onHeaderStateChange(int state, int offset) {
-                Log.d("Pull Down", "onHeaderStateChange: " + offset);
-//                setMargin(refresh_header,0,offset,0,0);
-//                if (state == PullRefreshListView.REFRESHING) {
-//                   loadData();
-//                }
-            }
-
-            @Override
-            public void onFooterStateChange(int state, int offset) {
-
-                setMargin(refresh_footer,0,resultListView.getHeight() - offset,0,0);
-                if (state == PullRefreshListView.REFRESHING) {
-                    if (!isLoading) {
-                        loadMore();
-                    }
-                }
-            }
-
-            @Override
-            public void shouldPullDownToRefresh(boolean should) {
-                resultSwipe.setEnabled(should);
-            }
-        });
-
-        resultSwipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
-            @Override
-            public void onRefresh() {
-                if (isLoading) {
-                    resultSwipe.setRefreshing(false);
-                } else {
-                    loadData();
-                }
-            }
-        });
-
-
-
-        if (savedInstanceState != null) {
-            mParams = savedInstanceState.getBundle("query_params");
-        } else {
-            mParams = getIntent().getBundleExtra("query_params");
-        }
-
-        if (mParams == null) {
-            mParams = new Bundle();
-        }
-
-        String title = mParams.getString("title");
-        setTitle(title);
-
-        loadData();
-
-    }
-
-    @Override
-    protected void onSaveInstanceState(Bundle outState) {
-        super.onSaveInstanceState(outState);
-
-        outState.putBundle("query_params",mParams);
-    }
-
-    // 动态修改Menu
-    @Override
-    public boolean onPrepareOptionsMenu(Menu menu) {
-        super.onPrepareOptionsMenu(menu);
-        menu.clear();
-
-
-//        if (resultData != null) {
-//            try {
-//                JSONArray menu_json = resultData.getJSONArray("menu");
-//
-//                if (menu_json != null && menu_json.length() > 0) {
-//
-//                    for (int i = 0; i < menu_json.length(); i++) {
-//                        JSONObject json = menu_json.getJSONObject(i);
-//                        String title = json.getString("title");
-//                        menu.add(0, i, 0, title);
-//                    }
-//                }
-//            } catch (JSONException e) {
-//                e.printStackTrace();
-//            }
-//        }
-
-        return true;
-    }
-
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-
-
-//        int which = item.getItemId();
-//        try {
-//            JSONArray menu = resultData.getJSONArray("menu");
-//            JSONObject json = menu.getJSONObject(which);
-//
-//            String actionType = json.getString("action");
-//            String url = json.optString("url");
-//
-//            if (actionType.equals("download")) {
-//                export(url);
-//            } else if (actionType.equals("save")) {
-//                if(BuildConfig.DEBUG && true){
-//                    //do something for assert aim
-//                    Log.e("Result", "onOptionsItemSelected DialogClick: not implement");
-//                }
-//            }
-//
-//        } catch (JSONException exception) {
-//            Log.d("Result", "onClick: ",exception);
-//        }
-
-        return true;
-    }
-
-
-//    public int last_index;
-//    public int total_index;
-//
-//    @Override
-//    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
-//        last_index = firstVisibleItem+visibleItemCount;
-//        total_index = totalItemCount;
-//    }
-//
-//    @Override
-//    public void onScrollStateChanged(AbsListView view, int scrollState) {
-//        if(last_index == total_index && (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE))
-//        {
-//            // 表示此时需要显示刷新视图界面进行新数据的加载(要等滑动停止)
-//            if(!isLoading)
-//            {
-//                // 设置刷新界面可见
-//                footer.setVisibility(View.VISIBLE);
-//                loadMore();
-//            }
-//        }
-//    }
-
-    // 设置header 和 footer宽度,否则listView会显示默认宽度
-    protected void setupUI() {
-        try {
-            if (resultData == null) {
-                return;
-            } else {
-                int result = resultData.getInt("result");
-                if (result != 2) {
-                    return;
-                }
-            }
-            JSONObject layout = resultData.getJSONObject("layout");
-
-            JSONObject header = layout.getJSONObject("header");
-            int width = header.getInt("width");
-            width = convertDp2Px(width);
-
-            AbsListView.LayoutParams footerLayoutParams = (AbsListView.LayoutParams)list_footer.getLayoutParams();
-            if (footerLayoutParams == null) {
-                footerLayoutParams = new AbsListView.LayoutParams(width,footer_height);
-            }
-            footerLayoutParams.height = footer_height;
-            footerLayoutParams.width = width;
-            list_footer.setLayoutParams(footerLayoutParams);
-
-
-        } catch (JSONException e) {
-            Log.e("Result", "setupUI: ", e);
-        }
-
-    }
-
-    public void loadComplete() {
-
-        setupUI();
-        resultListView.completeRefresh();
-        if (resultSwipe.isRefreshing()) {
-            resultSwipe.setRefreshing(false);
-        }
-        resultListView.forceLayout();
-
-        isLoading = false;//设置正在刷新标志位false
-        invalidateOptionsMenu();
-
-        String title = resultData.optString("table_title");
-        setTitleColor(Color.BLACK);
-        setTitle(title);
-
-        progressDialog.dismiss();
-    }
-
-
-    protected void showProgressDialog(String title, String msg) {
-        progressDialog.setTitle(title);
-        progressDialog.setMessage(msg);
-        progressDialog.show();
-    }
-
-    JSONObject readRawFile(int id)
-    {
-        String content;
-        Resources resources=this.getResources();
-        InputStream is=null;
-        try{
-            is=resources.openRawResource(id);
-            byte buffer[]=new byte[is.available()];
-            is.read(buffer);
-            content=new String(buffer);
-            JSONObject json = new JSONObject(content);
-            return json;
-        }
-        catch(IOException e)
-        {
-            e.printStackTrace();
-        }
-        catch (JSONException e) {
-            e.printStackTrace();
-        }
-        finally
-        {
-            if(is!=null)
-            {
-                try{
-                    is.close();
-                }catch(IOException e)
-                {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return null;
-    }
-
-    protected void loadData() {
-
-//        resultData = readRawFile(R.raw.predef_query);
-//        if (1 == 1) {
-//            return;
-//        }
-
-        if (isLoading) {
-            return;
-        }
-
-        isLoading = true;
-
-        showProgressDialog(null,"Loading");
-
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-
-                try {
-
-                    mParams.putInt("offset",0);
-                    mParams.putInt("limit",25);
-                    JSONObject new_resultData = Network.query(mParams);
-
-                    if (new_resultData != null) {
-                        Iterator<String> iterator = new_resultData.keys();
-                        while (iterator.hasNext()) {
-                            String key = iterator.next();
-                            Object value = new_resultData.get(key);
-                            resultData.put(key,value);
-                        }
-                    }
-
-                    runOnUiThread(new Runnable() {
-                        @Override
-                        public void run() {
-
-                            loadComplete();
-                            int result = resultData.optInt("result",0);
-                            if (result == 2) {
-
-                            } else {
-
-                                String msg = resultData.optString("msg");
-                                if (msg == null || msg.isEmpty()) {
-                                    msg = "Sorry,some error occurred";
-                                }
-
-                                new AlertDialog.Builder(mContext)
-                                        .setTitle("Warning")
-                                        .setMessage(msg)
-                                        .show();
-                            }
-
-                            adapter.notifyDataSetChanged();
-                        }
-                    });
-
-                } catch (Exception e) {
-                    Log.e("Result", "onCreate: ",e);
-                }
-
-
-
-
-            }
-        }).start();
-
-    }
-
-    protected void loadMore() {
-
-        if (isLoading) {
-            return;
-        }
-
-        isLoading = true;
-        showProgressDialog(null,"Loading");
-
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-
-                try {
-
-//                    Thread.sleep(2000);
-//
-//                    InputStream in = getResources().openRawResource( R.raw.result);
-//                    int length = in.available();
-//                    byte[] buffer = new byte[length];
-//                    in.read(buffer);
-//                    String res = new String(buffer,"utf8");
-//                    in.close();
-//
-//                    JSONObject newJson = new JSONObject(res);
-
-                    mParams.putInt("offset",adapter.getCount());
-                    mParams.putInt("limit",25);
-                    JSONObject newJson = Network.query(mParams);
-
-                    if (newJson != null) {
-
-                        int result = newJson.getInt("result");
-                        if (result == 2) {
-                            JSONObject newData = newJson.getJSONObject("data");
-                            int add_count = newData.getInt("count");
-
-                            JSONObject data = resultData.getJSONObject("data");
-                            int count = data.getInt("count");
-
-                            for (int i = 0; i < add_count; i++) {
-                                JSONArray new_data_item = newData.getJSONArray("item_" + i);
-                                if (new_data_item != null) {
-                                    data.put("item_" + count++,new_data_item);
-                                }
-                            }
-                            data.put("count",count);
-                            resultData.put("data",data);
-
-                            runOnUiThread(new Runnable() {
-                                @Override
-                                public void run() {
-
-                                    loadComplete();
-                                    adapter.notifyDataSetChanged();
-                                }
-                            });
-                        } else {
-                            String msg = newJson.optString("msg");
-                            if (msg == null || msg.isEmpty()) {
-                                msg = "Some error occurred";
-                            }
-                            showAlert(msg);
-                        }
-
-
-                    }
-
-
-                } catch (Exception e) {
-                    Log.e("Result", "onCreate: ",e);
-                    showAlert("Some error occurred");
-                }
-
-
-
-
-            }
-        }).start();
-    }
-
-    protected JSONObject contentData() {
-        try {
-            return resultData.getJSONObject("data");
-        } catch (JSONException e) {
-            Log.e("Result", "contentData: ", e);
-        }
-        return null;
-    }
-
-    protected JSONArray contentMenu() {
-        if (resultData != null) {
-            try {
-                JSONArray menu_json = resultData.getJSONArray("menu");
-                return menu_json;
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        }
-        return null;
-    }
-
-    protected JSONArray contentAction() {
-        if (resultData != null) {
-            try {
-                JSONArray action_json = resultData.getJSONArray("row_action");
-                return action_json;
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        }
-        return null;
-    }
-
-    protected JSONObject contentLayout() {
-        if (resultData != null) {
-            try {
-                JSONObject layout = resultData.getJSONObject("layout");
-                return layout;
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        }
-        return null;
-
-    }
-
-
-    private class GestureListener extends GestureDetector.SimpleOnGestureListener {
-
-        @Override
-        public boolean onDoubleTapEvent(MotionEvent e) {
-
-
-            if (e.getAction() == MotionEvent.ACTION_UP) {
-
-                TableRow cellRow = (TableRow)clickedView.getParent();
-                RelativeLayout cell = (RelativeLayout)cellRow.getParent();
-
-                int position = resultListView.getPositionForView(cell);
-//                Log.d("Result", "onDoubleTapEvent: " + position);
-
-                if (position == 0) {
-                    return false;
-                }
-
-                cellDoubleTapAction(position);
-
-            }
-
-            return false;
-        }
-
-        @Override
-        public boolean onSingleTapConfirmed(MotionEvent e) {
-            if (clickedView instanceof TextView) {
-                TextView tv = (TextView)clickedView;
-                if (ellipsisTextView(tv)) {
-                    showAlert(tv.getText().toString());
-                }
-            }
-            return false;
-        }
-    }
-
-    private int normalColor;
-    private int touchColor = Color.GRAY;
-    private void initClickListener() {
-
-        // 需要作为成员变量
-        detector = new GestureDetector(mContext, new GestureListener());
-
-        resultRowClickListener = new View.OnTouchListener() {
-
-            @Override
-            public boolean onTouch(View v, MotionEvent event) {
-
-                TableRow cellRow = (TableRow)v.getParent();
-                RelativeLayout cell = (RelativeLayout)cellRow.getParent();
-
-                int position = resultListView.getPositionForView(cell);
-
-                if (position == 0) {
-                    return false;
-                }
-
-
-//                View cellRow = (View) v.getParent();
-                if (event.getAction() == MotionEvent.ACTION_DOWN) {
-
-                    if (clickedView != null) {
-                        ((View)clickedView.getParent()).setBackgroundColor(normalColor);
-                    }
-
-                    normalColor = ((ColorDrawable)cellRow.getBackground()).getColor();
-                    cellRow.setBackgroundColor(touchColor);
-
-                } else if (event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_UP) {
-//                    cell.setBackgroundColor(normalColor);
-                }
-
-                clickedView = v;
-
-                detector.onTouchEvent(event);
-
-                return true;
-            }
-        };
-
-    }
-
-
-
-    protected class ResultAdapter extends BaseAdapter {
-
-        @Override
-        public boolean areAllItemsEnabled() {
-            return true;
-        }
-
-        @Override
-        public boolean isEnabled(int position) {
-            return true;
-        }
-
-        private class ResultHoder {
-            public ResultHoder(View view) {
-                row = (TableRow)view.findViewById(R.id.result_row);
-                view.setTag(this);
-            }
-            TableRow row;
-        }
-
-        public ResultAdapter(Context ctx) {
-
-        }
-
-        @Override
-        public void registerDataSetObserver(DataSetObserver observer) {
-            super.registerDataSetObserver(observer);
-        }
-
-        @Override
-        public void unregisterDataSetObserver(DataSetObserver observer) {
-            super.unregisterDataSetObserver(observer);
-        }
-
-        @Override
-        public int getCount() {
-            if (resultData == null) {
-                return 0;
-            } else {
-                int result = resultData.optInt("result");
-                if (result != 2) {
-                    return 0;
-                }
-            }
-            try {
-                JSONObject data = resultData.getJSONObject("data");
-                int result_count = data.getInt("count");
-                return result_count + 1; // header + data
-
-            } catch (JSONException e) {
-                Log.e("Result", "getCount: ", e);
-                return 0;
-            }
-        }
-
-        @Override
-        public Object getItem(int position) {
-            try {
-                if (position == 0) {
-                    // header
-
-                    JSONObject layout = resultData.getJSONObject("layout");
-                    JSONObject header = layout.getJSONObject("header");
-                    JSONArray col = header.getJSONArray("col");
-
-                    return col;
-
-                } else {
-                    // result row
-
-                    JSONObject data = resultData.getJSONObject("data");
-                    JSONArray item = data.getJSONArray("item_" + (position - 1));
-
-                    return item;
-                }
-
-
-            } catch (JSONException e) {
-                Log.e("Result", "getItem: ", e);
-            }
-            return null;
-        }
-
-        @Override
-        public long getItemId(int position) {
-            return position;
-        }
-
-        @Override
-        public boolean hasStableIds() {
-            return false;
-        }
-
-        @Override
-        public View getView(int position, View convertView, ViewGroup parent) {
-
-            View cell;
-            ResultHoder holder;
-            if (convertView == null) {
-
-                cell = LayoutInflater.from(mContext).inflate(R.layout.result_cell,null);
-                holder = new ResultHoder(cell);
-
-
-            } else {
-
-                cell = convertView;
-                holder = (ResultHoder)cell.getTag();
-
-            }
-//            holder.row.removeAllViews();
-
-//            cell.setOnTouchListener(resultRowClickListener);
-
-            holder.row.setBackgroundColor(Color.WHITE);
-            // setup
-           try {
-
-               JSONObject layout = resultData.getJSONObject("layout");
-
-               JSONObject header = layout.getJSONObject("header");
-               int width = header.getInt("width");
-               int height = header.getInt("height");
-               int margin_t = header.getInt("margin_t");
-               int margin_l = header.getInt("margin_l");
-               int margin_b = header.getInt("margin_b");
-               int margin_r = header.getInt("margin_r");
-
-               width = convertDp2Px(width);
-               height = convertDp2Px(height);
-               margin_t = convertDp2Px(margin_t);
-               margin_l = convertDp2Px(margin_l);
-               margin_b = convertDp2Px(margin_b);
-               margin_r = convertDp2Px(margin_r);
-
-
-               HorizontalScrollView.LayoutParams listViewLayoutParams = (HorizontalScrollView.LayoutParams)resultListView.getLayoutParams();
-               listViewLayoutParams.width = width;
-               resultListView.setLayoutParams(listViewLayoutParams);
-
-
-
-               JSONArray obj = (JSONArray)getItem(position);
-               JSONArray arr_col = header.getJSONArray("col");
-
-               if (position == 0) {
-
-                   // header
-                   String bg_color = header.getString("bg_color");
-                   String f_color = header.getString("f_color");
-
-                   if (!bg_color.contains("0x")) {
-                       bg_color = "0x" + bg_color;
-                   }
-                   if (!f_color.contains("0x")) {
-                       f_color = "0x" + f_color;
-                   }
-                   bg_color = bg_color.replace("0x","#");
-                   f_color = f_color.replace("0x","#");
-
-                   RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)holder.row.getLayoutParams();
-                   layoutParams.height = height;
-                   holder.row.setLayoutParams(layoutParams);
-
-                   // 调整显示列后,需要删除多余的列
-                   if (holder.row.getChildCount() > arr_col.length()) {
-                       for (int i = arr_col.length(); i < holder.row.getChildCount(); i++) {
-                           TextView tv = (TextView)holder.row.findViewById(i);
-                           holder.row.removeView(tv);
-                       }
-                   }
-
-                   // col
-                   for (int i = 0; i < arr_col.length(); i++) {
-
-                       JSONObject value = obj.getJSONObject(i);
-                       int col_w = value.getInt("width");
-                       col_w = convertDp2Px(col_w);
-
-                       String h_align = value.getString("h_align");
-                       String v_center = value.getString("v_center");
-                       String col_bg_color = value.getString("bg_color");
-                       String col_f_color = value.getString("f_color");
-                       String name = value.getString("name");
-
-
-                       bg_color = bg_color.replace("0x","#");
-                       f_color = f_color.replace("0x","#");
-
-                       TextView tv = (TextView)holder.row.findViewById(i);
-                       if (tv == null) {
-                           tv = new TextView(mContext);
-
-                           tv.setGravity(convertGravity("h_align",h_align) | convertGravity("v_center",v_center));
-                           tv.setSingleLine();
-                           tv.setEllipsize(TextUtils.TruncateAt.END);
-                           tv.setId(i);
-                           tv.setBackgroundDrawable(getResources().getDrawable(R.drawable.result_black_border));
-                           tv.setOnTouchListener(resultRowClickListener);
-                       } else {
-                           holder.row.removeView(tv);
-                       }
-
-                       // layout
-                       tv.setWidth(col_w);
-                       tv.setHeight(height);
-                       tv.setPadding(margin_l,margin_t,margin_r,margin_b);
-
-                       TableRow.LayoutParams tvLayoutParams = new  TableRow.LayoutParams(col_w, height);
-
-                       holder.row.addView(tv,i,tvLayoutParams);
-
-                       // content
-                       tv.setTextColor(Color.parseColor(f_color));
-                       tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,14);
-                       tv.getPaint().setFakeBoldText(true);
-
-                       if (name.contains("</")) {
-                           tv.setText(Html.fromHtml(name));
-                       } else {
-                           tv.setText(name);
-                       }
-
-                   }
-                   holder.row.setBackgroundColor(Color.parseColor(bg_color));
-
-               } else {
-
-                   // row
-                   JSONObject row = layout.getJSONObject("row");
-                   String f_color = row.getString("f_color");
-                   String color_0 = row.getString("color_0");
-                   String color_1 = row.getString("color_1");
-
-                   if (!f_color.contains("0x")) {
-                       f_color = "0x" + f_color;
-                   }
-                   if (!color_0.contains("0x")) {
-                       color_0 = "0x" + color_0;
-                   }
-                   if (!color_1.contains("0x")) {
-                       color_1 = "0x" + color_1;
-                   }
-
-
-                   f_color = f_color.replace("0x","#");
-                   color_0 = color_0.replace("0x","#");
-                   color_1 = color_1.replace("0x","#");
-
-                   int row_h = row.getInt("height");
-                   row_h = convertDp2Px(row_h);
-
-                   RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)holder.row.getLayoutParams();
-                   layoutParams.height = row_h;
-                   holder.row.setLayoutParams(layoutParams);
-
-                   // 调整显示列后,需要删除多余的列
-                   if (holder.row.getChildCount() > arr_col.length()) {
-                       for (int i = arr_col.length(); i < holder.row.getChildCount(); i++) {
-                           TextView tv = (TextView)holder.row.findViewById(i);
-                           holder.row.removeView(tv);
-                       }
-                   }
-
-                   // col
-                   for (int i = 0; i < arr_col.length(); i++) {
-
-                       JSONArray col_layout = row.getJSONArray("val");
-                       JSONObject layout_val = col_layout.getJSONObject(i);
-
-                       String type = layout_val.getString("type");
-                       String h_align = layout_val.getString("h_align");
-                       String v_center = layout_val.getString("v_center");
-                       String col_bg_color = layout_val.getString("bg_color");
-                       String col_f_color = layout_val.getString("f_color");
-
-                       col_bg_color = col_bg_color.replace("0x","#");
-                       col_f_color = col_f_color.replace("0x","#");
-
-                       String value = obj.getString(i);
-
-
-                       JSONObject size = ((JSONArray)getItem(0)).getJSONObject(i);
-                       int col_w = size.getInt("width");
-                       int col_h = row.getInt("height");
-
-                       col_w = convertDp2Px(col_w);
-                       col_h = convertDp2Px(col_h);
-
-                       TextView tv = (TextView) holder.row.findViewById(i);
-                       if (tv == null) {
-                           tv = new TextView(mContext);
-
-                           tv.setGravity(convertGravity("h_align",h_align) | convertGravity("v_center",v_center));
-                           tv.setSingleLine();
-                           tv.setEllipsize(TextUtils.TruncateAt.END);
-                           tv.setId(i);
-                           tv.setOnTouchListener(resultRowClickListener);
-                           tv.setBackgroundDrawable(getResources().getDrawable(R.drawable.result_black_border));
-                       } else {
-                           holder.row.removeView(tv);
-                       }
-
-                       // layout
-                       tv.setWidth(col_w);
-                       tv.setHeight(col_h);
-                       tv.setPadding(margin_l,margin_t,margin_r,margin_b);
-
-                       TableRow.LayoutParams tvLayoutParams = new  TableRow.LayoutParams(col_w, col_h);
-                       holder.row.addView(tv,i,tvLayoutParams);
-
-                       // content
-
-                       tv.setTextColor(Color.parseColor(f_color));
-                       tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,12);
-                       tv.getPaint().setFakeBoldText(false);
-                       tv.setText(Html.fromHtml(value));
-//                       if (value.contains("</")) {
-//                           tv.setText(Html.fromHtml(value));
-//                       } else {
-//                           tv.setText(value);
-//                       }
-
-
-                   }
-
-                   if ((position - 1) % 2 == 0) {
-                       holder.row.setBackgroundColor(Color.parseColor(color_0));
-                   } else {
-                       holder.row.setBackgroundColor(Color.parseColor(color_1));
-
-                   }
-               }
-
-           } catch (JSONException e) {
-               Log.e("Result", "getView: ", e);
-           }
-
-            return cell;
-        }
-
-        private int convertGravity(String key, String align) {
-
-            if (key.equals("h_align")) {
-                if (align.equals("center")) {
-                    return Gravity.CENTER_HORIZONTAL;
-                } else if (align.equals("left")) {
-                    return Gravity.LEFT;
-                } else if (align.equals("right")) {
-                    return Gravity.RIGHT;
-                }
-
-            }
-
-            if (key.equals("v_center")) {
-
-                if (align.equals("center")) {
-                    return Gravity.CENTER_VERTICAL;
-                } else if (align.equals("top")) {
-                    return Gravity.TOP;
-                } else if (align.equals("bottom")) {
-                    return Gravity.BOTTOM;
-                }
-            }
-            return Gravity.CENTER;
-        }
-
-        @Override
-        public int getItemViewType(int position) {
-            return 0;
-        }
-
-        @Override
-        public int getViewTypeCount() {
-            return 1;
-        }
-
-        @Override
-        public boolean isEmpty() {
-            return false;
-        }
-    }
-
-
-    public boolean ellipsisTextView(TextView tv) {
-        Layout l = tv.getLayout();
-        if ( l != null){
-            int lines = l.getLineCount();
-            if ( lines > 0) {
-                if (l.getEllipsisCount(lines - 1) > 0) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    public int convertDp2Px(int dp) {
-        return dp2px(mContext,dp);
-    }
-
-    public int px2dp(Context context, float pxValue) {
-        float scale = context.getResources().getDisplayMetrics().density;
-        return (int) (pxValue / scale + 0.5f);
-    }
-
-    public int dp2px(Context context, float dpValue) {
-        float scale = context.getResources().getDisplayMetrics().density;
-        return (int) (dpValue * scale + 0.5f);
-    }
-
-    public int px2sp(Context context, float pxValue) {
-        float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
-        return (int) (pxValue / fontScale + 0.5f);
-    }
-
-    public int sp2px(Context context, float spValue) {
-        float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
-        return (int) (spValue * fontScale + 0.5f);
-    }
-
-
-    protected String documentPath;
-    protected String download_query;
-    protected void export(final String download_url) {
-
-        if (download_query != null) {
-            documentPath = download_query;
-            openFile(new File(download_query));
-            return;
-        }
-
-        showProgressDialog(null,"Please wait");
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-
-                String cacheDir = ApexTrackingApplication.getInstance().getDocumentDir();
-                // download & get path
-                final File downloadFile = Network.download_query(download_url,cacheDir);
-                final String path = downloadFile != null && downloadFile.exists() ? downloadFile.getPath() : null;
-
-
-
-                documentPath = path;
-                download_query = path;
-
-
-                if (path != null) {
-                    runOnUiThread(new Runnable() {
-                        @Override
-                        public void run() {
-                            progressDialog.dismiss();
-                            openFile(downloadFile);
-                        }
-                    });
-                }
-
-            }
-        }).start();
-
-    }
-
-    public void showAlert(final String msg) {
-        if (msg == null || msg.isEmpty()) {
-            return;
-        }
-
-        runOnUiThread(new Runnable() {
-            @Override
-            public void run() {
-                new AlertDialog.Builder(mContext)
-                        .setMessage(msg)
-                        .show();
-            }
-        });
-    }
-
-    public void showOrderDetail() {
-//        Intent intent = OrderDetailActivity.build(mContext,OrderDetailActivity.class,null,URL_REMOTE,null,new Bundle());
-//
-//        startActivity(intent);
-    }
-
-    public void showKVDetail(final JSONObject param) {
-//        showProgressDialog("Please wait","Loading...");
-//
-//        new Thread(new Runnable() {
-//            @Override
-//            public void run() {
-//
-//                final JSONObject json = Network.kv_detail(RAUtil.Json2Bundle(param));
-////                final JSONObject json = readRawFile(R.raw.kv);
-//
-//                runOnUiThread(new Runnable() {
-//                    @Override
-//                    public void run() {
-//                        progressDialog.dismiss();
-//
-//                        int result = 0;
-//                        if (json != null) {
-//                            result = json.optInt("result",0);
-//                        }
-//                        if (result == 2) {
-//
-//                            Intent intent = KVDetailActivity.build(mContext,json.toString());
-//
-//                            startActivity(intent);
-//
-//                        } else {
-//                            String msg = json.optString("msg");
-//                            if (msg == null) {
-//                                msg = "Sorry,some error occurred";
-//                            }
-//                            showAlert(msg);
-//                        }
-//
-//                    }
-//                });
-//
-//            }
-//        }).start();
-
-    }
-
-    public void showQuickLook(final JSONObject param, final String url) {
-
-        showProgressDialog("Please wait","Downloading...");
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-
-                String cacheDir = ApexTrackingApplication.getInstance().getDocumentDir();
-                // 下载文件
-                final File downloadFile = Network.downloadFile(RAUtil.Json2Bundle(param),url,cacheDir);
-
-                runOnUiThread(new Runnable() {
-                    @Override
-                    public void run() {
-                        progressDialog.dismiss();
-                        if (downloadFile != null && downloadFile.exists()) {
-//                            try {
-//                                //此处需要新增保存文档的本地表
-//                                param;
-////                                String email=param.getString("email");
-////                                String email_subject=param.getString("email_subject");
-////                                String email_content=param.getString("email_content");
-//                            } catch (JSONException e) {
-//                                e.printStackTrace();
-//                            }
-                            openFile(downloadFile);
-                        } else {
-                            showAlert("Sorry,there is a wrong.");
-                        }
-                    }
-                });
-
-            }
-        }).start();
-
-
-    }
-
-    protected void openFile(File file) {
-
-        if (file == null || !file.exists()) {
-            return;
-        }
-
-        Uri uri = null;
-        String type = RAUtil.getMimeType(file.getPath());
-
-        // type "application/pdf"
-        Intent intent = new Intent(Intent.ACTION_VIEW);
-
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
-
-            // "com.usai.apex.fileprovider"即是在Manifest文件中配置的authorities
-            uri = FileProvider.getUriForFile(mContext, RAUtil.getProviderAuthorities(), file);
-            // 给目标应用一个临时授权
-            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
-        } else {
-            uri = Uri.fromFile(file);
-        }
-
-        intent.setDataAndType(uri, type);
-
-        if (getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null) {
-            // someone knows how to handle this mime type with this scheme, don't download.
-            try {
-                startActivity(intent);
-                return;
-            } catch (Exception ex) {
-                Log.d("Open File", "activity not found for " + type + " over " + uri, ex);
-            }
-
-        } else {
-            Log.d("Open File", "openFileAtPath: " + "No App " + uri);
-            try {
-                shareFile(uri,type);
-            } catch (Exception e) {
-                Log.e("Show Dialog Error", "openFileAtPath: ", e);
-            }
-        }
-
-    }
-
-    protected void shareFile(Uri uri, String type) {
-
-        Intent shareIntent = new Intent();
-        shareIntent.setAction(Intent.ACTION_SEND);
-        shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
-        shareIntent.setType(type);
-        startActivity(Intent.createChooser(shareIntent, "Share"));
-    }
-
-
-}

+ 7 - 1
ApexDrivers/apexmobile/src/main/java/com/usai/apex/servicelocationmap/ApexServiceLocationMapFragment.java

@@ -61,6 +61,8 @@ public class ApexServiceLocationMapFragment extends Fragment {
     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
         RelativeLayout fragment = (RelativeLayout) inflater.inflate(R.layout.service_location_map_fragment, null);
         mMapView = fragment.findViewById(R.id.service_location_map_view);
+        mMapView.setCenter(38.520968, -94.270818);
+        mMapView.setZoomLevel(3);
         return fragment;
     }
 
@@ -75,7 +77,7 @@ public class ApexServiceLocationMapFragment extends Fragment {
     public void onResume() {
         super.onResume();
 
-        mMapView.setCenter(29.945,104.7);
+
     }
 
     @Override
@@ -85,6 +87,7 @@ public class ApexServiceLocationMapFragment extends Fragment {
 
     @Override
     public void onDetach() {
+        mMapView=null;
         super.onDetach();
     }
 
@@ -144,6 +147,7 @@ public class ApexServiceLocationMapFragment extends Fragment {
 
     private void addLocationMarkers(JSONObject json) {
 
+
         int count = json.optInt("total");
 
         if (count > 0) {
@@ -179,6 +183,8 @@ public class ApexServiceLocationMapFragment extends Fragment {
 //                        detail.addr_zip = "610000";
 
                         GeoPoint geopoint = new GeoPoint(Double.valueOf(latitude), Double.valueOf(longitude));
+                        if(mMapView==null)
+                            return;
                         Marker marker = mMapView.addMarker(geopoint, company, city + "\n" + area);
                         mMapView.addWindowInfoForMarker(marker, detail, new ApexMarkerInfoWindow.ApexMarkerInfoWindowClickListener() {
                             @Override

+ 394 - 326
ApexDrivers/apexmobile/src/main/java/com/usai/apex/shipmap/ShipMap.java

@@ -1,11 +1,9 @@
 package com.usai.apex.shipmap;
 
-import android.app.Activity;
 import android.content.Context;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.graphics.Color;
-import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
 import android.support.annotation.CallSuper;
@@ -15,51 +13,62 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.ImageButton;
 import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import com.baidu.mapapi.SDKInitializer;
-import com.baidu.mapapi.map.BaiduMap;
-import com.baidu.mapapi.map.BitmapDescriptor;
-import com.baidu.mapapi.map.BitmapDescriptorFactory;
-import com.baidu.mapapi.map.InfoWindow;
-import com.baidu.mapapi.map.MapStatus;
-import com.baidu.mapapi.map.MapStatusUpdate;
-import com.baidu.mapapi.map.MapStatusUpdateFactory;
-import com.baidu.mapapi.map.MapView;
-import com.baidu.mapapi.map.Marker;
-import com.baidu.mapapi.map.MarkerOptions;
-import com.baidu.mapapi.model.LatLng;
-import com.google.android.gms.maps.CameraUpdate;
-import com.google.android.gms.maps.CameraUpdateFactory;
-import com.google.android.gms.maps.GoogleMap;
-import com.google.android.gms.maps.MapFragment;
-import com.google.android.gms.maps.OnMapReadyCallback;
-import com.google.android.gms.maps.model.CameraPosition;
-import com.usai.apex.ApexTrackingApplication;
+
 import com.usai.apex.R;
 
 import org.json.JSONException;
 import org.json.JSONObject;
+import org.osmdroid.util.GeoPoint;
+import org.osmdroid.views.overlay.Marker;
 
 import java.lang.ref.WeakReference;
 import java.util.Timer;
 import java.util.TimerTask;
 
-public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickListener, BaiduMap.OnMarkerClickListener, GoogleMap.OnInfoWindowClickListener, OnMapReadyCallback, InfoWindow.OnInfoWindowClickListener {
-
-    private MapFragment mGoogleMapView;
-    private GoogleMap mGoogleMap;
-    private com.google.android.gms.maps.MapView mMap;
-
-    private MapView mBaiduMap;
+import redant.usai.com.apexmap.mapkit.ApexMapView;
+import redant.usai.com.apexmap.mapkit.ApexMarkerInfoWindow;
+
+//import com.baidu.mapapi.SDKInitializer;
+//import com.baidu.mapapi.map.BaiduMap;
+//import com.baidu.mapapi.map.BitmapDescriptor;
+//import com.baidu.mapapi.map.BitmapDescriptorFactory;
+//import com.baidu.mapapi.map.InfoWindow;
+//import com.baidu.mapapi.map.MapStatus;
+//import com.baidu.mapapi.map.MapStatusUpdate;
+//import com.baidu.mapapi.map.MapStatusUpdateFactory;
+//import com.baidu.mapapi.map.MapView;
+//import com.baidu.mapapi.map.Marker;
+//import com.baidu.mapapi.map.MarkerOptions;
+//import com.baidu.mapapi.model.LatLng;
+//import com.google.android.gms.maps.CameraUpdate;
+//import com.google.android.gms.maps.CameraUpdateFactory;
+//import com.google.android.gms.maps.GoogleMap;
+//import com.google.android.gms.maps.MapFragment;
+//import com.google.android.gms.maps.OnMapReadyCallback;
+//import com.google.android.gms.maps.model.CameraPosition;
+
+public class ShipMap extends RelativeLayout {
+
+//    private ApexServiceLocationMapFragment ApexMapFragment;
+    ApexMapView mMapView;
+    private  Marker mCurrentMarker;
+
+//    private MapFragment mGoogleMapView;
+//    private GoogleMap mGoogleMap;
+//    private com.google.android.gms.maps.MapView mMap;
+
+//    private MapView mBaiduMap;
     private Context mContext;
-    private Boolean mUseGoogleMap;
+//    private Boolean mUseGoogleMap;
 
     private ShipMapListener mListener;
     private ShipMap self = this;
 
     private ImageButton mResizeBtn;
-
+//    @Override
+//    public void onInfoWindowClick(LocationDetail detail) {
+////        markerClicked(detail);
+//    }
     public ShipMap(Context context) {
         super(context);
         init(context);
@@ -87,9 +96,9 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
      * */
     public void destroy() {
         //
-        if (mUseGoogleMap && mGoogleMapView != null && mContext != null) {
-            ((Activity)mContext).getFragmentManager().beginTransaction().remove(mGoogleMapView).commit();
-        }
+//        if (mUseGoogleMap && mGoogleMapView != null && mContext != null) {
+//            ((Activity)mContext).getFragmentManager().beginTransaction().remove(mGoogleMapView).commit();
+//        }
 
         stopTwinkle();
     }
@@ -107,54 +116,67 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
         }
         String able= getResources().getConfiguration().locale.getCountry();
 //        if (packageInfo == null)
-        if (able.equals("CN"))
-        {
-            mUseGoogleMap = false;
-            System.out.println("没有安装");
-        } else {
-            mUseGoogleMap = true;
-            System.out.println("已经安装");
-        }
+//        if (able.equals("CN"))
+//        {
+//            mUseGoogleMap = false;
+//            System.out.println("没有安装");
+//        } else {
+//            mUseGoogleMap = true;
+//            System.out.println("已经安装");
+//        }
 //        mUseGoogleMap = false;
 
 //        GooglePlayServicesUtil.isGooglePlayServicesAvailable(mContext.getApplicationContext());
 
-        if (mUseGoogleMap) {
-
-//            googleMap = ((MapFragment)((Activity)mContext).getFragmentManager().findFragmentById(R.id.ship_google_map));
-
-            View relativeLayout = LayoutInflater.from(mContext).inflate(R.layout.ship_google_map,null);
-//            mGoogleMapView = relativeLayout.findViewById(R.id.ship_google_map);
-//            mGoogleMapView = ((MapFragment)((Activity)mContext).getFragmentManager().findFragmentById(R.id.ship_google_map));
-//            mGoogleMapView.getMapAsync(this);
 
-            mMap = relativeLayout.findViewById(R.id.ship_google_map);
-            mMap.onCreate(null);
-            mMap.onResume();
-            mMap.getMapAsync(this);
-
-            LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
-            relativeLayout.setBackgroundColor(Color.parseColor("#EFEFF4"));
-            addView(relativeLayout,layoutParams);
-
-        } else {
+        View relativeLayout = LayoutInflater.from(mContext).inflate(R.layout.service_location_map_fragment, null);
+        mMapView = relativeLayout.findViewById(R.id.service_location_map_view);
 
-            SDKInitializer.initialize(ApexTrackingApplication.get_instance());
-            mBaiduMap = new MapView(mContext);
-            mBaiduMap.getMap().setOnMarkerClickListener(this);
 
-            // 设置当前缩放
-            MapStatusUpdate u = MapStatusUpdateFactory.zoomTo(mBaiduMap.getMap().getMinZoomLevel());
-            mBaiduMap.getMap().setMapStatus(u);
-            mBaiduMap.showZoomControls(false); // false不显示缩放按钮
-            mBaiduMap.getMap().getUiSettings().setRotateGesturesEnabled(false); // 禁止旋转
-            mBaiduMap.getMap().getUiSettings().setOverlookingGesturesEnabled(false); // 禁止俯视调整
+        LayoutParams layoutParams_map = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
+        relativeLayout.setBackgroundColor(Color.parseColor("#EFEFF4"));
+        addView(relativeLayout,layoutParams_map);
 
+//        return fragment;
 
-            LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
-            mBaiduMap.setBackgroundColor(Color.parseColor("#EFEFF4"));
-            addView(mBaiduMap,layoutParams);
-        }
+//
+//
+//        if (mUseGoogleMap) {
+//
+////            googleMap = ((MapFragment)((Activity)mContext).getFragmentManager().findFragmentById(R.id.ship_google_map));
+//
+//            View relativeLayout = LayoutInflater.from(mContext).inflate(R.layout.ship_google_map,null);
+////            mGoogleMapView = relativeLayout.findViewById(R.id.ship_google_map);
+////            mGoogleMapView = ((MapFragment)((Activity)mContext).getFragmentManager().findFragmentById(R.id.ship_google_map));
+////            mGoogleMapView.getMapAsync(this);
+//
+//            mMap = relativeLayout.findViewById(R.id.ship_google_map);
+//            mMap.onCreate(null);
+//            mMap.onResume();
+//            mMap.getMapAsync(this);
+//
+//            LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
+//            relativeLayout.setBackgroundColor(Color.parseColor("#EFEFF4"));
+//            addView(relativeLayout,layoutParams);
+//
+//        } else {
+//
+//            SDKInitializer.initialize(ApexTrackingApplication.get_instance());
+//            mBaiduMap = new MapView(mContext);
+//            mBaiduMap.getMap().setOnMarkerClickListener(this);
+//
+//            // 设置当前缩放
+//            MapStatusUpdate u = MapStatusUpdateFactory.zoomTo(mBaiduMap.getMap().getMinZoomLevel());
+//            mBaiduMap.getMap().setMapStatus(u);
+//            mBaiduMap.showZoomControls(false); // false不显示缩放按钮
+//            mBaiduMap.getMap().getUiSettings().setRotateGesturesEnabled(false); // 禁止旋转
+//            mBaiduMap.getMap().getUiSettings().setOverlookingGesturesEnabled(false); // 禁止俯视调整
+//
+//
+//            LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
+//            mBaiduMap.setBackgroundColor(Color.parseColor("#EFEFF4"));
+//            addView(mBaiduMap,layoutParams);
+//        }
 
         ImageButton resizeBtn = new ImageButton(mContext);
         resizeBtn.setImageResource(R.drawable.resize_max);
@@ -211,32 +233,142 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
 
     private JSONObject mAnnotation;
 
-    private Marker mCurrentBaiduMarker;
+
+//    private Marker mCurrentBaiduMarker;
     private String backup_port="";
-    private com.google.android.gms.maps.model.Marker mCurrentGoogleMarker;
+//    private com.google.android.gms.maps.model.Marker mCurrentGoogleMarker;
+
+    private void addLocationMarkers(JSONObject json, int imageId) {
+
+
+        JSONObject location = json;
+        if (location != null) {
+
+            String port = location.optString("port");
+            String name = location.optString("name");
+            String addr = location.optString("addr");
+            String lonStr = location.optString("lon");
+            String latStr = location.optString("lat");
+
+//
+//            addMarker(marker);
+
+
+            if (lonStr != null && lonStr.length() > 0 && latStr != null && latStr.length() > 0) {
+
+                if (port == null) {
+                    port = "";
+                }
+                if (addr == null) {
+                    addr = "";
+                }
+
+
+                GeoPoint geopoint = new GeoPoint(Double.valueOf(latStr), Double.valueOf(lonStr));
+
+
+                Marker marker = new Marker(mMapView);
+                marker.setIcon(getResources().getDrawable(imageId,null));//设置图标
+            marker.setPosition(geopoint);//设置位置
+                marker.setAnchor(0, 0);//设置偏移量
+            marker.setTitle(name);//设置标题
+            marker.setSubDescription(port + " " + addr);//设置说明
+
+//                marker.getInfoWindow().setRelatedObject();
+                ApexMarkerInfoWindow infoWindow =new ApexMarkerInfoWindow(R.layout.info_window, mMapView).init();
+                marker.setInfoWindow(infoWindow);
+
+//                ApexMarkerInfoWindow infoWindow = new ApexMarkerInfoWindow(self, attachment);
+//                marker.getInfoWindow().
+
+                mMapView.addMarker(marker);
+//                Marker marker = mMapView.addMarker(geopoint, name, port + " " + addr);
+//            mMapView.addWindowInfoForMarker(marker, detail, new ApexMarkerInfoWindow.ApexMarkerInfoWindowClickListener() {
+//                @Override
+//                public void onMarkerInfoWindowDidClick(ApexMarkerInfoWindow infoWindow, Object attachment) {
+//                    if (mClickListener != null) {
+//                        LocationDetail locationDetail = (LocationDetail)attachment;
+//                        mClickListener.onInfoWindowClick(locationDetail);
+//                    }
+//                }
+//            });
+
+
+
+                            if (port.equals("Vessel")) {
+                mCurrentMarker = marker;
+            }
+
+//            LatLng llA = new LatLng(Double.parseDouble(latStr), Double.parseDouble(lonStr));
+//            BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(imageId);
+//
+//            Bundle extrainfo = new Bundle();
+//            extrainfo.putString("detail",port + " " + addr);
+//
+//            MarkerOptions markeroption = new MarkerOptions().position(llA).icon(icon).zIndex(9).title(name).extraInfo(extrainfo).draggable(true);
+//            markeroption.zIndex(priority);
+//
+//            Marker marker = (Marker) mBaiduMap.getMap().addOverlay(markeroption);
+//
+//            if (port.equals("Vessel")) {
+//                mCurrentBaiduMarker = marker;
+//            }
+
+            } else {
+                return;
+            }
+
+//                    LocationDetail detail = new LocationDetail(company, address, telephone, fax, contact, email);
+
+//                        detail.addr_city = "chengdu";
+//                        detail.addr_country = "china";
+//                        detail.addr_state = "sichuan";
+//                        detail.addr_zip = "610000";
+
+//                    GeoPoint geopoint = new GeoPoint(Double.valueOf(latitude), Double.valueOf(longitude));
+//                    Marker marker = mMapView.addMarker(geopoint, company, city + "\n" + area);
+//                    mMapView.addWindowInfoForMarker(marker, detail, new ApexMarkerInfoWindow.ApexMarkerInfoWindowClickListener() {
+//                        @Override
+//                        public void onMarkerInfoWindowDidClick(ApexMarkerInfoWindow infoWindow, Object attachment) {
+//                            if (mClickListener != null) {
+//                                LocationDetail locationDetail = (LocationDetail)attachment;
+//                                mClickListener.onInfoWindowClick(locationDetail);
+//                            }
+//                        }
+//                    });
+
+        }
+
+    }
     public void showShipAnnotation(JSONObject annotation,String backup_port) {
         if (annotation == null) {
             return;
         }
 
-        mCurrentGoogleMarker = null;
-        mCurrentBaiduMarker = null;
-
-        if (mUseGoogleMap) {
-           if (mGoogleMap != null)
-           {
-               mGoogleMap.clear();
-               this.backup_port = "";
-           } else {
-               mAnnotation = annotation;
-               this.backup_port =backup_port;
-               return;
-           }
-        } else
-        {
-            this.backup_port = "";
-            mBaiduMap.getMap().clear();
-        }
+        mCurrentMarker = null;
+//        mCurrentGoogleMarker = null;
+//        mCurrentBaiduMarker = null;
+
+
+        mMapView.removeMarkers();
+//        if (mUseGoogleMap) {
+//           if (mGoogleMap != null)
+//           {
+//               mGoogleMap.clear();
+//               this.backup_port = "";
+//           } else {
+//               mAnnotation = annotation;
+//               this.backup_port =backup_port;
+//               return;
+//           }
+//        }
+
+//        else
+//        {
+//            this.backup_port = "";
+//            mBaiduMap.getMap().clear();
+//        }
+        this.backup_port = "";
         mAnnotation = null;
 
         JSONObject pol = annotation.optJSONObject("pol");
@@ -248,7 +380,7 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
                 } catch (JSONException e) {
                     e.printStackTrace();
                 }
-                handleLocation(pol,AnnotationDisplayPriorityHigh,R.drawable.new_location_pol);
+                addLocationMarkers(pol,R.drawable.new_location_pol);
             }
         }
 
@@ -261,7 +393,7 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
                 } catch (JSONException e) {
                     e.printStackTrace();
                 }
-                handleLocation(pod,AnnotationDisplayPriorityHigh,R.drawable.new_location_pod);
+                addLocationMarkers(pod,R.drawable.new_location_pod);
             }
         }
 
@@ -274,7 +406,7 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
                 } catch (JSONException e) {
                     e.printStackTrace();
                 }
-                handleLocation(poe,AnnotationDisplayPriorityLow,R.drawable.new_location_poe);
+                addLocationMarkers(poe,R.drawable.new_location_poe);
             }
         }
 
@@ -287,7 +419,7 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
                 } catch (JSONException e) {
                     e.printStackTrace();
                 }
-                handleLocation(por,AnnotationDisplayPriorityLow,R.drawable.new_location_por);
+                addLocationMarkers(por,R.drawable.new_location_por);
             }
         }
 
@@ -300,7 +432,7 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
                 } catch (JSONException e) {
                     e.printStackTrace();
                 }
-                handleLocation(origin,AnnotationDisplayPriorityLow,R.drawable.new_location_origin);
+                addLocationMarkers(origin,R.drawable.new_location_origin);
             }
         }
 
@@ -313,7 +445,7 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
                 } catch (JSONException e) {
                     e.printStackTrace();
                 }
-                handleLocation(destination,AnnotationDisplayPriorityLow,R.drawable.new_location_destination);
+                addLocationMarkers(destination,R.drawable.new_location_destination);
             }
         }
 
@@ -325,7 +457,7 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
                 } catch (JSONException e) {
                     e.printStackTrace();
                 }
-                handleLocation(current,AnnotationDisplayPriorityRequired,R.drawable.ic_marker);
+                addLocationMarkers(current,R.drawable.ic_marker);
             }
         }
 
@@ -351,7 +483,7 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
     private TimerTask mTimerTask;
     private void startTwinkle() {
 
-        if (mCurrentGoogleMarker == null && mCurrentBaiduMarker == null) {
+        if (mCurrentMarker == null ) {
             return;
         }
 
@@ -381,16 +513,28 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
 
     private void twinkleCurrentAlpha(double alpha) {
 
-        if (mUseGoogleMap) {
-            if (mCurrentGoogleMarker != null) {
-                mCurrentGoogleMarker.setAlpha((float) alpha);
-            }
 
-        } else {
-            if (mCurrentBaiduMarker != null) {
-                mCurrentBaiduMarker.setAlpha((float) alpha);
-            }
+        if(mCurrentMarker!=null)
+        {
+            mCurrentMarker.setAlpha((float) alpha);
+
+//            mMapView.invalidate
+            mMapView.postInvalidate();
+//            mMapView.getOverlay();
         }
+//
+//        if (mUseGoogleMap) {
+//            if (mCurrentGoogleMarker != null) {
+//                mCurrentGoogleMarker.setAlpha((float) alpha);
+//            }
+//
+//        }
+//
+//        else {
+//            if (mCurrentBaiduMarker != null) {
+//                mCurrentBaiduMarker.setAlpha((float) alpha);
+//            }
+//        }
     }
 
 
@@ -406,116 +550,123 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
 
         if (lonStr != null && lonStr.length() > 0 && latStr != null && latStr.length() > 0) {
 
-            if (mUseGoogleMap) {
-
-                CameraPosition newLocation = new CameraPosition.Builder()
-                        .target(new com.google.android.gms.maps.model.LatLng(Float.valueOf(latStr), Float.valueOf(lonStr)))
-                        .zoom(2.5f)
-                        .bearing(0)
-                        .tilt(0)
-                        .build();
-                mGoogleMap.moveCamera(CameraUpdateFactory.newCameraPosition(newLocation));
-            } else {
-
-                LatLng center = new LatLng(Float.valueOf(latStr),Float.valueOf(lonStr)); //设定中心点坐标
-                MapStatus mMapStatus = new MapStatus.Builder()//定义地图状态
-                                                    .target(center)
-                                                    .zoom(2.5f)
-                                                    .build();  //定义MapStatusUpdate对象,以便描述地图状态将要发生的变化
-                MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus);
-                mBaiduMap.getMap().setMapStatus(mMapStatusUpdate);//改变地图状态
-            }
-        }
-
-    }
-
-    private void handleLocation(JSONObject location,int priority, int imageId) {
-
-        if (location == null) {
-            return;
-        }
-
-        if (mUseGoogleMap) {
-            handleGoogleLocation(location,priority,imageId);
-        } else {
-            handleBaiduLocation(location,priority,imageId);
-        }
-
-    }
-
-    private void handleGoogleLocation(JSONObject location,int priority, int imageId) {
-
-        String port = location.optString("port");
-        String name = location.optString("name");
-        String addr = location.optString("addr");
-        String lonStr = location.optString("lon");
-        String latStr = location.optString("lat");
-
-        if (lonStr != null && lonStr.length() > 0 && latStr != null && latStr.length() > 0) {
-
-            if (port == null) {
-                port = "";
-            }
-            if (addr == null) {
-                addr = "";
-            }
 
-            com.google.android.gms.maps.model.MarkerOptions options = new com.google.android.gms.maps.model.MarkerOptions();
-            options.icon(com.google.android.gms.maps.model.BitmapDescriptorFactory.fromResource(imageId))
-                    .position(new com.google.android.gms.maps.model.LatLng(Double.parseDouble(latStr), Double.parseDouble(lonStr)))
-                    .title(name)
-                    .snippet(port + " " + addr);
-            options.zIndex(priority);
+            mMapView.setCenter(Double.valueOf(latStr), Double.valueOf(lonStr));
 
-            com.google.android.gms.maps.model.Marker marker = mGoogleMap.addMarker(options);
-
-            if (port.equals("Vessel")) {
-                mCurrentGoogleMarker = marker;
-            }
-
-        } else {
-            return;
+//            if (mUseGoogleMap) {
+//
+//                CameraPosition newLocation = new CameraPosition.Builder()
+//                        .target(new com.google.android.gms.maps.model.LatLng(Float.valueOf(latStr), Float.valueOf(lonStr)))
+//                        .zoom(2.5f)
+//                        .bearing(0)
+//                        .tilt(0)
+//                        .build();
+//                mGoogleMap.moveCamera(CameraUpdateFactory.newCameraPosition(newLocation));
+//            }
+
+//            else {
+//
+//                LatLng center = new LatLng(Float.valueOf(latStr),Float.valueOf(lonStr)); //设定中心点坐标
+//                MapStatus mMapStatus = new MapStatus.Builder()//定义地图状态
+//                                                    .target(center)
+//                                                    .zoom(2.5f)
+//                                                    .build();  //定义MapStatusUpdate对象,以便描述地图状态将要发生的变化
+//                MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus);
+//                mBaiduMap.getMap().setMapStatus(mMapStatusUpdate);//改变地图状态
+//            }
         }
 
     }
 
-    private void handleBaiduLocation(JSONObject location,int priority, int imageId) {
-
-        String port = location.optString("port");
-        String name = location.optString("name");
-        String addr = location.optString("addr");
-        String lonStr = location.optString("lon");
-        String latStr = location.optString("lat");
-
-        if (lonStr != null && lonStr.length() > 0 && latStr != null && latStr.length() > 0) {
-
-            if (port == null) {
-                port = "";
-            }
-            if (addr == null) {
-                addr = "";
-            }
-
-            LatLng llA = new LatLng(Double.parseDouble(latStr), Double.parseDouble(lonStr));
-            BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(imageId);
-
-            Bundle extrainfo = new Bundle();
-            extrainfo.putString("detail",port + " " + addr);
-
-            MarkerOptions markeroption = new MarkerOptions().position(llA).icon(icon).zIndex(9).title(name).extraInfo(extrainfo).draggable(true);
-            markeroption.zIndex(priority);
-
-            Marker marker = (Marker) mBaiduMap.getMap().addOverlay(markeroption);
-
-            if (port.equals("Vessel")) {
-                mCurrentBaiduMarker = marker;
-            }
+//    private void handleLocation(JSONObject location,int priority, int imageId) {
+//
+//        if (location == null) {
+//            return;
+//        }
+//
+//        if (mUseGoogleMap) {
+//            handleGoogleLocation(location,priority,imageId);
+//        }
+//
+////        else {
+////            handleBaiduLocation(location,priority,imageId);
+////        }
+//
+//    }
 
-        } else {
-            return;
-        }
+//    private void handleGoogleLocation(JSONObject location,int priority, int imageId) {
+//
+//        String port = location.optString("port");
+//        String name = location.optString("name");
+//        String addr = location.optString("addr");
+//        String lonStr = location.optString("lon");
+//        String latStr = location.optString("lat");
+//
+//        if (lonStr != null && lonStr.length() > 0 && latStr != null && latStr.length() > 0) {
+//
+//            if (port == null) {
+//                port = "";
+//            }
+//            if (addr == null) {
+//                addr = "";
+//            }
+//
+//            com.google.android.gms.maps.model.MarkerOptions options = new com.google.android.gms.maps.model.MarkerOptions();
+//            options.icon(com.google.android.gms.maps.model.BitmapDescriptorFactory.fromResource(imageId))
+//                    .position(new com.google.android.gms.maps.model.LatLng(Double.parseDouble(latStr), Double.parseDouble(lonStr)))
+//                    .title(name)
+//                    .snippet(port + " " + addr);
+//            options.zIndex(priority);
+//
+//            com.google.android.gms.maps.model.Marker marker = mGoogleMap.addMarker(options);
+//
+//            if (port.equals("Vessel")) {
+//                mCurrentGoogleMarker = marker;
+//            }
+//
+//        } else {
+//            return;
+//        }
+//
+//    }
 
-    }
+//    private void handleBaiduLocation(JSONObject location,int priority, int imageId) {
+//
+//        String port = location.optString("port");
+//        String name = location.optString("name");
+//        String addr = location.optString("addr");
+//        String lonStr = location.optString("lon");
+//        String latStr = location.optString("lat");
+//
+//        if (lonStr != null && lonStr.length() > 0 && latStr != null && latStr.length() > 0) {
+//
+//            if (port == null) {
+//                port = "";
+//            }
+//            if (addr == null) {
+//                addr = "";
+//            }
+//
+//            LatLng llA = new LatLng(Double.parseDouble(latStr), Double.parseDouble(lonStr));
+//            BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(imageId);
+//
+//            Bundle extrainfo = new Bundle();
+//            extrainfo.putString("detail",port + " " + addr);
+//
+//            MarkerOptions markeroption = new MarkerOptions().position(llA).icon(icon).zIndex(9).title(name).extraInfo(extrainfo).draggable(true);
+//            markeroption.zIndex(priority);
+//
+//            Marker marker = (Marker) mBaiduMap.getMap().addOverlay(markeroption);
+//
+//            if (port.equals("Vessel")) {
+//                mCurrentBaiduMarker = marker;
+//            }
+//
+//        } else {
+//            return;
+//        }
+//
+//    }
 
     private boolean mShowPol = true,mShowPoe,mShowPod = true,mShowPor,mShowOrigin,mShowDestination,mShowCurrent = true,mTwinkleCurrent = true;
 
@@ -591,128 +742,45 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
         return mListener;
     }
 
-    /**
-     * Google
-     * */
 
-    @Override
-    public boolean onMarkerClick(com.google.android.gms.maps.model.Marker marker) {
-        return false;
-    }
-
-    @Override
-    public void onInfoWindowClick(com.google.android.gms.maps.model.Marker marker) {
-
-    }
-
-    @Override
-    public void onMapReady(GoogleMap googleMap) {
-
-        mGoogleMap = googleMap;
-        if (mGoogleMap != null) {
-            mGoogleMap.setInfoWindowAdapter(new ShipMapWindowInfoAdapter());
-//            mGoogleMap.moveCamera(CameraUpdateFactory.newCameraPosition(US));
-            mGoogleMap.setOnMarkerClickListener(this);
-            mGoogleMap.setOnInfoWindowClickListener(this);
-            if (mAnnotation != null) {
-                String port =backup_port;
-                showShipAnnotation(mAnnotation,port);
-            }
-            mGoogleMap.getUiSettings().setMapToolbarEnabled(false); // 隐藏底部ToolBar 导航按钮
-            mGoogleMap.getUiSettings().setRotateGesturesEnabled(false); // 禁止旋转
-
-            // 设置缩放级别
-            CameraUpdate zoom = CameraUpdateFactory.zoomTo(mGoogleMap.getMinZoomLevel());
-            mGoogleMap.animateCamera(zoom);
-        }
-    }
 
     /**
      * Baidu
      * */
-
-    @Override
-    public boolean onMarkerClick(Marker marker) {
-
-//        View viewCache = LayoutInflater.from(mContext).inflate(R.layout.ship_map_bubble, null);
 //
-//        TextView tv_title = (TextView) viewCache.findViewById(R.id.bubble_title);
-//        TextView tv_info = (TextView) viewCache.findViewById(R.id.bubble_detail);
-
-        View viewCache = ((Activity)mContext)
-                .getLayoutInflater().inflate(
-                        R.layout.marker_view, null);
-
-        TextView tv_title = (TextView) viewCache
-                .findViewById(R.id.tv_title);
-        TextView tv_info = (TextView) viewCache
-                .findViewById(R.id.tv_info);
-
-        tv_title.setText(marker.getTitle());
-        tv_info.setText(marker.getExtraInfo().getString("detail"));
-
-        LatLng ll = marker.getPosition();
-        InfoWindow mInfoWindow = new InfoWindow(BitmapDescriptorFactory.fromView(viewCache), ll, -100, this);
-        mBaiduMap.getMap().showInfoWindow(mInfoWindow);
-
-        return true;
-    }
-
-    @Override
-    public void onInfoWindowClick() {
-        mBaiduMap.getMap().hideInfoWindow();
-    }
-
-    /**
-     *
-     * */
-
-    class ShipMapWindowInfoAdapter implements GoogleMap.InfoWindowAdapter
-    {
-
-        View	mContents;
-
-        ShipMapWindowInfoAdapter() {
-            mContents = LayoutInflater.from(mContext).inflate(R.layout.ship_map_bubble, null);
-        }
-
-        @Override
-        public View getInfoContents(com.google.android.gms.maps.model.Marker marker)
-        {
-
-            String title = marker.getTitle();
-            TextView titleUi = ((TextView) mContents.findViewById(R.id.bubble_title));
-
-            if (title != null)
-            {
-                titleUi.setText(title);
-            }
-            else
-            {
-                titleUi.setText("");
-            }
-
-            String snippet = marker.getSnippet();
-            TextView snippetUi = ((TextView) mContents.findViewById(R.id.bubble_detail));
-            if (snippet != null)
-            {
-                snippetUi.setText(snippet);
-            }
-            else
-            {
-                snippetUi.setText("");
-            }
-            return mContents;
-        }
-
-        @Override
-        public View getInfoWindow(com.google.android.gms.maps.model.Marker marker)
-        {
+//    @Override
+//    public boolean onMarkerClick(Marker marker) {
+//
+////        View viewCache = LayoutInflater.from(mContext).inflate(R.layout.ship_map_bubble, null);
+////
+////        TextView tv_title = (TextView) viewCache.findViewById(R.id.bubble_title);
+////        TextView tv_info = (TextView) viewCache.findViewById(R.id.bubble_detail);
+//
+//        View viewCache = ((Activity)mContext)
+//                .getLayoutInflater().inflate(
+//                        R.layout.marker_view, null);
+//
+//        TextView tv_title = (TextView) viewCache
+//                .findViewById(R.id.tv_title);
+//        TextView tv_info = (TextView) viewCache
+//                .findViewById(R.id.tv_info);
+//
+//        tv_title.setText(marker.getTitle());
+//        tv_info.setText(marker.getExtraInfo().getString("detail"));
+//
+//        LatLng ll = marker.getPosition();
+//        InfoWindow mInfoWindow = new InfoWindow(BitmapDescriptorFactory.fromView(viewCache), ll, -100, this);
+//        mBaiduMap.getMap().showInfoWindow(mInfoWindow);
+//
+//        return true;
+//    }
+//
+//    @Override
+//    public void onInfoWindowClick() {
+//        mBaiduMap.getMap().hideInfoWindow();
+//    }
 
-            return null;
-        }
 
-    }
 
     public interface ShipMapListener {
 

+ 0 - 39
ApexDrivers/apexmobile/src/main/java/com/usai/util/RAUtil.java

@@ -1,53 +1,14 @@
 package com.usai.util;
 
-import android.app.Activity;
 import android.content.Context;
-import android.content.Intent;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Matrix;
-import android.media.ExifInterface;
-import android.media.MediaScannerConnection;
-import android.net.Uri;
-import android.os.Build;
 import android.os.Bundle;
-import android.os.Environment;
-import android.provider.Settings;
-import android.support.v4.app.ActivityCompat;
-import android.support.v4.content.FileProvider;
-import android.support.v4.content.PermissionChecker;
-import android.util.Log;
-import android.webkit.MimeTypeMap;
 
 import com.usai.apex.ApexTrackingApplication;
 import com.usai.redant.rautils.utils.FileManager;
-import com.usai.redant.rautils.utils.ImageUtil;
 
-import org.json.JSONArray;
-import org.json.JSONException;
 import org.json.JSONObject;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.lang.reflect.Array;
-import java.nio.channels.FileChannel;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
 
 /**
  * Created by ray on 27/06/2017.

+ 1 - 1
ApexDrivers/apexmobile/src/main/java/com/usai/util/dbUtil.java

@@ -616,7 +616,7 @@ public class dbUtil
 			String user = cursor.getString(0);
 			users.add(user);
 		}
-
+		dbUtil.CloseCursor(cursor);
 		int maxDisplay = 3;
 
 		String[] functions_arr = {"Ocean Booking", "Ocean B/L info.", "Container detail"};

+ 0 - 33
ApexDrivers/apexmobile/src/main/res/layout/activity_detail.xml

@@ -1,33 +0,0 @@
-<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/tabhost"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent" >
-
-    <RelativeLayout
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent" >
-
-
-        <TabWidget
-            android:id="@android:id/tabs"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_alignParentBottom="true"/>
-        <FrameLayout
-            android:id="@android:id/tabcontent"
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
-            android:layout_above="@android:id/tabs"
-            android:layout_alignParentLeft="true" >
-
-        </FrameLayout>
-
-        <View
-            android:id="@+id/view2"
-            android:layout_width="match_parent"
-            android:layout_height="1dp"
-            android:layout_above="@android:id/tabs"
-            android:background="@drawable/bottom_shadow" />
-    </RelativeLayout>
-
-</TabHost>

+ 0 - 64
ApexDrivers/apexmobile/src/main/res/layout/activity_function_select.xml

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

+ 2 - 1
ApexDrivers/apexmobile/src/main/res/layout/activity_new_detail.xml

@@ -31,7 +31,8 @@
         android:layout_width="match_parent"
         android:layout_height="40dp"
 
-
+        app:labelVisibilityMode="labeled"
+        app:itemHorizontalTranslationEnabled="false"
         android:background="@color/tab_bg"
         app:itemTextColor="@drawable/bottom_navigation_selector"
         app:layout_constraintBottom_toBottomOf="parent"

+ 0 - 140
ApexDrivers/apexmobile/src/main/res/layout/activity_result.xml

@@ -1,140 +0,0 @@
-<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"
-    tools:context=".ResultActivity" >
-
-    
-
-    <ScrollView
-        android:id="@+id/scrollView1"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_above="@+id/foot"
-        android:layout_below="@+id/head" >
-
-        <HorizontalScrollView
-            android:id="@+id/search_form"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content" >
-
-            <TableLayout
-                android:id="@+id/result_table"
-                android:layout_width="wrap_content"
-                android:layout_height="fill_parent"
-                android:padding="2dp"
-                android:background="@android:color/holo_blue_bright" >
-
-                <TableRow
-                    android:id="@+id/tr_header"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content" >
-                </TableRow>
-            </TableLayout>
-        </HorizontalScrollView>
-    </ScrollView>
-<RelativeLayout
-        android:id="@+id/status"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        android:layout_centerInParent="true"
-        android:layout_gravity="center"
-        
-        android:orientation="vertical"
-        android:visibility="gone" >
-
-        <TextView
-            android:id="@+id/status_message"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@+id/progressbar"
-            android:layout_centerHorizontal="true"
-            android:layout_marginBottom="16dp"
-            android:text="Loading..."
-            android:textAppearance="?android:attr/textAppearanceMedium" />
-
-        <ProgressBar
-            android:id="@+id/progressbar"
-            style="?android:attr/progressBarStyleLarge"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_centerInParent="true"
-            android:layout_marginTop="41dp" />
-    </RelativeLayout>
-    <LinearLayout
-        android:id="@+id/foot"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_alignParentBottom="true" >
-
-        <Button
-            android:id="@+id/btn_pre"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            style="?android:attr/buttonBarButtonStyle"
-            android:text="@string/str_prepage" 
-            android:enabled="false"/>
-
-        <Button
-            android:id="@+id/btn_next"
-            style="?android:attr/buttonBarButtonStyle"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-
-            android:enabled="false"
-            android:text="@string/str_nextpage" />
-
-    </LinearLayout>
-
-    <TextView
-        android:id="@+id/head"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentTop="true"
-        android:layout_centerHorizontal="true"
-        android:text="@string/str_0"
-        android:textAppearance="?android:attr/textAppearanceLarge" />
-
-    <LinearLayout
-        android:id="@+id/ll_refresh"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-       
-        android:layout_centerHorizontal="true"
-        android:layout_centerVertical="true"
-        android:orientation="vertical" 
-        android:gravity="center_horizontal"
-        android:visibility="invisible">
-
-        <TextView
-            android:id="@+id/tv_ver"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:gravity="center_horizontal"
-            android:text="Failed to get records\nTap Refresh button to retry" 
-            android:textAppearance="?android:attr/textAppearanceLarge" />
-            <Button
-                android:id="@+id/btn_refresh"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="10dp"
-
-                android:drawableLeft="@android:drawable/ic_popup_sync"
-                style="?android:attr/buttonBarButtonStyle"
-                android:text="Refresh" />
-     <!--    <FrameLayout
-            android:layout_width="wrap_content"
-            
-            android:layout_height="wrap_content"
-            android:background="@android:color/holo_blue_dark" 
-            android:layout_marginTop="10dp"> 
-
-
-
-        </FrameLayout>-->
-
-    </LinearLayout>
-
-</RelativeLayout>

+ 2 - 1
ApexDrivers/apexmobile/src/main/res/layout/activity_root.xml

@@ -46,7 +46,8 @@
         android:id="@+id/bottom_navigation"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-
+        app:labelVisibilityMode="labeled"
+        app:itemHorizontalTranslationEnabled="false"
 
         android:background="@color/tab_bg"
         app:itemTextColor="@drawable/bottom_navigation_selector"

+ 0 - 44
ApexDrivers/apexmobile/src/main/res/layout/activity_search.xml

@@ -1,44 +0,0 @@
-<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"
-    tools:context=".SearchActivity" >
-
-    <ListView
-        android:id="@android:id/list"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_above="@+id/foot"
-        android:layout_alignParentLeft="true"
-        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="horizontal" >
-
-            <Button
-                android:id="@+id/btncancel"
-                style="?android:attr/buttonStyleSmall"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:text="@string/str_cancel" />
-
-            <Button
-                android:id="@+id/btnok"
-                style="?android:attr/buttonStyleSmall"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:text="@string/search" />
-        </LinearLayout>
-
-
-</RelativeLayout>

+ 0 - 58
ApexDrivers/apexmobile/src/main/res/layout/activity_search_result.xml

@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<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:background="#ffffff"
-    tools:context="com.usai.apex.result.SearchResultActivity">
-
-
-    <!--<View-->
-        <!--android:id="@+id/result_refresh_header"-->
-        <!--android:layout_width="match_parent"-->
-        <!--android:layout_height="60dp"-->
-        <!--android:layout_marginTop="-60dp"-->
-        <!--android:background="#a3d309"-->
-        <!--/>-->
-
-    <android.support.v4.widget.SwipeRefreshLayout
-        android:id="@+id/result_swipe"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <HorizontalScrollView
-            android:id="@+id/horizontal_scroll"
-            android:layout_width="wrap_content"
-            android:layout_height="match_parent"
-            android:background="#ffffff"
-            >
-
-
-            <com.usai.apex.result.PullRefreshListView
-                android:id="@+id/result_table_list"
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:background="#ffffff"
-                >
-
-            </com.usai.apex.result.PullRefreshListView>
-
-
-        </HorizontalScrollView>
-
-    </android.support.v4.widget.SwipeRefreshLayout>
-
-    <TextView
-        android:id="@+id/result_refresh_footer"
-        android:layout_width="match_parent"
-        android:layout_height="30dp"
-        android:layout_below="@id/result_swipe"
-        android:background="#445588"
-        android:text="Loading More..."
-        android:textSize="22sp"
-        android:textColor="#ffffff"
-        android:gravity="center"
-        />
-
-</RelativeLayout>

+ 0 - 16
ApexDrivers/apexmobile/src/main/res/layout/activity_test.xml

@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    tools:context=".TestActivity">
-
-    <com.usai.apex.shipmap.ShipMap
-        android:id="@+id/ship_map"
-        android:layout_width="match_parent"
-        android:layout_height="200dp"
-        />
-
-</RelativeLayout>

+ 0 - 10
ApexDrivers/apexmobile/src/main/res/layout/activity_test_app_com.xml

@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    tools:context="com.usai.apex.TestAppComActivity">
-
-</android.support.constraint.ConstraintLayout>

+ 0 - 186
ApexDrivers/apexmobile/src/main/res/layout/new_function_select.xml

@@ -1,186 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:layout_alignParentTop="true"
-    android:layout_centerHorizontal="true"
-    android:orientation="vertical"
-    tools:context=".FunctionSelectActivity" >
-
-    <TextView
-        android:id="@+id/tv_content"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="@string/str_containerstatus"
-        android:textAppearance="?android:attr/textAppearanceMedium" />
-
-    <RadioGroup
-        android:id="@+id/radioGroup1"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginBottom="5dp"
-        android:layout_marginTop="5dp"
-        android:orientation="horizontal" >
-
-        <RadioButton
-            android:id="@+id/radio0"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:checked="true"
-            android:text="H_BOL" />
-
-        <RadioButton
-            android:id="@+id/radio1"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:text="Container#" />
-    </RadioGroup>
-
-    <AutoCompleteTextView
-        android:id="@+id/atv_criterion"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:completionThreshold="1"
-        android:hint="@string/prompt_search_criterion"
-        android:inputType="textAutoComplete"
-        android:maxLines="1"
-        android:singleLine="true" >
-    </AutoCompleteTextView>
-
-    <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:layout_weight="1"
-            android:text="@string/str_clear" />
-
-        <Button
-            android:id="@+id/btn_search"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:text="@string/search" />
-    </LinearLayout>
-
-    <View
-        android:layout_width="fill_parent"
-        android:layout_height="2dp"
-        android:layout_marginBottom="15dp"
-        android:layout_marginTop="15dp"
-        android:background="?android:attr/listDivider" />
-
-    <TableLayout
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:shrinkColumns="*"
-        android:stretchColumns="*" >
-
-        <TableRow
-            android:id="@+id/tableRow3"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content" >
-
-            <TextView
-                android:id="@+id/tv_booking"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:clickable="true"
-                android:drawableTop="@drawable/ic_oceanbooking"
-                android:enabled="true"
-                android:focusable="true"
-                android:gravity="center"
-                android:text="Ocean\nBooking" />
-
-            <TextView
-                android:id="@+id/tv_info"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:clickable="true"
-                android:drawableTop="@drawable/ic_ocean_blinfo"
-                android:enabled="true"
-                android:focusable="true"
-                android:gravity="center"
-                android:text="Ocean\nB/L Info." />
-
-            <TextView
-                android:id="@+id/tv_detail"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:clickable="true"
-                android:drawableTop="@drawable/ic_container_detail"
-                android:enabled="true"
-                android:focusable="true"
-                android:gravity="center"
-                android:text="Container\nDetail" />
-
-            <TextView
-                android:id="@+id/tv_doc"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:clickable="true"
-                android:drawableTop="@drawable/ic_document"
-                android:enabled="true"
-                android:focusable="true"
-                android:gravity="center"
-                android:text="Document\nManage" />
-        </TableRow>
-
-        <TableRow
-            android:id="@+id/tableRow4"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="10dp" >
-
-            <TextView
-                android:id="@+id/tv_message"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:clickable="true"
-                android:drawableTop="@drawable/ic_message"
-                android:enabled="true"
-                android:focusable="true"
-                android:gravity="center"
-                android:text="Message" />
-
-            <TextView
-                android:id="@+id/tv_location"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:clickable="true"
-                android:drawableTop="@drawable/ic_service_location"
-                android:enabled="true"
-                android:focusable="true"
-                android:gravity="center"
-                android:text="Service\nLocation" />
-
-            <TextView
-                android:id="@+id/tv_tools"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:clickable="true"
-                android:drawableTop="@drawable/ic_tools"
-                android:enabled="true"
-                android:focusable="true"
-                android:gravity="center"
-                android:text="Tools" />
-
-            <TextView
-                android:id="@+id/tv_exit"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:clickable="true"
-                android:drawableTop="@drawable/ic_exit"
-                android:enabled="true"
-                android:focusable="true"
-                android:gravity="center"
-                android:text="Logout" />
-        </TableRow>
-    </TableLayout>
-
-</LinearLayout>

Неке датотеке нису приказане због велике количине промена