Ray Zhang 12 жил өмнө
parent
commit
215191e239

+ 0 - 1
Apex/.classpath

@@ -4,6 +4,5 @@
 	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
 	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
 	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
-	<classpathentry kind="src" path="gen"/>
 	<classpathentry kind="output" path="bin/classes"/>
 </classpath>

+ 13 - 7
Apex/AndroidManifest.xml

@@ -38,17 +38,19 @@
 
         <activity
             android:name="com.usai.apex.DetailActivity"
-            android:label="@string/title_activity_detail" 
-            android:screenOrientation="landscape">
+            android:label="@string/title_activity_detail"
+            android:screenOrientation="landscape" >
             <meta-data
                 android:name="android.support.PARENT_ACTIVITY"
                 android:value="android.support.v4.app.FragmentActivity" />
 
-         <!--    <intent-filter>
+            <!--
+            <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
                 <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>  -->
+            </intent-filter>
+            -->
         </activity>
         <activity
             android:name="com.usai.apex.ApexActivity"
@@ -70,7 +72,7 @@
         <activity
             android:name="com.usai.apex.DirectTrackingFragment"
             android:label="@string/title_activity_direct_tracking" >
-        </activity>




+        </activity>





         -->
         <activity
             android:name="com.usai.apex.FunctionSelectActivity"
@@ -103,8 +105,12 @@
         <activity
             android:name="com.usai.apex.HelpActivity"
             android:label="@string/title_activity_help"
-            android:theme="@android:style/Theme.Holo.NoActionBar"
-            android:screenOrientation="portrait" >
+            android:screenOrientation="portrait"
+            android:theme="@android:style/Theme.Holo.NoActionBar" >
+        </activity>
+        <activity
+            android:name="com.usai.apex.CargoTrackingActivity"
+            android:label="@string/title_activity_cargo_tracking" >
         </activity>
     </application>
 

+ 4 - 1
Apex/res/drawable/detail_tag.xml

@@ -1,7 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android" >
 
-  
+      <gradient
+        android:angle="0"
+        android:endColor="#00000000"
+        android:startColor="#00000000" />
 
     <stroke
         android:width="1dp"

+ 66 - 0
Apex/res/layout/activity_cargo_tracking.xml

@@ -0,0 +1,66 @@
+<LinearLayout 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:orientation="vertical"
+    android:paddingBottom="@dimen/activity_vertical_margin"
+    android:paddingLeft="@dimen/activity_horizontal_margin"
+    android:paddingRight="@dimen/activity_horizontal_margin"
+    android:paddingTop="@dimen/activity_vertical_margin"
+    tools:context=".CargoTrackingActivity" >
+
+    <TextView
+        android:id="@+id/textView2"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Search by"
+        android:textAppearance="?android:attr/textAppearanceMedium" />
+
+    <RadioGroup
+        android:id="@+id/radioGroup1"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" >
+
+        <RadioButton
+            android:id="@+id/radio0"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:checked="true"
+            android:text="H_BOL" />
+
+        <RadioButton
+            android:id="@+id/radio1"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Container#" />
+    </RadioGroup>
+
+    <EditText
+        android:id="@+id/et_criterion"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:hint="@string/prompt_search_criterion" >
+
+        <requestFocus />
+    </EditText>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content" >
+
+        <Button
+            android:id="@+id/btn_cancel"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="Cancel" />
+
+        <Button
+            android:id="@+id/btn_search"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="Search" />
+    </LinearLayout>
+
+</LinearLayout>

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

@@ -53,7 +53,7 @@
         </EditText>
 
         <Button
-            android:id="@+id/button1"
+            android:id="@+id/btn_cancel"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="right"

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

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

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

@@ -37,11 +37,13 @@
     <string name="title_activity_detail">DetailActivity</string>
     <string name="search">Search</string>
     <!-- locations -->
-   
+
+
     <!-- test -->
     <string name="url"><a href="http://www.google.com">A1401330351H.pdf</a></string>
     <string name="link_text_manual"><b>text2: Explicit links using &lt;a&gt; markup.</b>      This has markup for a <a href="http://www.google.com">link</a> specified
       via an &lt;a&gt; tag.  Use a \"tel:\" URL
       to <a href="tel:4155551212">dial a phone number</a>.
