|
@@ -3,41 +3,33 @@ package com.usai.apex;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
import java.util.Iterator;
|
|
import java.util.Iterator;
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
-
|
|
|
|
|
import org.json.JSONException;
|
|
import org.json.JSONException;
|
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
import com.usai.util.Network;
|
|
import com.usai.util.Network;
|
|
|
import com.usai.util.dbUtil;
|
|
import com.usai.util.dbUtil;
|
|
|
|
|
|
|
|
-import android.R.bool;
|
|
|
|
|
-import android.R.integer;
|
|
|
|
|
import android.os.AsyncTask;
|
|
import android.os.AsyncTask;
|
|
|
import android.os.Build;
|
|
import android.os.Build;
|
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
|
|
|
+import android.R.integer;
|
|
|
import android.animation.Animator;
|
|
import android.animation.Animator;
|
|
|
import android.animation.AnimatorListenerAdapter;
|
|
import android.animation.AnimatorListenerAdapter;
|
|
|
-import android.app.ActionBar.LayoutParams;
|
|
|
|
|
import android.app.Activity;
|
|
import android.app.Activity;
|
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
|
import android.database.Cursor;
|
|
import android.database.Cursor;
|
|
|
import android.database.sqlite.SQLiteDatabase;
|
|
import android.database.sqlite.SQLiteDatabase;
|
|
|
|
|
+import android.graphics.Color;
|
|
|
import android.util.Log;
|
|
import android.util.Log;
|
|
|
import android.view.ContextMenu;
|
|
import android.view.ContextMenu;
|
|
|
import android.view.Gravity;
|
|
import android.view.Gravity;
|
|
|
import android.view.Menu;
|
|
import android.view.Menu;
|
|
|
import android.view.MenuItem;
|
|
import android.view.MenuItem;
|
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
-import android.view.ViewGroup;
|
|
|
|
|
import android.view.ContextMenu.ContextMenuInfo;
|
|
import android.view.ContextMenu.ContextMenuInfo;
|
|
|
import android.view.View.OnCreateContextMenuListener;
|
|
import android.view.View.OnCreateContextMenuListener;
|
|
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
|
|
-import android.widget.BaseAdapter;
|
|
|
|
|
import android.widget.Button;
|
|
import android.widget.Button;
|
|
|
-import android.widget.GridView;
|
|
|
|
|
-import android.widget.SimpleAdapter;
|
|
|
|
|
import android.widget.TableLayout;
|
|
import android.widget.TableLayout;
|
|
|
import android.widget.TableRow;
|
|
import android.widget.TableRow;
|
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
@@ -49,6 +41,8 @@ public class ResultActivity extends Activity
|
|
|
String password = null;
|
|
String password = null;
|
|
|
String function_name = null;
|
|
String function_name = null;
|
|
|
private SearchTask m_task = null;
|
|
private SearchTask m_task = null;
|
|
|
|
|
+
|
|
|
|
|
+ int sel = -1;
|
|
|
|
|
|
|
|
Bundle searchParms = null;
|
|
Bundle searchParms = null;
|
|
|
SearchResult searchresult = new SearchResult();
|
|
SearchResult searchresult = new SearchResult();
|
|
@@ -73,7 +67,7 @@ public class ResultActivity extends Activity
|
|
|
searchParms = getIntent().getBundleExtra("searchParms");
|
|
searchParms = getIntent().getBundleExtra("searchParms");
|
|
|
super.onCreate(savedInstanceState);
|
|
super.onCreate(savedInstanceState);
|
|
|
setContentView(R.layout.activity_result);
|
|
setContentView(R.layout.activity_result);
|
|
|
- footview = findViewById(R.id.foot);
|
|
|
|
|
|
|
+ footview = findViewById(R.id.foot);
|
|
|
// mSearchFormView = findViewById(R.id.search_form);
|
|
// mSearchFormView = findViewById(R.id.search_form);
|
|
|
Button btnnext = (Button) findViewById(R.id.btn_next);
|
|
Button btnnext = (Button) findViewById(R.id.btn_next);
|
|
|
btnnext.setOnClickListener(new View.OnClickListener()
|
|
btnnext.setOnClickListener(new View.OnClickListener()
|
|
@@ -82,10 +76,10 @@ public class ResultActivity extends Activity
|
|
|
@Override
|
|
@Override
|
|
|
public void onClick(View v)
|
|
public void onClick(View v)
|
|
|
{
|
|
{
|
|
|
-// TextView tv_head = (TextView) findViewById(R.id.tv_head);
|
|
|
|
|
|
|
+ // TextView tv_head = (TextView) findViewById(R.id.tv_head);
|
|
|
|
|
|
|
|
searchresult.set_direction(1);
|
|
searchresult.set_direction(1);
|
|
|
- if (searchresult.get_totalcount()==-1)
|
|
|
|
|
|
|
+ if (searchresult.get_totalcount() == -1)
|
|
|
requestdata(true);
|
|
requestdata(true);
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -94,7 +88,7 @@ public class ResultActivity extends Activity
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
Button btnpre = (Button) findViewById(R.id.btn_pre);
|
|
Button btnpre = (Button) findViewById(R.id.btn_pre);
|
|
|
btnpre.setOnClickListener(new View.OnClickListener()
|
|
btnpre.setOnClickListener(new View.OnClickListener()
|
|
|
{
|
|
{
|
|
@@ -102,9 +96,9 @@ public class ResultActivity extends Activity
|
|
|
@Override
|
|
@Override
|
|
|
public void onClick(View v)
|
|
public void onClick(View v)
|
|
|
{
|
|
{
|
|
|
-// TextView tv_head = (TextView) findViewById(R.id.tv_head);
|
|
|
|
|
|
|
+ // TextView tv_head = (TextView) findViewById(R.id.tv_head);
|
|
|
searchresult.set_direction(-1);
|
|
searchresult.set_direction(-1);
|
|
|
- if (searchresult.get_totalcount()==-1)
|
|
|
|
|
|
|
+ if (searchresult.get_totalcount() == -1)
|
|
|
requestdata(true);
|
|
requestdata(true);
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -119,6 +113,7 @@ public class ResultActivity extends Activity
|
|
|
requestdata(true);
|
|
requestdata(true);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
private OnCreateContextMenuListener m_tableMenu = new OnCreateContextMenuListener()
|
|
private OnCreateContextMenuListener m_tableMenu = new OnCreateContextMenuListener()
|
|
|
{
|
|
{
|
|
|
|
|
|
|
@@ -127,80 +122,97 @@ public class ResultActivity extends Activity
|
|
|
ContextMenuInfo contextmenuinfo)
|
|
ContextMenuInfo contextmenuinfo)
|
|
|
{
|
|
{
|
|
|
// TODO Auto-generated method stub
|
|
// TODO Auto-generated method stub
|
|
|
|
|
+ // TableLayout tl = (TableLayout) view;
|
|
|
|
|
+ //
|
|
|
|
|
+ // TableRow tr = (TableRow) tl.getFocusedChild();
|
|
|
|
|
+ // View v = (View) tl.getFocusedChild();
|
|
|
contextmenu.add(Menu.NONE, 0, 0, "Detail");
|
|
contextmenu.add(Menu.NONE, 0, 0, "Detail");
|
|
|
// contextmenu.add(Menu.NONE, 1, 1, "±à¼");
|
|
// contextmenu.add(Menu.NONE, 1, 1, "±à¼");
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public boolean onContextItemSelected(MenuItem item)
|
|
public boolean onContextItemSelected(MenuItem item)
|
|
|
{
|
|
{
|
|
|
// TODO Auto-generated method stub
|
|
// TODO Auto-generated method stub
|
|
|
AdapterContextMenuInfo menuInfo;
|
|
AdapterContextMenuInfo menuInfo;
|
|
|
- menuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
|
|
|
|
|
-// Cursor cursor = (Cursor) m_ListView
|
|
|
|
|
-// .getItemAtPosition(menuInfo.position);
|
|
|
|
|
-//
|
|
|
|
|
-// switch (item.getItemId())
|
|
|
|
|
-// {
|
|
|
|
|
-// case 0:
|
|
|
|
|
-// {// remove a record
|
|
|
|
|
-// int idx = cursor.getColumnIndex("number");
|
|
|
|
|
-// String strNumber = cursor.getString(idx);
|
|
|
|
|
-// String whereclause = "number = '" + strNumber + "'";
|
|
|
|
|
-// dbUtil.removeRecords(m_db, "user_numberlist", whereclause);
|
|
|
|
|
-// RefreshList();
|
|
|
|
|
-// // m_listadapter.notifyDataSetChanged();
|
|
|
|
|
-// // this.getListAdapter().notif
|
|
|
|
|
-// break;
|
|
|
|
|
-// }
|
|
|
|
|
-// // case 1:
|
|
|
|
|
-// // {
|
|
|
|
|
-// // //edit a record;
|
|
|
|
|
-// //
|
|
|
|
|
-// // int idx = cursor.getColumnIndex("_id");
|
|
|
|
|
-// // int id = cursor.getInt(idx);
|
|
|
|
|
-// //
|
|
|
|
|
-// // Intent intent = new Intent();
|
|
|
|
|
-// // intent.setClass(this, ActivityNumberListEdit.class);
|
|
|
|
|
-// // NumberEditInfo EditInfo = new NumberEditInfo();
|
|
|
|
|
-// // EditInfo.EditType = NumberEditInfo.TYPE_EDIT;
|
|
|
|
|
-// // EditInfo.EditTableName = m_Activityinfo.TableName;
|
|
|
|
|
-// //
|
|
|
|
|
-// // EditInfo.EditRecordID =id;
|
|
|
|
|
-// // if (m_Activityinfo.TableName == "user_blacklist")
|
|
|
|
|
-// // {
|
|
|
|
|
-// // // deal with black list;
|
|
|
|
|
-// // EditInfo.EditTable = NumberEditInfo.EDIT_TABLE_BLACK;
|
|
|
|
|
-// // EditInfo.CheckTableName = "user_whitelist";
|
|
|
|
|
-// // EditInfo.LabelTextID = R.string.label_AddBlack;
|
|
|
|
|
-// // EditInfo.NumberExistMoveID = R.string.phrase_numexist_white_mov;
|
|
|
|
|
-// // EditInfo.NumberExistID = R.string.phrase_numexist_blk;
|
|
|
|
|
-// // }
|
|
|
|
|
-// // else
|
|
|
|
|
-// // {
|
|
|
|
|
-// // // deal with white list;
|
|
|
|
|
-// // EditInfo.EditTable = NumberEditInfo.EDIT_TABLE_WHITE;
|
|
|
|
|
-// // EditInfo.CheckTableName = "user_blacklist";
|
|
|
|
|
-// // EditInfo.LabelTextID = R.string.label_AddWhite;
|
|
|
|
|
-// // EditInfo.NumberExistMoveID = R.string.phrase_numexist_blk_mov;
|
|
|
|
|
-// // EditInfo.NumberExistID = R.string.phrase_numexist_white;
|
|
|
|
|
-// // }
|
|
|
|
|
-// // intent.putExtra("ActivityInfo", EditInfo);
|
|
|
|
|
-// //
|
|
|
|
|
-// // startActivity(intent);
|
|
|
|
|
-// // break;
|
|
|
|
|
-// // }
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+// menuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
|
|
|
|
|
+ Log.d("table row select", sel+ "");
|
|
|
|
|
+ // Cursor cursor = (Cursor) m_ListView
|
|
|
|
|
+ // .getItemAtPosition(menuInfo.position);
|
|
|
|
|
+ //
|
|
|
|
|
+ // switch (item.getItemId())
|
|
|
|
|
+ // {
|
|
|
|
|
+ // case 0:
|
|
|
|
|
+ // {// remove a record
|
|
|
|
|
+ // int idx = cursor.getColumnIndex("number");
|
|
|
|
|
+ // String strNumber = cursor.getString(idx);
|
|
|
|
|
+ // String whereclause = "number = '" + strNumber + "'";
|
|
|
|
|
+ // dbUtil.removeRecords(m_db, "user_numberlist", whereclause);
|
|
|
|
|
+ // RefreshList();
|
|
|
|
|
+ // // m_listadapter.notifyDataSetChanged();
|
|
|
|
|
+ // // this.getListAdapter().notif
|
|
|
|
|
+ // break;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // // case 1:
|
|
|
|
|
+ // // {
|
|
|
|
|
+ // // //edit a record;
|
|
|
|
|
+ // //
|
|
|
|
|
+ // // int idx = cursor.getColumnIndex("_id");
|
|
|
|
|
+ // // int id = cursor.getInt(idx);
|
|
|
|
|
+ // //
|
|
|
|
|
+ // // Intent intent = new Intent();
|
|
|
|
|
+ // // intent.setClass(this, ActivityNumberListEdit.class);
|
|
|
|
|
+ // // NumberEditInfo EditInfo = new NumberEditInfo();
|
|
|
|
|
+ // // EditInfo.EditType = NumberEditInfo.TYPE_EDIT;
|
|
|
|
|
+ // // EditInfo.EditTableName = m_Activityinfo.TableName;
|
|
|
|
|
+ // //
|
|
|
|
|
+ // // EditInfo.EditRecordID =id;
|
|
|
|
|
+ // // if (m_Activityinfo.TableName == "user_blacklist")
|
|
|
|
|
+ // // {
|
|
|
|
|
+ // // // deal with black list;
|
|
|
|
|
+ // // EditInfo.EditTable = NumberEditInfo.EDIT_TABLE_BLACK;
|
|
|
|
|
+ // // EditInfo.CheckTableName = "user_whitelist";
|
|
|
|
|
+ // // EditInfo.LabelTextID = R.string.label_AddBlack;
|
|
|
|
|
+ // // EditInfo.NumberExistMoveID = R.string.phrase_numexist_white_mov;
|
|
|
|
|
+ // // EditInfo.NumberExistID = R.string.phrase_numexist_blk;
|
|
|
|
|
+ // // }
|
|
|
|
|
+ // // else
|
|
|
|
|
+ // // {
|
|
|
|
|
+ // // // deal with white list;
|
|
|
|
|
+ // // EditInfo.EditTable = NumberEditInfo.EDIT_TABLE_WHITE;
|
|
|
|
|
+ // // EditInfo.CheckTableName = "user_blacklist";
|
|
|
|
|
+ // // EditInfo.LabelTextID = R.string.label_AddWhite;
|
|
|
|
|
+ // // EditInfo.NumberExistMoveID = R.string.phrase_numexist_blk_mov;
|
|
|
|
|
+ // // EditInfo.NumberExistID = R.string.phrase_numexist_white;
|
|
|
|
|
+ // // }
|
|
|
|
|
+ // // intent.putExtra("ActivityInfo", EditInfo);
|
|
|
|
|
+ // //
|
|
|
|
|
+ // // startActivity(intent);
|
|
|
|
|
+ // // break;
|
|
|
|
|
+ // // }
|
|
|
|
|
+ // }
|
|
|
return super.onContextItemSelected(item);
|
|
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 initTable()
|
|
void initTable()
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
-// TableLayout tl = (TableLayout) findViewById(R.id.result_table);
|
|
|
|
|
-// tl.setOnCreateContextMenuListener(m_tableMenu);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ TableLayout tl = (TableLayout) findViewById(R.id.result_table);
|
|
|
|
|
+ tl.setFocusable(true);
|
|
|
|
|
+ tl.setOnCreateContextMenuListener(m_tableMenu);
|
|
|
SQLiteDatabase db = dbUtil.OpenDB(this, null, false);
|
|
SQLiteDatabase db = dbUtil.OpenDB(this, null, false);
|
|
|
Cursor cursor = db.query("fields_info", new String[] { "aname", "name",
|
|
Cursor cursor = db.query("fields_info", new String[] { "aname", "name",
|
|
|
"_id" }, "function_name='" + function_name + "' and user='"
|
|
"_id" }, "function_name='" + function_name + "' and user='"
|
|
@@ -380,10 +392,10 @@ public class ResultActivity extends Activity
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if(searchresult.get_direction()==-1)
|
|
|
|
|
- searchresult.set_offset(searchresult.get_offset()-20);
|
|
|
|
|
- searchParms.putString("offset", searchresult.get_offset()+"");
|
|
|
|
|
-
|
|
|
|
|
|
|
+ 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);
|
|
String jstr = Network.get_records(user, password, searchParms);
|
|
|
if (jstr == null || jstr.length() <= 0)
|
|
if (jstr == null || jstr.length() <= 0)
|
|
|
{
|
|
{
|
|
@@ -398,12 +410,12 @@ public class ResultActivity extends Activity
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
jsobj = new JSONObject(jstr);
|
|
jsobj = new JSONObject(jstr);
|
|
|
-// if (searchresult.get_fieldscount() == 0)
|
|
|
|
|
-// {
|
|
|
|
|
-// JSONObject objfields = jsobj.getJSONObject("fields");
|
|
|
|
|
-// if (objfields != null)
|
|
|
|
|
-// searchresult.init_fields(objfields.toString());
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ // if (searchresult.get_fieldscount() == 0)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // JSONObject objfields = jsobj.getJSONObject("fields");
|
|
|
|
|
+ // if (objfields != null)
|
|
|
|
|
+ // searchresult.init_fields(objfields.toString());
|
|
|
|
|
+ // }
|
|
|
JSONObject objrecords = jsobj.getJSONObject("records");
|
|
JSONObject objrecords = jsobj.getJSONObject("records");
|
|
|
if (objrecords != null)
|
|
if (objrecords != null)
|
|
|
searchresult.add_records(objrecords.toString());
|
|
searchresult.add_records(objrecords.toString());
|
|
@@ -466,52 +478,76 @@ public class ResultActivity extends Activity
|
|
|
if (success)
|
|
if (success)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
-// int loadcount = searchresult.get_count();
|
|
|
|
|
|
|
+ // int loadcount = searchresult.get_count();
|
|
|
int totalcount = searchresult.get_totalcount();
|
|
int totalcount = searchresult.get_totalcount();
|
|
|
TextView tv_head = (TextView) findViewById(R.id.head);
|
|
TextView tv_head = (TextView) findViewById(R.id.head);
|
|
|
if (totalcount == 0)
|
|
if (totalcount == 0)
|
|
|
{
|
|
{
|
|
|
tv_head.setText("0 record found");
|
|
tv_head.setText("0 record found");
|
|
|
- return ;
|
|
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
- tv_head.setText(/*loadcount + "/"
|
|
|
|
|
- + */searchresult.get_totalcount() + " records");
|
|
|
|
|
|
|
+ tv_head.setText(/*
|
|
|
|
|
+ * loadcount + "/" +
|
|
|
|
|
+ */searchresult.get_totalcount()
|
|
|
|
|
+ + " records");
|
|
|
TableLayout tl = (TableLayout) findViewById(R.id.result_table);
|
|
TableLayout tl = (TableLayout) findViewById(R.id.result_table);
|
|
|
|
|
|
|
|
int showcount = tl.getChildCount();
|
|
int showcount = tl.getChildCount();
|
|
|
- tl.removeViews(1, tl.getChildCount()-1);
|
|
|
|
|
-// int newcount = loadcount - showcount + 1;// +1 header row
|
|
|
|
|
|
|
+ tl.removeViews(1, tl.getChildCount() - 1);
|
|
|
|
|
+ // int newcount = loadcount - showcount + 1;// +1 header row
|
|
|
for (int i = 0; i < 10; i++)
|
|
for (int i = 0; i < 10; i++)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
- TableRow recordRow= new TableRow(ResultActivity.this);
|
|
|
|
|
- recordRow.setClickable(true);
|
|
|
|
|
- recordRow.setOnCreateContextMenuListener(m_tableMenu);
|
|
|
|
|
- // recordRow.SETSE
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- HashMap<String, String> record = searchresult
|
|
|
|
|
- .get_record(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);
|
|
|
|
|
+ String no = tvno.getText().toString();
|
|
|
|
|
+ sel=Integer.parseInt(tvno.getText().toString());
|
|
|
|
|
+ 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);
|
|
TextView field = new TextView(ResultActivity.this);
|
|
|
field.setBackgroundResource(R.drawable.tableitem);
|
|
field.setBackgroundResource(R.drawable.tableitem);
|
|
|
- field.setText(searchresult.get_offset()-10+i+"");
|
|
|
|
|
- Log.d("offset="+searchresult.get_offset(), "direction="+searchresult.get_direction());
|
|
|
|
|
|
|
+ field.setText(searchresult.get_offset() - 10 + i + "");
|
|
|
|
|
+ Log.d("offset=" + searchresult.get_offset(), "direction="
|
|
|
|
|
+ + searchresult.get_direction());
|
|
|
field.setGravity(Gravity.CENTER);
|
|
field.setGravity(Gravity.CENTER);
|
|
|
field.setPadding(10, 5, 10, 5);
|
|
field.setPadding(10, 5, 10, 5);
|
|
|
- field.setTextSize(20);
|
|
|
|
|
|
|
+ field.setTextSize(20);
|
|
|
recordRow.addView(field);
|
|
recordRow.addView(field);
|
|
|
for (int j = 0; j < showfieldmap.size(); j++)
|
|
for (int j = 0; j < showfieldmap.size(); j++)
|
|
|
{
|
|
{
|
|
|
TextView field1 = new TextView(ResultActivity.this);
|
|
TextView field1 = new TextView(ResultActivity.this);
|
|
|
String str = record.get(showfieldmap.get(j));
|
|
String str = record.get(showfieldmap.get(j));
|
|
|
field1.setBackgroundResource(R.drawable.tableitem);
|
|
field1.setBackgroundResource(R.drawable.tableitem);
|
|
|
- if(str.toLowerCase().trim().equals("null"))
|
|
|
|
|
- str="";
|
|
|
|
|
-
|
|
|
|
|
-// field1.setBackgroundColor(0xFFFFFFFF);
|
|
|
|
|
|
|
+ if (str.toLowerCase().trim().equals("null"))
|
|
|
|
|
+ str = "";
|
|
|
|
|
+
|
|
|
|
|
+ // field1.setBackgroundColor(0xFFFFFFFF);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
field1.setText(str);
|
|
field1.setText(str);
|
|
|
field1.setGravity(Gravity.CENTER);
|
|
field1.setGravity(Gravity.CENTER);
|
|
|
field1.setPadding(10, 5, 10, 5);
|
|
field1.setPadding(10, 5, 10, 5);
|
|
@@ -523,16 +559,16 @@ public class ResultActivity extends Activity
|
|
|
tl.addView(recordRow);
|
|
tl.addView(recordRow);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
Button btnnext = (Button) findViewById(R.id.btn_next);
|
|
Button btnnext = (Button) findViewById(R.id.btn_next);
|
|
|
|
|
|
|
|
- Button btnpre = (Button) findViewById(R.id.btn_pre);
|
|
|
|
|
- if(searchresult.get_offset()<=10)
|
|
|
|
|
|
|
+ Button btnpre = (Button) findViewById(R.id.btn_pre);
|
|
|
|
|
+ if (searchresult.get_offset() <= 10)
|
|
|
btnpre.setEnabled(false);
|
|
btnpre.setEnabled(false);
|
|
|
- else {
|
|
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
btnpre.setEnabled(true);
|
|
btnpre.setEnabled(true);
|
|
|
}
|
|
}
|
|
|
- if(searchresult.get_totalcount()-searchresult.get_offset()<=10)
|
|
|
|
|
|
|
+ if (searchresult.get_totalcount() - searchresult.get_offset() <= 10)
|
|
|
btnnext.setEnabled(false);
|
|
btnnext.setEnabled(false);
|
|
|
else
|
|
else
|
|
|
btnnext.setEnabled(true);
|
|
btnnext.setEnabled(true);
|
|
@@ -568,7 +604,7 @@ public class ResultActivity extends Activity
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
-// TextView tv_head = (TextView) findViewById(R.id.tv_head);
|
|
|
|
|
|
|
+ // TextView tv_head = (TextView) findViewById(R.id.tv_head);
|
|
|
// m_etPassword
|
|
// m_etPassword
|
|
|
// .setError(getString(R.string.error_incorrect_password));
|
|
// .setError(getString(R.string.error_incorrect_password));
|
|
|
// m_etPassword.requestFocus();
|
|
// m_etPassword.requestFocus();
|
|
@@ -590,14 +626,15 @@ public class ResultActivity extends Activity
|
|
|
int offset = 0;
|
|
int offset = 0;
|
|
|
// int count = 0;
|
|
// int count = 0;
|
|
|
ArrayList<HashMap<String, String>> records = new ArrayList<HashMap<String, String>>();
|
|
ArrayList<HashMap<String, String>> records = new ArrayList<HashMap<String, String>>();
|
|
|
-// ArrayList<field> fields = new ArrayList<field>();
|
|
|
|
|
|
|
|
|
|
-// public void init_fields(String jsonfields)
|
|
|
|
|
-// {
|
|
|
|
|
-// String TAG = "init_fields@ResultActivity.SearchResult";
|
|
|
|
|
-// Log.d(TAG, jsonfields);
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ // ArrayList<field> fields = new ArrayList<field>();
|
|
|
|
|
+
|
|
|
|
|
+ // public void init_fields(String jsonfields)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // String TAG = "init_fields@ResultActivity.SearchResult";
|
|
|
|
|
+ // Log.d(TAG, jsonfields);
|
|
|
|
|
+ //
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
public HashMap<String, String> get_record(int i)
|
|
public HashMap<String, String> get_record(int i)
|
|
|
{
|
|
{
|
|
@@ -625,7 +662,7 @@ public class ResultActivity extends Activity
|
|
|
records.add(record);
|
|
records.add(record);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
-// searchresult.set_offset(offset);
|
|
|
|
|
|
|
+ // searchresult.set_offset(offset);
|
|
|
// Log.e("records count:",objrecords.length()+"");
|
|
// Log.e("records count:",objrecords.length()+"");
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -652,29 +689,32 @@ public class ResultActivity extends Activity
|
|
|
{
|
|
{
|
|
|
return offset;
|
|
return offset;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
public int get_direction()
|
|
public int get_direction()
|
|
|
{
|
|
{
|
|
|
return direction;
|
|
return direction;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
public void set_offset(int i)
|
|
public void set_offset(int i)
|
|
|
{
|
|
{
|
|
|
- offset=i;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ offset = i;
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
public void set_direction(int i)
|
|
public void set_direction(int i)
|
|
|
{
|
|
{
|
|
|
- direction=i;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ direction = i;
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
-// public int get_count()
|
|
|
|
|
-// {
|
|
|
|
|
-// return records.size();
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ // public int get_count()
|
|
|
|
|
+ // {
|
|
|
|
|
+ // return records.size();
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
-// public int get_fieldscount()
|
|
|
|
|
-// {
|
|
|
|
|
-// return fields.size();
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ // public int get_fieldscount()
|
|
|
|
|
+ // {
|
|
|
|
|
+ // return fields.size();
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
// private class record
|
|
// private class record
|
|
|
// {
|
|
// {
|
|
@@ -682,28 +722,28 @@ public class ResultActivity extends Activity
|
|
|
//
|
|
//
|
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
-// private class field
|
|
|
|
|
-// {
|
|
|
|
|
-// String name = null;
|
|
|
|
|
-// String aliasname = null;
|
|
|
|
|
-// String type = null;
|
|
|
|
|
-//
|
|
|
|
|
-// public String get_name()
|
|
|
|
|
-// {
|
|
|
|
|
-// return name;
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// public String get_aliasname()
|
|
|
|
|
-// {
|
|
|
|
|
-// return aliasname;
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// public String get_type()
|
|
|
|
|
-// {
|
|
|
|
|
-// return type;
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ // private class field
|
|
|
|
|
+ // {
|
|
|
|
|
+ // String name = null;
|
|
|
|
|
+ // String aliasname = null;
|
|
|
|
|
+ // String type = null;
|
|
|
|
|
+ //
|
|
|
|
|
+ // public String get_name()
|
|
|
|
|
+ // {
|
|
|
|
|
+ // return name;
|
|
|
|
|
+ // }
|
|
|
|
|
+ //
|
|
|
|
|
+ // public String get_aliasname()
|
|
|
|
|
+ // {
|
|
|
|
|
+ // return aliasname;
|
|
|
|
|
+ // }
|
|
|
|
|
+ //
|
|
|
|
|
+ // public String get_type()
|
|
|
|
|
+ // {
|
|
|
|
|
+ // return type;
|
|
|
|
|
+ // }
|
|
|
|
|
+ //
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|