|
@@ -12,16 +12,19 @@ import android.os.Bundle;
|
|
|
import android.support.constraint.ConstraintLayout;
|
|
import android.support.constraint.ConstraintLayout;
|
|
|
import android.support.v7.app.ActionBar;
|
|
import android.support.v7.app.ActionBar;
|
|
|
import android.support.v7.app.AppCompatActivity;
|
|
import android.support.v7.app.AppCompatActivity;
|
|
|
|
|
+import android.support.v7.widget.SearchView;
|
|
|
import android.text.Editable;
|
|
import android.text.Editable;
|
|
|
import android.text.InputType;
|
|
import android.text.InputType;
|
|
|
import android.text.TextUtils;
|
|
import android.text.TextUtils;
|
|
|
import android.text.TextWatcher;
|
|
import android.text.TextWatcher;
|
|
|
import android.view.Gravity;
|
|
import android.view.Gravity;
|
|
|
|
|
+import android.view.KeyEvent;
|
|
|
import android.view.LayoutInflater;
|
|
import android.view.LayoutInflater;
|
|
|
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.View.OnClickListener;
|
|
import android.view.View.OnClickListener;
|
|
|
|
|
+import android.view.inputmethod.EditorInfo;
|
|
|
import android.widget.AdapterView;
|
|
import android.widget.AdapterView;
|
|
|
import android.widget.AdapterView.OnItemSelectedListener;
|
|
import android.widget.AdapterView.OnItemSelectedListener;
|
|
|
import android.widget.ArrayAdapter;
|
|
import android.widget.ArrayAdapter;
|
|
@@ -112,6 +115,12 @@ public class SearchListActivity extends AppCompatActivity implements OnClickList
|
|
|
// actionBar.setDisplayShowHomeEnabled(true);
|
|
// actionBar.setDisplayShowHomeEnabled(true);
|
|
|
actionBar.setDisplayShowTitleEnabled(true);
|
|
actionBar.setDisplayShowTitleEnabled(true);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private EditText mSearchView;
|
|
|
|
|
+ private Button mTableExpandBtn;
|
|
|
|
|
+ private boolean mShowTable;
|
|
|
|
|
+ private SearchListActivity self = this;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState)
|
|
protected void onCreate(Bundle savedInstanceState)
|
|
|
{
|
|
{
|
|
@@ -131,6 +140,7 @@ public class SearchListActivity extends AppCompatActivity implements OnClickList
|
|
|
// actionBar.setHomeActionContentDescription("Return");
|
|
// actionBar.setHomeActionContentDescription("Return");
|
|
|
//// actionBar.setDisplayShowTitleEnabled(true);
|
|
//// actionBar.setDisplayShowTitleEnabled(true);
|
|
|
//
|
|
//
|
|
|
|
|
+ mShowTable = false;
|
|
|
|
|
|
|
|
user = ApexTrackingApplication.get_user();
|
|
user = ApexTrackingApplication.get_user();
|
|
|
|
|
|
|
@@ -140,7 +150,7 @@ public class SearchListActivity extends AppCompatActivity implements OnClickList
|
|
|
setTitle(getIntent().getStringExtra("title"));
|
|
setTitle(getIntent().getStringExtra("title"));
|
|
|
|
|
|
|
|
ll_list = (LinearLayout) findViewById(R.id.ll_list);
|
|
ll_list = (LinearLayout) findViewById(R.id.ll_list);
|
|
|
- Button btnok = (Button) findViewById(R.id.btnok);
|
|
|
|
|
|
|
+ final Button btnok = (Button) findViewById(R.id.btnok);
|
|
|
btnok.setOnClickListener(this);
|
|
btnok.setOnClickListener(this);
|
|
|
Button btncancel = (Button) findViewById(R.id.btncancel);
|
|
Button btncancel = (Button) findViewById(R.id.btncancel);
|
|
|
btncancel.setOnClickListener(this);
|
|
btncancel.setOnClickListener(this);
|
|
@@ -150,8 +160,48 @@ public class SearchListActivity extends AppCompatActivity implements OnClickList
|
|
|
{
|
|
{
|
|
|
hashMap = (HashMap<String, String>) savedInstanceState
|
|
hashMap = (HashMap<String, String>) savedInstanceState
|
|
|
.getSerializable("hashMap");
|
|
.getSerializable("hashMap");
|
|
|
|
|
+ mShowTable = savedInstanceState.getBoolean("show_table");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ mSearchView = findViewById(R.id.search_view);
|
|
|
|
|
+ mSearchView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
|
|
|
|
+ if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_UNSPECIFIED) { {
|
|
|
|
|
+
|
|
|
|
|
+ self.onClick(btnok);
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }}
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ mTableExpandBtn = findViewById(R.id.search_table_expand_btn);
|
|
|
|
|
+ mTableExpandBtn.setOnClickListener(new OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(View v) {
|
|
|
|
|
+ boolean show = (boolean) v.getTag();
|
|
|
|
|
+ mShowTable = !show;
|
|
|
|
|
+ v.setTag(mShowTable);
|
|
|
|
|
+ if (mShowTable) {
|
|
|
|
|
+ mTableExpandBtn.setText("Hide");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ mTableExpandBtn.setText("Show");
|
|
|
|
|
+ }
|
|
|
|
|
+ init();
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if (mShowTable) {
|
|
|
|
|
+ mTableExpandBtn.setText("Hide");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ mTableExpandBtn.setText("Show");
|
|
|
|
|
+ }
|
|
|
|
|
+ mTableExpandBtn.setTag(mShowTable);
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -165,6 +215,12 @@ public class SearchListActivity extends AppCompatActivity implements OnClickList
|
|
|
{
|
|
{
|
|
|
// hashMap.clear();
|
|
// hashMap.clear();
|
|
|
ll_list.removeAllViews();
|
|
ll_list.removeAllViews();
|
|
|
|
|
+
|
|
|
|
|
+ if (!mShowTable) {
|
|
|
|
|
+ hashMap.clear();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
SQLiteDatabase db = dbUtil.OpenDB(this, null, true);
|
|
SQLiteDatabase db = dbUtil.OpenDB(this, null, true);
|
|
|
Cursor cursor = db.query("fields_info", new String[] { "aname",
|
|
Cursor cursor = db.query("fields_info", new String[] { "aname",
|
|
|
"field_type", "name", "_id" }, "function_name='"
|
|
"field_type", "name", "_id" }, "function_name='"
|
|
@@ -444,6 +500,7 @@ public class SearchListActivity extends AppCompatActivity implements OnClickList
|
|
|
@Override
|
|
@Override
|
|
|
protected void onSaveInstanceState(Bundle outState)
|
|
protected void onSaveInstanceState(Bundle outState)
|
|
|
{
|
|
{
|
|
|
|
|
+ outState.putBoolean("show_table",mShowTable);
|
|
|
outState.putSerializable("hashmap", hashMap);
|
|
outState.putSerializable("hashmap", hashMap);
|
|
|
super.onSaveInstanceState(outState);
|
|
super.onSaveInstanceState(outState);
|
|
|
}
|
|
}
|
|
@@ -528,6 +585,12 @@ public class SearchListActivity extends AppCompatActivity implements OnClickList
|
|
|
// criterion = parms.toString();
|
|
// criterion = parms.toString();
|
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
|
|
+ CharSequence keywordChar = mSearchView.getText();
|
|
|
|
|
+ if (keywordChar != null) {
|
|
|
|
|
+ String keyword = keywordChar.toString();
|
|
|
|
|
+ parms.putString("keyword",keyword);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
parms.putString("module_name", function_name);
|
|
parms.putString("module_name", function_name);
|
|
|
parms.putString("columns",
|
|
parms.putString("columns",
|
|
|
dbUtil.get_fields(user, function_name));
|
|
dbUtil.get_fields(user, function_name));
|