|
|
@@ -34,7 +34,7 @@ public class SearchActivity extends ListActivity implements OnClickListener
|
|
|
String password = null;
|
|
|
String function_name = null;
|
|
|
RecordsAdapter m_listadapter;
|
|
|
-// private ListView m_ListView = null;
|
|
|
+ // private ListView m_ListView = null;
|
|
|
HashMap<String, String> hashMap = new HashMap<String, String>();
|
|
|
|
|
|
public class RecordsAdapter extends SimpleCursorAdapter
|
|
|
@@ -107,37 +107,44 @@ public class SearchActivity extends ListActivity implements OnClickListener
|
|
|
final String f0 = cursor.getString(0);
|
|
|
final String field_type = cursor.getString(1);
|
|
|
final String name = cursor.getString(2);
|
|
|
-
|
|
|
- Log.e("cursor val", "name="+f0+" , type="+field_type);
|
|
|
- final EditText edit = (EditText) view.findViewById(R.id.edit_val);
|
|
|
- edit.addTextChangedListener(new TextWatcher()
|
|
|
- {
|
|
|
- @Override
|
|
|
- public void onTextChanged(CharSequence s, int start,
|
|
|
- int before, int count)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
- @Override
|
|
|
- public void beforeTextChanged(CharSequence s, int start,
|
|
|
- int count, int after)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
+ Log.e("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));
|
|
|
|
|
|
- @Override
|
|
|
- public void afterTextChanged(Editable s)
|
|
|
- {
|
|
|
- // 将editText中改变的值设置的HashMap中
|
|
|
- String val = s.toString();
|
|
|
- val.trim();
|
|
|
- if (val.length() > 0)
|
|
|
- hashMap.put(name, val);
|
|
|
-
|
|
|
-// Log.d("ime debug", "name="+f0+" , type="+field_type+", ime="+edit.getInputType());
|
|
|
- }
|
|
|
- });
|
|
|
+// 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"))
|
|
|
{
|
|
|
@@ -152,16 +159,20 @@ public class SearchActivity extends ListActivity implements OnClickListener
|
|
|
{
|
|
|
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());
|
|
|
+ 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);
|
|
|
|
|
|
@@ -209,7 +220,7 @@ public class SearchActivity extends ListActivity implements OnClickListener
|
|
|
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_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="
|
|
|
@@ -224,35 +235,33 @@ public class SearchActivity extends ListActivity implements OnClickListener
|
|
|
// 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.aliasName, R.id.tv_type });
|
|
|
+ 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)
|
|
|
+ vername = getPackageManager().getPackageInfo("com.usai.apex", 0).versionName;
|
|
|
+ boolean bFirstRun = RunOnce.getBoolean("FirstRun" + vername
|
|
|
+ + "_search", true);
|
|
|
+ if (bFirstRun)
|
|
|
{
|
|
|
SharedPreferences.Editor editor = RunOnce.edit();
|
|
|
- editor.putBoolean("FirstRun"+vername+"_search", false);
|
|
|
+ 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)
|
|
|
{
|
|
|
@@ -334,12 +343,12 @@ public class SearchActivity extends ListActivity implements OnClickListener
|
|
|
startActivity(intent);
|
|
|
break;
|
|
|
case R.id.action_help:
|
|
|
-// Intent intent = new Intent();
|
|
|
+ // 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);
|
|
|
+ // // intent.putExtra("password", password);
|
|
|
+ // intent.putExtra("function_name", function_name);
|
|
|
+ // intent.putExtra("behavior", Network.BEHAVIOR_SEARCH);
|
|
|
startActivity(intent);
|
|
|
break;
|
|
|
default:
|
|
|
@@ -361,7 +370,7 @@ public class SearchActivity extends ListActivity implements OnClickListener
|
|
|
intent.putExtra("password", password);
|
|
|
intent.putExtra("function_name", function_name);
|
|
|
Bundle parms = new Bundle();
|
|
|
- parms.putString("module_name",function_name);
|
|
|
+ parms.putString("module_name", function_name);
|
|
|
parms.putString("columns", dbUtil.get_fields(user, function_name));
|
|
|
Iterator<String> iter = hashMap.keySet().iterator();
|
|
|
while (iter.hasNext())
|