</string>
+    <string name="title_activity_cargo_tracking">CargoTrackingActivity</string>
 
 </resources>

+ 83 - 0
Apex/src/com/usai/apex/CargoTrackingActivity.java

@@ -0,0 +1,83 @@
+package com.usai.apex;
+
+import android.os.Bundle;
+import android.app.Activity;
+import android.content.Intent;
+import android.text.TextUtils;
+import android.view.Menu;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.RadioGroup;
+
+public class CargoTrackingActivity extends Activity implements OnClickListener
+{
+	String function_name;
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState)
+	{
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_cargo_tracking);
+		Button btn_cancel = (Button) findViewById(R.id.btn_cancel);
+		btn_cancel.setOnClickListener(this);
+		Button btn_search = (Button) findViewById(R.id.btn_search);
+		btn_search.setOnClickListener(this);
+		function_name = getIntent().getStringExtra("function_name");
+	}
+
+	// @Override
+	// public boolean onCreateOptionsMenu(Menu menu)
+	// {
+	// // Inflate the menu; this adds items to the action bar if it is present.
+	// getMenuInflater().inflate(R.menu.cargo_tracking, menu);
+	// return true;
+	// }
+
+	@Override
+	public void onClick(View v)
+	{
+		switch (v.getId())
+		{
+		case R.id.btn_cancel:
+		{
+			finish();
+			break;
+		}
+		case R.id.btn_search:
+		{
+			EditText et = (EditText) findViewById(R.id.et_criterion);
+			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, DetailActivity.class);
+
+				intent.putExtra("action1" , "Tracking");
+				intent.putExtra("function_name", "cargo_tracking");
+				intent.putExtra("cargo_criterion", cargo_criterion);
+				intent.putExtra("actions_count", 1);
+				RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup1);
+				if(rg.getCheckedRadioButtonId ()==R.id.radio0)
+					intent.putExtra("criterion_type", 0);
+				else
+					intent.putExtra("criterion_type", 1);
+//				hbol
+//				container_no
+				startActivity(intent);
+			}
+			break;
+		}
+		default:
+			break;
+		}
+
+	}
+
+}

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

@@ -32,6 +32,8 @@ public class DetailActivity extends FragmentActivity implements
 	// DetailFragment>();
 	String function_name;
 	String _id;
+	String cargo_criterion;
+	int criterion_type;
 
 	@Override
 	protected void onCreate(Bundle savedInstanceState)
@@ -47,6 +49,11 @@ public class DetailActivity extends FragmentActivity implements
 					commonUtil.generateViewId());
 		}
 		function_name = getIntent().getStringExtra("function_name");
+		if (function_name == "cargo_tracking")
+		{
+			criterion_type = getIntent().getIntExtra("criterion_type", 0);
+			cargo_criterion = getIntent().getStringExtra("cargo_criterion");
+		}
 		_id = getIntent().getStringExtra("_id");
 		setupTabs();
 
@@ -93,6 +100,14 @@ public class DetailActivity extends FragmentActivity implements
 
 		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);

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

@@ -17,7 +17,7 @@ public class DirectTrackingFragment extends Fragment implements OnClickListener
 			Bundle savedInstanceState)
 	{
 		View view = inflater.inflate(R.layout.fragment_direct_tracking, null);
-		Button btn = (Button) view.findViewById(R.id.button1);
+		Button btn = (Button) view.findViewById(R.id.btn_cancel);
 		btn.setOnClickListener(this);
 		return view;
 		// return super.onCreateView(inflater, container, savedInstanceState);

+ 8 - 0
Apex/src/com/usai/apex/FunctionSelectActivity.java

@@ -88,6 +88,14 @@ public class FunctionSelectActivity extends FragmentActivity implements OnClickL
 			break;
 		}
 		case R.id.ibtn_cargo:
