|
|
@@ -54,22 +54,117 @@ import java.util.Iterator;
|
|
|
|
|
|
public class SearchResultActivity extends AppCompatActivity implements AbsListView.OnScrollListener {
|
|
|
|
|
|
- private Bundle mParams;
|
|
|
- private JSONObject resultData;
|
|
|
+ protected Bundle mParams;
|
|
|
+ protected JSONObject resultData;
|
|
|
|
|
|
- private Context mContext;
|
|
|
- private ListView resultListView;
|
|
|
- private ResultAdapter adapter;
|
|
|
+ protected Context mContext;
|
|
|
+ protected ListView resultListView;
|
|
|
+ protected ResultAdapter adapter;
|
|
|
|
|
|
private View clickedView;
|
|
|
private View.OnTouchListener resultRowClickListener;
|
|
|
private GestureDetector detector;
|
|
|
|
|
|
- private TextView footer;
|
|
|
- private int footer_height = 60;
|
|
|
+ protected TextView footer;
|
|
|
+ protected int footer_height = 60;
|
|
|
|
|
|
ProgressDialog progressDialog;
|
|
|
|
|
|
+ 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);
|
|
|
+// }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
@@ -134,107 +229,52 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
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();
|
|
|
- }
|
|
|
- }
|
|
|
+// 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 onCreateOptionsMenu(Menu menu) {
|
|
|
-// getMenuInflater().inflate(R.menu.result_menu,menu);
|
|
|
-// return true;
|
|
|
-// }
|
|
|
|
|
|
@Override
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
|
|
-// if (item.getItemId() == R.id.result_menu) {
|
|
|
-//
|
|
|
-// try {
|
|
|
-//
|
|
|
-// JSONArray menu = resultData.getJSONArray("menu");
|
|
|
-//
|
|
|
-// if (menu.length() > 0) {
|
|
|
-// ArrayList<String> titleList = new ArrayList<>();
|
|
|
-//
|
|
|
-// for (int i = 0; i < menu.length(); i++) {
|
|
|
-// JSONObject json = menu.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 menu = resultData.getJSONArray("menu");
|
|
|
-// JSONObject json = menu.getJSONObject(which);
|
|
|
-//
|
|
|
-// String actionType = json.getString("action");
|
|
|
-// String url = json.optString("url");
|
|
|
+
|
|
|
+// int which = item.getItemId();
|
|
|
+// try {
|
|
|
+// JSONArray menu = resultData.getJSONArray("menu");
|
|
|
+// JSONObject json = menu.getJSONObject(which);
|
|
|
//
|
|
|
-// 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");
|
|
|
-// }
|
|
|
-// }
|
|
|
+// String actionType = json.getString("action");
|
|
|
+// String url = json.optString("url");
|
|
|
//
|
|
|
-// } catch (JSONException exception) {
|
|
|
-// Log.d("Result", "onClick: ",exception);
|
|
|
-// }
|
|
|
-// dialog.dismiss();
|
|
|
-// }
|
|
|
-// })
|
|
|
-// .show();
|
|
|
+// 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 e) {
|
|
|
-// Log.e("Result", "onOptionsItemSelected: ", e);
|
|
|
// }
|
|
|
//
|
|
|
+// } catch (JSONException exception) {
|
|
|
+// Log.d("Result", "onClick: ",exception);
|
|
|
// }
|
|
|
|
|
|
- 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;
|
|
|
}
|
|
|
|
|
|
@@ -262,7 +302,7 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void setupUI() {
|
|
|
+ protected void setupUI() {
|
|
|
try {
|
|
|
if (resultData == null) {
|
|
|
return;
|
|
|
@@ -302,13 +342,14 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
invalidateOptionsMenu();
|
|
|
|
|
|
String title = resultData.optString("table_title");
|
|
|
+ setTitleColor(Color.BLACK);
|
|
|
setTitle(title);
|
|
|
|
|
|
progressDialog.dismiss();
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void showProgressDialog(String title, String msg) {
|
|
|
+ protected void showProgressDialog(String title, String msg) {
|
|
|
progressDialog.setTitle(title);
|
|
|
progressDialog.setMessage(msg);
|
|
|
progressDialog.show();
|
|
|
@@ -349,13 +390,17 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- private void loadData() {
|
|
|
+ protected void loadData() {
|
|
|
|
|
|
// resultData = readRawFile(R.raw.predef_query);
|
|
|
// if (1 == 1) {
|
|
|
// return;
|
|
|
// }
|
|
|
|
|
|
+ if (isLoading) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
isLoading = true;
|
|
|
|
|
|
showProgressDialog(null,"Loading");
|
|
|
@@ -409,7 +454,11 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void loadMore() {
|
|
|
+ protected void loadMore() {
|
|
|
+
|
|
|
+ if (isLoading) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
isLoading = true;
|
|
|
showProgressDialog(null,"Loading");
|
|
|
@@ -486,7 +535,7 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
}).start();
|
|
|
}
|
|
|
|
|
|
- private JSONObject contentData() {
|
|
|
+ protected JSONObject contentData() {
|
|
|
try {
|
|
|
return resultData.getJSONObject("data");
|
|
|
} catch (JSONException e) {
|
|
|
@@ -495,6 +544,44 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
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
|
|
|
@@ -513,97 +600,7 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- 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);
|
|
|
- }
|
|
|
+ cellDoubleTapAction(position);
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -644,7 +641,7 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
|
|
|
|
|
|
|
|
|
- private class ResultAdapter extends BaseAdapter {
|
|
|
+ protected class ResultAdapter extends BaseAdapter {
|
|
|
|
|
|
@Override
|
|
|
public boolean areAllItemsEnabled() {
|
|
|
@@ -758,6 +755,7 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
|
|
|
// cell.setOnTouchListener(resultRowClickListener);
|
|
|
|
|
|
+ holder.row.setBackgroundColor(Color.WHITE);
|
|
|
// setup
|
|
|
try {
|
|
|
|
|
|
@@ -783,12 +781,20 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
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","#");
|
|
|
|
|
|
@@ -797,7 +803,7 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
holder.row.setLayoutParams(layoutParams);
|
|
|
|
|
|
// col
|
|
|
- for (int i = 0; i < obj.length(); i++) {
|
|
|
+ for (int i = 0; i < arr_col.length(); i++) {
|
|
|
|
|
|
JSONObject value = obj.getJSONObject(i);
|
|
|
int col_w = value.getInt("width");
|
|
|
@@ -809,6 +815,7 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
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","#");
|
|
|
|
|
|
@@ -819,7 +826,7 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
tv.setHeight(height);
|
|
|
tv.setGravity(convertGravity("h_align",h_align) | convertGravity("v_center",v_center));
|
|
|
|
|
|
- tv.setTextColor(Color.parseColor(f_color));
|
|
|
+
|
|
|
|
|
|
tv.setSingleLine();
|
|
|
tv.setEllipsize(TextUtils.TruncateAt.END);
|
|
|
@@ -836,6 +843,8 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
tv.setOnTouchListener(resultRowClickListener);
|
|
|
}
|
|
|
|
|
|
+ tv.setTextColor(Color.parseColor(f_color));
|
|
|
+
|
|
|
|
|
|
if (name.contains("</")) {
|
|
|
tv.setText(Html.fromHtml(name));
|
|
|
@@ -853,6 +862,18 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
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","#");
|
|
|
@@ -865,7 +886,7 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
holder.row.setLayoutParams(layoutParams);
|
|
|
|
|
|
// col
|
|
|
- for (int i = 0; i < obj.length(); i++) {
|
|
|
+ for (int i = 0; i < arr_col.length(); i++) {
|
|
|
|
|
|
JSONArray col_layout = row.getJSONArray("val");
|
|
|
JSONObject layout_val = col_layout.getJSONObject(i);
|
|
|
@@ -895,7 +916,7 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
tv.setWidth(col_w);
|
|
|
tv.setHeight(col_h);
|
|
|
tv.setGravity(convertGravity("h_align",h_align) | convertGravity("v_center",v_center));
|
|
|
- tv.setTextColor(Color.parseColor(col_f_color));
|
|
|
+
|
|
|
|
|
|
tv.setSingleLine();
|
|
|
tv.setEllipsize(TextUtils.TruncateAt.END);
|
|
|
@@ -911,6 +932,7 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
tv.setBackgroundDrawable(getResources().getDrawable(R.drawable.result_black_border));
|
|
|
}
|
|
|
|
|
|
+ tv.setTextColor(Color.parseColor(col_f_color));
|
|
|
|
|
|
if (value.contains("</")) {
|
|
|
tv.setText(Html.fromHtml(value));
|
|
|
@@ -1018,9 +1040,9 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
}
|
|
|
|
|
|
|
|
|
- private String documentPath;
|
|
|
- private String download_query;
|
|
|
- private void export(final String download_url) {
|
|
|
+ protected String documentPath;
|
|
|
+ protected String download_query;
|
|
|
+ protected void export(final String download_url) {
|
|
|
|
|
|
if (download_query != null) {
|
|
|
documentPath = download_query;
|
|
|
@@ -1075,8 +1097,8 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
}
|
|
|
|
|
|
public void showKVDetail(final JSONObject param) {
|
|
|
- showProgressDialog("Please wait","Loading...");
|
|
|
-
|
|
|
+// showProgressDialog("Please wait","Loading...");
|
|
|
+//
|
|
|
// new Thread(new Runnable() {
|
|
|
// @Override
|
|
|
// public void run() {
|
|
|
@@ -1133,6 +1155,8 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
if (path != null && !path.isEmpty()) {
|
|
|
Uri uri= Uri.parse(path);
|
|
|
openFileAtPath(uri,type);
|
|
|
+ } else {
|
|
|
+ showAlert("Sorry,there is a wrong.");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -1143,7 +1167,7 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void openFileAtPath(Uri uri, String type) {
|
|
|
+ protected void openFileAtPath(Uri uri, String type) {
|
|
|
// type "application/pdf"
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
|
intent.setDataAndType(uri, type);
|
|
|
@@ -1167,7 +1191,7 @@ public class SearchResultActivity extends AppCompatActivity implements AbsListVi
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void shareFile(Uri uri, String type) {
|
|
|
+ protected void shareFile(Uri uri, String type) {
|
|
|
|
|
|
Intent shareIntent = new Intent();
|
|
|
shareIntent.setAction(Intent.ACTION_SEND);
|