+		{
+			Intent intent = new Intent();
+			intent.setClass(this, CargoTrackingActivity.class);
+			intent.putExtra("user", user);
+			intent.putExtra("password", password);
+			intent.putExtra("function_name", "Cargo Tracking");
+			startActivity(intent);			
+		}
 			
 			break;
 		case R.id.ibtn_doc:

+ 9 - 4
Apex/src/com/usai/apex/LoginFragment.java

@@ -112,7 +112,6 @@ public class LoginFragment extends Fragment/* implements OnClickListener */
 		// return super.onCreateView(inflater, container, savedInstanceState);
 	}
 
-	
 	// /**
 	// * Attempts to sign in or register the account specified by the login
 	// form.
@@ -254,10 +253,8 @@ public class LoginFragment extends Fragment/* implements OnClickListener */
 			{
 				return false;
 			}
-	
-		}
-
 
+		}
 
 		@Override
 		protected void onPostExecute(final Boolean success)
@@ -303,8 +300,16 @@ public class LoginFragment extends Fragment/* implements OnClickListener */
 			}
 
 			default:
+			{
+				Toast toast = Toast.makeText(getActivity()
+						.getApplicationContext(),
+						"Unknown error code:"+errorcode,
+						Toast.LENGTH_LONG);
+				toast.setGravity(Gravity.CENTER, 0, 0);
+				toast.show();
 				break;
 			}
+			}
 
 			if (success)
 			{

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

@@ -198,7 +198,7 @@ public class ResultActivity extends Activity
 		Cursor cursor = db.query("actions_info",
 				new String[] { "name", "_id" }, "function_name='"
 						+ function_name + "' and user='" + user + "'", null,
-				null, null, null, null);
+				null, null, "priority", null);
 		int i = 0;
 		while (cursor.moveToNext())
 		{

+ 5 - 5
Apex/src/com/usai/util/Network.java

@@ -561,7 +561,7 @@ public class Network
 				db = dbUtil.OpenDB(ApexTrackingApplication.get_instance(),
 						null, true);
 				String sql = "insert into fields_info(name,aname,field_type,function_name,behavior,priority,show,user) values(?,?,?,?,?,?,?,?)";
-				String sql1 = "insert into actions_info(name,function_name,user) values(?,?,?)";
+				String sql1 = "insert into actions_info(name,function_name,user,priority) values(?,?,?,?)";
 				db.execSQL("update fields_info set abandon = 1 where user ='"
 						+ user + "'");
 				db.execSQL("update actions_info set abandon = 1 where user ='"
@@ -658,9 +658,8 @@ public class Network
 												// certain function
 					{
 						String actionname = (String) itactions.next();
-						boolean b = objbehavior.getBoolean(actionname);
-						if (b == false)
-							continue;
+						int action_priority = objbehavior.getInt(actionname);
+
 
 						int id = dbUtil.get_recordid(db, "actions_info",
 								"name='" + actionname + "' and function_name='"
@@ -668,7 +667,7 @@ public class Network
 										+ "'");
 						if (id >= 0) // record exist;
 						{
-							db.execSQL("update actions_info set abandon = 0 where _id ="
+							db.execSQL("update actions_info set abandon = 0 , priority="+action_priority+" where _id ="
 									+ id);
 						}
 						else
@@ -676,6 +675,7 @@ public class Network
 							stat1.bindString(1, actionname);
 							stat1.bindString(2, func_name);
 							stat1.bindString(3, user);
+							stat1.bindLong(4, action_priority);
 							stat1.executeInsert();
 
 						}

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

@@ -381,8 +381,8 @@ public class dbUtil
 
 		dbHelper.addInitSQL("CREATE TABLE actions_info ("
 				+ "_id INTEGER PRIMARY KEY," + "name VARCHAR(20),"
-				+ "function_name VARCHAR(20)," + "abandon BOOLEAN,"
-				+ "user VARCHAR(20))");
+				+ "function_name VARCHAR(20)," + "priority INTEGER,"
+				+ "abandon BOOLEAN," + "user VARCHAR(20))");
 		// dbHelper.addInitSQL("create table pics (" +
 		// "_id INTEGER PRIMARY KEY,"
 		// + "picker varchar(20)," + "err_code INTEGER ,"